propositional encoding - decision procedure
DESCRIPTION
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 - PowerPoint PPT PresentationTRANSCRIPT
Propositional Encoding - Decision Procedure
Daniel Kroening, Ofer StrichmanPresented by Changki Hong
2 / 22
Combination of theories Approach 1 : Combine decision procedures of the individ-
ual 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 proposi-
tional SAT solver.
Changki Hong @ pswlab Propositional Encodings
3 / 22
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 deci-
sion procedure of each theories.
Changki Hong @ pswlab Propositional Encodings
4 / 22
Contents Motivation Preliminaries Lazy encoding Eager encoding Conclusion
Changki Hong @ pswlab Propositional Encodings
5 / 22
Preliminaries
While (true){
if (Decide() == FALSE) return (SAT); while (BCP() == “conflict”) {
backtrack-level = Analyze_Conflict();if (backtrack-level < 0) return (UNSAT);else BackTrack(backtrack-level);
}}
Choose the next variable and value.Return False if all variables are assigned
Apply repeatedly the unit clause rule.Return “conflict” if reached a conflict
Backtrack until no conflict.Return -1 if impossible
Basic architecture of DPLL SAT solver
6 / 22
Contents Motivation Preliminaries Lazy encoding Eager encoding Conclusion
Changki Hong @ pswlab Propositional Encodings
7 / 22
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.
Changki Hong @ pswlab Propositional Encodings
8 / 22
Overview of lazy encoding Example
Let theory T be equality logic. - Á := x = y Æ ((y = z Æ x z) Ç x = z)
1. Compute propositional skeleton of the given formula- Á := e(x = y) Æ ((e(y = z) Æ e(x z)) Ç e(x = z)) - Let B := e(Á)
2. Pass B to a SAT solver - ® := {e(x = y) TRUE, e(y = z) TRUE, e(x z) TRUE, e(x = z) FALSE}
3. Decision procedure decides whether the conjunction of the literals cor-responding 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)
4. Pass B Æ e(:Th(®)) to a SAT solver. - ® := {e(x = y) TRUE, e(y = z) TRUE, e(x z) FALSE, e(x = z) TRUE}
Changki Hong @ pswlab Propositional Encodings
9 / 22
Overview of lazy encoding
Changki Hong @ pswlab Propositional Encodings
PropositionalSAT solver
DPT = A decision procedurefor theory T
® Th(®)
e(t) t
• ® - current assignment returned by SAT solver
• Th(®) - conjunction of the literal corresponding to current assignment and we de-fine each literal, denoted Th(liti, ®), as follows:
• t - t is returned by DPT and it is called blocking clause or lemma. This clause con-tradicts the current assignment, and hence blocks it from being repeated.
• e(t) - Boolean formula of the blocking clause.
10 / 22
Lazy algorithm Algorithm 1. Lazy-basic
Changki Hong @ pswlab Propositional Encodings
Input: A formula ÁOutput: “Satisfiable” if Á is satisfiable, and “Unsatisfiable” otherwise
1. function Lazy Basic (Á)2. B := e(Á);3. while (true) do4. <®, res> := SAT-Solver(B);5. if res =“Unsatisfiable” then return “Unsatisfiable”;6. else7. <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”}
11 / 22
Integration into DPLL Algorithm 2. Lazy-DPLL
Changki Hong @ pswlab Propositional Encodings
Input: A formula ϕOutput: “Satisfiable” if the formula is satisfiable, and “Unsatisfiable” otherwise
1. function Lazy-DPLL2. AddClauses(e(ϕ));3. if BCP() = “conflict” then return “Unsatisfiable”;4. while (true) do5. if ¬ Decide() then6. <t, res>:=Deduction(Th(®));7. if res=“Satisfiable” then return “Satisfiable”;8. AddClauses(e(t));9. while (BCP() = “conflict”) do10. backtrack-level := Analyze-Conflict();11. if backtrack-level < 0 then return “Unsatisfiable”;12. else BackTrack(backtrack-level);13. else14. while (BCP() = “conflict”) do15. 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
12 / 22
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 and e(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 communi-
cated 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.
Changki Hong @ pswlab Propositional Encodings
13 / 22
Improved Lazy-DPLL Algorithm 3. DPLL(T)
Changki Hong @ pswlab Propositional Encodings
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) do5. if ¬ Decide() then return “Satisfiable”; 6. repeat7. while (BCP() = “conflict”) do8. 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
14 / 22
DPLL (T)
Changki Hong @ pswlab Propositional Encodings
UNSAT
Decide
Deduction AddClauses
BackTrack
BCP Analyze-Conflict
Partial assign-ment
SATFull assignment
backtrack-level ¸ 0
backtrack-level < 0
Conflict
Satisfiable
®
Th(®) e(t) t
15 / 22
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 unsatisfi-ability, 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
Changki Hong @ pswlab Propositional Encodings
16 / 22
Implementation details of DPLL(T)
Changki Hong @ pswlab Propositional Encodings
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 / 22
Contents Motivation Preliminaries Lazy encoding Eager encoding Conclusion
Changki Hong @ pswlab Propositional Encodings
18 / 22
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
Changki Hong @ pswlab Propositional Encodings
19 / 22
Eager encoding Algorithm 4. Eager-encoding
Changki Hong @ pswlab Propositional Encodings
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”;6. else return “Satisfiable”;
20 / 22
Contents Motivation Preliminaries Lazy encoding Eager encoding Conclusion
Changki Hong @ pswlab Propositional Encodings
21 / 22
Conclusions The architecture of Yices
Changki Hong @ pswlab Propositional Encodings
Linear arithmetic Bit vectors Arrays Pointer
EUF
DPLL-based SAT solver
Core decision pro-cedure
Satelite decision procedure
from tool paper describing Yices
22 / 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 deci-
sion procedure of each theories.
Changki Hong @ pswlab Propositional Encodings