A More Efficient BDD-Based QBF Solver Oswaldo Olivo, E. Allen Emerson The University of Texas at Austin, U.S.A. September 15, 2011 1 / 40
Outline Introduction. Preliminaries. eBDD-QBF Solver. Experiments. Conclusions and Future Work. 2 / 40
Introduction Satisfiability of quantified boolean propositional formulas (QBF). QBF Applications: Conformant planning, model checking, equivalence checking and theorem proving. Solvers classified as search (DPLL) and symbolic (BDDs, ZDDs, AIGs). Conventional wisdom : Search outperforms Symbolic. 3 / 40
Introduction New BDD-based QBF solver. BDD Constraint Propagation. Enhanced early quantification. Variable elimination order. 4 / 40
Preliminaries: Quantified Boolean Formulas (QBFs) Let formula Q 1 X 1 Q 2 X 2 ... Q n X n φ , where Q i ∈ {∀ , ∃} , X i set of propositional variables and φ is a propositional formula over X i s. Q 1 X 1 Q 2 X 2 ... Q n X n is quantifier prefix and φ matrix . QBF : Is there a satisfying assignment for above formula? Assume CNF: (1) Q 1 X 1 Q 2 X 2 ... Q n X n ( C 1 ∧ C 2 ∧ ... ∧ C m ). Each C j is disjunction of literals called clause . 5 / 40
Preliminaries: Binary Decision Diagrams (BDDs) Binary Decision Diagram (BDD) is a DAG that represents all satisfying assignments. Inner node represents a variable x of formula and has two children denoted by high and low . Imposing variable ordering in paths, eliminating redundant nodes and merging of isomorphic subgraphs : ROBDDs. Apply ( A , B , op ) algorithm is binary operation op applied for BDDs. The RestrictBy ( A , B ) alg. prunes assignments of A inconsistent with B . 6 / 40
Preliminaries: Binary Decision Diagrams (BDDs) ( ¬ x 1 ∨ x 2 ) ∧ ( ¬ x 3 ∨ x 2 ) ∧ ( x 1 ∨ ¬ x 2 ∨ x 3 ) 7 / 40
eBDD-QBF solver New BDD-based QBF solver. Symbolic: Transforms input CNF into set of implicitly conjoined BDDs and applies decision procedure. Includes search-inspired optimizations for BDDs : unit clause and pure literal propagation ( BDD Constraint Propagation ). Employs a variant of early quantification from model checking. Dynamic variable elimination heuristics. 8 / 40
Enhanced Early Quantification Example. Inner Existential Variable case : ∃ x 1 ∀ x 2 ∃ x 3 (( x 1 ∨ x 2 ) ∧ ( ¬ x 2 ∨ x 3 ) ∧ ( ¬ x 1 ∨ ¬ x 3 )) ≡ ∃ x 1 ∀ x 2 (( x 1 ∨ x 2 ) ∧ ( ∃ x 3 ( ¬ x 2 ∨ x 3 ) ∧ ( ¬ x 1 ∨ ¬ x 3 ))) ≡ ∃ x 1 ∀ x 2 (( x 1 ∨ x 2 ) ∧ ( ¬ x 1 ∨ ¬ x 2 )) Inner Universal Variable case: ∃ x 1 ∀ x 2 ∀ x 3 (( x 1 ∨ x 2 ) ∧ ( ¬ x 2 ∨ x 3 ) ∧ ( ¬ x 1 ∨ ¬ x 3 )) ≡ ∃ x 1 ∀ x 2 (( x 1 ∨ x 2 ) ∧ ( ∀ x 3 ( ¬ x 2 ∨ x 3 )) ∧ ( ∀ x 3 ( ¬ x 1 ∨ ¬ x 3 ))) ≡ ∃ x 1 ∀ x 2 (( x 1 ∨ x 2 ) ∧ ¬ x 2 ∧ ¬ x 1 ) 9 / 40
QBF Formulations (1) Q 1 X 1 Q 2 X 2 ... Q n X n ( C 1 ∧ C 2 ∧ ... ∧ C m ). (2) Q 1 X 1 Q 2 X 2 ... Q n − 1 X n − 1 Q n ( X n − { x i } ) ( Q n x i ( C 1 ∧ C 2 ∧ ... ∧ C k ) ∧ C k +1 ∧ ... ∧ C m ) 10 / 40
Enhanced Early Quantification Algorithm. Recall (1) and (2) from previous slide .Let var x i be innermost in (1). w.l.o.g., x i occurs. in C 1 , ..., C k and not in C k +1 , ..., C m . x i existential → rewrite (1) into (2) . x i universal. → use ∀ x ( P ( x ) ∧ Q ( x )) ≡ ∀ x ( P ( x )) ∧ ∀ x ( Q ( x )), and (1) becomes. : (3) Q 1 X 1 Q 2 X 2 ... Q n − 1 X n − 1 ∀ ( X n − { x i } ) (( ∀ x i ( C 1 ) ∧ ∀ x i ( C 2 ) ∧ ... ∧ ∀ x i ( C k )) ∧ C k +1 ∧ ... ∧ C m ) Motivation : quantification typically reduces diagram size, as variable is eliminated from support set. Individually quantify , conjoin all simplified BDDs, store result and apply early quantification iteratively. 11 / 40
BDD Constraint Propagation (Unit Clause) Example. Simple Case: BDDs represent clauses. Existential variable: x 2 is unit clause. BDD 1 BDD 2 � �� � ���� ∃ x 1 ∃ x 2 ( ( x 1 ∨ ¬ x 2 ) ∧ x 2 ) BDD 1 ���� ≡ ∃ x 1 ( ( x 1 ) ) Universal variable: x 2 is unit clause. BDD 1 BDD 2 � �� � ���� ∃ x 1 ∀ x 2 ( ( x 1 ∨ ¬ x 2 ) ∧ x 2 ) ≡ UNSAT 12 / 40
BDD Constraint Propagation (Unit Clause). Unit Clause Propagation : Clause with only one literal has to be set to true in order to continue solving. Simple case: Initially every BDD represents a clause of the CNF f . Algorithm eBDD-QBF Unit Propagation: Detect all BDDs of support set size 1 (called unit BDDs ). 1 If any unit BDD is universal, return UNSAT. 2 Conjoin all unit BDDs into one BDD b . 3 return RestrictBy ( f , b ). 4 Limitation: Only works when BDDs represent clauses, hence useless after applying early quantification. 13 / 40
BDD Constraint Propagation (Unit Clause) Example. Complex Case: BDDs may represent non-clausal formulas. Existential variable: x 1 is inner unit clause. BDD 1 BDD 2 � �� � � �� � ∃ x 1 ∀ x 2 ∃ x 3 ( ( x 1 ∧ ¬ x 3 ) ∨ ( x 1 ∧ x 2 ) ∧ ( x 3 ∨ x 1 ) BDD 1 BDD 2 � �� � � �� � ≡ ∃ x 1 ∀ x 2 ∃ x 3 ( ( x 1 ∧ ( ¬ x 3 ∨ x 2 )) ∧ ( x 3 ∨ x 1 )) ���� InnerUnitClause BDD 1 � �� � ≡ ∀ x 2 ∃ x 3 ( ( ¬ x 3 ∨ x 2 )) Universal variable: x 1 is inner unit clause. BDD 1 BDD 2 � �� � � �� � ∀ x 1 ∀ x 2 ∃ x 3 ( ( x 1 ∧ ¬ x 3 ) ∨ ( x 1 ∧ x 2 ) ∧ ( x 3 ∨ x 1 ) ≡ UNSAT 14 / 40
BDD Constraint Propagation (Unit Clause) (Cont.) Complex case : Early quantification has been applied, so BDDs do not necessarily represent clauses. However, formula may contain inner unit clauses in their underlying CNF. Example ( x 1 ∧ x 2 ) ∨ ( x 1 ∧ x 3 ) ≡ x 1 ∧ ( x 2 ∨ x 3 ). Algorithm eBDD-QBF Unit Propagation : For each BDD b in the formula representation f : 1 For each variable x in the support set of b 2 If RestrictBy ( b , BDD ( ¬ x )) ≡ ZERO BDD then x is inner 3 unit clause . If RestrictBy ( b , BDD ( x )) ≡ ZERO BDD then ¬ x is inner 4 unit clause . If any inner unit clause is universal, return UNSAT. 5 Create BDD b by conjoining BDDs for every inner unit clause. 6 return RestrictBy ( f , b ) 7 Must detect selectively, otherwise just Prime Implicates . 15 / 40
BDD Constraint Propagation (Pure Literals) Example. Simple Case: BDDs represent clauses. Existential variable: x 1 is positively pure. BDD 1 BDD 2 � �� � ���� ∃ x 1 ∃ x 2 ( ( x 1 ∨ ¬ x 2 ) ∧ x 2 ) BDD 1 ���� ≡ ∃ x 2 ( ( x 2 ) ) Universal variable: x 2 is positively pure. BDD 1 BDD 2 � �� � � �� � ∃ x 1 ∀ x 2 ∃ x 3 ( ( ¬ x 1 ∨ x 2 ∨ x 3 ) ∧ ( ¬ x 3 ∨ x 2 ∨ x 1 )) BDD 1 BDD 2 � �� � � �� � ≡ ∃ x 1 ∃ x 3 ( ( ¬ x 1 ∨ x 3 ) ∧ ( ¬ x 3 ∨ x 1 )) 16 / 40
BDD Constraint Propagation (Pure Literals). Pure Literal Propagation : Literal appears only positively (negatively) in formula. If universal literal, remove it from formula. Otherwise, remove clauses containing it. Simple case: Initially every BDD represents a clause of the CNF f . Algorithm eBDD-QBF Pure Literal Propagation : For each BDD b of formula f 1 For each variable x in the support set of b 2 if RestrictBy ( b , BDD ( x )) ≡ ONE BDD , x is positive in b . 3 if RestrictBy ( b , BDD ( ¬ x )) ≡ ONE BDD , x is negative in b . 4 For each pure literal x in f 5 if x is universal, create BDD b ′ := BDD ( ¬ x ), otherwise 6 b ′ := BDD ( x ). Conjoin all BDDs b into a BDD c . 7 return RestrictBy ( f , c ) 8 Same Limitation as for Unit Prop. 17 / 40
BDD Constraint Propagation (Pure Literals) Example. Complex Case: BDDs may represent non-clausal formulas. Existential variable: x 1 is positively pure. BDD 1 BDD 2 � �� � � �� � ∃ x 1 ∀ x 2 ∃ x 3 (( ( x 1 ∧ ¬ x 3 ) ∨ ( x 1 ∧ x 2 )) ∧ ( x 3 ∨ ¬ x 2 )) Note: ∀ x 1 ( BDD 1) ≡ ( ¬ x 3 ∨ x 2 ) ≡ BDD 1[ x 1 := false ] BDD 2 � �� � ≡ ∀ x 2 ∃ x 3 ( x 3 ∨ ¬ x 2 ) Universal variable: x 1 is positively pure. BDD 1 BDD 2 � �� � � �� � ∀ x 1 ∀ x 2 ∃ x 3 (( ( x 1 ∧ ¬ x 3 ) ∨ ( x 1 ∧ x 2 )) ∧ ( x 3 ∨ ¬ x 2 )) Polarity check the same as for existential case. ≡ UNSAT 18 / 40
BDD Constraint Propagation (Pure Literals) (Cont.) Complex case : Early quantification has been applied, so BDDs are not necessarily clauses. Polarity is not so easy for this case. Algorithm eBDD-QBF Unit Propagation : Modify previous algorithm by changing polarity detection procedure: x is positively pure in BDD b iff ∀ x ( b ) ≡ RestrictBy ( b , BDD ( ¬ x )). Intuition: Quantification removes variable and setting positive to false removes variable too (analogous for negative case). Too expensive. Not used in mainstream experiments . 19 / 40
Variable Ordering Heuristics. Dynamic heuristics have been used in model checking. BDD-Based SAT and QBF solvers employ static heuristics. Reason: Bucket elimination with BDDs (a bucket being a set holding BDDs w/ the same top variable) relies on eliminating only top variables at each iteration, so the ordering must be fixed. We have implemented the following heuristics: Most occurring top variable. 1 Most occurring variable. 2 Least occurring top variable. 3 Least occurring variable. 4 Smallest BDD top variable. 5 Smallest BDD variable. 6 Bounded Most occurring variable with min. 7 20 / 40
Recommend
More recommend