1. Boolean satisfiability - Are we asking the wrong question?
Arijit Gupta
Introduction
Satisfiability probability and runtime
Boolean satisfiability lies at the very heart of the famous
P vs NP problem. It was the first problem shown to be
NP-complete, i.e. it lies in the complexity class NP (a
solution of it can be checked in time polynomial in the
input size) and every other NP-problem can be reduced
to it in polynomial time. This was a a milestone as many
other problems could be shown to be NP-complete by
reducing SAT to them.[6] Also, it is a very thoroughly
studied problem because it is highly relevant in areas
as diverse as circuit design, operations research[3] and
software verification[4].
For 2-SAT, 3-SAT and 4-SAT, we plotted the clause density α against the probability P
that a random formula is satisfiable. For 3-SAT, we additionally plotted α against the
runtime (measured as the number of recursive calls) of the DPLL algorithm. We implemented this in Python using the scipy and matplotlib packages. DPLL (from its inventors, Davis-Putnam-Logemann-Loveland) is based on determinate simplification of the
whole Boolean formula as well as indeterminate "guessing" of variable assignments and
backtracking when necessary. So it is essentially a search algorithm.[3] Due to limited
computing facilities, we only considered a relatively small number of variables and only
100 (50 for 4-SAT) instances of a Boolean formula with fixed density. In particular, the
curves are really much smoother and monotone.[2] The DP (Davis-Putnam) algorithm
was the precursor to DPLL and, while also utilising trivial simplification steps, does
not deploy search but rather logical resolution, so it is fully determinate. However, it is
considerably slower than DPLL.
(Random) k-SAT
Consider Boolean variables x1 , x2 , · · · , xn and a formula
of the form
m
k
lij
i=1
We observe that 2-SAT has a discontinuous "phase transition" at α = 1, which has been
proved rigorously.[1] More interesting is 3-SAT, which seems to have a discontinuous
phase 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 see
that the runtime peaks around the critical value of α. So do the instances that lie
around α make 3-SAT "hard" and intractable? This is indeed the case (and note that
we can observe the same qualitative behaviour for every other k-SAT problem where
k ≥ 3[7]).
j=1
where the lij are literals of the form xij or xij . This is a kSAT Boolean formula. We call the expression in parentheses a clause and note that the formula evaluates to
true 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 set
x1 and x2 to true, x3 to false. In general, we are interested in the question whether there exists an assignment
of true/false values to the variables such that the whole
Boolean formula is true.
A particularly interesting ensemble of k-SAT problems
is random k-SAT. An instance is generated by first fixing
the number of variables n and the number of clauses m
and setting α = m . Then for each clause, pick k out
n
of the n variables at random (without replacement) and
negate each one with probability 0.5. It turns out that
2-SAT is in P, i.e. it can be solved in time polynomial in
the input size n, where we require that m is polynomial
in n. On the other hand, k-SAT is NP-complete for all
k ≥ 3.[5][6]
References
[1]
A.Zweig et al. What makes a phase transition? Analysis of the random satisfiability problem. Physica A
389 1501-1511, 2010.
[2]
E.Lee, J.Roychowdhury, S.Seshia. Fundamental Algorithms for System Modeling, Analysis, and Optimization. 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. Science
264:1297-1301, 1994.
A toy model for 3-SAT[1]
Approximate the average number of solutions of a 3-SAT problem as < s >= 2n f m ,
0.875 + 0.009 ∗ α
if α < 3.8
where f ∼ Normal(µ, 0.0585 ∗ α) with µ =
unless µ < 0 [µ > 1], when we set µ to 0 [1].
0.875 + 0.170 ∗ α
if α ≥ 3.8
We then say that a particular 3-SAT formula is unsatisfiable iff < s >< 1. The intuition behind this model is that from the total
1
of 2n possible assignments, each newly added clause removes about 8 of the remaining solutions. This model exhibits the same
qualitative behaviour as the real 3-SAT problem and also yields a non-negligible gap between the values of α. Note that the average
number of solutions does not display any phase transition at all and that the probability of satisfiability can be fitted by a lognormal
distribution. The toy model is evidence for the claim that 3-SAT does not display a real phase transition, but only a trivial threshold
phenomenon, induced by a mere statistical event. So Zweig et al. propose that instead of examining an existence parameter (is there a
satisfying assignment to x1 , · · · , xn ?), investigating the quantitative parameter of the number of solutions of a particular 3-SAT instance
is much more appropriate and natural. Their provocation consists in claiming that the difference between the existence of exactly 0 or
1 solutions on the one hand and exactly 10 or 11 solutions on the other hand is of the same quality!
Rescaled average number of solutions, following a simple exponential
law closely.[1]
The SAT Association. SAT Basics. gauss.ececs.edu/SAT/articles/sat.pdf, retrieved 15.06.2013.
[4]
Zweig et al. argue that k-SAT does not display a genuine phase transition, where a parameter of the system, independent of the
problem definition, changes. So at α ≈ 4.2, the probability that the formula is satisfiable rapidly drops from 1 to 0, but no other
essential feature changes! After considering the related problem of the total number of satisfying assignments, the average of which
is 1 at α ≈ 5.2, we can ask where this discrepancy between the different values of α derives from.[1]
M.Mézard, A. Montanari. Information, Physics and Computation. Oxford University Press, 2009.
[3]
Really a phase transition?
Satisfiability in the toy model.[1]
Conclusions
k-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 fact
numerical. Finally, albeit concerning computational complexity in nature, this problem relates very smoothly to statistical physics, which is why some of the most efficient SAT
solvers 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 very
blurry 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]