Download presentation
Presentation is loading. Please wait.
Published byLeslie Randall Modified over 6 years ago
1
Decision Procedures - An algorithmic point of view
Quantified formulas Decision procedures – An algorithmic point of view Daniel Kroening and Ofer Strichman Decision Procedures - An algorithmic point of view
2
Why do we need quantifiers ?
As always: more modeling power Examples of quantifiers usage: “Everyone in the room has a friend” “There is a person in the room that all of his cars are red” “There is not more than one person in the room that earns more than $1M” Decision Procedures - An algorithmic point of view
3
Decision Procedures - An algorithmic point of view
Quantifiers in Math… For any integer x there is a smaller integer y 8x2Z 9y2Z. y < x X Reverse claim: There exists an integer y such that any integer x is greater than y 9y2Z 8x2Z. y < x £ (Bertrand’s postulate) For any natural number greater than 1 there is a prime number p such that n < p < 2n 8n2 N. 9p2 N. n >1 ! (isprime(p) Æ n < p < 2n) Decision Procedures - An algorithmic point of view
4
Decision Procedures - An algorithmic point of view
Actually… Satisfiability of (x1,,xn) = does there exist an interpretation of x1,,xn that satisfies ? Validity of (x1,,xn) = does it hold that all interpretation of x1,,xn satisfy ? Conclusion: what we did so far (satisfiability, validity) is non-alternating quantification. Decision Procedures - An algorithmic point of view
5
Example: Quantified Propositional Logic
Better known as Quantified Boolean Formulas (QBF) formula: var | : formula | formula Ç formula | ( formula ) | T | F| 8 var. (formula) | 9 var. (formula) 8x. (x Ç 9y. (y ! x)) 8x. (9y. ((x Ç :y) Æ (:x Çy)) Æ 9y. ((:y Ç :x) Æ (x Ç y))) X X Binding scope of y Decision Procedures - An algorithmic point of view
6
QBF: No functions, all variables are Boolean
Examples of Quantified Boolean Formula : u e.(u Ç :e)(:u Ç e) : e4e5 u1u2u3 e1e2e3. f(e1,e2,e3,e4,e5,u1,u2,u3) QBF Problem: is valid? P-Space Complete, theoretically harder than NP-Complete problems such as SAT. Decision Procedures - An algorithmic point of view
7
Prenex Normal-Form (PNF)
Formulas in PNF look like this: ’: Q[n]V[n]. .Q[1]V[1]. Quantifier-free formula where Q[i] 2 {8,9} and V[i] is a variable. Every quantified formula can be transformed to PNF while preserving validity. How ? prefix Decision Procedures - An algorithmic point of view
8
Prenex Normal Form (PNF)
Eliminate ! and $ (transform to Ç Æ :) Push negations inside using: : 8 x. $ 9 x. : : 9 x. $ 8 x. : If there are name conflicts across scopes, solve with renaming. Move quantifiers out by using recursively rules such as: Q1 x. 1(x) Æ Q2 y. 2(y) $ Q1 x. Q2 y. (1(x) Æ 2(y)) Qi2{8,9} Q1 x. 1(x) Ç Q2 y. 2(y) $ Q1 x. Q2 y. (1(x) Ç 2(y)) Qi2{8,9} 1 Æ 9 x. 2(x) $ 9 x. (1 Æ 2(x)) where x does not appear in 1 1 Æ 8 x. 2(x) $ 8 x. (1 Æ 2(x)) where x does not appear in 1 8 x. 1(x) Æ 8 x. 2(x) $ 8 x. (1(x) Æ 2(x)) 9 x. 1(x) Ç 9 x. 2(x) $ 9 x. (1(x) Ç 2(x))
9
Prenex Normal Form (PNF): example
:9x. : (9y. ((y ! x) Æ (: x Ç y)) Æ :8y. ((y Æ x) Ç (: x Æ : y))) 1,2. Eliminate !, push negations inside: 8x. (9y. ((:y Ç x) Æ (: x Ç y)) Æ 9y. ((:y Ç : x) Æ (x Ç y))) 3. Renaming: 8x. (9y1. ((:y1 Ç x) Æ (: x Ç y1)) Æ 9y2. ((:y2 Ç : x) Æ (x Ç y2))) 4. Move quantifiers to front: 8x. 9y1. 9y2. (x Ç :y1) Æ (: x Ç y1) Æ (:y2 Ç : x) Æ (x Ç y2) Decision Procedures - An algorithmic point of view
10
Why eliminating 9x. ÆiLi is enough
A procedure for eliminating an existential quantifier applied to a conjunction of literals is enough, because: Given a formula , write it in DNF. Use the fact that If x appears both positively and negatively in Lij, then the conjunction is false; otherwise, x can be removed. Eliminate universal quantifiers using the fact x. $ :9x. : Decision Procedures - An algorithmic point of view
11
Another way to project Boolean variables
Shannon expansion: 9x. = |x=0 Ç |x=1 8x. = |x=0 Æ |x=1 // can be derived from 8x. = :9x.: The same applies for all finite-range variables. Applying 9x., where in CNF $ resolution But: does not need to be in CNF, and there is no need to transform the formula to DNF. Decision Procedures - An algorithmic point of view
12
Projection for non-CNF formulas: example
9y 8z 9x. (y Ç (x Æ z)) 9y 8z. (y Ç (x Æ z))|x=0 Ç (y Ç (x Æ z))|x=1 9y 8z. ((y) Ç (y Ç z)) 9y :9z. (:y Æ :z) 9y. : ((:y Æ :z)|z=0 Ç (:y Æ :z)|z=1) 9y. : (:y) True Decision Procedures - An algorithmic point of view
13
Solving QBF with projection for CNF: 8
CNF is easier than general formulas: 8u1u2 9e1 8u3(u1Ç:e1)(:u1Çe1)(u2Ç:u3Ç:e1) 8u1u2 9e1 ((u1Ç:e1)(:u1Çe1)(u2Ç:trueÇ:e1)) Æ ((u1Ç:e1)(:u1Çe1)(u2Ç:falseÇ:e1)) 8u1u2 9e1 (u1Ç:e1)(:u1Çe1)(u2Ç:e1) Shortcut for CNF formulas: simply erase universally quantified variables! Decision Procedures - An algorithmic point of view
14
Solving QBF with projection for CNF: 9
Eliminate 9x. by projecting x on variables in higher quantification levels (their scope includes x’s scope). For CNF, projection with 9 can be done with Resolution. Resolution example: a Ç b Ç c’ Ç f g Ç h’ Ç c Ç f a Ç b Ç g Ç h’ a Ç b Ç g Ç h’Ç f Decision Procedures - An algorithmic point of view
15
Resolution Based QBF Algorithm
8u1u29e18u39e3e2(u1Ç:e1)(:u1Ç:e2Çe3)(u2Ç:u3Ç:e1)(e1Çe2)(e1Ç:e3) 8u1u29e18u39e3 (u1Ç:e1)(:u1Çe3Çe1)(u2Ç:u3Ç:e1)(e1Ç:e3) 8u1u29e18u3 (u1Ç:e1)(:u1Çe1)(u2Ç:u3Ç:e1) 8u1u29e1(u1Ç:e1)(:u1Çe1)(u2Ç:e1) 8u1u2(:u1Ç u2) FALSE Decision Procedures - An algorithmic point of view
16
Quantified Linear Arithmetic
formula = predicate | formula Ç formula | :formula | (formula) | 8 var. formula | 9 var. formula predicate = i ai xi · c 8x.9y.9z. (y+1 · x Æ z+1 · y Æ 2x+1 · z) Decision Procedures - An algorithmic point of view
17
Solving QLA with projection
Eliminate 9x. by projecting x. In Linear Arithmetic over R projection can be done with Fourier-Motzkin elimination. Fourier-Motzkin method to eliminate a variable xn: - for each pair of constraints: i=1..n-1ai’xi < xn < i=1..n-1aixi add a constraint i=1..n-1ai’xi < i=1..n-1aixi - in the end remove all constraints involving xn. Decision Procedures - An algorithmic point of view
18
Solving QLA with projection
Fourier Motzkin: example. Eliminate y: x + 1 · y Æ y · 3z + 3 Æ 2y · 2z + 4 x + 1 · z Æ x + 1 · 3z + 3 Decision Procedures - An algorithmic point of view
19
Quantifier elimination - example
Transform 8 to 9 via: (8x. ) $ (:9x. :) 8x.9y.9z. (y+1 · x Æ z+1 · y Æ 2x+1 · z) 8x.9y. (y+1 · x Æ 2x+1 · y-1 ) 8x. (2x+2 · x-1) // transform to 9 :9x. : (2x+2 · x-1) :9x. x > -3 :true false Decision Procedures - An algorithmic point of view
20
Quantifier elimination by projection: summary
Given a PNF formula f = Q[n]V[n]Q[1]V[1] For i = 1 .. n { if Q[i] = 9 then = project(,V[i]) else = :project(:,V[i]) } Return Decision Procedures - An algorithmic point of view
21
Search Based QBF Algorithms
Work by gradually assigning variables A partial assignment [KGS98] M. Cadoli, A. Giovanardi, M. Schaerf. An Algorithm to Evaluate Quantified Boolean Formulae. In Proc. of 16th National Conference on Artificial Intelligence (AAAI-98) Decision Procedures - An algorithmic point of view
22
Search Based QBF Algorithms
Work by gradually assigning variables A partial assignment Undetermined Continue search [KGS98] M. Cadoli, A. Giovanardi, M. Schaerf. An Algorithm to Evaluate Quantified Boolean Formulae. In Proc. of 16th National Conference on Artificial Intelligence (AAAI-98) Decision Procedures - An algorithmic point of view
23
Search Based QBF Algorithms
Work by gradually assigning variables A partial assignment Undetermined Conflict Backtrack Record the reason [KGS98] M. Cadoli, A. Giovanardi, M. Schaerf. An Algorithm to Evaluate Quantified Boolean Formulae. In Proc. of 16th National Conference on Artificial Intelligence (AAAI-98) Decision Procedures - An algorithmic point of view
24
Search Based QBF Algorithms
Work by gradually assigning variables A partial assignment Undetermined Conflict Satisfied Backtrack Determine the covered satisfying space [KGS98] M. Cadoli, A. Giovanardi, M. Schaerf. An Algorithm to Evaluate Quantified Boolean Formulae. In Proc. of 16th National Conference on Artificial Intelligence (AAAI-98) Decision Procedures - An algorithmic point of view
25
Search Based QBF Algorithms
Work by gradually assigning variables A partial assignment Undetermined Conflict Satisfied The majority of QBF solvers are search based, the DPLL algorithm is an example of this Decision Procedures - An algorithmic point of view
26
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF eu (e Ç u)(:e Ç :u) Unknown True (1) False(0) Decision Procedures - An algorithmic point of view
27
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF eu (e Ç u)(:e Ç :u) e = 0 Unknown True (1) False(0) Decision Procedures - An algorithmic point of view
28
Basic DPLL Flow for QBF eu (e Ç u)(:e Ç :u)
Existential quantification eu (e Ç u)(:e Ç :u) Universal quantification e = 0 Satisfying Node Unknown True (1) u = 1 False(0) Decision Procedures - An algorithmic point of view
29
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF eu (e Ç u)(:e Ç :u) e = 0 Backtrack Unknown True (1) u = 1 False(0) Decision Procedures - An algorithmic point of view
30
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF eu (e Ç u)(:e Ç :u) e = 0 Unknown True (1) u = 1 u = 0 False(0) Decision Procedures - An algorithmic point of view
31
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF eu (e Ç u)(:e Ç :u) e = 0 Unknown True (1) u = 1 u = 0 False(0) Decision Procedures - An algorithmic point of view
32
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF eu (e Ç u)(:e Ç :u) e = 1 e = 0 Unknown True (1) u = 1 u = 0 False(0) Decision Procedures - An algorithmic point of view
33
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF eu (e Ç u)(:e Ç :u) e = 1 e = 0 Unknown True (1) u = 1 u = 1 u = 0 False(0) Decision Procedures - An algorithmic point of view
34
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF eu (e Ç u)(:e Ç :u) e = 1 e = 0 Conflicting Node Unknown True (1) u = 1 u = 1 u = 0 False(0) Decision Procedures - An algorithmic point of view
35
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF eu (e Ç u)(:e Ç :u) e = 1 e = 0 Unknown True (1) u = 1 u = 1 u = 0 False(0) Decision Procedures - An algorithmic point of view
36
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF False eu (e Ç u)(:e Ç :u) e = 1 e = 0 Unknown True (1) u = 1 u = 1 u = 0 False(0) Decision Procedures - An algorithmic point of view
37
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF ue (u Ç e)(:u Ç :e) Unknown True (1) False(0) Decision Procedures - An algorithmic point of view
38
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF ue (u Ç e)(:u Ç :e) u = 1 Unknown True (1) False(0) Decision Procedures - An algorithmic point of view
39
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF ue (u Ç e)(:u Ç :e) u = 1 Unknown True (1) e = 1 False(0) Decision Procedures - An algorithmic point of view
40
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF ue (u Ç e)(:u Ç :e) u = 1 Unknown True (1) e = 1 e = 0 False(0) Decision Procedures - An algorithmic point of view
41
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF ue (u Ç e)(:u Ç :e) u = 1 Unknown True (1) e = 1 e = 0 False(0) Decision Procedures - An algorithmic point of view
42
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF ue (u Ç e)(:u Ç :e) u = 1 u = 0 Unknown True (1) e = 1 e = 0 e = 1 False(0) Decision Procedures - An algorithmic point of view
43
Decision Procedures - An algorithmic point of view
Basic DPLL Flow for QBF True ue (u Ç e)(:u Ç :e) u = 1 u = 0 Unknown True (1) e = 1 e = 0 e = 1 False(0) Decision Procedures - An algorithmic point of view
44
Decision Procedures - An algorithmic point of view
What we saw is DPLL - QBF while (true) { decide_next_branch() //choose a branch variable while(true) { status = deduce(); //unit propagation if (status == CONFLICT) { blevel = analyze_conflict(); //find out the reason for conflict if (blevel < 0) return UNSATISFIABLE; else backtrack(blevel); } else if (status == SATISFIABLE) { blevel = analyze_SAT() //find out the reason for satisfaction if (blevel < 0) return SATISFIABLE; else break; }} Decision Procedures - An algorithmic point of view
45
Naïve DPLL Based Approach
Works on a CNF database Learning and non-chronological backtracking is much harder – requires a change! Modern QBF solvers do not work with CNF, rather with a combination of CNF with Cubes. This lets them apply learning efficiently. Decision Procedures - An algorithmic point of view
46
Decision Procedures - An algorithmic point of view
ACNF Definition: Augmented CNF (ACNF) = C1 Æ C2Æ …Æ CmÇ S1 Ç S2 Ç ……Ç Sk Where Ci’s are clauses, and Sj ’s are cubes. Each Sj is contained in the clause term C1 C2…Cm. i.e.i{1,2…k}, Si C1 Æ C2 Æ … Æ Cm In ACNF, cubes are redundant Example: (:aÇ:bÇ:c)Æ(:aÇbÇc) Æ(aÇ:bÇc) Æ(aÇbÇ:c) Ç (:aÆ:bÆ:c) Ç (aÆ :bÆ c) Decision Procedures - An algorithmic point of view
47
Solving QBF of ACNF formulas
Cubes are necessary for saving information on the (universal) space already covered. We will see a special case: 2QBF 2QBF = QBF with one quantifier alternation very useful! Decision Procedures - An algorithmic point of view
48
Decision Procedures - An algorithmic point of view
A special case: 2QBF DPLL search based, utilize a standard SAT solver Algorithm I: Assign universal variables first Algorithm II: no restriction in decision order w.r.t. variable quantification order Resolution based No simplification, just Q-resolution With complete two-level minimization (using Logic-Minimization) at each resolution step Decision Procedures - An algorithmic point of view
49
Coverage Cubes and Blocking Clauses
(u1 Ç u2 Ç e1) Æ (u3 Ç :e2) Æ (:u1Ç :u2Ç e2) Æ (u1Ç :e1Ç :e2) satisfying assignment : {u1=1, u2=0, u3=X, e1=0, e2=0} coverage cube for the universal Boolean space: u1 :u2 select a set of literals that satisfy all clauses blocking clause: :u1 Ç u2 prevents revisiting the already searched space satisfying cube: {u1=1, u2=0, e2=0} Decision Procedures - An algorithmic point of view
50
Example for Algorithm I
8u1u29e1e2. (u1Ç e1)Æ(:u1Ç :e1)Æ(:u1Ç u2Ç:e2) Æ(:u2Ç:e1Ç e2) Æ (e1Ç:e2) universal assignment: u1=0, u2=0 SAT assignment: u1=0, u2=0, e1=1, e2=1 satisfying cube (cover set): u1=0, e1=1, e2=1 coverage cube: u1=0 universal assignment: u1=1, u2=0 SAT assignment: u1=1, u2=0, e1=0, e2=0 satisfying cube (cover set): u1=1, e1=0, e2=0 coverage cube: u1=1 no more universal assignment left, instance is true Decision Procedures - An algorithmic point of view
51
Decision Procedures - An algorithmic point of view
universal assignment SAT assignment 5 1 2 satisfying cube (cover set) 3 4 coverage cube universal space (u1,u2,…,um) existential space (e1,e2,…,en) Decision Procedures - An algorithmic point of view
52
Example for Algorithm II
8u1u29e1e2. (u1Ç e1)Æ(:u1Ç :e1)Æ(:u1Ç u2Ç:e2) Æ(:u2Ç:e1Ç e2) Æ (e1Ç:e2) SAT assignment: u1=0, e1=1, e2=1, u2=0 blocking clause: (u1 Ç :e1 Ç :e2) coverage cube: u1=0 SAT assignment: u1=1, e1=0, e2=0 , u2=0 blocking clause: (u1 Ç :e1 Ç :e2) coverage cube: u1=1 The entire universal space is covered, instance is true Decision Procedures - An algorithmic point of view
53
universal variable space
Algorithm II SAT assignment, no need to respect quantification order to get that coverage cube 3 4 1 blocking clause 2 all variable space (u1,u2,…,um,e1,e2,…,en) universal variable space (u1,u2,…,um) Decision Procedures - An algorithmic point of view
54
Resolution Based Algorithm
First resolve out existential variables After resolving out all existential variables An empty clause (a clause with no literal or consisting only of universal variables) false An empty set of clauses true Has the memory blowup problem Alleviate by simplifying the propositional part after each resolution step Decision Procedures - An algorithmic point of view
55
Example for Resolution Based Algorithm
8u1u29e1e2. (u1Ç e1)Æ(:u1Ç :e1)Æ(:u1Ç u2Ç:e2) Æ(:u2Ç:e1Ç e2) Æ (e1Ç:e2) resolve out e1 8u1u29e2. (u1Ç :u2 Ç e2)Æ(:u1Ç :e2)Æ(:u1Ç u2Ç:e2) simplify 8u1u29e2. (u1Ç :u2 Ç e2)Æ(:u1Ç :e2) resolve out e2 empty set of clause instance is true Decision Procedures - An algorithmic point of view
56
Experimental Results (Malik et al.)
# of clauses (100 vars, 5 lits/clause) Alg. I Alg. II Res w/o simp Res w/ simp Quaffle 100 (100 instances) 0(100) 16.22(98) 0.01(100) 0.25(100) >400(0) 200 (10 instances) 160(6) >400(0) 0.36(10) 169.09(6) >400(0) Circuit Depth Alg. I Alg. II Res w/o simp Res w/ simp Quaffle s1488 1 0.15 0.26 >400 2.19 0.27 3 0.80 294.27 >400 25.04 18.23 5 2.5 >400 >400 208.6 >400 s1423 1 0.15 >400 >400 4.29 0.22 15 2.11 >400 >400 >400 >400 34** 298.86 >400 >400 >400 >400 * The tests were done on an Intel Pentium III 933 MHz machine with 1GB of RAM running linux. ** Improves on previous diameter lower bound of 26
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.