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

Similar documents
Tutorial 1: Modern SMT Solvers and Verification

CS156: The Calculus of Computation

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

Satisfiability Modulo Theories

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

Satisfiability Modulo Theories (SMT)

Foundations of Artificial Intelligence

CS156: The Calculus of Computation Zohar Manna Autumn 2008

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

Topics in Model-Based Reasoning

Combining Decision Procedures

Lecture 1: Logical Foundations

Rewriting for Satisfiability Modulo Theories

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010

The Simplify Theorem Prover

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

Foundations of Lazy SMT and DPLL(T)

Propositional and First Order Reasoning

Combined Satisfiability Modulo Parametric Theories

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

An Introduction to Satisfiability Modulo Theories

Classical Propositional Logic

Chapter 7 Propositional Satisfiability Techniques

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory

Comp487/587 - Boolean Formulas

Logic and Inferences

Lecture 9: The Splitting Method for SAT

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

SAT Solvers: Theory and Practice

Part 1: Propositional Logic

Lecture Notes on SAT Solvers & DPLL

Satisfiability Modulo Theories (SMT)

SMT: Satisfiability Modulo Theories

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

Solving SAT Modulo Theories

CSE507. Introduction. Computer-Aided Reasoning for Software. Emina Torlak courses.cs.washington.edu/courses/cse507/17wi/

Lecture 2 Propositional Logic & SAT

Leonardo de Moura Microsoft Research

Quantifiers. Leonardo de Moura Microsoft Research

Propositional Reasoning

Satisfiability Modulo Theories

Foundations of Artificial Intelligence

Model Based Theory Combination

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Chapter 7 Propositional Satisfiability Techniques

Formal Verification Methods 1: Propositional Logic

Propositional Logic. Methods & Tools for Software Engineering (MTSE) Fall Prof. Arie Gurfinkel

Solving Quantified Verification Conditions using Satisfiability Modulo Theories

Combinations of Theories for Decidable Fragments of First-order Logic

An Introduction to SAT Solving

Learning Goals of CS245 Logic and Computation

Theory Combination. Clark Barrett. New York University. CS357, Stanford University, Nov 2, p. 1/24

LOGIC PROPOSITIONAL REASONING

Sums of Products. Pasi Rastas November 15, 2005

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

Decision Procedures for Satisfiability and Validity in Propositional Logic

Constraint Solving for Finite Model Finding in SMT Solvers

Overview, cont. Overview, cont. Logistics. Optional Reference #1. Optional Reference #2. Workload and Grading

Symbolic Analysis. Xiangyu Zhang

Constraint Logic Programming and Integrating Simplex with DPLL(T )

SAT/SMT/AR Introduction and Applications

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit:

Propositional Logic: Models and Proofs

Propositional Logic. Testing, Quality Assurance, and Maintenance Winter Prof. Arie Gurfinkel

Propositional and Predicate Logic. jean/gbooks/logic.html

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

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Satisfiability Modulo Theories

The Impact of Craig s Interpolation Theorem. in Computer Science

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester)

From SAT To SMT: Part 1. Vijay Ganesh MIT

Propositional Logic: Evaluating the Formulas

Finite model finding in satisfiability modulo theories

Satisfiability Modulo Theories

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

Integer vs. constraint programming. IP vs. CP: Language


Propositional Calculus

Predicate Logic: Sematics Part 1

Satisability Modulo Structures as Constraint Satisfaction: An Introduction

Notes. Corneliu Popeea. May 3, 2013

Introduction to SAT (constraint) solving. Justyna Petke

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

Polite Theories Revisited

Propositional logic. Programming and Modal Logic

NP-Complete Reductions 2

Using E-Unification to Handle Equality in Universal Formula Semantic Tableaux Extended Abstract

Deliberative Agents Knowledge Representation I. Deliberative Agents

1 Algebraic Methods. 1.1 Gröbner Bases Applied to SAT

On the Complexity of the Reflected Logic of Proofs

Mathematical Logic Part Three

Planning as Satisfiability

Worst-Case Upper Bound for (1, 2)-QSAT

Combining Non-Stably Infinite Theories

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

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

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

CS:4420 Artificial Intelligence

Transcription:

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

WHAT I LL TALK ABOUT Propositional Logic Terminology, Satisfiability, Decision Procedure First-Order Logic Terminology, Background Theories Satisfiability Modulo Theories Combining Theories, SMT Solvers

TERMINOLOGY: PROPOSITIONAL LOGIC Propositional variables: Propositional formulae: p, q, r p, φ 1 φ 2, φ 1 φ 2, φ Literals: Clauses: p, p p q r s Conjunctive Normal Form: (p q) r (s q) Truth Assignment: Let p be false, q be true, etc.

SATISFIABILITY Given a propositional formula φ, does it have a truth assignment M, such that M = φ? Decidable: there exists a decision procedure for this Complexity: NP-complete

DECISION PROCEDURE DPLL Method Sound Complete Backtracking Conjunctive Normal Form Davis, Putnam, Logemann, Loveland: 1960, 1962

DECISION PROCEDURE Function DPLL Input: A formula, Output: A boolean φ If φ is consistent Return true If φ contains an empty clause Return false l := choose_literal( φ ) Return DPLL( φ l ) Or DPLL( φ l )

DECISION PROCEDURE Performance: Depends on choice of branching literal Satisfying assignment may be found quickly Unsatisfiability requires exhaustive search Modern Heuristics

TERMINOLOGY: FIRST-ORDER LOGIC Variables: X = {x 1,x 2,x 3,... } Function Symbols: Predicate Symbols: F = {f 1,f 2,f 3,... } P = {p 1,p 2,p 3,... } Equality, quantification, propositional connectives: =,,,,,

TERMINOLOGY: FIRST-ORDER LOGIC Term τ ::= x f(τ 1,..., τ n ) Formula ϕ ::= τ 1 = τ 2 p(τ 1,..., τ n )... Sentence: fully quantified formula Structure: a triple (δ, σ, ι) Domain δ : set of values Signature σ : set of function and predicate symbols, with arities ι Interpretation : what X, F, P do in δ

TERMINOLOGY: EXAMPLES Term: x 1, f 1 (x 3 ), f 2 (x 2,f 1 (x 3 )) Formula: Sentence: p 1 (x 1 ), x 1 = f 1 (x 3 ), p 1 (x 1 ), x 1. p 1 (x 1 ) p 2 (x 1,x 2 ) x 1.p 1 (x 1 ), x 3. x 1.x 1 = f 1 (x 3 ) Structure: a triple (δ, σ, ι) δ Domain : N σ Signature : c n 0, for all, ι n N is zero 1 Interpretation : for is_zero: if argument is 0 then true, else false

BACKGROUND THEORIES Theory : A set of sentences in signature σ. T σ Some theories: Theory of Equality with Uninterpreted Functions Theory of Integers Theory of Reals Theory of Lists

BACKGROUND THEORIES Two ways to define a theory: Enumerate a set of axioms, and close the set under logical consequence Define a structure in which all sentences are satisfied

BACKGROUND THEORIES T E Theory of Equality with Uninterpreted Functions ( Empty Theory ) {} T Z (Z, +,, ) Theory of Integers T R Theory of Reals (Q, +,, ) T L Theory of Lists cons(car(x),cdr(x)) = x, car(cons(x,y)) = x, cdr(cons(x,y)) = y,...

BACKGROUND THEORIES T E Theory of Equality with Uninterpreted Functions ( Empty Theory ) Undecidable. Quantifier-free fragment is decidable T Z Theory of Integers Decidable. Quantifier-free fragment is NP-complete T R Theory of Reals Decidable. Quantifier-free fragment is solvable in polynomial time T L Theory of Lists Decidable. Quantifier-free fragment is solvable in linear time

SATISFIABILITY IN A THEORY Given a signature σ and a theory T σ, a formula ϕ, constructed in σ, is satisfiable in T σ, if ϕ evaluates to true under some interpretation of T σ

SATISFIABILITY MODULO THEORIES Assume we have signatures σ 1,..., σ n, and theories T,..., T σ1 σn, so that we have a combined signature σ = σ 1 σ n and combined theory of T σ = T T σ1 σn Is a formula ϕ, constructed in σ, satisfiable in T σ?

SMT EXAMPLE Let T = T E T Z. Let s assume we have a formula with the following terms conjuncted: 1 x x 2 Γ = f(x) f(1) f(x) f(2) Is Γsatisfiable in T?

DECISION PROCEDURE Nelson-Oppen method Combines decision procedures for first-order theories into a single decision procedure for the union theory - equality symbol is shared ϕ must be quantifier-free Signatures σ 1,..., σ n must be disjoint Theories T σ1,..., T σn must be stably infinite

STABLY INFINITE THEORIES For signature σ, a theory T σ is stably infinite, if for every quantifier-free formula ϕ in σ that is satisfiable in T σ, there exists an interpretation satisfying ϕ, whose domain is infinite. T E,T Z,T R,T L are all stably infinite theories. For signature σ = {a, b}, the following theory is not stably infinite: T = { x. x = a x = b}

NELSON-OPPEN METHOD Phase 1: Purify Phase 2: Equality Propagation Contradiction Rule Equality Propagation Rule Case Split Rule

NELSON-OPPEN METHOD Purify phase: Assume formula from σ 1 σ 2 Γ, a conjunction of literals Convert gamma to conjunction Γ 1 Γ 2, satisfying two properties: Each literal in Γ i is a literal in σ i, for all i Γ 1 Γ 2 is satisfiable in T 1 T 2, iff Γ is

NELSON-OPPEN METHOD Purify phase example Assume Formula σ 1 = {f 1 }, σ 2 = {g 1 } Γ = {f(g(x)) g(f(x))} Each term and inequality purified

NELSON-OPPEN METHOD Purify phase example Assume Formula σ 1 = {f 1 }, σ 2 = {g 1 } Γ = {f(g(x)) g(f(x))} Each { term and inequality purified Γ = f(g(x)) g(f(x)) }

NELSON-OPPEN METHOD Purify phase example Assume Formula σ 1 = {f 1 }, σ 2 = {g 1 } Γ = {f(g(x)) g(f(x))} Each term and inequality purified { } f(w1 ) g(f(x)) Γ = w 1 = g(x)

NELSON-OPPEN METHOD Purify phase example Assume Formula σ 1 = {f 1 }, σ 2 = {g 1 } Γ = {f(g(x)) g(f(x))} Each term and inequality purified f(w 1 ) g(w 2 ) Γ = w 1 = g(x) w 2 = f(x)

NELSON-OPPEN METHOD Purify phase example Assume Formula σ 1 = {f 1 }, σ 2 = {g 1 } Γ = {f(g(x)) g(f(x))} Each term and inequality purified w 3 w 4 w 1 = g(x) Γ = w 2 = f(x) w 3 = f(w 1 ) w 4 = g(w 2 )

NELSON-OPPEN METHOD Purify phase example Assume Formula σ 1 = {f 1 }, σ 2 = {g 1 } Γ = {f(g(x)) g(f(x))} Each term and inequality purified { } w2 = f(x) Γ 1 = w 3 = f(w 1 ) Γ 2 = w 1 = g(x) w 4 = g(w 2 ) w 3 w 4

NELSON-OPPEN METHOD Equality Propagation Phase Tree with states Γ 1, Γ 2,E as nodes Initial derivation s 0 : Γ 1, Γ 2, Apply inference rules If all leaves are labeled false, then unsat Else sat

NELSON-OPPEN METHOD Equality Propagation Phase Contradiction If unsatisfiable Equality Propagation If equality is satisfiable Γ 1, Γ 2,E false Γ 1, Γ 2,E Γ 1, Γ 2,E {x = y} Case Split Γ 1, Γ 2,E Γ 1, Γ 2,E {x 1 = y 1 } Γ 1, Γ 2,E {x n = y n }

NELSON-OPPEN METHOD Equality Propagation Phase example Satisfiability of following formula in T Z T E 1 x 1 x x 2 x 2 Γ = Γ f(x) f(1) Z = w 1 =1 f(x) f(2) w 2 =2 After purify: { f(x) f(w1 ) Γ E = f(x) f(w 2 ) }

NELSON-OPPEN METHOD Equality Propagation Phase example Satisfiability of following formula in T Z T E s 0 : Γ Z, Γ E, s 1 : Γ Z, Γ E, {x = w 1 } s 2 : Γ Z, Γ E, {x = w 2 } s 3 : false s 4 : false

THEORY CONVEXITY Case-Split inference rule creates many, many subtrees Can be avoided altogether, if the combined theories are convex T R,T E,T L are convex. T Z is not.

THEORY CONVEXITY A theory T σ is convex, if for every conjunction Γ of literals in σ, and for every disjunction x 1 = y 1 x n = y n n T Γ = some j i=1 x i = y i iff T Γ = x j = y j, for

THEORY CONVEXITY How is T Z not convex? We have a formula: the conjunction Γ = We have a disjunction, x = z y = z x =1 y =2 1 z z 2 While T Z Γ logically implies the disjunction, both x = z and y = z do not logically follow.

IMPLEMENTATION Theory of Equality with Uninterpreted Functions has decision procedure: Congruence Closure algorithm E-Graphs: a set of terms, and an equivalence relation on those terms

SMT SOLVERS Simplify (HP Research) CVC3 (Stanford) Yices (SRI International) Z3 (MS Research) Paradox (Chalmers)

ISSUES Modularity of theories More theories Extending to solve formulas with quantification

CONCLUSION Thank you for coming Questions welcome Wanna hack one up?

BIBLIOGRAPHY Zohar Manna and Calogero Zarba. Combining Decision Procedures. In Formal Methods at the Crossroads: from Panacea to Foundational Support, Lecture Notes in Computer Science, Volume 2787, Springer-Verlag, November 2003, pp. 381-422. David Detlefs, Greg Nelson, James B. Saxe. Simplify: A Theorem Prover for Program Checking. In Journal of the ACM, Vol 52, No 3, May 2005, pp 365-473. Greg Nelson and Derek C. Oppen. Simplification by Cooperating Decision Procedures. In ACM Transactions on Programming Languages and Systems, Vol 1, No 2. October 1979, pp 245-257. Greg Nelson and Derek C. Oppen. Fast Decision Procedures Based on Congruence Closure. In Journal of the ACM, Vol 27, No 2, April 1980, pp 356-364. Stanley N. Burris. Logic for Mathematics and Computer Science. Prentice Hall, August 1997.