Decision Procedures An Algorithmic Point of View Revision 1.0 - - PowerPoint PPT Presentation

decision procedures
SMART_READER_LITE
LIVE PREVIEW

Decision Procedures An Algorithmic Point of View Revision 1.0 - - PowerPoint PPT Presentation

Propositional Encodings Chapter 11 Decision Procedures An Algorithmic Point of View Revision 1.0 D.Kroening O.Strichman Outline 1 Overview 2 Notation 3 A Basic Encoding Algorithm 4 Integration into DPLL 5 Theory Propagation and the DPLL( T )


slide-1
SLIDE 1

Decision Procedures

An Algorithmic Point of View

D.Kroening O.Strichman

Propositional Encodings

Chapter 11

Revision 1.0

slide-2
SLIDE 2

Outline

1 Overview 2 Notation 3 A Basic Encoding Algorithm 4 Integration into DPLL 5 Theory Propagation and the DPLL(T) Framework 6 Theory Propagation and the DPLL(T) Framework 7 Optimizations and Implementation Issues

Decision Procedures – Propositional Encodings 2

slide-3
SLIDE 3

Propositional Encodings Let T be a first-order Σ-theory such that:

T is quantifier-free. There exists a decision procedure, denoted DPT , for the conjunctive fragment of T.

Decision Procedures – Propositional Encodings 3

slide-4
SLIDE 4

Propositional Encodings Example 1:

T is equality logic. DPT is the congruence closure algorithm.

Example 2:

T is disjunctive linear arithmetic. DPT is the Simplex algorithm.

Decision Procedures – Propositional Encodings 4

slide-5
SLIDE 5

Propositional Encodings We will now study a framework that combines DPT , and a SAT solver, in various ways, in order to construct a decision procedure for T.

Decision Procedures – Propositional Encodings 5

slide-6
SLIDE 6

Propositional Encodings We will now study a framework that combines DPT , and a SAT solver, in various ways, in order to construct a decision procedure for T. This method is modular, efficient, competitive (all state-of-the-art SMT solvers work this way).

Decision Procedures – Propositional Encodings 5

slide-7
SLIDE 7

Propositional Encodings The two main engines in this framework work in tight collaboration: The SAT solver chooses those literals that need to be satisfied in order to satisfy the Boolean structure of the formula, and The theory solver DPT checks whether this choice is consistent in T.

Decision Procedures – Propositional Encodings 6

slide-8
SLIDE 8

Notation Let l be a Σ-literal. Denote by e(l) the Boolean encoder of this literal. Let t be a Σ-formula, Denote by e(t) the Boolean formula resulting from substituting each Σ-literal in t with its Boolean encoder.

Decision Procedures – Propositional Encodings 7

slide-9
SLIDE 9

Notation Let l be a Σ-literal. Denote by e(l) the Boolean encoder of this literal. Let t be a Σ-formula, Denote by e(t) the Boolean formula resulting from substituting each Σ-literal in t with its Boolean encoder. For a Σ-formula t, the resulting Boolean formula e(t) is called the propositional skeleton of t.

Decision Procedures – Propositional Encodings 7

slide-10
SLIDE 10

Boolean encoders – examples Example I: Let l := x = y be a Σ-literal. Then e(x = y), a Boolean variable, is its encoder.

Decision Procedures – Propositional Encodings 8

slide-11
SLIDE 11

Boolean encoders – examples Example I: Let l := x = y be a Σ-literal. Then e(x = y), a Boolean variable, is its encoder. Example II: Let t := x = y ∨ x = z be a Σ-formula. Then e(t) := e(x = y) ∨ e(x = z) is its Boolean encoder.

Decision Procedures – Propositional Encodings 8

slide-12
SLIDE 12

Overview by an example Let T be equality logic. Given an NNF formula ϕ := x = y ∧ ((y = z ∧ x = z) ∨ x = z) , (1) we begin by computing its propositional skeleton:

Decision Procedures – Propositional Encodings 9

slide-13
SLIDE 13

Overview by an example Let T be equality logic. Given an NNF formula ϕ := x = y ∧ ((y = z ∧ x = z) ∨ x = z) , (1) we begin by computing its propositional skeleton: e(ϕ) := e(x = y) ∧ ((e(y = z) ∧ e(x = z)) ∨ e(x = z)) . (2)

Decision Procedures – Propositional Encodings 9

slide-14
SLIDE 14

Overview by an example Let T be equality logic. Given an NNF formula ϕ := x = y ∧ ((y = z ∧ x = z) ∨ x = z) , (1) we begin by computing its propositional skeleton: e(ϕ) := e(x = y) ∧ ((e(y = z) ∧ e(x = z)) ∨ e(x = z)) . (2) Note that since we are encoding literals and not atoms, e(ϕ) has no negations and hence is trivially satisfiable.

Decision Procedures – Propositional Encodings 9

slide-15
SLIDE 15

Overview by an example Let B be a Boolean formula, initially set to e(ϕ), i.e., B := e(ϕ) .

Decision Procedures – Propositional Encodings 10

slide-16
SLIDE 16

Overview by an example Let B be a Boolean formula, initially set to e(ϕ), i.e., B := e(ϕ) . As a second step, we pass B to a SAT solver.

Decision Procedures – Propositional Encodings 10

slide-17
SLIDE 17

Overview by an example Let B be a Boolean formula, initially set to e(ϕ), i.e., B := e(ϕ) . As a second step, we pass B to a SAT solver. Assume that the SAT solver returns the satisfying assignment α := {e(x = y) → true, e(y = z) → true, e(x = z) → true, e(x = z) → false} .

Decision Procedures – Propositional Encodings 10

slide-18
SLIDE 18

Overview by an example Denote by ˆ Th(α) the conjunction of the literals corresponding to this assignment. ˆ Th(α) := x = y ∧ y = z ∧ x = z ∧ ¬(x = z) .

Decision Procedures – Propositional Encodings 11

slide-19
SLIDE 19

Overview by an example Denote by ˆ Th(α) the conjunction of the literals corresponding to this assignment. ˆ Th(α) := x = y ∧ y = z ∧ x = z ∧ ¬(x = z) . The decision procedure DPT now has to decide whether ˆ Th(α) is satisfiable.

Decision Procedures – Propositional Encodings 11

slide-20
SLIDE 20

Overview by an example Denote by ˆ Th(α) the conjunction of the literals corresponding to this assignment. ˆ Th(α) := x = y ∧ y = z ∧ x = z ∧ ¬(x = z) . The decision procedure DPT now has to decide whether ˆ Th(α) is satisfiable. ˆ Th(α) is not satisfiable, which means that the negation of this formula is a tautology.

Decision Procedures – Propositional Encodings 11

slide-21
SLIDE 21

Overview by an example Thus B is conjoined with e(¬ ˆ Th(α)), the Boolean encoding of this tautology: e(¬ ˆ Th(α)) := (¬e(x = y) ∨ ¬e(y = z) ∨ ¬e(x = z) ∨ e(x = z)) .

Decision Procedures – Propositional Encodings 12

slide-22
SLIDE 22

Overview by an example Thus B is conjoined with e(¬ ˆ Th(α)), the Boolean encoding of this tautology: e(¬ ˆ Th(α)) := (¬e(x = y) ∨ ¬e(y = z) ∨ ¬e(x = z) ∨ e(x = z)) . This clause contradicts the current assignment, and hence blocks it from being repeated. Such clauses are called blocking clauses.

Decision Procedures – Propositional Encodings 12

slide-23
SLIDE 23

Overview by an example Thus B is conjoined with e(¬ ˆ Th(α)), the Boolean encoding of this tautology: e(¬ ˆ Th(α)) := (¬e(x = y) ∨ ¬e(y = z) ∨ ¬e(x = z) ∨ e(x = z)) . This clause contradicts the current assignment, and hence blocks it from being repeated. Such clauses are called blocking clauses. We denote by t the formula – also called the lemma – returned by DPT (in this example t := ¬ ˆ Th(α)).

Decision Procedures – Propositional Encodings 12

slide-24
SLIDE 24

Overview by an example After the blocking clause has been added, the SAT solver is invoked again and suggests another assignment, for example α′ := {e(x = y) → true, e(y = z) → true, e(x = z) → true, e(x = z) → false} .

Decision Procedures – Propositional Encodings 13

slide-25
SLIDE 25

Overview by an example After the blocking clause has been added, the SAT solver is invoked again and suggests another assignment, for example α′ := {e(x = y) → true, e(y = z) → true, e(x = z) → true, e(x = z) → false} . The corresponding Σ-formula ˆ Th(α′) := x = y ∧ y = z ∧ x = z ∧ ¬(x = z) (3) is satisfiable, which proves that ϕ, the original formula, is satisfiable. Indeed, any assignment that satisfies ˆ Th(α′) also satisfies ϕ.

Decision Procedures – Propositional Encodings 13

slide-26
SLIDE 26

Overview

t ˆ Th(α) for a conjunction of Σ-terms DPT - A Decision procedure Propositional SAT Solver α e(t)

The information flow between the two components of the decision procedure.

Decision Procedures – Propositional Encodings 14

slide-27
SLIDE 27

Overview There are many improvements to this basic procedure.

Decision Procedures – Propositional Encodings 15

slide-28
SLIDE 28

Overview There are many improvements to this basic procedure. One such improvement is: “Invoke the decision procedure DPT after partial assignments, rather than waiting for a full assignment.”

Decision Procedures – Propositional Encodings 15

slide-29
SLIDE 29

Overview There are many improvements to this basic procedure. One such improvement is: “Invoke the decision procedure DPT after partial assignments, rather than waiting for a full assignment.” A contradicting partial assignment leads to a more powerful lemma t, as it blocks all assignments that extend it.

Decision Procedures – Propositional Encodings 15

slide-30
SLIDE 30

Overview There are many improvements to this basic procedure. One such improvement is: “Invoke the decision procedure DPT after partial assignments, rather than waiting for a full assignment.” A contradicting partial assignment leads to a more powerful lemma t, as it blocks all assignments that extend it. Theory propagation: When the partial assignment is not contradictory, it can be used to derive implications that are propagated back to the SAT solver.

Decision Procedures – Propositional Encodings 15

slide-31
SLIDE 31

Overview by an example Continuing the example above, consider the partial assignment α := {e(x = y) → true, e(y = z) → true} , (4)

Decision Procedures – Propositional Encodings 16

slide-32
SLIDE 32

Overview by an example Continuing the example above, consider the partial assignment α := {e(x = y) → true, e(y = z) → true} , (4) and the corresponding formula that is transferred to DPT , ˆ Th(α) := x = y ∧ y = z . (5)

Decision Procedures – Propositional Encodings 16

slide-33
SLIDE 33

Overview by an example Continuing the example above, consider the partial assignment α := {e(x = y) → true, e(y = z) → true} , (4) and the corresponding formula that is transferred to DPT , ˆ Th(α) := x = y ∧ y = z . (5) DPT concludes that x = z is implied, and hence inform the SAT solver that e(x = z) → true and e(x = z) → false are implied by the current partial assignment α.

Decision Procedures – Propositional Encodings 16

slide-34
SLIDE 34

Plan We will now formalize three versions of the algorithm:

1 Simple 2 Incremental 3 DPLL(T) Decision Procedures – Propositional Encodings 17

slide-35
SLIDE 35

Notation lit(ϕ) – the set of literals in a given NNF formula ϕ. liti(ϕ) – the i-th distinct literal in ϕ (assuming some predefined order on the literals).

Decision Procedures – Propositional Encodings 18

slide-36
SLIDE 36

Notation lit(ϕ) – the set of literals in a given NNF formula ϕ. liti(ϕ) – the i-th distinct literal in ϕ (assuming some predefined order on the literals). α – For a given encoding e(ϕ), denotes an assignment (either full or partial), to the encoders in e(ϕ).

Decision Procedures – Propositional Encodings 18

slide-37
SLIDE 37

Notation Th(liti, α) – For an encoder e(liti) that is assigned a truth value by α, denotes the corresponding literal: Th(liti, α) . = liti α(liti) = true ¬liti α(liti) = false . (6)

Decision Procedures – Propositional Encodings 19

slide-38
SLIDE 38

Notation Th(liti, α) – For an encoder e(liti) that is assigned a truth value by α, denotes the corresponding literal: Th(liti, α) . = liti α(liti) = true ¬liti α(liti) = false . (6) Th(α) . = {Th(liti, α) | e(liti) is assigned by α}

Decision Procedures – Propositional Encodings 19

slide-39
SLIDE 39

Notation Th(liti, α) – For an encoder e(liti) that is assigned a truth value by α, denotes the corresponding literal: Th(liti, α) . = liti α(liti) = true ¬liti α(liti) = false . (6) Th(α) . = {Th(liti, α) | e(liti) is assigned by α} ˆ Th(α) – a conjunction over the elements in Th(α).

Decision Procedures – Propositional Encodings 19

slide-40
SLIDE 40

Example Use of the Notation Let lit1 = (x = y), lit2 = (y = z), lit3 = (z = w) , (7)

Decision Procedures – Propositional Encodings 20

slide-41
SLIDE 41

Example Use of the Notation Let lit1 = (x = y), lit2 = (y = z), lit3 = (z = w) , (7) and let α be a partial assignment such that α := {e(lit1) → false, e(lit2) → true} .

Decision Procedures – Propositional Encodings 20

slide-42
SLIDE 42

Example Use of the Notation Let lit1 = (x = y), lit2 = (y = z), lit3 = (z = w) , (7) and let α be a partial assignment such that α := {e(lit1) → false, e(lit2) → true} . Then Th(lit1, α) := ¬(x = y), Th(lit2, α) := (y = z) ,

Decision Procedures – Propositional Encodings 20

slide-43
SLIDE 43

Example Use of the Notation Let lit1 = (x = y), lit2 = (y = z), lit3 = (z = w) , (7) and let α be a partial assignment such that α := {e(lit1) → false, e(lit2) → true} . Then Th(lit1, α) := ¬(x = y), Th(lit2, α) := (y = z) , and Th(α) := {¬(x = y), (y = z)} .

Decision Procedures – Propositional Encodings 20

slide-44
SLIDE 44

Example Use of the Notation Let lit1 = (x = y), lit2 = (y = z), lit3 = (z = w) , (7) and let α be a partial assignment such that α := {e(lit1) → false, e(lit2) → true} . Then Th(lit1, α) := ¬(x = y), Th(lit2, α) := (y = z) , and Th(α) := {¬(x = y), (y = z)} . Conjoining these terms gives us ˆ Th(α) := ¬(x = y) ∧ (y = z) .

Decision Procedures – Propositional Encodings 20

slide-45
SLIDE 45

Notation T – a Σ-theory.

Decision Procedures – Propositional Encodings 21

slide-46
SLIDE 46

Notation T – a Σ-theory. DPT a decision procedure for the conjunctive fragment of T.

Decision Procedures – Propositional Encodings 21

slide-47
SLIDE 47

Notation T – a Σ-theory. DPT a decision procedure for the conjunctive fragment of T. Let Deduction be a procedure based on DPT , which receives a conjunction of Σ-literals as input, and

decides whether it is satisfiable, and, if the answer is negative, returns constraints over these literals.

Decision Procedures – Propositional Encodings 21

slide-48
SLIDE 48
  • 1. A Basic Algorithm

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);

Decision Procedures – Propositional Encodings 22

slide-49
SLIDE 49
  • 1. Deduction

Consider the following three requirements from the clause t that is returned by Deduction:

1 The formula t is T-valid, i.e., t is a tautology in T. For

example, if T is the theory of equality, then x = y ∧ y = z − → x = z is T-valid.

Decision Procedures – Propositional Encodings 23

slide-50
SLIDE 50
  • 1. Deduction

Consider the following three requirements from the clause t that is returned by Deduction:

1 The formula t is T-valid, i.e., t is a tautology in T. For

example, if T is the theory of equality, then x = y ∧ y = z − → x = z is T-valid.

2 The atoms in t are restricted to those appearing in ϕ. Decision Procedures – Propositional Encodings 23

slide-51
SLIDE 51
  • 1. Deduction

Consider the following three requirements from the clause t that is returned by Deduction:

1 The formula t is T-valid, i.e., t is a tautology in T. For

example, if T is the theory of equality, then x = y ∧ y = z − → x = z is T-valid.

2 The atoms in t are restricted to those appearing in ϕ. 3 The encoding of t contradicts α, i.e., e(t) is a blocking clause. Decision Procedures – Propositional Encodings 23

slide-52
SLIDE 52
  • 1. Deduction

Consider the following three requirements from the clause t that is returned by Deduction:

1 The formula t is T-valid, i.e., t is a tautology in T. For

example, if T is the theory of equality, then x = y ∧ y = z − → x = z is T-valid.

2 The atoms in t are restricted to those appearing in ϕ. 3 The encoding of t contradicts α, i.e., e(t) is a blocking clause.

The first requirement is sufficient for guaranteeing soundness.

Decision Procedures – Propositional Encodings 23

slide-53
SLIDE 53
  • 1. Deduction

Consider the following three requirements from the clause t that is returned by Deduction:

1 The formula t is T-valid, i.e., t is a tautology in T. For

example, if T is the theory of equality, then x = y ∧ y = z − → x = z is T-valid.

2 The atoms in t are restricted to those appearing in ϕ. 3 The encoding of t contradicts α, i.e., e(t) is a blocking clause.

The first requirement is sufficient for guaranteeing soundness. The second and third requirements are sufficient for guaranteeing termination.

Decision Procedures – Propositional Encodings 23

slide-54
SLIDE 54
  • 1. Deduction

Two of the requirements can be weakened:

Decision Procedures – Propositional Encodings 24

slide-55
SLIDE 55
  • 1. Deduction

Two of the requirements can be weakened: Requirement 1: the clause t can be any formula that is implied by ϕ, and not just a T-valid formula.

Decision Procedures – Propositional Encodings 24

slide-56
SLIDE 56
  • 1. Deduction

Two of the requirements can be weakened: Requirement 1: the clause t can be any formula that is implied by ϕ, and not just a T-valid formula. Requirement 2: the clause t may refer to atoms that do not appear in ϕ, as long as the number of such new atoms is finite.

Decision Procedures – Propositional Encodings 24

slide-57
SLIDE 57
  • 1. Deduction

Two of the requirements can be weakened: Requirement 1: the clause t can be any formula that is implied by ϕ, and not just a T-valid formula. Requirement 2: the clause t may refer to atoms that do not appear in ϕ, as long as the number of such new atoms is finite.

For example, in equality logic, we may allow t to refer to all atoms of the form xi = xj where xi, xj are variables in var(ϕ), even if only some of these equality predicates appear in ϕ.

Decision Procedures – Propositional Encodings 24

slide-58
SLIDE 58
  • 2. We can do better...

Let Bi be the formula B in the i-th iteration of the loop.

Decision Procedures – Propositional Encodings 25

slide-59
SLIDE 59
  • 2. We can do better...

Let Bi be the formula B in the i-th iteration of the loop. The constraint Bi+1 is strictly stronger than Bi for all i ≥ 1, because clauses are added but not removed between iterations.

Decision Procedures – Propositional Encodings 25

slide-60
SLIDE 60
  • 2. We can do better...

Let Bi be the formula B in the i-th iteration of the loop. The constraint Bi+1 is strictly stronger than Bi for all i ≥ 1, because clauses are added but not removed between iterations. As a result, any conflict clause that is learned while solving Bi can be reused when solving Bj for i < j.

Decision Procedures – Propositional Encodings 25

slide-61
SLIDE 61
  • 2. We can do better...

Let Bi be the formula B in the i-th iteration of the loop. The constraint Bi+1 is strictly stronger than Bi for all i ≥ 1, because clauses are added but not removed between iterations. As a result, any conflict clause that is learned while solving Bi can be reused when solving Bj for i < j. This is a special case of incremental satisfiability.

Decision Procedures – Propositional Encodings 25

slide-62
SLIDE 62
  • 2. We can do better...

Hence, invoking an incremental SAT solver in line 4 can increase the efficiency of the algorithm.

Decision Procedures – Propositional Encodings 26

slide-63
SLIDE 63
  • 2. We can do better...

Hence, invoking an incremental SAT solver in line 4 can increase the efficiency of the algorithm. A better option is to integrate Deduction into the DPLL-SAT algorithm, as shown in the following algorithm.

Decision Procedures – Propositional Encodings 26

slide-64
SLIDE 64
  • 2. We can do better...

Hence, invoking an incremental SAT solver in line 4 can increase the efficiency of the algorithm. A better option is to integrate Deduction into the DPLL-SAT algorithm, as shown in the following algorithm. This algorithm uses a procedure AddClauses, which adds new clauses to the current set of clauses at run time.

Decision Procedures – Propositional Encodings 26

slide-65
SLIDE 65
  • 2. We can do better...

Hence, invoking an incremental SAT solver in line 4 can increase the efficiency of the algorithm. A better option is to integrate Deduction into the DPLL-SAT algorithm, as shown in the following algorithm. This algorithm uses a procedure AddClauses, which adds new clauses to the current set of clauses at run time. Before seeing this algorithm let us first recall DPLL...

Decision Procedures – Propositional Encodings 26

slide-66
SLIDE 66
  • 2. A Reminder: DPLL

✡ ☛ ✠ ✟ ✛ ✡ ☛ ✠ ✟ ✡ ☛ ✠ ✟ ✡ ☛ ✠ ✟ ✲ ✲ ❄ ✲ ✲ ❄ ❄

Decide assignment full conflict SAT UNSAT dl ≥ 0 BackTrack Analyze- Conflict BCP conflict no partial assignment

Decision Procedures – Propositional Encodings 27

slide-67
SLIDE 67
  • 2. Pseudo-code for DPLL

1: function DPLL 2:

if BCP() = “conflict” then return “Unsatisfiable”;

3:

while (true) do

4:

if ¬Decide() then return “Satisfiable”;

5:

else

6:

while (BCP() = “conflict”) do

7:

backtrack-level := Analyze-Conflict();

8:

if backtrack-level < 0 then return “Unsatisfiable”;

9:

else BackTrack(backtrack-level);

Decision Procedures – Propositional Encodings 28

slide-68
SLIDE 68
  • 2. Integration into DPLL

1: function Lazy-DPLL 2:

AddClauses(cnf (e(ϕ)));

3:

if BCP() = “conflict” then return “Unsatisfiable”;

4:

while (true) do

5:

if ¬Decide() then ⊲ Full assignment

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);

Decision Procedures – Propositional Encodings 29

slide-69
SLIDE 69
  • 3. DPLL(T)

Consider a formula ϕ that contains an integer variable x1 and, among others, the literals x1 ≥ 10 and x1 < 0.

Decision Procedures – Propositional Encodings 30

slide-70
SLIDE 70
  • 3. DPLL(T)

Consider a formula ϕ that contains an integer variable x1 and, among others, the literals x1 ≥ 10 and x1 < 0. Assume that the Decide procedure assigns e(x1 ≥ 10) → true and e(x1 < 0) → true.

Decision Procedures – Propositional Encodings 30

slide-71
SLIDE 71
  • 3. DPLL(T)

Consider a formula ϕ that contains an integer variable x1 and, among others, the literals x1 ≥ 10 and x1 < 0. Assume that the Decide procedure assigns e(x1 ≥ 10) → true and e(x1 < 0) → true. Inevitably, any call to Deduction results in a contradiction between these two facts, independently of any other decisions that are made.

Decision Procedures – Propositional Encodings 30

slide-72
SLIDE 72
  • 3. DPLL(T)

However, the algorithms we saw so far do not call Deduction until a full satisfying assignment is found.

Thus, the time taken to complete the assignment is wasted.

Decision Procedures – Propositional Encodings 31

slide-73
SLIDE 73
  • 3. DPLL(T)

However, the algorithms we saw so far do not call Deduction until a full satisfying assignment is found.

Thus, the time taken to complete the assignment is wasted.

Further, the refutation of this full assignment may be due to

  • ther reasons (i.e., a proof that a different subset of the

assignment is contradictory).

Hence, additional assignments that include the same wrong assignment to e(x1 ≥ 10) and e(x1 < 0) are not ruled out.

Decision Procedures – Propositional Encodings 31

slide-74
SLIDE 74
  • 3. DPLL(T)

Early call to Deduction can serve two purposes:

Decision Procedures – Propositional Encodings 32

slide-75
SLIDE 75
  • 3. DPLL(T)

Early call to Deduction can serve two purposes:

1 Contradictory partial assignments are ruled out early. Decision Procedures – Propositional Encodings 32

slide-76
SLIDE 76
  • 3. DPLL(T)

Early call to Deduction can serve two purposes:

1 Contradictory partial assignments are ruled out early. 2 Allows theory propagation.

Continuing our example, once e(x1 ≥ 10) has been assigned true, we can infer that e(x1 < 0) must be false and avoid the conflict altogether.

This brings us to the next version of the algorithm, called DPLL(T).

Decision Procedures – Propositional Encodings 32

slide-77
SLIDE 77
  • 3. Reminder: DPLL

✡ ☛ ✠ ✟ ✛ ✡ ☛ ✠ ✟ ✡ ☛ ✠ ✟ ✡ ☛ ✠ ✟ ✲ ✲ ❄ ✲ ✲ ❄ ❄

Decide assignment full conflict SAT UNSAT dl ≥ 0 BackTrack Analyze- Conflict BCP conflict no partial assignment

Decision Procedures – Propositional Encodings 33

slide-78
SLIDE 78
  • 3. ... and now DPLL(T)

✡ ☛ ✠ ✟ ✡ ☛ ✠ ✟ ✡ ☛ ✠ ✟ ✛ ✡ ☛ ✠ ✟ ✡ ☛ ✠ ✟ ✡ ☛ ✠ ✟ ❄ ✲ ❄ ✻ ❄ ✲ ❄ ✲ ✲ ✲

BCP conflict Analyze- Conflict UNSAT Deduction

AddClauses

α t e(t) Decide SAT propagation Theory BackTrack ˆ Th(α) dl ≥ 0 dl < 0 assignment partial assignment full / conflict

Decision Procedures – Propositional Encodings 34

slide-79
SLIDE 79

1: function DPLL(T) 2:

AddClauses(cnf (e(ϕ)));

3:

if BCP() = “conflict” then return “Unsatisfiable”;

4:

while (true) do

5:

if ¬Decide() then return “Satisfiable”; ⊲ Full assignment

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 t ≡ true

Decision Procedures – Propositional Encodings 35

slide-80
SLIDE 80
  • 3. Restrictions on t

If ˆ Th(α) is satisfiable, we require t to fulfill one of the following two conditions in order to guarantee termination:

Decision Procedures – Propositional Encodings 36

slide-81
SLIDE 81
  • 3. Restrictions on t

If ˆ Th(α) is satisfiable, we require t to fulfill one of the following two conditions in order to guarantee termination:

1 The clause e(t) is an asserting clause under α. This implies

that the addition of e(t) to B and a call to BCP leads to an assignment to the encoder of some literal.

Decision Procedures – Propositional Encodings 36

slide-82
SLIDE 82
  • 3. Restrictions on t

If ˆ Th(α) is satisfiable, we require t to fulfill one of the following two conditions in order to guarantee termination:

1 The clause e(t) is an asserting clause under α. This implies

that the addition of e(t) to B and a call to BCP leads to an assignment to the encoder of some literal.

2 When Deduction cannot find an asserting clause t as

defined above, t and e(t) are equivalent to true. The second case occurs, for example, when all the Boolean variables are already assigned, and thus the formula is found to be satisfiable.

Decision Procedures – Propositional Encodings 36

slide-83
SLIDE 83
  • 3. Theory Propagation

Various ways to perform theory propagation: After every decision / after every assignment

Decision Procedures – Propositional Encodings 37

slide-84
SLIDE 84
  • 3. Theory Propagation

Various ways to perform theory propagation: After every decision / after every assignment Partial / Exhaustive theory propagation – propagate all that is implied by the current partial assignment.

Decision Procedures – Propositional Encodings 37

slide-85
SLIDE 85
  • 3. Theory Propagation

Various ways to perform theory propagation: After every decision / after every assignment Partial / Exhaustive theory propagation – propagate all that is implied by the current partial assignment. Refer only to existing predicates / add auxiliary ones. Exhaustive theory propagation after each assignment: what does this mean ?

Decision Procedures – Propositional Encodings 37

slide-86
SLIDE 86
  • 3. Theory Propagation

Various ways to perform theory propagation: After every decision / after every assignment Partial / Exhaustive theory propagation – propagate all that is implied by the current partial assignment. Refer only to existing predicates / add auxiliary ones. Exhaustive theory propagation after each assignment: what does this mean ? That’s right, no possible conflicts on the theory side.

Decision Procedures – Propositional Encodings 37

slide-87
SLIDE 87
  • 3. Theory Propagation

How to check whether a predicate p is implied by ˆ Th(α) ? Plunging – is ˆ Th(α) ∧ ¬p satisfiable ?

Decision Procedures – Propositional Encodings 38

slide-88
SLIDE 88
  • 3. Theory Propagation

How to check whether a predicate p is implied by ˆ Th(α) ? Plunging – is ˆ Th(α) ∧ ¬p satisfiable ? Theory-specific propagation. For example, in equality logic build the equality graph corresponding to Th(α). Infer equalities/disequalities from the graph.

Decision Procedures – Propositional Encodings 38

slide-89
SLIDE 89
  • 3. Theory Propagation

How to check whether a predicate p is implied by ˆ Th(α) ? Plunging – is ˆ Th(α) ∧ ¬p satisfiable ? Theory-specific propagation. For example, in equality logic build the equality graph corresponding to Th(α). Infer equalities/disequalities from the graph. Note that theory propagation matters for efficiency, not correctness.

Decision Procedures – Propositional Encodings 38

slide-90
SLIDE 90
  • 3. Theory Propagation

How to check whether a predicate p is implied by ˆ Th(α) ? Plunging – is ˆ Th(α) ∧ ¬p satisfiable ? Theory-specific propagation. For example, in equality logic build the equality graph corresponding to Th(α). Infer equalities/disequalities from the graph. Note that theory propagation matters for efficiency, not correctness. How much propagation is cost-effective is a subject for research, and depends on T.

Decision Procedures – Propositional Encodings 38

slide-91
SLIDE 91
  • 3. Theory Propagation – How?

Normally theory propagation is done by transferring clauses to the the DPLL solver. It turns out to be inefficient – few (less than 0.5%) are actually used. Instead – add implied literals directly to the implication stack.

This causes a problem in Analyze-conflict() – can you see what problem ?

Decision Procedures – Propositional Encodings 39

slide-92
SLIDE 92
  • 3. Theory Propagation – How?

The problem: Analyze-conflict() requires an antecedent clause for each implication, in order to compute the conflict clause and backtrack level.

Decision Procedures – Propositional Encodings 40

slide-93
SLIDE 93
  • 3. Theory Propagation – How?

The problem: Analyze-conflict() requires an antecedent clause for each implication, in order to compute the conflict clause and backtrack level. Theory propagation without clauses breaks this mechanism – there are implications without antecedents.

Decision Procedures – Propositional Encodings 40

slide-94
SLIDE 94
  • 3. Theory Propagation – How?

The problem: Analyze-conflict() requires an antecedent clause for each implication, in order to compute the conflict clause and backtrack level. Theory propagation without clauses breaks this mechanism – there are implications without antecedents. Solution – DPT should be able to explain an implication post-mortem, in the form of a clause.

Decision Procedures – Propositional Encodings 40

slide-95
SLIDE 95
  • 3. Strong Lemmas

When ˆ Th(α) is unsatisfiable, the lemma (clause returned by Deduction) rules out α.

Decision Procedures – Propositional Encodings 41

slide-96
SLIDE 96
  • 3. Strong Lemmas

When ˆ Th(α) is unsatisfiable, the lemma (clause returned by Deduction) rules out α. Ideally, it should be generalized as much as possible.

Decision Procedures – Propositional Encodings 41

slide-97
SLIDE 97
  • 3. Strong Lemmas

When ˆ Th(α) is unsatisfiable, the lemma (clause returned by Deduction) rules out α. Ideally, it should be generalized as much as possible. Solution: analyze the reason for unsatisfiability. Build lemma accordingly.

Decision Procedures – Propositional Encodings 41

slide-98
SLIDE 98
  • 3. Strong Lemmas – An Example

✡ ☛ ✠ ✟

x2 = x3

✡ ☛ ✠ ✟

x1 = x3

✡ ☛ ✠ ✟

x2 = x4

PPPP P q ◗◗◗◗◗ ◗ s ✲ ✟✟✟✟ ✟ ✯ ✑✑✑✑✑ ✑ ✸ ✡ ☛ ✠ ✟ ✡ ☛ ✠ ✟ ✡ ☛ ✠ ✟ ✟✟✟✟✟ ✟ ✯ ◗◗◗◗◗ ◗ s ✡ ☛ ✠ ✟

F(x1) = F(x3) F(x1) = F(x3) false x3 = x4 x1 = x2

Decision Procedures – Propositional Encodings 42