1 / 63

Decision Procedures for Equality Logic and Uninterpreted Functions

Decision Procedures for Equality Logic and Uninterpreted Functions . Daniel Kroening and Ofer Strichman Decision Procedure. TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A A. Last talk.

sagira
Télécharger la présentation

Decision Procedures for Equality Logic and Uninterpreted Functions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Decision Procedures for Equality Logic and Uninterpreted Functions Daniel Kroening and OferStrichman Decision Procedure TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAA

  2. Last talk.. • We learnt about Equality logic and Equality logic with uninterpreted functions. • There were two reduction schemes to transform Equality logic with uninterpreted functions into Equality logic. • Today, we will cover how to determine satisfiability of the Equality logic.

  3. Contents • Decision procedure for the Equality logic and UFs • Decision procedure for the Equality logic • Transform equality logic to propositional logic • Range allocation algorithm

  4. Basic assumptions and notations • Assumptions • Input formulas are in NNF (Negation Normal Form) • Input formulas are checked for satisfiability • Notations • Equality formula with Uninterpreted Functions: UF • Equality formula: E

  5. Decision procedure for conjunction of equalities • Input: A conjunction of equalities and disequalities • Define an equivalence class for each variable. For each equality x = y, unite the equivalence classes of xand y. Repeat until convergence. • For each disequalityuv if u is in the same equivalence class as v return 'UNSAT'. • Return 'SAT'.

  6. x4,x5 Example • x1 = x2∧x2 = x3∧x4 = x5∧x5x1 x1,x2,x3 Equivalence class Equivalence class Is there a disequality between members of the same class ? • No, so return SAT

  7. x4,x5 Decision procedure for conjunction of equalities with uninterpreted functions • x1 = x2∧x2 = x3∧x4 = x5∧x5x1 ∧F(x1) F(x2) F(x1) x1,x2,x3 Equivalence class F(x2) Equivalence class Equivalence class Equivalence class

  8. x4,x5 Compute the Congruence Closure • x1 = x2∧x2 = x3∧x4 = x5∧x5x1 ∧F(x1)F(x2) x1,x2,x3 F(x1),F(x2) Equivalence class Equivalence class Equivalence class Given two terms t1, t2 thatare in the same class and that F(t1) and F(t2) are terms in for some uninterpreted function F, merge the classes of F(t1) and F(t2). Repeat until there are no more such instances. If there exists a disequality t1 t2 in UF such that t1 and t2 are in the same equivalence class, return “Unsatisfiable”. Otherwise return “Satisfiable”

  9. Consider a Boolean structure • x1 = x2∨(x2 = x3∧x4 = x5∧x5x1 ∧F(x1) F(x2)) x1,x2 F(x1) F(x2) x4,x5 x2,x3 Equivalence class Equivalence classes case 1 case 2 Syntactic case splitting: This can work well as long as there are not too many cases to consider.

  10. y x z Basic notions • From here on that uninterpreted functions have already been eliminated that we are solving the satisfiability problem for equality logic without uninterpreted functions. E: x = y∧y = z∧zx • The Equality predicates: {x = y, y = z, zx}which we can break to two sets: • equality edge : E= ={x = y, y = z}, disequality edge : E = {zx} • The Equality GraphGE(E) = (V,E=,E) (a.k.a“E-graph”)

  11. y x z Basic notions 1E: (x= y∧y = z)∧zxunsatisfiable 2E: (x= y∧y = z)∨zx satisfiable The graph GE(E) represents an abstraction ofE Itignores the Boolean structure ofE

  12. y x z Basic notions • Dfn: a path made ofE= edges is anEquality Path.we writex =*z. • Dfn: a path made of E= edges +exactly one edge fromE is a Disequality Path. We writex*y.

  13. y x z Basic notions • Dfn. A cycle with one disequality edge is a Contradictory Cycle. • In a Contradictory Cycle, for every two nodesx, yit holds thatx =* yandx* y.

  14. y x z Basic notions • Dfn: A subgraph is called satisfiableiffthe conjunction of the predicates represented by its edges is satisfiable. • Thm: A subgraph is unsatisfiableiff it contains a Contradictory cycle

  15. Simplifications • 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

  16. Simplification: example x3 • (x1 = x2∨x1=x4) ∧(x1x3∨x2 = x3) • (x1 = x2∨True) ∧(x1x3∨x2 = x3) • (¬False ∨True) = True • Satisfiable! True False x4 x2 True x1

  17. Decision procedures for Equality logic and UFs • From hereon we are going to look at algorithms which transform Equality logic into propositional logic and use decision procedure for propositional logic. • Algorithm I – From Equality to Propositional Logic • Adding transitivity constraints • Making the graph chordal • Algorithm II – Range-Allocation • What is the small-model property? • Finding a small adequate range (domain) to each variable • Reducing to Propositional Logic

  18. Decision Procedures for Equality Logic • We will first investigate methods that solve Equality Logic. Uninterpreted functions are eliminated with one of the reduction schemes. • Our starting point: the E-Graph GE(E) • Recall that GE(E)represents an abstraction of E.It representsALL equality formulas with the same set of equality predicates as E.

  19. e2 e3 e1 From Equality to Propositional LogicBryant & Velev2000: the Sparse method E :x1 = x2∧x2 = x3∧x1x3 enc:e1∧e2∧¬e3 • Encode all edges with Boolean variables • (note: for now, ignore polarity) • This is an abstraction • Transitivity of equality is lost! • Must add transitivity constraints!

  20. e2 e3 e1 From Equality to Propositional Logic E :x1= x2∧x2 = x3∧x1x3 enc:e1 ∧e2∧¬e3 • For each cycle add a transitivity constraint trans = (e1∧e2⇒e3) ∧ (e1∧e3⇒e2) ∧ (e3∧e2⇒e1) Check: enc∧trans

  21. From Equality to Propositional Logic • There can be an exponential number of cycles, so let’s try to make it better. • Dfn: A chord of a cycle is an edge connecting two non-adjacent nodes of the cycle. If a cycle has no chords in a given graph, it is called a chord-free cycle. • Thm [Bryant & Velev]: It is sufficient to constrain chord-free simple cycles T e2 T e5 T e1 F e3 F e4 T From Bryant’s slide

  22. From Equality to Propositional Logic • Still, there can be an exponential number of chord-free simple cycles… • Solution: make the graph ‘chordal’ by adding edges. …. From Bryant’s slide

  23. From Equality to Propositional Logic • Dfn: A graph is chordal iff every cycle of size 4 or more has a chord. • How to make a graph chordal ? eliminate vertices one at a time, and connect their neighbors. From Bryant’s slide

  24. From Equality to Propositional Logic • Once the graph is chordal, we can constrain only the triangles. • Note that this procedure adds no more than a polynomial # of edges, and results in a polynomial # of constraints. T T T T Contradiction! T F T

  25. Decision Procedures for Equality logic and UFs • Algorithm I – From Equality to Propositional Logic • Adding transitivity constraints • Making the graph chordal • Algorithm II – Range-Allocation • Small-model property • Finding a small adequate range (domain) to each variable • Reducing to Propositional Logic   

  26. The small model property • We show a method for solving equality logic formulas by relying on the Small model property. • This means that if a formula in this logic is satisfiable, then there is a finite, bounded in size, model that satisfies it. • In Equality Logic, we can compute this bound. • Solution strategy for checking whether a given equality formula is satisfiable, can be summarized as follows: • Determine, a domain allocation by mapping each variable xi into a finite set of intergers. • Encode each variable xi as an enumerated type over its finite domain. Construct a propositional formula representing Eunder this finite domain, and use either BDDs or SAT to check if this formula is satisfiable.

  27. The small model property • Claim: the range 1..n is adequate, where n is the number of variables in  • Proof: • Every satisfying assignment defines a partition of the variables • Every assignment that results in the same partitioning also satisfies the formula • The range 1..n allows all partitionings • Complexity • We need log n variables to encode the range 1…n • For n variables we need n log n bits

  28. Reducing state-space Instead of giving the range [1..11], analyze connectivity: x1 x2 y1 y2 g1 g2 u1 f1 f2 u2 z x1, y1, x2, y2:{0-1} u1, f1, f2, u2 : {0-3} g1, g2, z: {0-2} The state-space: from 1111to~ 110592

  29. Reducing state-space (Cond.) Or even better: {0} {0-1} x1 x2 y1 y2 g1 g2 u1 f1 f2 u2 z x1, y1, g1 , u1 : {0} x2, y2 , g2 , f1: {0-1} f2, z : {0-2} u2 : {0-3} The state-space: from110592to576

  30. Range minimization problem • Given an Equality formula E, find in polynomial time a small domain D* sufficient to preserve its satisfiability • In other words: find D* such that • E is satisfiable under an infinite domain D → E is satisfiable under the finite domain D*

  31. The strategy 1. Determine a range allocation R, mapping each variable xiE into a small set of integers, such that E is satisfiableiff it is satisfiable over some R-interpretation. 2. Encode each variable xi as an enumerated type over R(xi), and use a standard satisfiability checker as a decision procedure.

  32. What range is adequate ? • Recall that a subgraph of an E-Graph GE(E) is unsatisfiable iff it contains a contradictory cycle. • Dfn: A Range Allocation R is adequate for GE(E) if every satisfiable subgraph can be satisfied under R. • Now we need an algorithm to find adequate ranges

  33. Example • Building the E-graph E : E= : x1 x2 y1 y2 g1 g2 u1 f1 f2 u2 z Note: 1. Inconsistent subsets appear ascontradictory cycles 2.Some of the vertices are mixed

  34. The range allocation algorithm Step I - pre-processing: A. Remove all solid edges not belonging to contradictory cycles. B. Add a single unique value to singleton vertices, and remove them from the graph. {0} {1} {2} {3} x1 x2 y1 y2 g1 g2 u1 f1 f2 u2 z

  35. The range allocation algorithm Step 2 – Set construction: • A. For each mixed vertex xi: 1. Add a unique value ui to R(xi) 2. Broadcast ui on G= 3. Remove xiand its adjacent edges from the graph • B. Add a unique value to each remaining G= component {4} {4} {4, } {4, } {4} g1 g2 g1 g1 g2 z z z {4, } {4, } {4} A. B.

  36. The range allocation algorithm {6} {6} {6} {6} u1 f1 f2 u2 1. {6,7} {6,7} {6,7} 2. f1 f2 u2 {6,7, } {6,7, } 3. f1 u2 {6} {6,7, } {6,7} {6,7, } u1 f1 f2 u2

  37. The range allocation algorithm • The state-space is reduced to 72. 1..n connectivity better connectivity range allocation algo. 576 72 1111 110592

  38. Conclusion • Decision procedure for the equality logic with UFs, which uses syntactic case splitting method, is inefficient if the formula has many disjunctions. • There are two algorithms which transform the original equality logic formula into the corresponding propositional logic formula and then check satisfiability using BDDs or SAT solver.

  39. Linear Arithmetic Daniel Kroening and OferStrichman Decision Procedure

  40. Linear Arithmetic Feasible region Linear program consists of the objective function and the constraints. We are interested in the decision problem rather than the optimization problem.

  41. Simplex algorithm • The simplex algorithm is developed by Danzig in 1947 but it still efficiently used. • The simplex algorithm can decide satisfiability of a conjunction of linear inequalities. • The set of constraints is normally accompanied by a linear objective functions in terms of the variables of the formula. • If the set of constraints is satisfiable, the simplex algorithm provides a satisfying assignment that maximizes the value of the objective function. • As we are concerned with the decision problem rather than the optimization problem, we are going to cover a variant of the simplex algo. called general simplex that does not require an objective function.

  42. General simplex algorithm • The general simplex algorithm accepts two types of constraints as input: • Equalities of the form • Lower and upper bounds on the variables: where liand uiare constants representing the lower and upper bounds on xi, respectively. We call this representation of input formula as general form.

  43. General simplex algorithm • We can transform an linear constraint LFR with F2 {=, ·, ¸} into the general form as follows: • Let m be the number of constraints. For the i-th constraints, 1·i·m • Move all addends in R to the left-hand side to obtain L’Fb, where b is a constant. • Introduce a new variable si. Add the constraints F b • The original and the transformed conjunctions of constraints are obviously equisatisfiable.

  44. Example • The new variables s1, … , sm are called the additional variables. • The variables x1, … , xnin the original constraints are called problem variables.

  45. General simplex algorithm • It is common and convenient to view linear constraints satisfaction problem as geometrical problems. The shaded region represents satisfiable area. The red circled points illustrate the progress that the simplex algorithm makes.

  46. General simplex algorithm • The general form of the constraints can be represented as follows: A : m by (n+m) metrics x : 1 by (n+m)metrics (x1, … , xn, s1,… , sm)

  47. General simplex algorithm • The tableau is simply a different representation of A. • Additional variables such as s1, … , sm are also called the basic variable and denoted by B. • Problem variables such as x1, … , xn are also called the nonbasic variable and denoted by N. • Tableau is written into • Example

  48. General simplex algorithm

  49. General simplex algorithm • The algorithm initializes its data structure as follows: • The set of basic variables B is the set of additional variables. • The set of nonbasic variables N is the set of problem variables. • For any xiwith i2 {1, … ,n+m}, ®(xi) =0. • Pivot operation • Swaps xi with xj (xi is from the column of the tableau and xj is from the row of the tableau). • The process of the pivot operation is explained in the following example.

  50. Example • We initialize ®(xi) =0. The lower bound of s1 is 2 and it is violated. • Since the variable x has a positive coefficient, it is suitable for the pivot operation. • We need to increase s1by 2 in order to meet the lower bound, which means that x has to increase by 2 as well.

More Related