# CMU Randomized Algorithms

Randomized Algorithms, Carnegie Mellon: Spring 2011

## Another Algorithm for SAT

BTW, when solving HW#1 Problem #2, it may be interesting to try solve the problem for -SAT. The algorithm remains the same, and you should be able to show a success probability of approximately . As a sanity check, for this is again .

So here’s a different randomized algorithm to solve -SAT in less than time. This one is from a paper titled Satisfiability Coding Lemma due to Ramamohan Paturi, Pavel Pudlak and Francis Zane. Hence, we’ll call this the PPZ algorithm.

Pick a random permutation on the variables. Pick a uniformly random “start” assignment for the variables. Now consider the variables in the order , and do the following:

If the current variable is the only remaining variable for some clause, set it to satisfy that clause. (If occurs positively in some clause and negatively in some other clause, you can abort the process at this point.) If the current variable only occurs in clauses with more than one variable, set it equal to .

Now, setting this variable to or will cause some clauses to be satisfied: remove these clauses. In other clauses, this variable will just disappear. E.g., if a clause was and we set to , then the new clause will just be . Do all these simplifications, and then go on to the next variable.

That’s it. To recap, we just pick a random variable, if it is forced (due to some clause of length ), set it to the forced value, else set it randomly. Continue until we have a complete assignment.

A theorem due to PPZ says:

Theorem 1

Given a satisfying -SAT formula, the probability that this algorithm finds a satisfying assignment is at least .

Hence for , this gives an algorithm with expected running time approximately . Not quite as good as Sch\”{o}ning’s algorithm, but not too bad! And the proof is also very clean. In this post we’ll just consider the case where there is a unique satisfying assignment . (The general case is not much harder, see Section~4.1 in the PPZ paper.)

So yeah, there’s a unique satisfying assignment . This means that for every variable , changing the value of to will give us an unsatisfying assignment, and some clause will complain because it is not satisfied any more; if there are several, pick any one. Call this a critical clause for variable , and name it . OK, variables, each with its very own critical clause.

Why these critical clauses? Suppose in the clause , we’ve set the other variables to be the same as in . Then the only way to satisfy will be to also set equal to . And, if it turns out that in the random order we’re considering the variables, if came after all the other variables in , this is precisely what the PPZ algorithm will do! Indeed, it will not have to make a random choice for : our hand will be forced to choose .

So suppose for a random permutation, call a variable *lucky* if among the variables in their critical clause, places last in the ordering . And be the set of lucky variables for permutation . Then, assuming that we lucked out and chose for all the variables , the algorithm will certainly also set to . So, for the permutation , the chance (over the choice of ) that we find the satisfying assignment is .

Finally, what is , the expectation taken over random permutations ? Rewriting, it is . By convexity, the numerator is at least . And what is the expectation? See, there are variables. Each one has a chance to be lucky and placed last in its critical clause, and so the expected size of is . So our success probability is at least , proving the theorem for the unique assignment case.

A couple of notes: Firstly, you can think of the PPZ algorithm as a randomized non-backtracking Davis-Putnam procedure. You’ll probably hear about DPLL algorithms (named after Martin Davis, Hilary Putnam, George Logemann, and Donald Loveland) sooner or later, if you haven’t already; so if you’re interested, check out these notes by Satish Rao.

Secondly, the PPZ algorithm can be improved. After their paper, Paturi, Pudlak and Zane teamed up with Mike Saks to give us the PPSZ paper (here, here). Their new algorithm first does some simple preprocessing (a few steps of resolution, since you ask), and then runs the PPZ algorithm. The new PPSZ analysis beats Sch\”{o}ning’s performance of for and higher.

Moreover, as we mentioned in this post, the two algorithms work better in somewhat orthogonal cases: Sch\”{o}ning’s algorithm works better when there are many “well-spread” satisfying assignments, and PPSZ works better with “few” solutions. And the papers of Iwama and Tamaki, and Hertli et al., combine these two algorithms carefully to get the current world record algorithms. Can you beat this world record?

Problem 2.A: Is there a term missing from the sum?