1 / 22

Propositional Encoding - Decision Procedure

Propositional Encoding - Decision Procedure. Daniel Kroening , Ofer Strichman Presented by Changki Hong. Combination of theories. Approach 1 : Combine decision procedures of the individual theories. Nelson- Oppen method

cathal
Download Presentation

Propositional Encoding - Decision Procedure

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. Propositional Encoding - Decision Procedure • Daniel Kroening, OferStrichman • Presented by Changki Hong

  2. Combination of theories • Approach 1: Combine decision procedures of the individual theories. • Nelson-Oppen method • Approach 2 : Reduce all theories to a common logic if possible (e.g. Propositional logic) • Combine decision procedure for individual theories with a propositional SAT solver.

  3. In detail approach 2 • Two encoding schemes in the category of approach 2 • Lazy encoding • Keep interacting between SAT solver and decision procedures of each theories. • Almost every tool that participated in the SMT competitions in 2005-2007 belongs to this category of solvers. • Eager encoding • SAT solver is invoked only once with no further interaction with decision procedure of each theories.

  4. Contents Motivation Preliminaries Lazy encoding Eager encoding Conclusion

  5. Preliminaries Choose the next variable and value. Return False if all variables are assigned While (true) { if (Decide() == FALSE) return (SAT); while (BCP() == “conflict”) { backtrack-level = Analyze_Conflict(); if (backtrack-level < 0) return (UNSAT); else BackTrack(backtrack-level); } } Apply repeatedly the unit clause rule. Return “conflict”if reached a conflict Backtrack until no conflict. Return -1if impossible Basic architecture of DPLL SAT solver

  6. Contents Motivation Preliminaries Lazy encoding Eager encoding Conclusion

  7. Lazy encoding • Two main engines • SAT solver : assigns truth values to literals in order to satisfy the Boolean structure of the formula • Decision procedure of the individual theories : checks whether this assignment is consistent in theory. • Definition 1. (Boolean encoder) • Given a -literal l, we associate with it a unique Boolean variable e(l), which we call the Boolean encoder of this literal. • Given a -formula t, e(t) denotes the Boolean formula resulting from substituting each -literal in t with its Boolean encoder. We also call it as propositional skeleton.

  8. Overview of lazy encoding • Example • Let theory T be equality logic. • Á:=x = yÆ((y = zÆxz)Çx=z) • Compute propositional skeleton of the given formula • Á:=e(x= y) Æ((e(y= z) Æe(xz))Çe(x=z)) • Let B := e(Á) • Pass B to a SAT solver • ® := {e(x= y)  TRUE,e(y= z)  TRUE,e(xz)  TRUE,e(x=z)  FALSE} • Decision procedure decides whether the conjunction of the literals corresponding to this assignment (Th(®)) is satisfiable • Th(®):=x= yÆy= zÆxzÆ:(x=z) • blocking clause : e(:Th(®)):= :e(x= y) Ç:e(y= z) Ç:e(xz)Çe(x=z) • Pass BÆe(:Th(®)) to a SAT solver. • ® := {e(x = y)  TRUE,e(y = z)  TRUE,e(xz) FALSE,e(x=z) TRUE}

  9. Overview of lazy encoding Propositional SAT solver ® Th(®) DPT = A decision procedure for theory T e(t) t • ® -current assignment returned by SAT solver • Th(®) - conjunction of the literal corresponding to current assignment and we define each literal, denoted Th(liti, ®), as follows: • t - t is returned by DPT and it is called blocking clause or lemma. This clause contradicts the current assignment, and hence blocks it from being repeated. • e(t) - Boolean formula of the blocking clause.

  10. Lazy algorithm Input: A formula Á Output: “Satisfiable” if Áis satisfiable, and “Unsatisfiable” otherwise 1. function Lazy Basic (Á) 2. B:=e(Á); 3. while (true) do 4. <®, res> := SAT-Solver(B); 5. if res =“Unsatisfiable” then return “Unsatisfiable”; 6. else 7. <t, res> := Deduction(Th(®)) ; 8. if res =“Satisfiable” then return “Satisfiable”; 9. B:=B ∧e(t); • Deduction • input - conjunction of the literal corresponding to current assignment • output - a tuple of the form <blocking clause, result> where the result is one of {“Satisfiable”, “Unsatisfiable”} Algorithm 1. Lazy-basic

  11. Integration into DPLL Input: A formula ϕ Output: “Satisfiable” if the formula is satisfiable, and “Unsatisfiable” otherwise 1. function Lazy-DPLL 2. AddClauses(e(ϕ)); 3. if BCP() = “conflict” then return “Unsatisfiable”; 4. while (true) do 5. if ¬Decide() then 6. <t, res>:=Deduction(Th(®)); 7. if res=“Satisfiable” then return “Satisfiable”; 8. AddClauses(e(t)); 9. while (BCP() = “conflict”) do 10. backtrack-level := Analyze-Conflict(); 11. if backtrack-level < 0 then return “Unsatisfiable”; 12. else BackTrack(backtrack-level); 13. else 14. while (BCP() = “conflict”) do 15. backtrack-level := Analyze-Conflict(); 16. if backtrack-level < 0 then return “Unsatisfiable”; 17. else BackTrack(backtrack-level); If there is no more assignment to do Algorithm 2. Lazy-DPLL

  12. Improvement • Algorithm 2 does not call Deduction() until a full satisfying assignment is found. • Example • Assume that the Decide() procedure assigns e(x1¸ 10) TRUE ande(x1<0) TRUE. • Deduction() results in a contradiction. • Time taken to complete the assignment is wasted. • Algorithm 2 can be improved by running Deduction before a full assignment to the Boolean encoder is available. • Contradictory partial assignment are ruled out early. • Implications of literals that are still unassigned can be communicated back to the SAT solver. • ex) once e(x1¸ 10) has been assigned TRUE, we can infer that e(x1<0) must be FALSE and avoid conflict.

  13. Improved Lazy-DPLL Input: A formula ϕ Output: “Satisfiable” if the formula is satisfiable and “Unsatisfiable” otherwise 1. function DPLL(T) 2. AddClauses(e(ϕ)); 3. if BCP() = “conflict” then return “Unsatisfiable”; 4. while (true) do 5. if ¬Decide() then return “Satisfiable”; 6. repeat 7. while (BCP() = “conflict”) do 8. backtrack-level := Analyze-Conflict(); 9. if backtrack-level < 0 then return “Unsatisfiable”; 10. else BackTrack(backtrack-level); 11. <t, res>:=Deduction(Th(α)); 12. AddClauses(e(t)); 13. until res = Satisfiable Full assignment Partial assignment Algorithm 3. DPLL(T)

  14. DPLL (T) Decide SAT Full assignment BackTrack Partial assignment backtrack-level ¸ 0 BCP Analyze- Conflict ® Conflict UNSAT backtrack-level <0 Th(®) Deduction AddClauses e(t) t Satisfiable

  15. Implementation details of DPLL(T) • Deduction • Returning blocking clause • If S is the set of literals that serve as the premises in the proof of unsatisfiability, then the blocking clause is • Example • Th(®):=x = yÆy = zÆxzÆ:(x=z) • blocking clause - t:= :(x = y) Ç:(y = z) Ç:(xz)Ç x=z

  16. Implementation details of DPLL(T) • Deduction • Returning implied assignment instead of blocking clauses • Th(®) implies a literal liti, then • The encoded clause e(t) is of the form • Example • Let e(x1¸ 10) TRUE, e(x1<0) is unassigned yet. • Deduction detects that :(x1<0) is implied. • t:=:(x1¸10)Ç:(x1 <0) • e(t):=(:(x1¸10)Ç:(x1 < 0))

  17. Contents Motivation Preliminaries Lazy encoding Eager encoding Conclusion

  18. Eager encoding • Eager encoding • Perform a full reduction from the problem of deciding  -formulas to one of deciding propositional formulas. • All the necessary clauses are added to the propositional skeleton. • SAT solver is invoked only once, with no further interaction with decision procedure of each theories. • Example • Equality logic and Uninterpreted Functions • Substitute equality literals into Boolean variables and add constraints • Array logic • Substitute array read operation into UF

  19. Eager encoding Input: A formula ϕ Output: “Satisfiable” if ϕ is satisfiable and “Unsatisfiable” otherwise 1. function Eager-Encoding(ϕ) 2. e(P) := Deduction(lit(ϕ)); 3. ϕE := e(ϕ) Æe(P); 4. <α, res> := SAT-Solver(ϕE); 5. if res =“Unsatisfiable” then return “Unsatisfiable”; else return “Satisfiable”; Algorithm 4. Eager-encoding

  20. Contents Motivation Preliminaries Lazy encoding Eager encoding Conclusion

  21. Conclusions Satelite decision procedure Linear arithmetic Bit vectors Arrays Pointer EUF Core decision procedure DPLL-based SAT solver from tool paper describing Yices The architecture of Yices

  22. Conclusions • Two encoding schemes • Lazy encoding • Keep interacting between SAT solver and decision procedure of each theories. • Almost every tool that participated in the SMT competitions in 2005-2007 belongs to this category of solvers. • Eager encoding • SAT solver is invoked only once with no further interaction with decision procedure of each theories.

More Related