Mathematical Problems in Engineering

Volume 2013 (2013), Article ID 165927, 6 pages

http://dx.doi.org/10.1155/2013/165927

## Message Passing Algorithm for Solving QBF Using More Reasoning

School of Computer Science and Information Technology, Northeast Normal University, Changchun 130117, China

Received 26 June 2013; Accepted 24 July 2013

Academic Editor: William Guo

Copyright © 2013 Su Weihua et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

We present a novel solver for solving Quantified Boolean Formulae problem (QBF). In order to improve the performance, we introduce some reasoning rules into the message passing algorithm for solving QBF. When preprocessing the formulae, the solver incorporates the equality reduction and the hyperbinary resolution. Further, the solver employs the message passing method to obtain more information when selecting branches. By using the unit propagation, conflict driven learning, and satisfiability directed implication and learning, the solver handles the branches. The experimental results also show that the solver can solve QBF problem efficiently.

#### 1. Introduction

Quantified Boolean Formulae can be seen as an extension of the well-known canonical NP-complete problem of Propositional Satisfiability (SAT) with existential or universal quantifiers to every variable in the propositional formulae. Given a Quantified Boolean Formula, the question of deciding the satisfiability of the formula is called a Quantified Boolean Satisfiability problem (QBF). QBF is an important issue in artificial intelligence because it is the prototypical PSPACE-complete problem. Many practical problems can be transformed into QBF, for example, conformant planning [1], verification [2], nonmonotonic reasoning [3], and reasoning about knowledge [4].

Now most researchers make great efforts on designing excellent QBF solvers in order to increase the efficiency for solving QBF problem. WalkQSAT is the first incomplete QBF solver using stochastic local search methods, and it applies a SAT solver—walksat for selecting the next branch [5]. WATCHEDCSBJ features watched data structure [6]. QuBE is an adaptation of the classic DPLL (Davis, Putnam, Logemann, and Loveland) backtracking search algorithm. Moreover, it adopts watched data structure and learning [7]. QSAT employs the maximum occurrences in minimum sized clauses (MOMS) heuristic [8]. Quaffle extends variable state independent decaying sum (VSIDS) heuristic and conflict driven learning [9].

In this paper, we propose a novel QBF solver based on a DPLL algorithm, called EHSPQBF. The system combines many advanced techniques together. In preprocessing, we adopt the equality reduction and the hyperbinary resolution to simplify the formulae. In choosing branches process, we employ a message passing method—survey propagation. By giving exact information, the approach selects branches more exactly, which can decrease the search space and improve the backtracking time. In branched treatment process, we utilize conflict reasoning, conflict driven learning, and satisfiability directed implication and learning to help pruning the search space. Owing to these outstanding techniques, the ability of solving QBF problems has greatly improved.

#### 2. Quantified Boolean Formulae

We begin this section by presenting some notions in this paper. A literal is either a Boolean variable or its negation . If a literal is , the negation of the literal is . A clause is a disjunction of literals which does not contain a complementary pair and simultaneously. A propositional logic formula in Conjunction Normal Form (CNF) is a conjunction of clauses. A Quantified Boolean Formula (QBF) has the form
where is a propositional logic formula in CNF involving Boolean variables , and every is either an existential quantifier or a universal quantifier . A variable is existential if the restriction quantifier of the variable is , and universal otherwise. Any Boolean variable can take a value *true* or *false*. A truth assignment for a propositional logic formula is a map that assigns each variable a value. The satisfying assignment, called model, is the truth assignment that makes the propositional logic formula evaluated to *true*. The partial variable assignment is a map that assigns some variables values. We say a formula composed of zero clause is an empty formula, denoted by , which is interpreted as *true*. An empty clause is a clause containing zero literal, which means that the clause is *false*.

The Quantified Boolean Formulae Satisfiability problem is to decide whether a Quantified Boolean Formula is satisfiable. For example, given a QBF , the QBF is satisfiable if and only if for each truth assignment to there exists a truth assignment to . In the rest of the paper, we will use QBF to denote the formulae and the satisfiability problems.

For a QBF of the form (1), because and , we can group in the same set all consecutive variables having the same quantifier. Therefore, equality (1) can be rewritten into the following form: where is a set of propositional variables and all such sets are mutual disjoint. In such a format, each quantifier is applied to a set of variables rather than to a single Boolean variable. Moreover, the sequence of quantifiers alternates; an existential quantifier follows a universal quantifier and vice versa. With the quantifier restricted, each variable has a quantification level, which increases from the outermost quantification set to the innermost quantification set; that is, the variables belonging to the outermost quantification set have quantification level 1 and so forth.

#### 3. The Relationship between SAT and QBF

The SAT problem is a typical NP-complete problem, which has a close relationship with QBF problem. More specifically, SAT can be regarded as an especial form of QBF with only existing existential quantifier, and QBF can be regarded as an extended form of SAT with additional prefixes. In addition, they are both prototypical problems for complexity classes. SAT is an NP-complete problem while QBF is a PSPACE-complete problem, which is inherently more difficult than SAT. In the following, we will discuss the similarities and dissimilarities between QBF and SAT.

*Orders of Disposing Variables*. When dealing with SAT, we can select variables in a random order. While dealing with QBF, we must select variables in a sequence of quantifier level that is, the variables whose quantifier level is minimal will be assigned first and so on. As a matter of fact, the reason of doing so is that the variables in QBF have a dependency relationship. For example, given a QBF , the value of an existential that makes the formula true may depend directly on the value of a universal which is quantified prior to . Therefore, the key of dealing with QBF is to select the variables in the sequence of quantifier level.

*Search Space*. The search space of SAT is a tree while the search space of QBF is an AND/OR tree. They both regard the assignment of variables as weights and variables as nodes. The difference is that QBF has two types of nodes: AND node and OR node. In the AND/OR tree, the universal variables correspond to the AND nodes and the existential variables correspond to the OR nodes.

*Hardness of the Problems*. The QBF is more difficult than SAT. As we know, SAT is NP-complete while QBF is PSPACE-complete. For a SAT, the algorithm will stop when a satisfying assignment is found. However, for a QBF, the algorithm needs to continue searching because of the universal quantifiers.

Because of the close relationship between SAT and QBF, most of methods for QBF can be regarded as a generalization of algorithms commonly for SAT. Therefore, we can solve QBF with equality reduction and the hyperbinary resolution which is really effective in solving SAT.

#### 4. QBF Algorithm Framework

Recently, search-based QBF solvers are based on an extension to the DPLL algorithm. Now we give the DPLL algorithm for QBF in Algorithm 1. In the algorithm, is an empty clause and is a clause composed of only universal variables. The DPLL algorithm works on the principle of preprocessing, choosing branches, branched treatment, and then recursively solving the simplified QBF. In preprocessing process (line 1), DPLL employs several reasoning rules to simplify QBF like pure literal rule, unit literal rule, and so forth. In choosing branches (variables) process (line 4), DPLL selects variables in a fixed order; that is, the variables in the outermost quantification set are chosen first and so on. In branched treatment process (lines 5–8), DPLL searches AND/OR tree depending on the chosen variable. If the chosen variable is an existential variable, an OR node is explored; otherwise an AND node is explored. DPLL terminates when the simplified QBF is an empty formula (line 2), which means the input formula is satisfiable; when the simplified QBF contains an empty clause or there is a clause made of all universally quantified variables (line 3), which means the input formula is unsatisfiable.

In Algorithm 2, we present the basic algorithm of EHSPQBF, which is based on DPLL algorithm. At first, we explain the terms occurred in the algorithm. The term is an empty clause, and is a clause composed of only universal variables. In preprocessing process (line 1), we simplify the input formula in CNF employing unit literal rule, the equality reduction, and the hyperbinary resolution. In choosing branches process (line 9), we use survey propagation as a heuristic. By giving exact information, the approach makes the choice of branch more exactly, which can decrease the search space and improve the run-time. In branched treatment process (line 4), we deduce the formula using conflict reasoning rule. The result of the deduction has three values:* undetermined*, *satisfaction,* and *conflict*. If result is *conflict* (*satisfaction*), that is, evaluates to 0 (resp., 1) under the current partial variable assignment, the algorithm analyzes the conflict (resp., satisfaction); if the result is *undetermined*, that is, evaluates neither 0 nor 1, the algorithm continues to choose branches. In this process, we employ the conflict driven learning and satisfiability directed learning to reduce the search space.

#### 5. Preprocessing via Reasoning Rules

Besides the unit literal rule, the preprocess stage also uses more powerful reasoning rules, that is, the hyperbinary resolution and the equality reduction [10]. As a matter of fact, the hyperbinary resolution rule is a sequence of ordinary resolution steps. Though they are of similar function in simplifying the formulae, the hyperbinary resolution reduces the space which the sequence intermediate clauses occupy. And the equality reduction rule can further reduce the size of the input formula. It first finds the equivalences, and then it substitutes each equivalent variable, which can simplify the input formula. Now we describe them in the following.

*Definition 1. *The hyperbinary resolution rule of inference takes as input a -ary clause and binary clauses each of the form , where is existential variable; then it deduces the clause .

The advantage of the hyperbinary resolution is that it can save the solving time. The hyperbinary resolution can generate unit clauses or binary clauses in order to simplify the input formula. In addition, if the deduced clause contains only universal variables, the formula can be directly decided the QBF instance is *unsatisfiable*. For example, consider a formula . If we apply the hyperbinary resolution rule to , the rule is able to obtain a deduced clause which contains only one universal variable, and we can decide that the formula is *unsatisfiable*. By simplifying the formula, the hyperbinary resolution rule reduces the solving time.

*Definition 2. *The equality reduction of a QBF formula by a pair of equivalent literals is a rule of replacing by if satisfies(1)contains the pair of binary clauses and ;(2)the quantification level of is greater than ;(3) and are both existential.

Note that the QBF formula is *unsatisfiable* if there is a universal in the clause . Once that equality reduction finds the equivalences, then it substitutes each variable with its definition in the formula. For example, let . Since literals and are equivalent literals, we obtain the simplified QBF. is by using equality reduction. Notice that when the hyperbinary resolution rule applies to , the input formula can be further simplified.

Above all, we can find that the hyperbinary resolution rule and equality reduction have the power to reduce the size of the formula. They cannot only occupy less space but also increase the efficiency for solving QBF.

#### 6. Choosing Branches with Survey Propagation

The survey propagation (SP) [11] method is a ground-breaking development for solving SAT. The occurrence makes the SAT problems that we can deal with scale from with ten thousand variables to with one million variables. As far as we know, SP is the only algorithm successful at solving random SAT problems with one million variables and beyond in near-linear time in the hardest region. In this section, we will discuss how to choose branches with the SP method. As a message passing algorithm, SP passes message on a factor graph which provides an easy graphical description to the message passing procedures. In the following, we will address the factor graph in detail.

##### 6.1. Factor Graph

The factor graph is an undirected graph (see Figure 1). It has two types of nodes: one represents variables called “variable node” (circles in Figure 1) and the other represents clauses called “function node” (squares in Figure 1). A function node is connected to a variable node by an edge whenever the variable (or its negation) appears in the clause . In the graphical representation, we use a full (dashed) line between and whenever the variable appearing in the clause is . For every variable node , we denote by the set of function nodes to which it is connected, by the subset of consisting of function nodes where the variable appears unnegated, and by the complementary set of . denotes the set without node . Similarly, for each function node , we denote by the set of neighboring variable nodes. For example, given a QBF , we can represent the propositional logic formula with factor graph in Figure 1, where clause represents and clause represents .

##### 6.2. Message Passing

The survey propagation algorithm passes two types of messages: one passed from a function node to a variable node; the other passed from a variable node to a function node. The update of both messages is realized by the message update rule which is defined as follows.(1) The message passed from a function node to a variable node : the message, called “survey”, is a real number : If is empty, then . In equality (3), the variable sends a particular symbol to clause saying that the variable cannot satisfy the clause (“”), that the variable can satisfy the clause (“”), or that it is indifferent (“0”).(2) The message passed from a variable node to a function node : each variable passes a triplet of real numbers to each of its clause neighbors : where and denote neighbors which tend to make variable dissatisfy or satisfy clause . If a set like is empty, the corresponding product takes value 1. In the above equalities, the variable sends a particular symbol to clause saying that the variable cannot satisfy the clause (“”), that the variable can satisfy the clause (“”), or that it is indifferent (“0”).

When SP converges to a fixed point set of messages , one can use it to estimate the statistic characteristic (called bias) of every variable. There are two types of biases: positive bias and negative bias. The positive (negative) bias is the probability that variable is restricted to 1 (0). The computing formulae are as follows:

where

As a whole, SP gathers the statistical information which can guide the choosing branches. In choosing branches process, we select branches obeying quantification orders. For variables in the same quantification level, we compute positive and negative biases with SP. Then we fix the biased variable in the same quantification level; that is, one variable has the largest bias . Having selected the variable, we assign the variable depending on the current quantification level. If the current quantification level is existential, we assign the biased value to the variable; otherwise we assign the reverse biased value to the variable.

#### 7. Branched Treatment

After choosing branches, we can perform branched treatment on the chosen variable. The purpose of treatment is to decide whether the current branch of search tree is satisfiable. In branched treatment process, we employ some efficient technologies, such as conflict reasoning, conflict driven learning, and satisfiability directed learning.

##### 7.1. Conflict Driven Learning

Conflict driven learning utilizes the knowledge learned from failures in certain search space to help prune search in future spaces. If the current branch of the search tree is not satisfied, we can perform conflict driven learning. It is carried out by the analyze conflict routine in Algorithm 3.

The analyze conflict routine analyzes the current status and brings the search to a new space by backtracking. At first, we explain some terms in the routine. As an algorithm based on DPLL, EHSPQBF is a branch and search procedure. Each branch has a decision level (). The first branch has decision level 1 and so forth. And variables implied by a decision variable will have the same decision level as the decision variable. Now we introduce the analyze conflict routine. At the beginning, it decides whether there exist conflict clauses in the current QBF formula (line 1). If they exist, we utilize function gen_clause() for generating learned clause (line 2). The learned clause can guarantee that the decision level which the algorithm backtracks to is unique. Then function add_clause() performs conflict driven learning when the result of deduction is *conflict*, which causes a learned clause constructed and added to the database (line 3). At last, we decide whether the decision level that the algorithm backtracks to 0 (line 4). If it is not 0, EHSPQBF will backtrack to the decision level (line 5). The aim of conflict driven learning is to memorize the conflict branch. If search space has the same branch in the further, we can prune the branch directly, which need not go on searching.

##### 7.2. Satisfiability Directed Learning

Satisfiability directed learning utilizes the knowledge learned from satisfactions to reduce the number of satisfying leaves which need to be visited. When the result of deduction is *satisfaction*, we can perform satisfiability directed learning. It is carried out by the analyze SAT routine in Algorithm 4. At first, we show relevant definitions used in the routine.

*Definition 3. *(extended CNF) Let be a CNF. An extended CNF is , where is an entity, that is, a conjunction of literals.

Now let us introduce the detail of the routine. At the beginning, it judges whether there exist satisfying entities in the current QBF in extended CNF (line 1). If they exist, the routine goes to line 4; otherwise, entity from the current variable assignment is generated by function gen_sat_induced_entity() (lines 2-3). In lines 4-5, a learned entity is not generated by function consensus_gen_entity() until the generated entity meets the following conditions. Among all its universal variables, one and only one has the highest decision level, supposing the variable is ; is at a decision level with a universal variable as the decision variable; all existential literals with quantification level smaller than ’s are assigned *true* before ’s decision level. The decision level of universal variable is the decision level which the algorithm will backtrack to. Then function add_newentity() performs satisfiability directed learning (line 6). It occurs when the result of deduction is *satisfaction*, which causes a learned entity constructed and added to the database. At last, we decide whether the decision level of variable is 0 or not (line 7). If it is not 0, EHSPQBF will backtrack to the decision level of variable (line 5). The aim of satisfiability directed learning is memorizing the satisfied branch. If search space has the same branch in the further, we can decide the branch is satisfiable directly and go on searching the other branch of the universal variable.

#### 8. Experimental Evaluation

In this section, to test the performance of the solver EHSPQBF, three algorithms are compared. Our solver EHSPQBF is written in C++. All experiments are carried out on a DELL PowerEdge 2650 computer with 2 Intel Xeon 2.00 GHz CPU and 1G RAM running RedHat ES3.0. Table 1 presents the results of the comparisons of the solvers. In the table, EHSPQBF-HBR is the solver that removes the hyperbinary resolution rule from EHSPQBF; EHSPQBF-EQR is the solver that removes the equality reduction rule from EHSPQBF. All instances are generated by a random generator. (3, 60, 80, 5, 0) denotes a formula indexing 0 that contains 3 quantification levels, 60 variables, 80 clauses, and each clause length is not more than 5.

From the results of the EHSPQBF, we can see that both hyperbinary resolution rule and equality reduction rule contribute much compared with the results of EHSPQBF-EQR and EHSPQBF-HBR. Consequently the run-time of the algorithms decreases. Therefore, by introducing the hyperbinary resolution rule and equality reduction rule, EHSPQBF algorithm increases the efficiency for solving QBF problem.

#### 9. Conclusions

In this paper, we present a novel QBF solver EHSPQBF. In preprocessing, we adopt the equality reduction and the hyperbinary resolution to simplify the formulae. When choosing branches, the system uses survey propagation to select next branch; when handling branches, the system employs conflict reasoning and conflict driven learning as well as satisfiability directed learning together. Experimental results show that, as a heuristic, SP can choose branches effectively. And other techniques such as conflict driven learning also speed up the solving process. As a whole, EHSPQBF is an efficient QBF solver.

#### Acknowledgments

This work was fully supported by the National Natural Science Foundation of China (Grant nos. 11226275, 61103136, and 61070084), the Fundamental Research Funds for the Central Universities (Grant no. 11QNJJ006), the Ministry of Education (Grant no. 20120043120017), the Postdoctoral Science Foundation of China (2012M520658), and the opening fund of top key discipline of computer software and theory in Zhejiang provincial colleges at Zhejiang Normal University (Grant no. ZSDZZZZXK37).

#### References

- J. Rintanen, “Asymptotically optimal encodings of conformant planning in QBF,” in
*Proceedings of the 22nd AAAI Conference on Artificial Intelligence*, pp. 1045–1050, July 2007. View at Scopus - P. Marin, C. Miller, and B. Becker, “Incremental QBF preprocessing for partial design verification,” in
*Proceeding of the 15th International Conference of Theory and Applications of Satisfiability Testing*, pp. 473–474, 2012. - U. Egly, T. Eiter, H. Tompits, and S. Woltran, “Solving advanced reasoning tasks using quantified Boolean formulas,” in
*Proceeding of the 12th AAAI Conference on Artificial Intelligence*, pp. 417–422, 2000. - G. Pan and M. Y. Vardi, “Optimizing a BDD-based modal solver,” in
*Proceedings of the 19th International Conference on Automated Deduction*, pp. 75–89, August 2003. View at Scopus - I. P. Gent, H. H. Hoos, A. G. D. Rowley, and K. Smyth, “Using stochastic local search to solve quantified Boolean formulae,” in
*Proceeding of the Principles and Practice of Constraint Programming*, pp. 348–362, 2003. - I. Gent, E. Giunchiglia, M. Narizzano, A. Rowley, and A. Tachella, “Watched data structures for QBF solvers,” in
*Proceeding of the 6th International Conference on Theory and Applications of Satisfiability Testing*, pp. 348–355, 2003. - E. Giunchiglia, M. Narizzano, and A. Tacchella, “QuBE: a system for deciding quantified Boolean formulas satisfiability,” in
*Proceeding of the 17th International Joint Conference on Artificial Intelligence*, pp. 18–23, 2001. - J. Rintanen, “Partial implicit unfolding in the Davis Putnam procedure for quantified Boolean formulae,” in
*Proceeding of the 8th International Conference on Logic for Programming, Artificial Intelligence and Reasoning*, pp. 362–376, 2001. - L. Zhang and S. Malik, “Towards a symmetric treatment of satisfaction and conflicts in quantified Boolean formula evaluation,” in
*Proceeding of the Principles and Practice of Constraint Programming*, pp. 200–215, 2002. - F. Bacchus, “Enhancing Davis Putnam with extended binary clause reasoning,” in
*Proceedings of the 18th National Conference on Artificial Intelligence (AAAI '02)*, pp. 613–619, August 2002. View at Scopus - M. Mézard, G. Parisi, and R. Zecchina, “Analytic and algorithmic solution of random satisfiability problems,”
*Science*, vol. 297, no. 5582, pp. 812–815, 2002. View at Publisher · View at Google Scholar · View at Scopus