Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.

Slides:



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

CS 336 March 19, 2012 Tandy Warnow.
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
Great Theoretical Ideas in Computer Science for Some.
Interpolants from Z3 proofs Ken McMillan Microsoft Research TexPoint fonts used in EMF: A A A A A.
Deciding Equality with Uninterpreted Functions using Congruence Closure Constantinos Bartzis.
Great Theoretical Ideas in Computer Science.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture4: Regular Expressions Prof. Amos Israeli.
Plan for today Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search.
What’s left in the course. The course in a nutshell Logics Techniques Applications.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Proof-system search ( ` ) Interpretation search ( ² ) Main search strategy DPLL Backtracking Incremental SAT Natural deduction Sequents Resolution Main.
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 Theorem proving Alexander Serebrenik. 2 TP for FM FM: proving properties of programs. Theorem proving: proving statements in first-order logics (FOL).
` ² Q E D I Nelson-Oppen review
The Simplify Theorem Prover Greg Nelson, Dave Detlefs and Jim Saxe Mooly Sagiv.
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.
Administrative stuff On Thursday, we will start class at 11:10, and finish at 11:55 This means that each project will get a 10 minute presentation + 5.
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 … }
Course announcement Software Reliability Methods –Spring 06, Tu Th 9:30am-11:00am –Instructors: Ingolf Krueger, Ranjit Jhala, Sorin Lerner Topics: –Model.
Review: forward E { P } { P && E } TF { P && ! E } { P 1 } { P 2 } { P 1 || P 2 } x = E { P } { \exists … }
Plan for the rest of the quarter TuesdayThursday Week 7ResolutionProof carrying code Week 8No class (Sorin in DC for workshop) Predicate abstraction (Mystery.
After today Week 9 –Tu: Pat Rondon –Th: Ravi/Nathan Week 10 –Tu: Nathan/Ravi –Th: Class canceled Finals week –Th: Zach, John.
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.
ECE 667 Synthesis and Verification of Digital Systems
Course eval results More applications Last question –Luging: 0.5 –Curling: 1.5 –Figure skating: 2 –Ice fishing: 6.5 –Foosball: 0.5.
Going back to techniques Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
Induction and recursion
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Lecture 22 More NPC problems
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
CS344: Introduction to Artificial Intelligence Lecture: Herbrand’s Theorem Proving satisfiability of logic formulae using semantic trees (from Symbolic.
Discrete Structures Lecture 12: Trees Ji Yanyan United International College Thanks to Professor Michael Hvidsten.
Lazy Annotation for Program Testing and Verification Speaker: Chen-Hsuan Adonis Lin Advisor: Jie-Hong Roland Jiang November 26,
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
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.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Finding Conflicting Instances of Quantified Formulas in SMT Andrew Reynolds Cesare Tinelli Leonardo De Moura July 18, 2014.
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.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
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.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
CSC317 1 At the same time: Breadth-first search tree: If node v is discovered after u then edge uv is added to the tree. We say that u is a predecessor.
Satisfiability Modulo Theories and DPLL(T) Andrew Reynolds March 18, 2015.
Proof And Strategies Chapter 2. Lecturer: Amani Mahajoub Omer Department of Computer Science and Software Engineering Discrete Structures Definition Discrete.
Theory of Computational Complexity Probability and Computing Chapter Hikaru Inada Iwama and Ito lab M1.
Decision Procedures in First Order Logic
The NP class. NP-completeness
Decision Procedures in Equality Logic
Gábor Kusper University of Linz RISC Austria
Great Theoretical Ideas in Computer Science
Search techniques.
Algorithms (2IL15) – Lecture 7
Minimum Spanning Trees
Lecture 23 NP-Hard Problems
Presentation transcript:

Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy DPLL backtracking search Enumerating over Herbrand’s universe Backtracking search with SAT solver (Verifun) Prenex normal form Replacing 9 with function symbols Next

Equality (Part I): Congruence closure and E-graph Part II of equality (rewrite rules) will be later in the quarter ` ² QD I E

` ² QD I E Equality with uninterpreted func symbols Want to establish, for example, that f(f(a,b),b) = a follows from f(a,b) = a Or that f(a) = a follows from f(f(f(a))) = a and f(f(f(f(f(a))))) = a These kinds of inferences are often required to perform program verification

Axioms of EUF Intuition behind decision procedure for EUF: repeatedly apply these axioms to infer new equalities a 1 = b 1 a 2 = b 2 … a n = b n f(a 1, a 2, …, a n ) = f(b 1, b 2, …, b n ) EQ-PROP a = b b = c a = c TRANS ` ² QD I E

Representing terms with graphs f f ab ab f(a,b) f(f(a,b),b) ` ² QD I E

Applying TRANS If node a is equal to node b and node b is equal to node c, then node a is equal to node c = = ` ² QD I E

Applying TRANS If node a is equal to node b and node b is equal to node c, then node a is equal to node c = = = ` ² QD I E

Applying EQ-PROP If two nodes have the same label, and all their children are pairwise equal, then the two nodes are also equal f …… f …… == ` ² QD I E

Applying EQ-PROP If two nodes have the same label, and all their children are pairwise equal, then the two nodes are also equal f …… f …… == = ` ² QD I E

Example Assume f(a,b) = a, show f(f(a,b),b) = a f f ab ab f(a,b) f(f(a,b),b) ` ² QD I E

Example Assume f(a,b) = a, show f(f(a,b),b) = a f f ab ab f(a,b) f(f(a,b),b) ` ² QD I E

Another example Assume f(f(f(a))) = a and f(f(f(f(f(a))))) = a Show f(a) = a afffff af(a)f(f(a))f(f(f(a)))f(f(f(f(a))))f(f(f(f(f(a))))) ` ² QD I E

Another example Assume f(f(f(a))) = a and f(f(f(f(f(a))))) = a Show f(a) = a afffff af(a)f(f(a))f(f(f(a)))f(f(f(f(a))))f(f(f(f(f(a))))) ` ² QD I E

Let’s formalize this Suppose we have a labeled graph G = (V,E), where: – (v) denotes the label of vertex v –  (v) denotes the outdegree (number of outgoing edges) of vertex v. – v[i] denotes the i th successor of vertex v ` ² QD I E

Congruence Let R be a relation on V. Two vertices u and v are congruent under R if: – (u) = (v) –  (u) =  (v) – for all i such that 1 · i ·  (u), (u[i], v[i]) 2 R Intuition: –R represents known equalities –Read congruent as “identical” –This is essentially an instance of the EQ-PROP rule ` ² QD I E

Congruence closure A relation R on V is closed under congruences if, for all vertices u and v such that u and v are congruent under R, (u,v) 2 R For any given R, there exists a unique minimal extension R’ of R such that R’ is an equivalence relation and R’ is closed under congruences; R’ is the congruence closure of R ` ² QD I E

Computing the congruence closure A simple algorithm for computing the congruence closure: 1. For any (u,v) 2 R, merge u and v into one node 2. While there are vertices u and v that are congruent under R, but for which (u,v) 2 R, merge u and v into one node Upon termination, each node in R represents an equivalence class in the congruence closure R’ How do we find the vertices u and v in step 2? ` ² QD I E

Representing the equiv. relation Represent the equivalence relation by its corresponding partition, that is, by the set of its equivalence classes UNION(u,v) combines the equivalence classes of vertices u and v FIND(u) returns the unique name of the equivalence class of vertex u ` ² QD I E

A refined version of the algorithm Given R that is closed under congruences, MERGE(u,v) constructs the congruance closure of R [ {(u,v)} MERGE(u,v) 1.If FIND(u) = FIND(v) then return 2.Let P u be the set of predecessors of all vertices equivalent to u, and P v the set of predecessors of all vertices equivalent to v 3.Call UNION(u,v) 4.For each pair x 2 P u, y 2 P v, if FIND(x)  FIND(y) and CONGRUENT(x,y) = TRUE, then MERGE(x,y) CONGRUENT(u,v) 1. If  (u)   (v) then return FALSE 2.For 1 · I ·  (u), if FIND(u[i])  FIND(v[i]), then return FALSE 3.Return TRUE ` ² QD I E

Decision procedure for EUF SAT-EUF(F), where F is a conjunction of equalities and inequalities: –Build a graph G for all terms in the equalities and inequalities, where  (t) is the node for term t –For each equality t 1 = t 2, call Merge(  (t 1 ),  (t 2 )) –For each inequality t 1  t 2, if FIND(  (t 1 )) = FIND(  (t 2 )), then return UNSAT –Return SAT ` ² QD I E

E-graph The graph from Nelson-Oppen 80 was later called the E-graph (equality graph) Nodes in the E-graph are the equivalence classes We can represent an inequality a  b in the E- graph with a special inequality edge between FIND(  (a)) and FIND(  (b)) If two equivalence classes connected by an inequality edge are merged, then there is an inconsistency ` ² QD I E

E-graph The E-graph can be constructed incrementally –Adding an equality causes cascading merges –Adding an inequality causes a new inequality edge to appear We can incorporate the E-graph into our backtracking search algorithm –Use E-graph as the context –Adding an assumption to the context now means inserting the (in)equality into the E-graph ` ² QD I E

Example from last time Show the following is unsatisfiable: –a = b Æ ( : (f(a) = f(b)) Ç b = c) Æ : (f(a) = f(c)) ` ² QD I E

Example from last time Show the following is unsatisfiable: –a = b Æ ( : (f(a) = f(b)) Ç b = c) Æ : (f(a) = f(c)) ` ² QD I E

We have a theorem prover for EUF! Let’s call the theorem prover we have so far (backtracking + E-graph) Simplify-- This name was carefully chosen: our theorem prover has the same core as Simplify What’s in Simplify that’s missing from Simplify--? –Quantifiers. We’ll see this next. –Interpreted function symbols. For example, how can we prove x = y ) x ¸ y. We’ll see this on Tuesday. ` ² QD I E

Recap Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy DPLL backtracking search Enumerating over Herbrand’s universe Backtracking search with SAT solver Prenex normal form Replacing 9 with function symbols E-graph Next: matching heuristic for universal quantifiers

Matching heuristic ` ² E D I Q

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 search We want to find substitutions  giving values to x 1, …,x n such that  (P) will be useful in the proof ` ² E D I Q

General idea in matching Pick a term t from P called a trigger (also called a pattern) Instantiate P with a substitution  if  (t) is a term that the prover is likely to require information about Intuition of why this works: –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) ` ² E D I Q

General idea in matching Each theorem prover has its own way of deciding what terms it wants information about For example, in Simplify--, we’ll check to see if  (t) is present in the context (the E-graph) As another example, PVS checks if  (t) appears in any of its assumptions ` ² E D I Q

Example Assume 8 x,y. car(cons(x,y)) = x Let’s use the trigger car(cons(x,y)) We are therefore looking for values of x and y such that car(cons(x,y)) appears in the E-graph ` ² E D I Q

Example Assume 8 x,y. car(cons(x,y)) = x cons car f ab ` ² E D I Q

Example Assume 8 x,y. car(cons(x,y)) = x cons car f ab Instantiate with x = a and y = f(a,b) Get car(cons(a,f(a,b))) = a Add this to the E-graph = ` ² E D I Q

Matching with backtracking While performing the backtracking search, periodically perform matching to add new assumptions into the context Let’s try this to prove the following: –Assume the BG axiom 8 x,y. car(cons(x,y)) = x –Show cons(a,b) = cons(c,d) ) a = c ` ² E D I Q

Matching with backtracking ` ² E D I Q

` ² E D I Q

Choice of trigger is important Goal: find a term or set of terms that will contain all the variables in the universal quantifier But… Many possible choices Smaller triggers apply are more general, but may lead to instantiating more times than needed Larger triggers are less general, but may lead to missed instantiations ` ² E D I Q

Matching in the E-graph Matching in the E-graph is done up to equivalence Consider an E-graph that represents the equality f(a) = a. Despite having only two nodes, this E-graph represents not only a and f(a), but also f(f(a)) and actually f n (a) for any n. Because the E-graph represents more terms than it has nodes, matching in the E-graph is more powerful than simple conventional pattern-matching, since the matcher is able to exploit the equality information in the E-graph. ` ² E D I Q

Example of exploiting E-graph info Assume 8 x. f(x) = x 8 x. g(g(x)) = x Show g(f(g(a))) = a ` ² E D I Q

Example of exploiting E-graph info Assume 8 x. f(x) = x 8 x. g(g(x)) = x Show g(f(g(a))) = a ` ² E D I Q