Internals of SMT Solvers. Leonardo de Moura Microsoft Research

Similar documents
Topics in Model-Based Reasoning

Satisfiability Modulo Theories

Leonardo de Moura Microsoft Research

Tutorial 1: Modern SMT Solvers and Verification

Quantifiers. Leonardo de Moura Microsoft Research

SMT BASICS WS 2017/2018 ( ) LOGIC SATISFIABILITY MODULO THEORIES. Institute for Formal Models and Verification Johannes Kepler Universität Linz

The Eager Approach to SMT. Eager Approach to SMT

Satisfiability Modulo Theories (SMT)

Solving Quantified Verification Conditions using Satisfiability Modulo Theories

SAT/SMT/AR Introduction and Applications

USING FOURIER-MOTZKIN VARIABLE ELIMINATION FOR MCSAT EXPLANATIONS IN SMT-RAT

Satisfiability Modulo Theories

Leonardo de Moura Microsoft Research

Foundations of Lazy SMT and DPLL(T)

LOGIC PROPOSITIONAL REASONING

Interpolation. Seminar Slides. Betim Musa. 27 th June Albert-Ludwigs-Universität Freiburg

WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008

Formal methods in analysis

Propositional Logic: Evaluating the Formulas

Proving Unsatisfiability in Non-linear Arithmetic by Duality

Model Based Theory Combination

Integrating Simplex with DPLL(T )

SMT: Satisfiability Modulo Theories

Satisfiability Modulo Theories (SMT)

Solving SAT Modulo Theories

Constraint Logic Programming and Integrating Simplex with DPLL(T )

An Introduction to Satisfiability Modulo Theories

Constraint Solving for Finite Model Finding in SMT Solvers

An Introduction to Z3

a > 3, (a = b a = b + 1), f(a) = 0, f(b) = 1

Rewriting for Satisfiability Modulo Theories

Finite model finding in satisfiability modulo theories

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

CS156: The Calculus of Computation

Satisfiability Modulo Theories

Lecture 9: The Splitting Method for SAT

SMT Beyond DPLL(T): A New Approach to Theory Solvers and Theory Combination

Quantifier Instantiation Techniques for Finite Model Finding in SMT

Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011

Introduction Algorithms Applications MINISAT. Niklas Sörensson Chalmers University of Technology and Göteborg University

CSE507. Satisfiability Modulo Theories. Computer-Aided Reasoning for Software. Emina Torlak

Round 9: Satisfiability Modulo Theories, Part II

Lecture 2 Propositional Logic & SAT

Nikolaj Bjørner Microsoft Research Tractability Workshop MSR Cambridge July 5, FSE &

IntSat: From SAT to Integer Linear Programming

Introduction to SAT (constraint) solving. Justyna Petke

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 3: Practical SAT Solving

SMT and Z3. Nikolaj Bjørner Microsoft Research ReRISE Winter School, Linz, Austria February 5, 2014

An Introduction to SAT Solving

SAT-Based Verification with IC3: Foundations and Demands

Combined Satisfiability Modulo Parametric Theories

Reasoning with Quantified Boolean Formulas

Symbolic Analysis. Xiangyu Zhang

UCLID: Deciding Combinations of Theories via Eager Translation to SAT. SAT-based Decision Procedures

Efficient E-matching for SMT Solvers. Leonardo de Moura, Nikolaj Bjørner Microsoft Research, Redmond

Decision Procedures An Algorithmic Point of View

Lazy Proofs for DPLL(T)-Based SMT Solvers

CS156: The Calculus of Computation Zohar Manna Autumn 2008

Finding Conflicting Instances of Quantified Formulas in SMT. Andrew Reynolds Cesare Tinelli Leonardo De Moura July 18, 2014

Comp487/587 - Boolean Formulas

Satisfiability Modulo Theories

SAT in Formal Hardware Verification

Integrating Answer Set Programming and Satisfiability Modulo Theories

Classical Propositional Logic

On the Relative Efficiency of DPLL and OBDDs with Axiom and Join

Course An Introduction to SAT and SMT. Cap. 2: Satisfiability Modulo Theories

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 8: Procedures for First-Order Theories, Part 2

Heuristics for Efficient SAT Solving. As implemented in GRASP, Chaff and GSAT.

Linear Algebra, Boolean Rings and Resolution? Armin Biere. Institute for Formal Models and Verification Johannes Kepler University Linz, Austria

The Simplify Theorem Prover

Implementing Branch and Bound Algorithms in SMT. Andrew Reynolds Two Sigma July 12, 2016

IC3 and Beyond: Incremental, Inductive Verification

Interactive Theorem Proving in Industry

Solving SAT and SAT Modulo Theories: From an Abstract Davis Putnam Logemann Loveland Procedure to DPLL(T)

A brief introduction to Logic. (slides from

Combining Decision Procedures

Propositional Reasoning

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

From SAT To SMT: Part 1. Vijay Ganesh MIT

Satisfiability and SAT Solvers. CS 270 Math Foundations of CS Jeremy Johnson

Satisfiability Modulo Theories and Assignments

Lecture Notes on SAT Solvers & DPLL

A DPLL(T ) Theory Solver for a Theory of Strings and Regular Expressions

Abstract DPLL and Abstract DPLL Modulo Theories

Pretending to be an SMT Solver with Vampire (and How We Do Instantiation)

Verification using Satisfiability Checking, Predicate Abstraction, and Craig Interpolation. Himanshu Jain THESIS ORAL TALK

Selfless Interpolation for Infinite-State Model Checking

Formalizing Simplex within Isabelle/HOL

Solving Non-Linear Arithmetic

A two-tier technique for supporting quantifiers in a lazily proof-explicating theorem prover

Foundations of Artificial Intelligence

A Concurrency Problem with Exponential DPLL(T ) Proofs

Satisfiability Modulo Theories

Model-based Theory Combination

Foundations of Artificial Intelligence

On Solving Boolean Combinations of UTVPI Constraints

Efficient Theory Combination via Boolean Search

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

Hierarchic Superposition With Weak Abstraction and the Beagle Theorem Prover

Proof Complexity of Quantified Boolean Formulas

Transcription:

Internals of SMT Solvers Leonardo de Moura Microsoft Research

Acknowledgements Dejan Jovanovic (SRI International, NYU) Grant Passmore (Univ. Edinburgh)

Herbrand Award 2013 Greg Nelson

What is a SMT Solver?

Multiple Approaches is a portfolio of solvers

Preprocessing F Simplify Modular Architecture is a must have Variable elimination if-then-else elimination Solver

Equivalence Preserving Simplifications F Simplify F Examples: x + y + 1 x 2 y 1 p true p p

Preprocessor API F and F may be only equisatisfiable F Preprocessor F Model Converter Proof Converter

Example Variable Elimination Proof builder Model builder

Example Variable Elimination M, M(a) = M(b) + 1 Proof builder Model builder M

Example Variable Elimination b 5, a 6 Proof builder Model builder b 5

Model Converters Extension Filter M, M(a) = M(b) + 1 Model builder M

Model Converter: Filter p (q h) Tseitin CNF converter M k p k, k q, k h, k q h Model builder M

Model Converter: Filter p (q h) Tseitin CNF converter p t, q f, h t p k, k q, k h, k q h Model builder p t, k f, q f, h t

Model Converter: Extension + Filter x: bitvec 4, y, z: bitvec[2] x = concat(y, z) Bit-blaster M x 3 y 1, x 2 y 0, x 1 z 1, x 0 z 0 Model builder M

Preprocessors 1. Produce Equivalent Formula 2. Produce Equisatisfiable Formula 3. Assume closed world (non-incremental) Example: symmetry reduction

Simple QF_BV (bit-vector) solver F Simplify Variable elimination Bit-blasting Tseitin CNF converter SAT Solver

Under/Over-Approximations Under-approximation unsat answers cannot be trusted Over-approximation sat answers cannot be trusted

Under/Over-Approximations Under-approximation model finders Over-approximation proof finders

Under/Over-Approximations Under-approximation S S S Over-approximation S S \ S

Under/Over-Approximations Under-approximation Example: QF_NIA model finders add bounds to unbounded variables (and blast) Over-approximation Example: Boolean abstraction

Under/Over-Approximations Combining under and over is bad! sat and unsat answers cannot be trusted.

Tracking: under/overapproximations Proof and Model converters can check if the resultant models and proofs are valid.

CEGAR is your friend Counter-Example Guided Abstract Refinement Using over-approximation procedure Solver(F) Model F p := Abstract(F) loop (R, M) := Solve(F p ) if R = UNSAT then return UNSAT R := Check(F, M) if R = SAT then return SAT F p := Refine(F, F p, M)

CEGAR is your friend Counter-Example Guided Abstract Refinement Using under-approximation procedure Solver(F) Proof F p := Abstract(F) loop (R, Pr) := Solve(F p ) if R = SAT then return SAT R := Check(F, Pr) if R = UNSAT then return UNSAT F p := Refine(F, F p, M)

CEGAR is your friend Counter-Example Guided Abstract Refinement Refinements: Incremental Solver Run over and under-approximation is parallel

Uninterpreted Functions by CEGAR Suppose we have a Solver that does not support uninterpreted functions (example: QF_BV solver) Congruence Rule: x 1 = y 1,, x n = y n f(x 1,, x n ) = f(y 1,, y n )

Uninterpreted Functions by CEGAR Congruence Rule: x 1 = y 1,, xn = yn f(x 1,, xn) Abstract: replace each f-application with a fresh variable (over-approximation) a = b + 1, f(a 1) = c, f(b) c a = b + 1, k 1 = c, k 2 c k 1 f a 1, k 2 f(b)

Uninterpreted Functions by CEGAR Congruence Rule: x 1 = y 1,, xn = yn f(x 1,, xn) Check: check if congruence rule is satisfied a = b + 1, k 1 = c, k 2 c k 1 f a 1, k 2 f(b) a 1, b 0, c 0, k 1 0, k 2 1

Uninterpreted Functions by CEGAR Congruence Rule: x 1 = y 1,, xn = yn f(x 1,, xn) Refine: expand congruence axiom a 1 = b k 1 = k 2 a = b + 1, k 1 = c, k 2 c k 1 f a 1, k 2 f(b) a 1, b 0, c 0, k 1 0, k 2 1

Uninterpreted Functions by CEGAR Congruence Rule: x 1 = y 1,, xn = yn f(x 1,, xn) Refine: expand congruence axiom a 1 = b k 1 = k 2 a = b + 1, k 1 = c, k 2 c, (a 1 = b k 1 = k 2 ) unsat a 1 b k 1 = k 2

Simple QF_UFBV Solver UF by CEGAR QF_BV solver

Simple QF_AUFBV Solver arrays on top of UF AUF by CEGAR QF_BV solver Lemmas on Demand For Theory of Arrays [Brummayer-Biere 2009]

Simple UFBV Solver model-based quantifier instantiation MBQI UF by CEGAR QF_BV solver Efficiently solving quantified bit-vector formulas [Wintersteiger at al 2010]

Simple QF_NIA solver by CEGAR nonlinear integer arithmetic Hilbert s 10 th Problem DPRM theorem: QF_NIA is undecidable Idea: use (under-approximation) CEGAR 1. Add lower/upper bounds to all variables, and convert into QF_BV 2. If SAT done 3. Otherwise, refine: increase lower/upper bounds

Lazy SMT as CEGAR Suppose we have a Solver that can only process a conjunction of literals. Examples: Congurence Closure (UF), Simplex (Linear Real Arithmetic)

Lazy SMT as CEGAR: 1. Abstract Basic Idea x 0, y = x + 1, (y > 2 y < 1) p 1, p 2, (p 3 p 4 ) p 1 (x 0), p 2 (y = x + 1), p 3 (y > 2), p 4 (y < 1) [Audemard et al - 2002], [Barrett et al - 2002], [de Moura et al - 2002] [Flanagan et al - 2003],

Lazy SMT as CEGAR: 2. Solve Basic Idea x 0, y = x + 1, (y > 2 y < 1) p 1, p 2, (p 3 p 4 ) p 1 (x 0), p 2 (y = x + 1), p 3 (y > 2), p 4 (y < 1) SAT Solver

Lazy SMT as CEGAR: 2. Solve Basic Idea x 0, y = x + 1, (y > 2 y < 1) p 1, p 2, (p 3 p 4 ) p 1 (x 0), p 2 (y = x + 1), p 3 (y > 2), p 4 (y < 1) SAT Solver Assignment p 1, p 2, p 3, p 4

Lazy SMT as CEGAR: 3. Check Basic Idea x 0, y = x + 1, (y > 2 y < 1) p 1, p 2, (p 3 p 4 ) p 1 (x 0), p 2 (y = x + 1), p 3 (y > 2), p 4 (y < 1) SAT Solver Assignment p 1, p 2, p 3, p 4 x 0, y = x + 1, (y > 2), y < 1

Lazy SMT as CEGAR: 3. Check Basic Idea x 0, y = x + 1, (y > 2 y < 1) p 1, p 2, (p 3 p 4 ) p 1 (x 0), p 2 (y = x + 1), p 3 (y > 2), p 4 (y < 1) SAT Solver Assignment p 1, p 2, p 3, p 4 x 0, y = x + 1, (y > 2), y < 1 Unsatisfiable x 0, y = x + 1, y < 1 Theory Solver

Lazy SMT as CEGAR: 4. Refine Basic Idea x 0, y = x + 1, (y > 2 y < 1) p 1, p 2, (p 3 p 4 ) p 1 (x 0), p 2 (y = x + 1), p 3 (y > 2), p 4 (y < 1) SAT Solver Assignment p 1, p 2, p 3, p 4 x 0, y = x + 1, (y > 2), y < 1 New Lemma p 1 p 2 p 4 Unsatisfiable x 0, y = x + 1, y < 1 Theory Solver

Lazy SMT as CEGAR: 4. Refine Basic Idea New Lemma p 1 p 2 p 4 Unsatisfiable x 0, y = x + 1, y < 1 Theory Solver AKA Theory conflict

Lazy SMT as CEGAR: refinements Many refinements: Incrementality Efficient Backtracking Efficient Lemma Generation Theory propagation - DPLL(T) [Ganzinger et all 2004] Many SMT solvers are based on DPLL(T)

Proofs DPLL(T) weakness Theories are second-class citizens. DPLL(T) is not model-driven (key property of CDCL). Models

CDCL: Conflict Driven Clause Learning DPLL Resolution Model Proof

DPLL(T) weakness DPLL(T) works well only for easy theories. Examples: Uninterpreted functions Difference logic (x y c) Linear real arithmetic Hard theories : Linear integer arithmetic Arrays Nonlinear real arithmetic

Example: Nonlinear Real Arithmetic x 2 4x + y 2 y + 8 < 1 xy 2x 2y + 4 > 1 PSPACE PSPACE membership Canny 1988, Grigor ev 1988 QF_NRA NP NP-hardness x is Boolean x (x-1) = 0 x or y or z x + y + z > 0

The RISE of Model-Driven Techniques in SMT

Proofs Saturation x Search Proof-finding Model-finding Models

Two procedures Resolution Proof-finder Saturation DPLL Model-finder Search CDCL is model-driven proof search

Linear Arithmetic Fourier-Motzkin Proof-finder Saturation Simplex Model-finder Search

Fourier-Motzkin t 1 ax, bx t 2 bt 1 abx, abx at 2 bt 1 at 2 Very similar to Resolution Exponential time and space

Polynomial Constraints AKA Existential Theory of the Reals R x 2 4x + y 2 y + 8 < 1 xy 2x 2y + 4 > 1

CAD Big Picture 1. Project/Saturate set of polynomials 2. Lift/Search: Incrementally build assignment v: x k α k Isolate roots of polynomials f i (α, x) Select a feasible cell C, and assign x k some α k C If there is no feasible cell, then backtrack

CAD Big Picture x 2 + y 2 1 < 0 x y 1 > 0 1. Saturate x 4 x 2 + 1 x 2 1 x 2. Search (, 1) 1 ( 1, 0) 0 (0, 1) 1 (1, ) x 4 x 2 + 1 + + + + + + + x 2 1 + 0 - - - 0 + x - - - 0 + + +

CAD Big Picture x 2 + y 2 1 < 0 x y 1 > 0 1. Saturate x 4 x 2 + 1 x 2 1 x (, 1 2 ) 1 2 ( 1 2, ) 4 + y 2 1 + + + 2y 1 + 0 - x 2 2. Search (, 1) 1 ( 1, 0) 0 (0, 1) 1 (1, ) x 4 x 2 + 1 + + + + + + + x 2 1 + 0 - - - 0 + x - - - 0 + + +

CAD Big Picture x 2 + y 2 1 < 0 x y 1 > 0 1. Saturate x 4 x 2 + 1 x 2 1 x (, 1 2 ) 1 2 ( 1 2, ) 4 + y 2 1 + + + 2y 1 + 0 - CONFLICT x 2 2. Search (, 1) 1 ( 1, 0) 0 (0, 1) 1 (1, ) x 4 x 2 + 1 + + + + + + + x 2 1 + 0 - - - 0 + x - - - 0 + + +

Proofs NLSat: Model-Driven Search Static x Dynamic Optimistic approach Key ideas Models Start the Search before Saturate/Project We saturate on demand Model guides the saturation

Experimental Results (1) OUR NEW ENGINE

Experimental Results (2) OUR NEW ENGINE

Other examples Delayed Theory Combination [Bruttomesso et al 2006] X Model-Based Theory Combination

Other examples Array Theory by Axiom Instantiation X Lemmas on Demand For Theory of Array [Brummayer-Biere 2009] a, i, v: a i v i = v a, i, j, v: i = j a i v j = a[j]

Other examples (for linear arithmetic) Fourier-Motzkin X Generalizing DPLL to richer logics [McMillan et al 2009] Conflict Resolution [Korovin et al 2009]

Saturation: successful instances Polynomial time procedures Gaussian Elimination Congruence Closure

MCSat Model-Driven SMT Lift ideas from CDCL to SMT Generalize ideas found in model-driven approaches Easier to implement Model construction is explicit

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1)

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 Propagations

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 Propagations

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 Propagations

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 Boolean Decisions

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 x 2 Semantic Decisions

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 x 2 Conflict We can t find a value for y s.t. 4 + y 2 1

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 x 2 Conflict We can t find a value for y s.t. 4 + y 2 1 Learning that x 2 + y 2 1 (x= 2) is not productive

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 (x = 2) x 2 + y 2 1 (x = 2) Learning that x 2 + y 2 1 (x= 2) is not productive

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 (x = 2) x 3 x 2 + y 2 1 (x = 2) Learning that x 2 + y 2 1 (x= 2) is not productive

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 (x = 2) x 3 Same Conflict x 2 + y 2 1 (x = 2) We can t find a value for y s.t. 9 + y 2 1 Learning that x 2 + y 2 1 (x= 2) is not productive

x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 x 2 y Conflict x 2 + y 2 1 x 2 x 1 x, x 1 (x 2 + y 2 1) x 1

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 x 1 (x 2 + y 2 1) x 1

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 x 1 (x 2 + y 2 1) x 1 Conflict x 2 (x 1)

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 (x 2 + y 2 1) x 1 Learned by resolution x 2 (x 2 + y 2 1)

MCSat x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 (x 2 + y 2 1) x 2 (x 2 + y 2 1) (x 2 + y 2 1) x 1

MCSat: FM Example x + z + 1 0 z 0 x y 0 y 0 x + z + 1 0, x y 0 z 0, y 0 z + 1 x, x y 1 x, x 0 We can t find a value of x

MCSat: FM Example x + z + 1 0 z 0 x y 0 y 0 x + z + 1 0, x y 0 z 0, y 0 x: x + z + 1 0 x y 0 z + 1 y 0 Fourier-Motzkin x + z + 1 0 x y 0 z + 1 y 0

MCSat: FM Example x + z + 1 0 z 0 x y 0 z + 1 y 0 x + z + 1 0 x y 0 z + 1 y 0

MCSat: FM Example x + z + 1 0 z 0 x y 0 z + 1 y 0 y 1 x + z + 1 0 x y 0 z + 1 y 0 x + z + 1 0, x y 0 z 0, y 1 z + 1 x, x y 1 x, x 1

MCSat: FM Example x + z + 1 0 z 0 x y 0 z + 1 y 0 y 1 x 1 x + z + 1 0 x y 0 z + 1 y 0 x + z + 1 0, x y 0 z 0, y 1 z + 1 x, x y 1 x, x 1

MCSat: Another Example 4xy 4x + y > 1, x 2 + y 2 < 1, x 3 + 2x 2 + 3y 2 5 < 0

MCSat: Another Example 4xy 4x + y > 1, x 2 + y 2 < 1, x 3 + 2x 2 + 3y 2 5 < 0 Feasible Region x 3 + 2x 2 + 3y 2 5 < 0 4xy 4x + y > 1 What is the core? x 2 + y 2 < 1 Starting search Partial solution: x 0.5 Can we extend it to y?

MCSat: Another Example 4xy 4x + y > 1, x 2 + y 2 < 1, x 3 + 2x 2 + 3y 2 5 < 0 Feasible Region x 3 + 2x 2 + 3y 2 5 < 0 4xy 4x + y > 1 What is the core? x 2 + y 2 < 1 Starting search Partial solution: x 0.5 Can we extend it to y?

MCSat Finite Basis Every theory that admits quantifier elimination has a finite basis (given a fixed assignment order) F[x, y 1,, y m ] y 1 α 1,, y m α m x: F[x, y 1,, y m ] C 1 [y 1,, y m ] C k [y 1,, y m ] F x, y 1,, y m C k [y 1,, y m ]

MCSat Finite Basis F n [x 1, x 2,, x n 1, x n ] F n 1 [x 1, x 2,, x n 1 ] F 2 [x 1, x 2 ] F 1 [x 1 ]

MCSat Finite Basis F n [x 1, x 2,, x n 1, x n ] F n 1 [x 1, x 2,, x n 1 ] F 2 [x 1, x 2 ] F 1 [x 1 ]

MCSat Finite Basis F n [x 1, x 2,, x n 1, x n ] F n 1 [x 1, x 2,, x n 1 ] F 2 [x 1, x 2 ] F 1 [x 1 ]

MCSat Finite Basis F n [x 1, x 2,, x n 1, x n ] F n 1 [x 1, x 2,, x n 1 ] F 2 [x 1, x 2 ] F 1 [x 1 ]

MCSat Finite Basis Every finite theory has a finite basis Example: Fixed size Bit-vectors F[x, y 1,, y m ] y 1 α 1,, y m α m F x, y 1,, y m (y 1 = α 1 ) (y m = α m )

MCSat Finite Basis Theory of uninterpreted functions has a finite basis Theory of arrays has a finite basis [Brummayer- Biere 2009] In both cases the Finite Basis is essentially composed of equalities between existing terms.

MCSat: Uninterpreted Functions a = b + 1, f a 1 < c, f b > a a = b + 1, f k < c, f b > a, k = a 1 a = b + 1, f k < c, f b > a, k = a 1 Treat f(k) and f(b) as variables Generalized variables

MCSat: Uninterpreted Functions a = b + 1, f k < c, f b > a, k = a 1 k 0 b 0 f(k) 0 f(b) 2 Conflict: f k and f b must be equal k = b f k = f(b)

MCSat: Uninterpreted Functions a = b + 1, f k < c, f b > a, k = a 1 k 0 b 0 f(k) 0 k = b (Semantic) Propagation k = b f k = f(b)

MCSat: Uninterpreted Functions a = b + 1, f k < c, f b > a, k = a 1 k 0 b 0 f(k) 0 k = b f k = f(b) k = b f k = f(b)

MCSat: Uninterpreted Functions a = b + 1, f k < c, f b > a, k = a 1 k 0 b 0 f(k) 0 k = b f k = f(b) f(b) 0 k = b f k = f(b)

MCSat Finite Basis We can also use literals from the finite basis in decisions. Application: simulate branch&bound for bounded linear integer arithmetic LP solution: x 1 = 0.8 x 2 = 2.4 x 2 6 5 4 x 1 0 x 1 1 3 2 x 1 = 0 x 2 = 3 x 1 = 1 x 2 = 2 1 0 1 2 3 4 5 6 x 1

MCSat: Termination Propagations Boolean Decisions Semantic Decisions

MCSat Propagations Boolean Decisions Semantic Decisions

MCSat Propagations Boolean Decisions Semantic Decisions

MCSat Maximal Elements FiniteBasis

x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 x 1 Conflict x 2 (x 1) (x 2 + y 2 1) x 1

x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 x 1 Conflict x 2 (x 1) (x 2 + y 2 1) x 1 x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 (x 2 + y 2 1) x 2 (x 2 + y 2 1) (x 2 + y 2 1) x 1

x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 x 2 + y 2 1 x 1 Conflict x 2 (x 1) (x 2 + y 2 1) x 1 x 2, x 1 y 1, (x 2 + y 2 1 xy > 1) x 2 x 1 y 1 (x 2 + y 2 1) x 2 (x 2 + y 2 1) (x 2 + y 2 1) x 1

MCSat x < 1 p, p x = 2 x 1

MCSat x < 1 p, p x = 2 x 1 p

MCSat x < 1 p, p x = 2 x 1 p Conflict (evaluates to false)

MCSat x < 1 p, p x = 2 x 1 p New clause x < 1 x = 2

MCSat x < 1 p, p x = 2 x 1 p New clause x < 1 x = 2 x < 1

MCSat x < 1 p, p x = 2 x 1 p New clause x < 1 x = 2 x < 1

MCSat: Architecture Arithmetic Arrays Boolean Lists

MCSat: development

MCSat prototype: 7k lines of code Deduction Rules Boolean Resolution Fourier-Motzkin Equality Split Normalization Ackermann expansion aka Congruence

MCSat: preliminary results prototype: 7k lines of code QF_LRA

MCSat: preliminary results prototype: 7k lines of code QF_UFLRA and QF_UFLIA

Conclusion Mode-driven techniques are very promising Preprocessing CEGAR MCSat: new framework for developing SMT solvers MCSat generalizes NLSat Modular architecture

Resources: Papers The Strategy Challenge in SMT Solving, L. de Moura and G. Passmore. http://research.microsoft.com/en-us/um/people/leonardo/files/smt-strategy.pdf Solving non-linear arithmetic, D. Jovanovic and L. de Moura http://research.microsoft.com/en-us/um/people/leonardo/files/ijcar2012.pdf A Model Constructing Satisfiability Calculus, L. de Moura and D. Jovanonic http://research.microsoft.com/en-us/um/people/leonardo/files/mcsat.pdf The Design and Implementation of the Model Constructing Satisfiability Calculus, D. Jovanovic, C. Barrett, L. de Moura http://research.microsoft.com/en-us/um/people/leonardo/mcsat_design.pdf

Resources: Source Code nlsat https://z3.codeplex.com/sourcecontrol/latest#src/nlsat/ mcsat https://github.com/dddejan/cvc4/tree/mcsat tactic/preprocessors https://z3.codeplex.com/sourcecontrol/latest#src/tactic/