Sat

1

Click here to load reader

Transcript of Sat

Page 1: Sat

Booleansatisfiability -Areweasking thewrongquestion?Arijit Gupta

IntroductionBoolean satisfiability lies at the very heart of the famousP vs NP problem. It was the first problem shown to beNP-complete, i.e. it lies in the complexity class NP (asolution of it can be checked in time polynomial in theinput size) and every other NP-problem can be reducedto it in polynomial time. This was a a milestone as manyother problems could be shown to be NP-complete byreducing SAT to them.[6] Also, it is a very thoroughlystudied problem because it is highly relevant in areasas diverse as circuit design, operations research[3] andsoftware verification[4].

(Random) k-SATConsider Boolean variables x1, x2, · · · , xn and a formulaof the form

m∧i=1

k∨j=1

lij

where the lij are literals of the form xij or xij . This is a k-SAT Boolean formula. We call the expression in paren-theses a clause and note that the formula evaluates totrue iff all of its clauses are true. For example,

(x1 ∨ x3) ∧ (x2 ∨ x3) ∧ (x2 ∨ x3)

is a satisfiable 3-variable instance of 2-SAT as we can setx1 and x2 to true, x3 to false. In general, we are inter-ested in the question whether there exists an assignmentof true/false values to the variables such that the wholeBoolean formula is true.A particularly interesting ensemble of k-SAT problemsis random k-SAT. An instance is generated by first fixingthe number of variables n and the number of clauses mand setting α = m

n . Then for each clause, pick k outof the n variables at random (without replacement) andnegate each one with probability 0.5. It turns out that2-SAT is in P, i.e. it can be solved in time polynomial inthe input size n, where we require that m is polynomialin n. On the other hand, k-SAT is NP-complete for allk ≥ 3.[5][6]

Satisfiability probability and runtime

For 2-SAT, 3-SAT and 4-SAT, we plotted the clause density α against the probability Pthat a random formula is satisfiable. For 3-SAT, we additionally plotted α against theruntime (measured as the number of recursive calls) of the DPLL algorithm. We imple-mented this in Python using the scipy and matplotlib packages. DPLL (from its inven-tors, Davis-Putnam-Logemann-Loveland) is based on determinate simplification of thewhole Boolean formula as well as indeterminate "guessing" of variable assignments andbacktracking when necessary. So it is essentially a search algorithm.[3] Due to limitedcomputing facilities, we only considered a relatively small number of variables and only100 (50 for 4-SAT) instances of a Boolean formula with fixed density. In particular, thecurves are really much smoother and monotone.[2] The DP (Davis-Putnam) algorithmwas the precursor to DPLL and, while also utilising trivial simplification steps, doesnot deploy search but rather logical resolution, so it is fully determinate. However, it isconsiderably slower than DPLL.We observe that 2-SAT has a discontinuous "phase transition" at α = 1, which has beenproved rigorously.[1] More interesting is 3-SAT, which seems to have a discontinuousphase transition at α ≈ 4.2. This more involved conjecture has not been proved yet.[1]Comparing the runtime of DPLL with the probability that 3-SAT is satisfiable, we seethat the runtime peaks around the critical value of α. So do the instances that liearound α make 3-SAT "hard" and intractable? This is indeed the case (and note thatwe can observe the same qualitative behaviour for every other k-SAT problem wherek ≥ 3[7]).

Really a phase transition?

Zweig et al. argue that k-SAT does not display a genuine phase transition, where a parameter of the system, independent of theproblem definition, changes. So at α ≈ 4.2, the probability that the formula is satisfiable rapidly drops from 1 to 0, but no otheressential feature changes! After considering the related problem of the total number of satisfying assignments, the average of whichis 1 at α ≈ 5.2, we can ask where this discrepancy between the different values of α derives from.[1]

A toy model for 3-SAT[1]Approximate the average number of solutions of a 3-SAT problem as < s >= 2nfm,

where f ∼ Normal(µ, 0.0585 ∗ α) with µ =

{0.875 + 0.009 ∗ α if α < 3.80.875 + 0.170 ∗ α if α ≥ 3.8

unless µ < 0 [µ > 1], when we set µ to 0 [1].

We then say that a particular 3-SAT formula is unsatisfiable iff < s >< 1. The intuition behind this model is that from the totalof 2n possible assignments, each newly added clause removes about 1

8 of the remaining solutions. This model exhibits the samequalitative behaviour as the real 3-SAT problem and also yields a non-negligible gap between the values of α. Note that the averagenumber of solutions does not display any phase transition at all and that the probability of satisfiability can be fitted by a lognormaldistribution. The toy model is evidence for the claim that 3-SAT does not display a real phase transition, but only a trivial thresholdphenomenon, induced by a mere statistical event. So Zweig et al. propose that instead of examining an existence parameter (is there asatisfying assignment to x1, · · · , xn?), investigating the quantitative parameter of the number of solutions of a particular 3-SAT instanceis much more appropriate and natural. Their provocation consists in claiming that the difference between the existence of exactly 0 or1 solutions on the one hand and exactly 10 or 11 solutions on the other hand is of the same quality!

Rescaled average number of solu-tions, following a simple exponentiallaw closely.[1]

Satisfiability in the toy model.[1]

Conclusionsk-SAT’s non-trivial nature explains in part why the fastest algorithms that approximate the probability of a random k-SAT formula of fixed m, n to be satisfiable are in factnumerical. Finally, albeit concerning computational complexity in nature, this problem relates very smoothly to statistical physics, which is why some of the most efficient SATsolvers nowadays use methods invented by scientists working in statistical mechanics.[1] We also observe that the usage of the notion of a "phase transition" is currently veryblurry and should be clarified because it is not at all clear that the threshold in 3-SAT is not mainly induced by the law of large numbers.[1]

References[1] A.Zweig et al. What makes a phase transition? Analysis of the random satisfiability problem. Physica A

389 1501-1511, 2010.

[2] M.Mézard, A. Montanari. Information, Physics and Computation. Oxford University Press, 2009.

[3] The SAT Association. SAT Basics. gauss.ececs.edu/SAT/articles/sat.pdf, retrieved 15.06.2013.

[4] E.Lee, J.Roychowdhury, S.Seshia. Fundamental Algorithms for System Modeling, Analysis, and Optimiza-tion. embedded.eecs.berkeley.edu/eecsx44/fall2011/lectures/SATsolving.pdf, retrieved 15.06.2013.

[5] J.Sethna. Statistical Mechanics: Entropy, Order Parameters and Complexity. Oxford University Press, 2006.

[6] S.Wernicke. Introduction to Theoretical Computer Science. Udacity.com, retrieved 15.06.2013.

[7] S. Kirkpatrick, B. Selman. Critical behavior in the satisfiability of random boolean formulae. Science264:1297-1301, 1994.