The Simplify Theorem Prover Greg Nelson, Dave Detlefs and Jim Saxe Mooly Sagiv.

Slides:



Advertisements
Similar presentations
SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.
Advertisements

Quantified Invariant Generation using an Interpolating Saturation Prover Ken McMillan Cadence Research Labs TexPoint fonts used in EMF: A A A A A.
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Quantified Invariant Generation using an Interpolating Saturation Prover Ken McMillan Cadence Research Labs TexPoint fonts used in EMF: A A A A A.
Completeness and Expressiveness
Inference Rules Universal Instantiation Existential Generalization
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
Automated Reasoning Systems For first order Predicate Logic.
SAT and Model Checking. Bounded Model Checking (BMC) A.I. Planning problems: can we reach a desired state in k steps? Verification of safety properties:
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.
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)
Yeting Ge Leonardo de Moura New York University Microsoft Research.
Existential Graphs and Davis-Putnam April 3, 2002 Bram van Heuveln Department of Cognitive Science.
` ² Q E D I Nelson-Oppen review
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Decision Procedures Mooly Sagiv. Bibliography Nelson & Oppen Fast Decision Procedures Based on Congruence Closure JACM 1979 Stump, Dill, Barrett, Levitt.
Review: forward E { P } { P && E } TF { P && ! E } { P 1 } { P 2 } { P 1 || P 2 } x = E { P } { \exists … }
A two-tier approach for supporting quantifiers in a lazily proof-explicating theorem prover K. Rustan M. Leino Microsoft Research, Redmond Madan Musuvathi.
1 A propositional world Ofer Strichman School of Computer Science, Carnegie Mellon University.
1 A Combination Method for Generating Interpolants by G. Yorsh and M. Masuvathi Presentation by: Emilia Katz.
Monadic Predicate Logic is Decidable Boolos et al, Computability and Logic (textbook, 4 th Ed.)
Course eval results More applications Last question –Luging: 0.5 –Curling: 1.5 –Figure skating: 2 –Ice fishing: 6.5 –Foosball: 0.5.
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.
Leonardo de Moura Microsoft Research. Many approaches Graph-based for difference logic: a – b  3 Fourier-Motzkin elimination: Standard Simplex General.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
Boolean Satisfiability and SAT Solvers
1 A Combination Method for Generating Interpolants Greta Yorsh Madan Musuvathi Tel Aviv University, Israel Microsoft Research, Redmond, US CAV’05.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Leonardo de Moura and Nikolaj Bjørner Microsoft Research.
CHAPTERS 7, 8 Oliver Schulte Logical Inference: Through Proof to Truth.
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
Introduction to Satisfiability Modulo Theories
Leonardo de Moura Microsoft Research. Is formula F satisfiable modulo theory T ? SMT solvers have specialized algorithms for T.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
Unification Algorithm Input: a finite set Σ of simple expressions Output: a mgu for Σ (if Σ is unifiable) 1. Set k = 0 and  0 = . 2. If Σ  k is a singleton,
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Symbolic and Concolic Execution of Programs Information Security, CS 526 Omar Chowdhury 10/7/2015Information Security, CS 5261.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson.
Inference in First Order Logic. Outline Reducing first order inference to propositional inference Unification Generalized Modus Ponens Forward and backward.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Extended Static Checking for Java Cormac Flanagan Joint work with: Rustan Leino, Mark Lillibridge, Greg Nelson, Jim Saxe, and Raymie Stata Compaq Systems.
CS357 Lecture 13: Symbolic model checking without BDDs Alex Aiken David Dill 1.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Finding Conflicting Instances of Quantified Formulas in SMT Andrew Reynolds Cesare Tinelli Leonardo De Moura July 18, 2014.
Selected Decision Procedures and Techniques for SMT More on combination – theories sharing sets – convex theory Un-interpreted function symbols (quantifier-free.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Deciding Combined Theories Presented by Adi Sosnovich Based on presentation from: Decision Procedures An Algorithmic Point of View Daniel Kroening and.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
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.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Decision Procedures in First Order Logic
Lazy Proofs for DPLL(T)-Based SMT Solvers
Introduction to Software Verification
Lecture 2 Propositional Logic
Satisfiability Modulo Theories
Artificial Intelligence: Agents and Propositional Logic.
Presentation transcript:

The Simplify Theorem Prover Greg Nelson, Dave Detlefs and Jim Saxe Mooly Sagiv

Bibliography Nelson & Oppen Simplification by Cooperating Decision Procedures TOPLAS 1980 Tinelli & Zarba Combining non-stably infinite theories Journal of Automated Reasoning, 2006 Simplify: A Theorem Prover for Program Checking David Detlefs, Greg Nelson, James B. Saxe JACM 2005 Verifun: An Explicating Theorem Prover for Quantified Formulas Cormac Flanagan, Rajeev Joshi, James B. Saxe HPL Zap: Automated Theorem Proving for Software Analysis Thomas Ball, Shuvendu K. Lahiri, Madanlal Musuvathi MSR Technical Report 2005

The Simplify Theorem Prover Proof by Refutation Incomplete & Sometimes diverges Supports –Full first order logic Skolemization Incomplete treatment of universal quantifications –Special theories EUF Theory of arrays Relational Linear Algebra (The Simplex) –Incomplete treatment multiplication Partial orders –Combination of theories –New axioms Very successful: used as the engine in many checkers: –ESC/Modula3, ESC/Java, SLAM,...

Outline Search strategy (propositional) [Specialized theories] –EUF –Arrays –Simplex Combining theories Handling quantifiers Recent systems –Verifun –ZAP

Simplify search strategy Somewhat naive Top down guessing of truth values with backtracking Finds implied truth values “Lazy” conversion to CNF Use “Proxies” Scored clauses Goal oriented

Example  a=b f(a)  f(b) b=c f(a)  f(c)  Inconsistency detected by the EUF procedure so backtrack

Example  a=b f(a)  f(b) b=c f(a)  f(c)  Inconsistent with EUF Report UNSAT

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?

Cooperating Decision Procedures Nelson & Oppen Quantifier free Proof be refutation Separate the conjunct into separate conjuncts A  B such that –A and B use different theories –Only constants are shared If either A or B is UNSAT report UNSAT When A and B are SAT propagate equalities between A and B and repeat

Example Theories  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)) LIST  x, y: x = y  f (x) = f(y) EUF  x: x+0 =0  x: x +-x = 0 0  1  x, y, z: (x+y)+z = x + (y+z) 0  1  x, y:x+y = y +x  x: x  x  x, y: x  y  y  x  x, y: x  y  y  x  x=y  x, y: x  y  y  z  x  z  x, y,z: x  y  x+z  y+z R

A Simple Example xyxy y  x+g 1 g 2 =g 3 -g 4 g 5 =0 x  y  y  x + CAR(CONS(0, x))  P(h(x)-h(y))  P(0) P(g 2 )=true P(g 5 )=false g 3 =h(x) g 4 =h(y) g 1 =CAR(CONS(g 5, x))

Non-Convexity If one of the theories is UNSAT the original formulas is UNSAT (Soundness) But the original formula may be UNSAT and yet no single equality suffices to prove UNSAT Happens for theories which imply non-convex equalities T  F  c 1 = c 2  c 3 = c 4 without T  F  c 1 = c 2 or T  F  c 3 = c 4 Performs a case split

Example for Case Split SELECT(UPDATE(v, I, e), j) = x  SELECT(v, j)=y  x>e  x>y

Equality Propagation Procedure 1.Assign conjunctions to F L and F F s.t., F F contains only F-literals F L contains only L-literals F L  F F is satisfiable iff F is satisfiable 2.If either F L or F F is UNSAT report UNSAT 3.If either F L or F F entails equality not entailed by other add this equality and go to step 2 4.If either F L or F F entails u 1 =v 2  u 2 =v 2  … u k =v k without entailing any equality alone then apply the procedure recursively to the k-formulas F L  F F  v i = u i If any of these formulas is SAT return SAT 5.Return UNSAT

Notes Only equalities are propagated Requires that the theories can find all consequent equalities Completeness is non-obvious The original paper also performs simplification

Convexity A formula F is non-convex F entails u 1 =v 2  u 2 =v 2  … u k =v k without entailing any equality alone –Otherwise it is convex A theory is convex Convex theories –EUF –Relational linear algebra Non-convex theories –Theory of arrays –Theory of reals under multiplications xy =0  z=0  R x=z  y=z –Theory of integers under + and 

Hints about Completeness The residues of formula –The strongest Boolean combinations of equalities between constants entailed by the formula x=f(a)  y=f(b)a=b  x=y x+y-a-b>0  (x=a  y=b)   (x=b  y=a) x=STORE(v, u, e)[j] i=j  x=e x=STORE(v, u, e)[j]  y=v[j] if i=j then x=e else x=y Lemma 4: If A and B are formulas whose only common parameters are constant symbols then RES(A  B) = RES(A)  RES(B)

The residues in the simple example xyxy y  x+g 1 g 2 =g 3 -g 4 g 5 =0 g 1 =g 5  x=y  g 5 =g 2  g 3 =g 4 x  y  y  x + CAR(CONS(0, x))  P(h(x)-h(y))  P(0) P(g 2 )=true P(g 5 )=false g 3 =h(x) g 4 =h(y) g 2  g 5  x=y  g 3 =g 4 g 1 =CAR(CONS(g 5, x)) g 1 =g 5

Handling Quantifiers The problem becomes undecidable Complete procedures exist and implemented (e.g., SPASS next week) Simplify employs incomplete heuristics –Instantiate universal quantifiers with relevant terms –Can be tuned by the user

Instantiating universal quantifiers Suppose that 8 x 1, …, x n. P is known to hold –For example, because it is an axiom –Or because it is added to the environment during a backtracking We want to find substitutions  giving values to x 1, …,x n such that  (P) will be useful in the proof

General idea in matching Pick a term t from P called a trigger (sometimes pattern) Instantiate P with a substitution  if  (t) is a term that the prover is likely to require information about Separately implemented for different theories Intuition: –Since P contains the term t,  (P) will contain the term  (t), and so it provides information about  (t) –This is likely to be useful, since the prover wants information about  (t)

Matching in the E-graph The Congruence Graph is called E-graph Match triggers into equivalence classes For every occurrence of the trigger in the E- graph assert the corresponding instance –Adds terms and equalities

Example Assume 8 x,y: car(cons(x,y)) = x Prove cons(a, b) = cons(c, d))  a=c First trigger “car(cons(x,y)” Second trigger “cons(x,y)”

Choosing a trigger Heuristically important Liberal (small) triggers –Too many terms –Sometimes infinite loops Conservative (large) triggers –May fail to prove the theorem The user can provide –Candidate triggers –Candidate untriggers

Triggers as sets of terms Sometimes single trigger is not enough  s, t, x: member(x, s)  subset(s, t)  member(x,t ) Use sets of terms as triggers { member(x, s), subset(s, t)}

Matching in the E-graph (example) Assume 8 x:f(x) = x [trigger f(x)] 8 x:g(g(x) = x [trigger g(g(x))] Prove g(f(g(a))) = a

Matching Loops Repeated applications of matching Example  x: P(f(x), f(g(x)) [Trigger f(x)] Can be sometimes avoided by: –Check if the body of the quantifier contains a larger instance of the term –Alternate matching and decisions –User input

Limitations of matching Matching loops Not goal oriented Limitations of the theories (  x: P(x+1))  P(1+a)

Simplify experience Handles large formulas Robust In many cases complete enough Fully automatic for simple program verification –Cleanness Incompleteness in programs –Deep properties –Shape of dynamically allocated structures But slow on Boolean combinations

Verifun : A Theorem Prover Using Lazy Proof Explication Rajeev Joshi Cormac Flanagan, Jim Saxe and Xinming Ou Key ideas: –use SAT solvers to find candidate truth assignments to atomic formulae – have theory modules produce compact “proofs” that are added to the SAT problem to reject all truth assignments containing the “same” inconsistency Requires –proof explicating theory modules Uses Simplify Theories extended with Explication and matching Implemented in Java (~10,500 lines) and in C (~800 lines)

Zap: Automated Theorem Proving for Software Analysis Thomas Ball, Shuvendu Lahiri, Madanlal Musuvati (MSR) Use a SAT algorithm for the search procedure Use Nelson&Oppen to combine theories Develop new decision procedures Use quantifier matching Add features for program analysis

Conclusion Handling specialized theories yields significant improvements –Efficiency –Termination –Predictability Combination procedures are useful But resolution based theorem provers can still br superior in several cases