Presentation is loading. Please wait.

Presentation is loading. Please wait.

Solving Non-clausal Formulas with DPLL search

Similar presentations


Presentation on theme: "Solving Non-clausal Formulas with DPLL search"— Presentation transcript:

1 Solving Non-clausal Formulas with DPLL search
Christian Thiffault Fahiem Bacchus University of Toronto URL for the location of these slides. Toby Walsh UNSW

2 CNF The classical DPLL algorithm (most modern SAT solvers) work with Conjunctive Normal Form (CNF) However, CNF is not the most natural representation. Hence, to use modern SAT solver technology problems must be converted to CNF In this work we demonstrate that such a conversion is unnecessary. For a number of reasons such a conversion is also undesirable. We demonstrate that original structure lost in conversion can be utilized to significantly improve the performance of SAT solvers. 6/25/2019 NCDPLL SAT 2004

3 Tseitin Encodings The most commonly used CNF encoding is the Tseitin encoding [Tseitin 1970]. This encoding converts a propositional formula recursively by adding a new variable for every subformula. 6/25/2019 NCDPLL SAT 2004

4 Tseitin Encodings A → (C & D) V1 ≡ (C & D) (~V1, C) (~V1, D)
(~V1, C), (~V1, D), (~C,~D,V1) (~V1, C) (~V1, D) (~C,~D,V1) 6/25/2019 NCDPLL SAT 2004

5 Tseitin Encodings A → (C & D) V1 ≡ (C & D) V2 ≡ (A → V1) (~V1, C)
(~V1, C), (~V1, D), (~C,~D,V1) V2 ≡ (A → V1) (~V2, ~A,V1), (A,V2), (~V1,V2) (~V1, C) (~V1, D) (~C,~D,V1) 4. (~V2, ~A,V1) 5. (A,V2) 6. (~V1,V2) 6/25/2019 NCDPLL SAT 2004

6 Tseitin Encodings A → (C & D) V1 ≡ (C & D) V2 ≡ (A → V1)
(~V1, C), (~V1, D), (~C,~D,V1) V2 ≡ (A → V1) (~V2, ~A,V1), (A,V2), (V1,V2) The formula must be true: (V2) (~V1, C) (~V1, D) (~C,~D,V1) 4. (~V2, ~A,V1) 5. (A,V2) 6. (V1,V2) 7. (V2) 6/25/2019 NCDPLL SAT 2004

7 Converting to CNF is Undesirable
There are two obvious problems arising from this conversion. Structural information is lost The fact that a particular group of clauses were generated from the same subformula is lost. The global interconnections between the various subformulas are lost. Additional variables are added. This potentially increases the size of the DPLL search. 6/25/2019 NCDPLL SAT 2004

8 Structural Information
Some of this information could be recovered from the CNF encoding, but not all of it [Lang & Marquis, 1989]. There is good empirical evidence that recovering structural information can yield considerable benefits in solving performance. [EqSatZ, LSAT]. But why lose this information in the first place? We will show conversion to CNF is not necessary. We also develop techniques which confirm the benefits of retaining the original structure. 6/25/2019 NCDPLL SAT 2004

9 Extra Variables Various works have noted the potential difficulty of introducing new variables. Some have suggested restricting the DPLL search so that it cannot branch on any on the newly introduced “subformula” variables. However, it is not difficult to show that restricting branching in this manner causes an exponential slowdown on some problems [Jarvisalo et al. 2004] Solvers that attempt to restrict their branching in this manner can perform very poorly on many problems. 6/25/2019 NCDPLL SAT 2004

10 Extra Variables The alternative is unrestricted branching.
However, with unrestricted branching a CNF solver can waste a lot of time branching on variables that have dynamically become irrelevant. 6/25/2019 NCDPLL SAT 2004

11 Irrelevant Variables A=False. A → (C & D) Formula satisfied 6/25/2019
NCDPLL SAT 2004

12 Irrelevant Variables CNF
A → (C & D) V1 ≡ (C & D) V2 ≡ (A → V1) Solver must still determine that the remaining clauses are SAT (~V1, C) (~V1, D) (~C,~D,V1) 4. (~V2, ~A,V1) 5. (A,V2) 6. (V1,V2) 7. (V2) 8. (~A) 6/25/2019 NCDPLL SAT 2004

13 Converting to CNF is Unnecessary
DPLL search can be performed on the original formula. This has been noted in previous work on circuit based solvers [Ganai et al. 2002] 6/25/2019 NCDPLL SAT 2004

14 DPLL on formulas Convert formula to a dag. A → (C & D) \/ B → (C & D)
6/25/2019 NCDPLL SAT 2004

15 DPLL on formulas Associate a truth value (True/ False/ Unassigned) with every node of the DAG. Now perform DPLL search by splitting on the truth value of an unassigned node. Use the logic of the boolean operators to propagate truth values to neighboring nodes. A solution is found when all nodes have been labeled with consistent truth values (i.e., the parent and child values are consistent with the logic of the parent’s operator.) A contradiction occurs when True and False are propagated to the same node. 6/25/2019 NCDPLL SAT 2004

16 Example \/ B A & C D 6/25/2019 NCDPLL SAT 2004

17 Example \/ B A & C D 6/25/2019 NCDPLL SAT 2004

18 Example \/ B A & C D 6/25/2019 NCDPLL SAT 2004

19 Comparison Assigning a truth value to a node in the DAG is equivalent to assigning a truth value to the corresponding variable in the CNF encoding. Propagation in the DAG is equivalent to unit propagation in the CNF encoding. 6/25/2019 NCDPLL SAT 2004

20 Comparison The rule that propagated a truth value can be recorded. Once a contradiction is detected a conflict clause can be learned (a set of impossible node assignments). This clause can be made equivalent to the 1-UIP clauses learned by CNF solvers. The learned clauses can be stored and used to unit propagate node truth values in the rest of the search. 6/25/2019 NCDPLL SAT 2004

21 Comparison Complex gates, e.g., n-ary XOR can be more efficiently propagated in the DAG representation (these gates require a number of clauses exponential in the number of their inputs). 6/25/2019 NCDPLL SAT 2004

22 Efficient Propagation
Efficient Unit Propagation via lazy data structures is a key element of modern SAT solvers. One new feature of our circuit based solver over previous circuit solvers is that it utilizes similar lazy data structures to make its propagation as efficient as CNF solvers. 6/25/2019 NCDPLL SAT 2004

23 Efficient Propagation
E.g., an AND gate becomes true only when all of its children become true. Assign one child as a true watch, and don’t check for true propagating to the AND gate node unless its true watch becomes true. Some benchmarks have AND gates with thousands of children. Previous “table-lookup” circuit solvers required some computation each time a child became true. Using these techniques there is no intrinsic loss of efficiency in using the DAG over CNF. 6/25/2019 NCDPLL SAT 2004

24 Structure Based Optimizations
Since no penalty is being paid for using the original formula, we can turn to exploiting the extra structural information it provides. We implemented two structure based optimizations. Don’t care propagation to deal with irrelevant variables. Conflict Clause reduction. 6/25/2019 NCDPLL SAT 2004

25 Don’t Care Propagation
We propagate a third “truth” value through the DAG: don’t cares. A node C is don’t care wrt a particular parent P if its truth value can no longer affect the truth value of P nor any of its P siblings. or P is don’t care. A node C is don’t care if it is don’t care wrt to all of its parents. 6/25/2019 NCDPLL SAT 2004

26 Don’t Care Propagation
Assign a don’t care watch parent for each node. C becoming don’t care wrt to its watch parent P can be detected when truth values are propagated to P. If C becomes don’t care wrt to its don’t care watch we look for another watch. If we can’t find one we know that C has become don’t care. Finally, we stop the search from branching on don’t care nodes. This eliminates branching of irrelevant values. 6/25/2019 NCDPLL SAT 2004

27 Conflict Clause Reductions
If one learns a conflict clause (L1,L2,...) and one has L1 → L2, then we can reduce the conflict clause by a resolution step: (-L1,L2) (L1,L2,...)  (L2,...) The resolvant subsumes the original conflict clause. In a CNF encoding one would have to search the clauses to detect this situation—probably not going to be effective. In the DAG one can examine the neighbors of each node assignment in the conflict clause to see if any of the other assignments in the clause are implied by it. If so we can remove the implying node assignment. If this is done with discrimination it can yield a significant decrease in the size of the learned clauses with little overhead. 6/25/2019 NCDPLL SAT 2004

28 Empirical Results. We compared with Zchaff.
Tried to make the two solvers as close as possible, same magic numbers (e.g., clause database cleanup criteria, restart intervals etc.), same branching heuristics. Hence, we tried to isolate the impact of the non-clausal representation and the structure based optimizations. We believe that the same improvements could be obtained with others CNF solvers via this technique. 6/25/2019 NCDPLL SAT 2004

29 Empirical Results caveats
Our experiments were hampered by a lack of non-clausal benchmarks. The performance of our solver was also limited by the fact that the benchmarks we did obtain has already been transformed into simpler formulas, e.g., no complex XOR of IFF gates were present in the benchmarks. 6/25/2019 NCDPLL SAT 2004

30 FVP-UNSAT-2.0 (Velev) Time
6/25/2019 NCDPLL SAT 2004

31 FVP-UNSAT-2.0 Decisions 6/25/2019 NCDPLL SAT 2004

32 FVP-UNSAT-2.0 Don’t Cares
6/25/2019 NCDPLL SAT 2004

33 FVP-UNSAT-2.0 Clause Reduction
6/25/2019 NCDPLL SAT 2004

34 Other Series 6/25/2019 NCDPLL SAT 2004

35 Conclusions No intrinsic reason to convert to CNF.
Many other structure based optimizations remain to be investigated, e.g. better branching non-clausal representation of conflicts more complex gates. 6/25/2019 NCDPLL SAT 2004


Download ppt "Solving Non-clausal Formulas with DPLL search"

Similar presentations


Ads by Google