Graph Based Representations SAT Solving for Non-clausal Formulas
Ruiyun Xie and Benzhai Hai
Xie R., Hai B. (2012) Graph Based Representations SAT Solving for Non-clausal Formulas. In: Jin D., Lin S. (eds) Advances in Electronic Commerce, Web Application and Communication. Advances in Intelligent and Soft Computing, vol 149. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-28658-2_2
Efficient SAT Solving for Non-Clausal Formulas Using DPLL, Graphs, and Watched Cuts
Himanshu Jain Edmund M. Clarke
Himanshu Jain, Edmund M. Clarke: Efficient SAT solving for non-clausal formulas using DPLL, graphs, and watched cuts. DAC 2009: 563-568
Abstract.
Boolean satisfiability (SAT) solvers are used heavily in hardware and We represent the vhpform of a given NNF formula in the form of two graphs called vpgraph and hpgraph. 译文:我们用vpgraph和hpgraph这两个图来表示给定NNF公式的vhpform。
The input formula is translated into a 2-dimensional format called vertical-horizontal path form (vhpform). In this form disjuncts (operands of ∨) are arranged orizontally and conjuncts (operands of ∧) are arranged 译文:在这种形式中,析取(∨的操作数)水平排列,合取(∧的操作数)垂直排列。 The formula is satisfiable if and only if there exists a vertical path through this arrangement that does not contain two opposite literals ( l and ¬l). 译文:当且仅当存在一条垂直路径通过这种布局时,公式是可满足的。
The input formula is not required to be in CNF. |
|
Keywords: SAT, NNF, DPLL.
1 Introduction
The Boolean satisfiability (SAT) problem decides whether a given Boolean formula is satisfiable or unsatisfiable. The SAT problem is of central importance in various areas of computer science, including theoretical computer science, hardware and software verification, and artificial intelligence. The SAT problem is NP-complete [1] and no provably efficient algorithms are known for it. Most state-of-the-art SAT procedures are variations of the Davis-Putnam-Logemann-Loveland (DPLL) algorithm and require theinput formula to be in conjunctive normal form (CNF). The design and implementation of SAT solvers becomes much easier if the input formulas are restricted to CNF. Given a truth assignment s to a subset of variables occurring in a formula, a Boolean constraint propagation (BCP) algorithm determines if s falsifies the given formula, else it provides the set of implied assignments (unit literals). Modern SAT solvers spend about 80%-90% of the total time during the BCP steps. For formulas in CNF, BCP can be carried out very efficiently using the two-watched literal scheme [2]. |
|
Typical formulas generated by the industrial applications are not necessarily in CNF.We refer to these formulas as non-clausal formulas.译文:我们把这些公式称为非子句公式。 In order to check the satisfiability of a non-clausal formula f using a CNF based SAT solver, f needs to be converted to CNF. This is done by introducing new variables [4, 3]. The result is a CNF formula f0 which is equi-satisfiable to f and is polynomial in the size of f. This is the most common way of converting f to a CNF formula. Conversion of a non-clausal formula to a CNF formula destroys the initial structure of the formula,which can be crucial for efficient satisfiability checking. The advantage of introducing new variables to convert f to f ' is that it can allow for an exponentially shorter proof than is possible by completely avoiding the introduction of new variables [5]. However, the translation from f to f ' also introduces a large number of new variables and clauses, which can potentially increase the overhead during the BCP steps and make the decision heuristics less effective. In order to reduce this overhead modern CNF SAT solvers use pre-processing techniques that try to eliminate certain variables and clauses [6]. The disadvantage with pre-processing is that it does not always lead to improvement in the SAT solver performance. It can also fail on large examples due to significant memory overhead. |
|
We propose a new SAT solving framework based on a representation known as vertical-horizontal path form (vhpform) due to Peter Andrews [7, 8]. The vhpform is a two-dimensional representation of formulas in NNF. We represent the vhpform of a given NNF formula in the form of two graphs called vpgraph and hpgraph.译文:我们用vpgraph和hpgraph这两个图来表示给定NNF公式的vhpform。 The vpgraph encodes the disjunctive normal form and the hpgraph encodes the conjunctive normal form of a given NNF formula.译文:vpgraph编码析取范式,hpgraph编码给定NNF公式的合取范式。 The size of these graphs is linear in the size of the given formula. |
|
2 Preliminaries
A Boolean formula is in negation normal form (NNF) iff it contains only the Boolean connectives "∧" (.AND.), "∨" (.OR.) and"¬" (.NOT.), and the scope of each occurrence of "¬ "is a Boolean variable. We also require that there is no structure sharing in a NNF formula, that is, output from a gate acts as input to at most one gate. A NNF formula is tree-like, while a circuit can be DAG-like.译文:NNF公式是树状的,而电路可以是dag状的。 |
|
Conversion of Boolean Circuits to NNF | |
In our work Boolean circuits are converted to NNF formulas in two stages. The first In order to avoid a blowup in the size of the resulting formula we The second stage gets rid of the structure sharing in order to obtain a NNF formula. |
|
Vertical-Horizontal Path | |
It is known that every propositional formula is equivalent to a formula in NNF.译文:众所周知,在NNF中,每个命题公式等价于一个公式。
More specifically, we use a two-dimensional format of a nnf formula, called a vertical-horizontal path form (vhpform) as described in [9].译文:更具体地说,我们使用nnf公式的二维格式,称为垂直-水平路径形式(vhpform),如[9]中所述。 In this form disjunctions are written horizontally and conjunctions are written vertically.译文:这种形式的析取词是横着写的,连词是竖着写的。 For example Fig. 1(a) shows the formula f= (((p ∨¬r ) ∧¬q ∧r) ∨ (q ∧ (p ∨ ¬s) ∧¬p)) in vhpform. |
|
Vertical path |
|
A vertical path through a vhpform is a sequence of literals in the vhpform that results by choosing either the left or the right scope for each occurrence of ∨. For the vhpform in Fig. 1(a) the set of vertical paths is {<p, ¬q, r>,<¬r, ¬q, r >,< q, p, ¬p >,< q, ¬s , ¬p >}. | |
Horizontal path | |
A horizontal path through a vhpform is a sequence of literals in the vhpform that results by choosing either the left or the right scope for each occurrence of ∧. For the vhpform in Fig. 1(a) the set of horizontal paths is {<p, ¬r,q>, <p, ¬r, p,¬s>, <p, ¬r, ¬p>, <¬q,q>, ,<¬q, p,¬s>, <¬q, ¬p >, <r,q>, <q, p,¬s>,<r, ¬p>} The following are two important results regarding satisfiability of negation normal formulas from [2]. Let F be a formula in negation normal form and let σ be an assignment (σ can be a partial truth assignment). |
|
Theorem 1. s satisfies F iff there exists a vertical path P in the vhpform of F such that |
|
Theorem 2. s falsifies F iff there exists a horizontal path P in the vhpform of F such |
|
Example 1. The vhpform in Fig. 2.1 has a vertical path <p,¬q,r> whose every literal |
|
3 Graph Based Representations
3.1 Graphical Encoding of Vertical Paths (Vpgraph)
A graph containing all vertical paths present in the vhpform of a NNF formula is called a vpgraph. Given a NNF formula f, we define the vpgraph Gv(f) as a tuple (V,R,L,E,Lit), where V is the set of nodes corresponding to all occurrences of literals in f, RV is a set of root nodes, LV is a set of leaf nodes, E⊆V ×V is the set of edges, and Lit(n) denotes the literal associated with node nV. A node nR has no incoming edges and a node nL has no outgoing edges. |
|
The vpgraph containing all vertical paths in the vhpform of Fig. 3.1(a) is shown in Fig. 3.1(b). For the vpgraph in Fig. 3.1(b), we have V ={1,2,3,4,5,6,7,8},R = {1,2,5},L = {4,8}, E = {(1,3), (2,3), (3,4), (5,6), (5,7), (6,8), (7,8)} and for each nV, Lit(n) is shown inside the node labeled n in Fig. 3.1(b). Each path in the vpgraph Gv(f), starting from a root node and ending at a leaf node, corresponds to a vertical path in the vhpform of f. For example, path <1,3,4> in Fig.3.1(b) corresponds to the vertical path <p, ¬q, r>in Fig. 3.1(a) (obtained by replacing node n on path by Lit(n)). |
|
3.2 Graphical Encoding of Horizontal Paths (Hpgraph)
A graph containing all horizontal paths present in the vhpform of a NNF formula is called a hpgraph. We use Gh(f) to denote the hpgraph of a formula f. The procedure for constructing a hpgraph is similar to the above procedure for constructing the vpgraph. The difference is that the hpgraph for f = f1f2 is obtained by taking the union of the hpgraphs for f1 and f2 and the hpgraph for f = f1f2 is obtained by concatenating the hpgraphs of f1 and f2. |
|
The hpgraph containing all horizontal paths in the vhpform in Fig.3.2(a) is shown in Fig. 3.2(b). For the hpgraph in Fig. 3.2(b), we have V ={1,2,3,4,5,6,7,8}, R={1,3,4}, L={5,7,8}, E ={(1,2), (2,5), (2,6), (2,8), (3,5), (3,6), (3,8), (4,5), (4,6), (4,8), (6,7)} and for each nV, Lit(n) is shown inside the node labeled n. |
|
It can be shown by induction that the vpgraph and hpgraph of a NNF formula are directed acyclic graphs (DAGs).有向无环图 One can also represent vpgraph and hpgraph as directed series-parallel graphs. Series-parallel graphs have been widely studied and many problems that are NP-complete for general graphs can be solved in linear time for series-parallel graphs [10].译文:串并联图得到了广泛的研究,许多一般图的np完全问题在串并联图的线性时间内都能得到解决。 |
|
When constructing an hpgraph/vpgraph from a NNF formula f each literal inf gets represented as a new node in the hpgraph and vpgraph of f.译文:当从NNF公式f构建hpgraph/vpgraph时,每个字面inf都被表示为f的hpgraph和vpgraph中的一个新节点。 We assume that the node number corresponding to each literal l in f is the same in the hpgraph and the vpgraph of f.译文:我们假设f中每个字面值l对应的节点号在hpgraph和f的vpgraph中是相同的。 Thus, the set of nodes in the hpgraph and vpgraph are identical.译文:因此,hpgraph和vpgraph中的节点集是相同的。 |
|
4 Conclusions
We presented a two-dimensional representation of NNF formulas called vertical horizontal path form (vhpform).译文:NNF公式的二维表示称为垂直水平路径形式(vhpform) The vhpform of an NNF formula contains vertical and horizontal paths. A vertical path is like a cube (term) in the DNF representation of a given formula, while a horizontal path is like a clause in the CNF representation of a given formula. 译文:在DNF表示的给定公式中,垂直路径就像一个立方体(项)。 译文:水平路径就像给定公式的CNF表示中的一个子句。
The vpgraph encodes all vertical paths and the hpgraph encodes all Both vpgraph and hpgraph can be obtained in linear time in the size The NNF of formula is usually more succinct than the (pre-processed) CNF of the circuit in terms of number of variables.译文:在变量数量方面,公式的NNF通常比(预处理的)电路的CNF更简洁。 |
|
References
1. Cook, S.A.: The complexity of theorem-proving procedures. In: STOC, pp. 151–158 (1971),
|
|
Efficient SAT Solving for Non-Clausal Formulas Using DPLL, Graphs, and Watched Cuts
ABSTRACT
Boolean satisability (SAT) solvers are used heavily in hardware and software verication tools for checking satisability of Boolean formulas. Most state-of-the-art SAT solvers are based on the Davis-Putnam-Logemann-Loveland (DPLL) algorithm and require the input formula to be in conjunctive normal form (CNF). We present a new SAT solver that operates on the negation normal form (NNF) of the given Boolean formulas/circuits. The NNF of a formula is usually more succinct than the CNF of the formula in terms of the number of variables. |
|
Our algorithm applies the DPLL algorithm to the graph-based representations of NNF formulas. We adapt the idea of the two-watched-literal scheme from CNF SAT solvers in order to efciently carry out Boolean Constraint Propagation (BCP), a key task in the DPLL algorithm. We evaluate the new solver on a large collection of Boolean circuit benchmarks obtained from formal verification problems. The new solver outperforms the top solvers of the SAT 2007 competition and SAT-Race 2008 in terms of run time on a large majority of the benchmarks. |
|
Keywords:
Boolean Satisability, Verification, DPLL, NNF
1. INTRODUCTION
The problem of propositional (Boolean) satisability (SAT) is to decide whether a given propositional formula is satisable. This problem is of central importance in hardware and software verication, logic synthesis, automatic test generation, and artificial intelligence.
Typical formulas arising in practice arenot necessarily in CNF. We refer to propositional formulas not in CNF form as non-clausal formulas (Boolean circuits). As argued by Thiffault et al. [20] converting a non-clausal formula to CNF introduces overhead in form of a large number of new variables and may destroy the initial structure of the formula, which can be crucial in efficient satisfiability checking. |
|
Suppose we are given a non-clausal formula f. In order to check |
|
There are two ways of converting f to a CNF formula. The rst way of converting f to a CNF formula is by
Let us denote the CNF formula obtained by expansion of f as CNF(f). For example Note that CNF(f) and f |
|
the disjunctive normal form (DNF) formula 析取范式(DNF) | |
1.1 Our Contributions | |
(1) We present a new SAT solver that checks the satisfiability of a NNF formula f by applying the DPLL algorithm to the hpgraph of f. Our solver also utilizes the vpgraph of f in certain steps of SAT solving. If the input formula/circuit is not in NNF it is first converted to an equi-satisable NNF formula as explained in Section 2. |
|
(2) The most crucial component of our DPLL SAT solver is an efficient Boolean Constraint Propagation (BCP) algorithm on the hpgraph.译文:我们的DPLL SAT求解器最关键的部分是在hpgraph上的一个有效的布尔约束传播(BCP)算法。 We describe an algorithm for performing BCP on hpgraph that adapts the two-watched-literal scheme [18] found in CNF SAT solvers. In particular, a watch in an hpgraph corresponds to a node cut in the hpgraph. By maintaining two node Fig. 1(a) shows two node cuts C1;C2 (possible watches) for a hpgraph. Two node cuts allow watching two
As in CNF SAT solvers non-chronological backtracking is cheap as the node cuts are not updated when backtracking. (Section 3) 译文:在CNF SAT解算器中,非按时间顺序回溯是廉价的,因为回溯时节点切割不会更新. |
|
(3) We show how to update the node cuts (watches) in the hpgraph efficiently by using the vpgraph of the given formula.译文:我们展示了如何利用给定公式的vpgraph有效地更新hpgraph中的节点切线(表)。 We show that a minimal cut in a hpgraph corresponds to a path in the corresponding vpgraph. Thus, finding a small node cut in an hpgraph corresponds to nding a path in the corresponding vpgraph.
|
|
(4) We have carefully implemented these ideas in a non-clausal SAT solver. We evaluate the solver on 2541 non-clausal benchmarks obtained from publicly available sources. Our solver outperforms the top SAT solvers of the SAT 2007 competition and SAT-Race 2008 in terms of runtime. (Section 5) |
|
RelatedWork: | |
Most state-of-the-art SAT procedures are based on DPLL search and require the input formula to be in CNF [3, 4, 5, 17, 18, 13, 11, 19, 8]. There has been work on applying DPLL directly to circuit [12, 16, 20] representations. In [12] a hybrid SAT solver is described where the original formula is processed in circuit form, and learned clauses are processed separately in CNF.
Unlike existing circuit SAT solvers our SAT solver does not operate on the circuit representation directly. In our approach a given formula/circuit is converted to an equi-satisfiable NNF formula. The NNF formula is then represented in the form of two graphs called the vpgraph and hpgraph. These graphs are used in our SAT algorithms. Jain et al. [15] use a vpgraph/hpgraph This work uses the vpgraph/hpgraph in a DPLL-based SAT solver. In our unreported experiments we found the solver in [15] to have poor performance on the benchmarks we consider in this paper. 译文:这项工作使用vpgraph/hpgraph在一个基于dpll的SAT求解器。在我们未报告的实验中,我们发现[15]中的求解器在本文考虑的基准测试中性能较差。 A technical report version of this paper with proofs can be found in the chapters 2 and 4 of [14]. |
2. PRELIMINARIES
A Boolean formula is in negation normal form (NNF) iff it contains We also require that there is no structure sharing in a NNF
|
|
Conversion of Boolean Circuits to NNF:
|
|
Obtaining the hpgraph and vpgraph from a given NNF formula: |
|
In the subsequent sections we assume that the input Boolean circuit has been converted to a NNF formula. Given a NNF formula four SAT algorithms check the satisability of f without introducing any more new variables. We use the work by Andrews [7] and Jain et al. [15] in order to represent the NNF formula in form of Jain et al. [14, 15] present a recursive (linear time) procedure for obtaining the hpgraph and vpgraph from a given NNF formula. |
|
|
|
7. REFERENCES
[1] AIGER, http://fmv.jku.at/aiger. |
|