Decision Procedures Mooly Sagiv. Bibliography Nelson & Oppen Fast Decision Procedures Based on Congruence Closure JACM 1979 Stump, Dill, Barrett, Levitt.

Slides:



Advertisements
Similar presentations
Model Checking Lecture 4. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
Advertisements

A Randomized Satisfiability Procedure for Arithmetic and Uninterpreted Function Symbols Sumit Gulwani George Necula EECS Department University of California,
Logical Abstract Interpretation Sumit Gulwani Microsoft Research, Redmond.
Synthesis, Analysis, and Verification Lecture 04c Lectures: Viktor Kuncak VC Generation for Programs with Data Structures “Beyond Integers”
WSPD Applications.
Satisfiability Modulo Theories (An introduction)
Linked List Implementation class List { private List next; private Object data; private static List root; private static int size; public static void addNew(Object.
On Solving Presburger and Linear Arithmetic with SAT Ofer Strichman Carnegie Mellon University.
Hybrid Systems Presented by: Arnab De Anand S. An Intuitive Introduction to Hybrid Systems Discrete program with an analog environment. What does it mean?
Technion 1 Generating minimum transitivity constraints in P-time for deciding Equality Logic Ofer Strichman and Mirron Rozanov Technion, Haifa, Israel.
Deciding Equality with Uninterpreted Functions using Congruence Closure Constantinos Bartzis.
Number Theory and Cryptography
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Plan for today Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Nikolaj Bjørner Microsoft Research Lecture 3. DayTopicsLab 1Overview of SMT and applications. SAT solving, Z3 Encoding combinatorial problems with Z3.
1 Satisfiability Modulo Theories Sinan Hanay. 2 Boolean Satisfiability (SAT) Is there an assignment to the p 1, p 2, …, p n variables such that  evaluates.
Automated Theorem Proving Lecture 4.   Formula := A |  |    A  Atom := b | t = 0 | t < 0 | t  0 t  Term := c | x | t + t | t – t | ct | Select(m,t)
Ofer Strichman, Technion 1 Decision Procedures in First Order Logic Part III – Decision Procedures for Equality Logic and Uninterpreted Functions.
1 Deciding separation formulas with SAT Ofer Strichman Sanjit A. Seshia Randal E. Bryant School of Computer Science, Carnegie Mellon University.
The Theory of NP-Completeness
The Simplify Theorem Prover Greg Nelson, Dave Detlefs and Jim Saxe Mooly Sagiv.
Technion 1 Generating minimum transitivity constraints in P-time for deciding Equality Logic Ofer Strichman and Mirron Rozanov Technion, Haifa, Israel.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Technion 1 (Yet another) decision procedure for Equality Logic Ofer Strichman and Orly Meir Technion.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
1 A propositional world Ofer Strichman School of Computer Science, Carnegie Mellon University.
Prof. Necula CS Lecture 111 Theorem Proving for FOL Satisfiability Procedures CS Lecture 11.
1 A Combination Method for Generating Interpolants by G. Yorsh and M. Masuvathi Presentation by: Emilia Katz.
On Solving Presburger and Linear Arithmetic with SAT Ofer Strichman Carnegie Mellon University.
Ofer Strichman, Technion Deciding Combined Theories.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
Binary Decision Diagrams (BDDs)
Model Checking Lecture 4 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Lecture 22 More NPC problems
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
1 P P := the class of decision problems (languages) decided by a Turing machine so that for some polynomial p and all x, the machine terminates after at.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
NPC.
CS357 Lecture 13: Symbolic model checking without BDDs Alex Aiken David Dill 1.
1/20 Arrays Changki PSWLAB Arrays Daniel Kroening and Ofer Strichman Decision Procedure.
Selected Decision Procedures and Techniques for SMT More on combination – theories sharing sets – convex theory Un-interpreted function symbols (quantifier-free.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
1 A framework for eager encoding Daniel Kroening ETH, Switzerland Ofer Strichman Technion, Israel (Executive summary) (submitted to: Formal Aspects of.
Deciding Combined Theories Presented by Adi Sosnovich Based on presentation from: Decision Procedures An Algorithmic Point of View Daniel Kroening and.
Computer Systems Laboratory Stanford University Clark W. Barrett David L. Dill Aaron Stump A Framework for Cooperating Decision Procedures.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
Satisfiability Modulo Theories and DPLL(T) Andrew Reynolds March 18, 2015.
Decision Procedures in First Order Logic
Decision Procedures in Equality Logic
Lazy Proofs for DPLL(T)-Based SMT Solvers
Satisfiability Modulo Theories
NP-Completeness Yin Tat Lee
Binary Decision Diagrams
Chapter 34: NP-Completeness
NP-Completeness Yin Tat Lee
CSE 589 Applied Algorithms Spring 1999
Instructor: Aaron Roth
Lecture 23 NP-Hard Problems
Presentation transcript:

Decision Procedures Mooly Sagiv

Bibliography Nelson & Oppen Fast Decision Procedures Based on Congruence Closure JACM 1979 Stump, Dill, Barrett, Levitt A Decision Procedure for an Extensional Theory of Arrays LICS’01

Decision Procedures Complete (terminating) algorithms for determining the validity (satisfiability) of a formula in a given logic –Cost is an issue Decidable logic a logic with a decision procedure for every formula Decidable (computation problem) there exists an a terminating algorithm which solves every instance of the problem

Obtaining a decision procedure Limit the logic Limit the class of intended models Answer validity (satisfiabilty) w.r.t. a given theory T  F

Church’s Theorem 1936 First order logic is undecidable

Trakhtenbrot 50 First order logic over finite models is undecidable

Tarski’s Theorem 1951 First-order theory of reals with +, *, =, > is decidable But undecidable over integers –Decidable for Presburger arithmetic 1929 Simplex –Efficient for difference constraints

Rabin’s Theorem 1969 Monadic theory of the infinite binary trees is decidable

Proving Decidability Small model theorem –Every satisfiable formula has a model whose size if proportional to the size of the formula Direct decision procedure Reduction to another decidable logic

Quantifier Free First Order Logic Universal formulas only Allow a fixed scheme of first order formulas T Determine if T  F Decidable for interesting theories –Uninterpreted functions  a, b: f(a, b) = a  f(f(a, b), b) = a –Theory of lists –Arrays Different theories can be combined

Theory of Uninterpreted Functions (EUF) Theory T  x, y: x = y  f (x) = f(y) Determine the validity of universal formulas Decidability Ackerman 1954 Downey, Sethi, Tarjan, Kozen, Nelson& Open Efficient Algorithms Bryant, German, Velev 1999 Improvements for positive terms

Small model property of EUF formulas Ackerman 1954 Every satisfiable formula has a model of size k where k is the number of distinct function application terms Example –x = y  f(g(x)) = f (g(y)) –{x, y, g(x), g(y), f(g(x)), f(g(y))} Impractical algorithm

Proof by Refutation Determine the validity of a formula by checking the satifiability of its negation For quantifier free it is enough to consider Conjunction of literals –DNF –SMT Example “  a, b: f(a, b) = a  f(f(a, b), b) = a” –Proof that “f(ca, cb) = ca   f((f(ca, cb), cb) = ca” is not satisfiable

An efficient EUF algorithm (intuition) Goal prove satifiability of t 1 =u 1  …  t p =u p  r 1  s 1 ...  r q  s q Represent terms using DAGs Unify equal terms and their consequences Report UNSAT when contradicts inequalities Otherwise report SAT

The Congruent Closure Problem Given –A finite labeled directed graph G Nodes are labeled by function symbols Edges are labeled –A binary relation R on the nodes Two nodes are congruent under R if –They have the same label –Their neighbors are in R (respectively) R is closed under congruences if all congruent nodes according to R are in R Compute the a minimal extension of R which is an equivalence relation and closed under congruences

Example 1 f(ca, cb) = ca   f((f(ca, cb), cb) = ca

Example 2  a: f(f(f(a))) = a  f(f(f(f(f(a)))))=a  f(a) = a f(f(f(a))) = a  f(f(f(f(f(a)))))=a  f(a)  a

Computing Congruence Closure Let R be a relation which is congruence closed Compute the congruence closure of R  {(u, v)} by MERGE(u, v) MERGE(u, v) 1. If FIND(u) = FIND(v) then return 2. Let P u be the predecessors of vertices equivalent to u and P v be the predecessors of vertices equivalent to to v 3. UNION(u, v) 4. For each pair (x, y) such that x  P u, y  P v, CONGRUENT(x, y) and FIND(x)  FIND(y) do MERGE(x, y) CONGRUENT(u, v) = label(u) = label(v)  i: FIND(u[i]) = FIND(v[i])

Properties of the Congruence Closure Algorithm Partial Correctness Complexity O(m 2 ) Downey, Sethi, and Tarjan achieves O(m log n) by storing the vertices in a hash table keyed by the list of equivalence classes of their successors

Application 1: EUF Construct a graph G which corresponds to the set of all terms appearing in the conjunction t 1 =u 1  …  t p =u p  r 1  s 1 ...  r q  s q For each term i appearing in the conjunction let  (i) denote the node of the term Let R be the identity relation on vertices For every 1  i  p, MERGE(  (t i ),  (u i )) If for some 1  j  q,  (r j ) is equivalent to  (s j )) report UNSAT Otherwise report SAT

Improvements and Extensions Lahiri, Bryant, Goel, Talupur TACAS 2004 Explicit Representation ITE(e1, e2, e3) = (e1  e2)  (  e1  e2) P(T1, T2, …, Tk) Treat `positive’ terms differently

Simple Theory of Lisp Lists CAR, CDR, CONS without Nil values Use congruence closure with special equalities  x, y: CAR(CONS(x, y)) = x  x, y: CDR(CONS(x, y)) = y  x:  ATOM(x)  CONS(CAR(x), CDR(x)) = x  x, y:  ATOM(CONS(x, y))  x, y: CAR(x)=CAR(y)  CDR(x) = CDR(y)  ATOM(x)  ATOM(y)  f(x) = f(y)

Application 2: Lisp v 1 =w 1  …  b r =w r  x 1  y 1 ...  x s  y s  ATOM(u 1 )  …  ATOM(u q ) Construct a graph G which corresponds to the set of all terms appearing in the conjunction For each term i appearing in the conjunction let  (i) denote the node of the term Let R be the identity relation on vertices For every 1  i  r, MERGE(  (v i ),  (w i )) For every vertex u labeled by CONS add a vertex v labeled by CAR and a vertex w labeled by CDR with out degree one s.t. v[1]=w[1]=u and MERGE(v, u[1]) and MERGE(v, u[2]) If for some 1  j  s,  (x j ) is equivalent to  (y j )) report UNSAT If for some 1  j  q,  (u j ) is equivalent to a CONS node report UNSAT Otherwise report SAT

Integrating Values Becomes NP-Hard  x, y: CAR(CONS(x, y)) = x  x, y: CDR(CONS(x, y)) = y  x: X  NIL  CONS(CAR(x), CDR(x)) = x  x, y: CONS(x, y)  NIL CAR)NIL( = CDR(NIL)=NIL

Theory of Arrays (Stores) SELECT(UPDATE(v, i, e), j) = if i=j then e else SELECT(v, j) UPDATE)v, i, SELECT(v, i)) = v UPDATE)UPDATE)v, i, e), i, f) = UPDATE(v, i, f) i  j  UPDATE (UPDATE (v, i, e), j, f) = UPDATE (UPDATE (v, j, f), I, e) Eliminate UPDATE and use EUF

Combining Decision Procedures Programming languages combine different features –Arithmetic –Data types –Arrays –… Is there a way to compose decision procedures of different theories? Given two decidable logics is there a way to combine the logics into a decidable logic?

Bibliography Nelson & Oppen Fast Decision Procedures Based on Congruence Closure JACM 1979 Stump, Dill, Barrett, Levitt A Decision Procedure for an Extensional Theory of Arrays LICS’01

Conclusion Interesting decision procedures exist Employed in theorem provers and optimizing compilers Developing a decision procedure is non-obvious –Different theories may imply different costs –Fragile