Decision Procedures in First Order Logic Decision Procedures

  • Slides: 19
Download presentation
Decision Procedures in First Order Logic Decision Procedures for Equality Logic Daniel Kroening and

Decision Procedures in First Order Logic Decision Procedures for Equality Logic Daniel Kroening and Ofer Strichman 1

Outline n Introduction ¨ Definition, n complexity ¨ Reducing Uninterpreted Functions to Equality Logic

Outline n Introduction ¨ Definition, n complexity ¨ Reducing Uninterpreted Functions to Equality Logic ¨ Using Uninterpreted Functions in proofs ¨ Simplifications Introduction to the decision procedures ¨ The framework: assumptions and Normal Forms ¨ General terms and notions ¨ Solving a conjunction of equalities ¨ Simplifications Decision Procedures An algorithmic point of view 2

Basic assumptions and notations n Input formulas are in NNF n Input formulas are

Basic assumptions and notations n Input formulas are in NNF n Input formulas are checked for satisfiability n Formula with Uninterpreted Functions: UF n Equality formula: E Decision Procedures An algorithmic point of view 3

First: conjunction of equalities n Input: A conjunction of equalities and disequalities 1. Define

First: conjunction of equalities n Input: A conjunction of equalities and disequalities 1. Define an equivalence class for each variable. For each equality x = y unite the equivalence classes of x and y. Repeat until convergence. 2. For each disequality u v if u is in the same equivalence class as v return 'UNSAT'. 3. Return 'SAT'. Decision Procedures An algorithmic point of view 4

Example n x 1 = x 2 Æ x 2 = x 3 Æ

Example n x 1 = x 2 Æ x 2 = x 3 Æ x 4=x 5 Æ x 5 x 1 , x 2 , x 3 Equivalence class , x 5 x 4 Equivalence class Is there a disequality between members of the same class ? Decision Procedures An algorithmic point of view 5

Next: add Uninterpreted Functions n x 1 = x 2 Æ x 2 =

Next: add Uninterpreted Functions n x 1 = x 2 Æ x 2 = x 3 Æ x 4=x 5 Æ x 5 x 1 Æ F(x 1) F(x 2) F( x 1) x 1 , x 2 , x 3 , x 5 x 4 Equivalence class F( x 2) Equivalence class Decision Procedures An algorithmic point of view 6

Next: Compute the Congruence Closure n x 1 = x 2 Æ x 2

Next: Compute the Congruence Closure n x 1 = x 2 Æ x 2 = x 3 Æ x 4=x 5 Æ x 5 x 1 Æ F(x 1) F(x 2) x 1 , x 2 , x 3 F( x 1 ), F( , x 5 x x 4 2) Equivalence class Now - is there a disequality between members of the same class ? This is called the Congruence Closure Decision Procedures An algorithmic point of view 7

And now: consider a Boolean structure n x 1 = x 2 Ç (x

And now: consider a Boolean structure n x 1 = x 2 Ç (x 2 = x 3 Æ x 4=x 5 Æ x 5 x 1 Æ F(x 1) F(x 2)) x 1 , x 2 Equivalence class x , x 3 2 x , x 5 4 ) x 1 ( F ) x 2 ( F Equivalence classes case 1 case 2 Syntactic case splitting: this is what we want to avoid! Decision Procedures An algorithmic point of view 8

Deciding Equality Logic with UFs n Input: Equality Logic formula UF n Convert UF

Deciding Equality Logic with UFs n Input: Equality Logic formula UF n Convert UF to DNF n For each clause: ¨ Define an equivalence class for each variable and each function instance. ¨ For each equality x = y unite the equivalence classes of x and y. For each function symbol F, unite the classes of F(x) and F(y). Repeat until convergence. ¨ If all disequalities are between terms from different equivalence classes, return 'SAT'. n Return 'UNSAT'. Decision Procedures An algorithmic point of view 9

Basic notions E: x = y Æ y = z Æ z x n

Basic notions E: x = y Æ y = z Æ z x n The Equality predicates: {x = y, y = z, z x} which we can break to two sets: E= ={x = y, y = z}, E = {z x} n The Equality Graph GE( E) = h. V, E=, E i (a. k. a “E-graph”) y x z Decision Procedures An algorithmic point of view 10

Basic notions 1 E: x = y Æ y = z Æ z x

Basic notions 1 E: x = y Æ y = z Æ z x unsatisfiable 2 E : x = y Æ y = z Ç z x satisfiable y x z The graph GE( E) represents an abstraction of E It ignores the Boolean structure of E Decision Procedures An algorithmic point of view 11

Basic notions y x z n Dfn: a path made of E= edges is

Basic notions y x z n Dfn: a path made of E= edges is an Equality Path. we write x =*z. n Dfn: a path made of E= edges + exactly one edge from E is a Disequality Path. We write x *y. Decision Procedures An algorithmic point of view 12

Basic notions y x n n z Dfn. A cycle with one disequality edge

Basic notions y x n n z Dfn. A cycle with one disequality edge is a Contradictory Cycle. In a Contradictory Cycle, for every two nodes x, y it holds that x =* y and x * y. Decision Procedures An algorithmic point of view 13

Basic notions y x z n Dfn: A subgraph is called satisfiable iff the

Basic notions y x z n Dfn: A subgraph is called satisfiable iff the conjunction of the predicates represented by its edges is satisfiable. n Thm: A subgraph is unsatisfiable iff it contains a Contradictory cycle Decision Procedures An algorithmic point of view 14

Basic notions n Thm: Every Contradictory Cycle is either simple or contains a simple

Basic notions n Thm: Every Contradictory Cycle is either simple or contains a simple contradictory cycle Decision Procedures An algorithmic point of view 15

Simplifications, again n n Let S be the set of edges that are not

Simplifications, again n n Let S be the set of edges that are not part of any Contradictory Cycle Thm: replacing all solid edges in S with False, and all dashed edges in S with True, preserves satisfiability Decision Procedures An algorithmic point of view 16

Simplification: example x 3 Tru x 4 Tru e False e x 2 x

Simplification: example x 3 Tru x 4 Tru e False e x 2 x 1 n (x 1 = x 2 Ç x 1 = x 4) Æ (x 1 x 3 Ç x 2 = x 3) n (x 1 = x 2 Ç True) Æ (x 1 x 3 Ç x 2 = x 3) n (: False Ç True) = True n Satisfiable! Decision Procedures An algorithmic point of view 17

Syntactic vs. Semantic splits n So far we saw how to handle disjunctions through

Syntactic vs. Semantic splits n So far we saw how to handle disjunctions through syntactic case-splitting. n There are much better ways to do it than simply transforming it to DNF: ¨ Semantic Tableaux, ¨ SAT-based splitting, ¨ others… n We will investigate some of these methods later in the course. Decision Procedures An algorithmic point of view 18

Syntactic vs. Semantic splits n Now we start looking at methods that split the

Syntactic vs. Semantic splits n Now we start looking at methods that split the search space instead. This is called semantic splitting. n SAT is a very good engine for performing semantic splitting, due to its ability to guide the search, prune the search-space etc. Decision Procedures An algorithmic point of view 19