Extending DPLL-Based QBF Solvers to Handle Free Variables Will - - PowerPoint PPT Presentation

extending dpll based qbf solvers to handle free variables
SMART_READER_LITE
LIVE PREVIEW

Extending DPLL-Based QBF Solvers to Handle Free Variables Will - - PowerPoint PPT Presentation

Extending DPLL-Based QBF Solvers to Handle Free Variables Will Klieber , Mikol a s Janota, Joao Marques-Silva, Edmund Clarke July 9, 2013 1 Open QBF Closed QBF: All variables quantified; answer is True or False. Open QBF: Contains


slide-1
SLIDE 1

Extending DPLL-Based QBF Solvers to Handle Free Variables

Will Klieber, Mikol´ aˇ s Janota, Joao Marques-Silva, Edmund Clarke

July 9, 2013

1

slide-2
SLIDE 2

Open QBF

◮ Closed QBF: All variables quantified; answer is True or False. ◮ Open QBF: Contains free (unquantified) variables. ◮ Goal: Find equivalent propositional formula. ◮ E.g., given ∃x. x ∧ (y ∨ z), return y ∨ z.

2

slide-3
SLIDE 3

Open QBF

◮ Closed QBF: All variables quantified; answer is True or False. ◮ Open QBF: Contains free (unquantified) variables. ◮ Goal: Find equivalent propositional formula. ◮ E.g., given ∃x. x ∧ (y ∨ z), return y ∨ z. ◮ Applications: symbolic MC, synthesis from formal spec, etc.

2

slide-4
SLIDE 4

Outline

◮ Na¨

ıve Algorithm

◮ Introduce sequents that generalize clauses for open QBF in CNF

(without ghost variables)

◮ Experimental results ◮ Ghost variables: see paper.

3

slide-5
SLIDE 5

Na¨ ıve Algorithm

◮ Notation: “ite(x, φ1, φ2)” is a formula with an if-then-else:

ite(x, φ1, φ2) = (x ∧ φ1) ∨ (¬x ∧ φ2)

4

slide-6
SLIDE 6

Na¨ ıve Algorithm

◮ Notation: “ite(x, φ1, φ2)” is a formula with an if-then-else:

ite(x, φ1, φ2) = (x ∧ φ1) ∨ (¬x ∧ φ2)

◮ Recursively Shannon-expand on free variables:

Φ = ite(x, Φ|x=True, Φ|x=False)

4

slide-7
SLIDE 7

Na¨ ıve Algorithm

◮ Notation: “ite(x, φ1, φ2)” is a formula with an if-then-else:

ite(x, φ1, φ2) = (x ∧ φ1) ∨ (¬x ∧ φ2)

◮ Recursively Shannon-expand on free variables:

Φ = ite(x, Φ|x=True, Φ|x=False)

◮ Base case (no more free variables): Give to closed-QBF solver.

4

slide-8
SLIDE 8

Na¨ ıve Algorithm

1. function solve(Φ) { 2. if (Φ has no free variables) 3. return closed qbf solve(Φ); 7. }

5

slide-9
SLIDE 9

Na¨ ıve Algorithm

1. function solve(Φ) { 2. if (Φ has no free variables) 3. return closed qbf solve(Φ); 4. x := (a free variable in Φ); 5. return ite(x, solve( Φ|x=True ), 6. solve( Φ|x=False )); 7. }

5

slide-10
SLIDE 10

Na¨ ıve Algorithm

1. function solve(Φ) { 2. if (Φ has no free variables) 3. return closed qbf solve(Φ); 4. x := (a free variable in Φ); 5. return ite(x, solve( Φ|x=True ), 6. solve( Φ|x=False )); 7. } Builds OBDD if:

  • 1. same branch order,
  • 2. formula construction is memoized, and
  • 3. ite(x, φ, φ) is simplified to φ.

5

slide-11
SLIDE 11

Na¨ ıve Algorithm

◮ Na¨

ıve Algorithm:

◮ Similar to DPLL in terms of branching. ◮ But lacks many optimizations that make DPLL fast: ◮ Non-chronological backtracking ◮ Clause learning

◮ Our open-QBF technique:

◮ Extend existing closed-QBF algorithm to allow free variables.

6

slide-12
SLIDE 12

Preliminaries

◮ Prenex Form: Q1

x1...Qn

  • xn. φ where φ has no quantifiers.

7

slide-13
SLIDE 13

Preliminaries

◮ Prenex Form: Q1

x1...Qn

  • xn. φ where φ has no quantifiers.

◮ In ∀x.∃y. φ, we say that y is downstream of x.

◮ ∃y occurs inside scope of ∀x.

7

slide-14
SLIDE 14

Preliminaries

◮ Prenex Form: Q1

x1...Qn

  • xn. φ where φ has no quantifiers.

◮ In ∀x.∃y. φ, we say that y is downstream of x.

◮ ∃y occurs inside scope of ∀x.

◮ Free variables are upstream of all quantified variables.

7

slide-15
SLIDE 15

Preliminaries

◮ Prenex Form: Q1

x1...Qn

  • xn. φ where φ has no quantifiers.

◮ In ∀x.∃y. φ, we say that y is downstream of x.

◮ ∃y occurs inside scope of ∀x.

◮ Free variables are upstream of all quantified variables. ◮ We identify assignment π with the set of literals made true by π. ◮ E.g., identify {(e1, True), (u2, False)} with {e1, ¬u2}.

7

slide-16
SLIDE 16

Preliminaries

◮ Prenex Form: Q1

x1...Qn

  • xn. φ where φ has no quantifiers.

◮ In ∀x.∃y. φ, we say that y is downstream of x.

◮ ∃y occurs inside scope of ∀x.

◮ Free variables are upstream of all quantified variables. ◮ We identify assignment π with the set of literals made true by π. ◮ E.g., identify {(e1, True), (u2, False)} with {e1, ¬u2}. ◮ Substitution: Φ|π substitutes assigned variables with values

(even if bound by quantifier, which gets deleted).

7

slide-17
SLIDE 17

QBF as a Game

◮ Existential variables are owned by Player ∃. ◮ Universal variables are owned by Player ∀. ◮ Players assign variables in quantification order. ◮ The goal of Player ∃ is to make Φ be true. ◮ The goal of Player ∀ is to make Φ be false.

8

slide-18
SLIDE 18

Properties of Clauses and Cubes

◮ Motivate definition of sequents. ◮ If π falsifies all literals in clause C in CNF Φ, then Φ|π = False.

9

slide-19
SLIDE 19

Properties of Clauses and Cubes

◮ Motivate definition of sequents. ◮ If π falsifies all literals in clause C in CNF Φ, then Φ|π = False. ◮ If π falsifies all existential literals in clause C in CNF Φ and

doesn’t satisfy any universal literals in C, then Φ|π = False.

9

slide-20
SLIDE 20

Properties of Clauses and Cubes

◮ Motivate definition of sequents. ◮ If π falsifies all literals in clause C in CNF Φ, then Φ|π = False. ◮ If π falsifies all existential literals in clause C in CNF Φ and

doesn’t satisfy any universal literals in C, then Φ|π = False.

◮ If π satisfies all universal literals in a cube C in a DNF Φ and

doesn’t falsify any existential literals in C, then Φ|π = True.

9

slide-21
SLIDE 21

Properties of Clauses and Cubes

◮ Motivate definition of sequents. ◮ If π falsifies all literals in clause C in CNF Φ, then Φ|π = False. ◮ If π falsifies all existential literals in clause C in CNF Φ and

doesn’t satisfy any universal literals in C, then Φ|π = False.

◮ If π satisfies all universal literals in a cube C in a DNF Φ and

doesn’t falsify any existential literals in C, then Φ|π = True.

◮ Tautological clauses learned via long-distance resolution?

(Assuming ∀-reduction is done only on-the-fly, during unit prop.)

9

slide-22
SLIDE 22

Lnow, Lfut Sequents

◮ Definition. A game-state specifier is a pair Lnow, Lfut

consisting of two sets of literals, Lnow and Lfut.

◮ Definition. We say that Lnow, Lfut matches assignment π iff:

  • 1. for every literal ℓ in Lnow, ℓ|π = True, and
  • 2. for every literal ℓ in Lfut, either ℓ|π = True or ℓ ∈ vars(π).

10

slide-23
SLIDE 23

Lnow, Lfut Sequents

◮ Definition. A game-state specifier is a pair Lnow, Lfut

consisting of two sets of literals, Lnow and Lfut.

◮ Definition. We say that Lnow, Lfut matches assignment π iff:

  • 1. for every literal ℓ in Lnow, ℓ|π = True, and
  • 2. for every literal ℓ in Lfut, either ℓ|π = True or ℓ ∈ vars(π).

◮ E.g., {e}, {u} matches {e} and {e, u},

10

slide-24
SLIDE 24

Lnow, Lfut Sequents

◮ Definition. A game-state specifier is a pair Lnow, Lfut

consisting of two sets of literals, Lnow and Lfut.

◮ Definition. We say that Lnow, Lfut matches assignment π iff:

  • 1. for every literal ℓ in Lnow, ℓ|π = True, and
  • 2. for every literal ℓ in Lfut, either ℓ|π = True or ℓ ∈ vars(π).

◮ E.g., {e}, {u} matches {e} and {e, u},

but does not match {} or {e, ¬u}.

10

slide-25
SLIDE 25

Lnow, Lfut Sequents

◮ Definition. A game-state specifier is a pair Lnow, Lfut

consisting of two sets of literals, Lnow and Lfut.

◮ Definition. We say that Lnow, Lfut matches assignment π iff:

  • 1. for every literal ℓ in Lnow, ℓ|π = True, and
  • 2. for every literal ℓ in Lfut, either ℓ|π = True or ℓ ∈ vars(π).

◮ E.g., {e}, {u} matches {e} and {e, u},

but does not match {} or {e, ¬u}.

◮ Lnow, {ℓ, ¬ℓ} matches π only if π doesn’t assign ℓ.

10

slide-26
SLIDE 26

Lnow, Lfut Sequents

◮ Definition. A game-state specifier is a pair Lnow, Lfut

consisting of two sets of literals, Lnow and Lfut.

◮ Definition. We say that Lnow, Lfut matches assignment π iff:

  • 1. for every literal ℓ in Lnow, ℓ|π = True, and
  • 2. for every literal ℓ in Lfut, either ℓ|π = True or ℓ ∈ vars(π).

◮ Definition. “Lnow, Lfut |

= (Φ ⇔ ψ)” means “for all assignments π that match Lnow, Lfut, Φ|π is logically equivalent to ψ|π unless π is a don’t-care assignment”.

11

slide-27
SLIDE 27

Lnow, Lfut Sequents

◮ Definition. A game-state specifier is a pair Lnow, Lfut

consisting of two sets of literals, Lnow and Lfut.

◮ Definition. We say that Lnow, Lfut matches assignment π iff:

  • 1. for every literal ℓ in Lnow, ℓ|π = True, and
  • 2. for every literal ℓ in Lfut, either ℓ|π = True or ℓ ∈ vars(π).

◮ Definition. “Lnow, Lfut |

= (Φ ⇔ ψ)” means “for all assignments π that match Lnow, Lfut, Φ|π is logically equivalent to ψ|π unless π is a don’t-care assignment”.

◮ Without ghost literals: No assignments are don’t-care. ◮ With ghost literals: Some assignments are don’t-care.

11

slide-28
SLIDE 28

Correspondence of Sequents to Clauses and Cubes

◮ Consider a QBF with existential literals e1 ... en and

universal literals u1 ... um.

◮ Clause (e1 ∨ ... ∨ en ∨ u1 ∨ ... ∨ um) in CNF Φin corresponds to

sequent {¬e1, ..., ¬en}, {¬u1, ..., ¬um} | = (Φin ⇔ False).

12

slide-29
SLIDE 29

Correspondence of Sequents to Clauses and Cubes

◮ Consider a QBF with existential literals e1 ... en and

universal literals u1 ... um.

◮ Clause (e1 ∨ ... ∨ en ∨ u1 ∨ ... ∨ um) in CNF Φin corresponds to

sequent {¬e1, ..., ¬en}, {¬u1, ..., ¬um} | = (Φin ⇔ False).

◮ Cube (e1 ∧ ... ∧ en ∧ u1 ∧ ... ∧ um) in DNF Φin corresponds to

sequent {u1, ..., um}, {e1, ..., en} | = (Φin ⇔ True).

12

slide-30
SLIDE 30

Correspondence of Sequents to Clauses and Cubes

◮ Consider a QBF with existential literals e1 ... en and

universal literals u1 ... um.

◮ Clause (e1 ∨ ... ∨ en ∨ u1 ∨ ... ∨ um) in CNF Φin corresponds to

sequent {¬e1, ..., ¬en}, {¬u1, ..., ¬um} | = (Φin ⇔ False).

◮ Cube (e1 ∧ ... ∧ en ∧ u1 ∧ ... ∧ um) in DNF Φin corresponds to

sequent {u1, ..., um}, {e1, ..., en} | = (Φin ⇔ True).

◮ Sequents generalize clauses/cubes because

Lnow, Lfut | = (Φ ⇔ ψ) can have ψ be a formula in terms of free variables.

12

slide-31
SLIDE 31

Alternate Sequent Notation

◮ “Lnow, Lfut |

= (∃ loses Φ)” means “Lnow, Lfut | = (Φ ⇔ False)”.

◮ “Lnow, Lfut |

= (∀ loses Φ)” means “Lnow, Lfut | = (Φ ⇔ True)”.

13

slide-32
SLIDE 32

Resolution rule for free variable

Literal r is free Lnow

1

∪ {r}, Lfut

1 |

= (Φin ⇔ ψ1) Lnow

2

∪ {¬r}, Lfut

2 |

= (Φin ⇔ ψ2) Lnow

1

∪ Lnow

2

, Lfut

1 ∪ Lfut 2 ∪ {r, ¬r} |

= (Φin ⇔ ite(r, ψ1, ψ2))

14

slide-33
SLIDE 33

Top-level algorithm

1. initialize_sequent_database(); 2. πcur := ∅; Propagate(); 3. while (true) { 12. }

15

slide-34
SLIDE 34

Top-level algorithm

1. initialize_sequent_database(); 2. πcur := ∅; Propagate(); 3. while (true) { 4. while (πcur doesn’t match any database sequent) { 5. DecideLit(); 6. Propagate(); 7. } 12. }

15

slide-35
SLIDE 35

Top-level algorithm

1. initialize_sequent_database(); 2. πcur := ∅; Propagate(); 3. while (true) { 4. while (πcur doesn’t match any database sequent) { 5. DecideLit(); 6. Propagate(); 7. } 8. Learn(); 9. if (learned seq has form ∅, Lfut | = (Φin ⇔ ψ)) return ψ; 10. Backtrack(); 11. Propagate(); 12. }

15

slide-36
SLIDE 36

Propagation

◮ Let seq be a sequent Lnow, Lfut |

= (Φin ⇔ ψ) in database.

◮ If there is a literal ℓ ∈ Lnow such that

  • 1. πcur ∪ {ℓ} matches seq, and
  • 2. ℓ is not downstream of any unassigned literals in Lfut,

then ¬ℓ is forced; it is added to the current assignment πcur.

16

slide-37
SLIDE 37

Propagation

◮ Let seq be a sequent Lnow, Lfut |

= (Φin ⇔ ψ) in database.

◮ If there is a literal ℓ ∈ Lnow such that

  • 1. πcur ∪ {ℓ} matches seq, and
  • 2. ℓ is not downstream of any unassigned literals in Lfut,

then ¬ℓ is forced; it is added to the current assignment πcur.

◮ Propagation ensures that the solver never re-explores areas of the

search space for which it already knows the answer.

16

slide-38
SLIDE 38

Learning

func Learn() { 1. seq := (the database sequent that matches πcur); 2. while (true) { } }

17

slide-39
SLIDE 39

Learning

func Learn() { 1. seq := (the database sequent that matches πcur); 2. while (true) { 3. r := (the most recently assigned literal in seq.Lnow) 4. seq := Resolve(seq, antecedent[r]); } }

17

slide-40
SLIDE 40

Learning

func Learn() { 1. seq := (the database sequent that matches πcur); 2. while (true) { 3. r := (the most recently assigned literal in seq.Lnow) 4. seq := Resolve(seq, antecedent[r]); 5. if (seq.Lnow = ∅ or has good UIP(seq)) 6. return seq; 7. } }

17

slide-41
SLIDE 41

Resolution rule for quantified variable (case 1)

The quantifier type of r in Φ is Q Lnow

1

∪ {r}, Lfut

1 |

= (Q loses Φin) Lnow

2

∪ {¬r}, Lfut

2 |

= (Q loses Φin) Opponent of Q owns all literals in Lfut

1

r is not downstream of any ℓ such that ℓ ∈ Lfut

1

and ¬ℓ ∈ (Lfut

1 ∪ Lfut 2 )

Lnow

1

∪ Lnow

2

, Lfut

1 ∪ Lfut 2 |

= (Q loses Φin)

18

slide-42
SLIDE 42

Resolution rule for quantified variable (case 2)

The quantifier type of r in Φ is Q Lnow

1

∪ {r}, Lfut

1 |

= (Q loses Φin) Lnow

2

∪ {¬r}, Lfut

2 |

= (Φin ⇔ ψ) Opponent of Q owns all literals in Lfut

1

r is not downstream of any ℓ such that ℓ ∈ Lfut

1

and ¬ℓ ∈ (Lfut

1 ∪ Lfut 2 )

Lnow

1

∪ Lnow

2

, Lfut

1 ∪ Lfut 2 ∪ {¬r} |

= (Φin ⇔ ψ)

19

slide-43
SLIDE 43

Experimental Comparison

◮ Our solver: GhostQ. ◮ Compared to computational-learning solver from:

  • B. Becker, R. Ehlers, M. Lewis, and P. Marin,

“ALLQBF solving by computational learning” (ATVA 2012).

◮ Benchmarks (from same paper): synthesis from formal

specifications.

20

slide-44
SLIDE 44

Cactus Plot

100 200 300 400 500 600 700 800 200 400 600 800 1000 1200 1400 1600 1800

CPU time (s) instances learner learner-d learner-c GQ

21

slide-45
SLIDE 45

Formula Size

100 101 102 103 104 105 100 101 102 103

GQ learner-c

22

slide-46
SLIDE 46

Conclusion

◮ DPLL-based solver for open QBF. ◮ Sequents generalize clauses and cubes. ◮ Generates proof certificates. ◮ Our solver produces unordered BDDs.

◮ Unordered because of unit propagation. ◮ In our experience, often larger than OBDDs.

◮ More details: preprint of CP 2013 paper on Will Klieber’s website.

23