随机算法 (Fall 2015)/Lovász Local Lemma

From TCS Wiki
Revision as of 10:11, 29 November 2015 by imported>Etone (The random search algorithm)
Jump to navigation Jump to search

Lovász Local Lemma

Suppose that we are give a set of "bad" events A1,A2,,An. We want to know that it is possible that none of them occurs, that is:

Pr[i=1nAi¯]>0.

Obviously, a necessary condition for this is that for none of the bad events its occurrence is certain, i.e. Pr[Ai]<1 for all i. We are interested in the sufficient condition for the above. There are two easy cases:

Case 1: mutual independence.

If all the bad events A1,A2,,Am are mutually independent, then

Pr[i=1mAi¯]=i=1m(1Pr[Ai])

and hence this probability is positive if Pr[Ai]<1 for all i.

Case 2: arbitrary dependency.

On the other extreme, if we know nothing about the dependencies between these bad event, the best we can do is to apply the union bound:

Pr[i=1mAi¯]1i=1mPr[Ai],

which is positive if i=1mPr[Ai]<1. This is a very loose bound, however it cannot be further improved if no further information regarding the dependencies between the events is assumed.

Lovász Local Lemma (symmetric case)

In most situations, the dependencies between events are somewhere between these two extremal cases: the events are not independent of each other, but on the other hand the dependencies between them are not total out of control. For these more general cases, we would like to exploit the tradeoff between probabilities of bad events and dependencies between them.

The Lovász local lemma is such a powerful tool for showing the possibility of rare event under limited dependencies. The structure of dependencies between a set of events is described by a dependency graph, which is a graph with events as vertices and each event is adjacent to the events which are dependent with it in the dependency graph.

Definition (dependency graph)
Let A1,A2,,Am be a set of events. A graph D=(V,E) with set of vertices V={A1,A2,,Am} is called a dependency graph for the events A1,,Am if every event Ai is mutually independent of all the events in {Aj(Ai,Aj)E}.

The maximum degree d of the dependency graph D is a very useful information, as it tells us that every event Ai among A1,A2,,Am is dependent with how many other events at most.

Remark on the mutual independence
In probability theory, an event A is said to be independent of events B1,B2,,Bk if for any disjoint I,J{1,2,,k}, we have
Pr[A(iIBi)(iJB¯i)]=Pr[A],
that is, occurrences of events among B1,B2,,Bk have no influence on the occurrence of A.
Example
Let X1,X2,,Xn be a set of mutually independent random variables. Each event Ai is a predicate defined on a number of variables among X1,X2,,Xn. Let vbl(Ai) be the unique smallest set of variables which determine Ai. The dependency graph D=(V,E) is defined as that any two events Ai,Aj are adjacent in D if and only if they share variables, i.e. vbl(Ai)vbl(Aj).

The following theorem was proved by Erdős and Lovász in 1975 and then later improved by Lovász in 1977. Now it is commonly referred as the Lovász local lemma. It is a very powerful tool, especially when being used with the probabilistic method, as it supplies a way for dealing with rare events.

Lovász Local Lemma (symmetric case)
Let A1,A2,,Am be a set of events, and assume that the followings hold:
  1. Pr[Ai]p for every event Ai;
  2. every event Ai is mutually independent of all other events except at most d of them, and
ep(d+1)1.
Then
Pr[i=1nAi¯]>0.

Here d is the maximum degree of the dependency graph D for the events A1,,Am.

Intuitively, the Lovász Local Lemma says that if a rare (but hopefully possible) event is formulated as to avoid a series of bad events simultaneously, then the rare event is indeed possible if:

  • none of these bad events is too probable;
  • none of these bad events is dependent with too many other bad events;

Here the tradeoff between "too probable" and "too many" is characterized by the ep(d+1)1 condition.

According to a result of Shearer in 1985, the condition of the Lovász Local Lemma cannot be substantially improved if only the bounds on p and d are known.

Lovász Local Lemma (asymmetric case)

Sometimes when applying the local lemma, a few bad events are much more probable than others or are dependent with more other bad events. In this case, using the same upper bounds p on the probability of bad events or d on the number of dependent events will be much wasteful. To more accurately deal with such general cases, we need a more refined way to characterize the tradeoff between local dependencies and probabilities of bad events.

We need to introduce a few notations that will be frequently used onwards. Let A={A1,A2,,Am} be a set of events. For every event AiA, we define its neighborhood and inclusive neighborhood as follows:

  • inclusive neighborhood: Γ+(Ai) denotes the set of events in A, including Ai itself, that are dependent with Ai. More precisely, Ai is mutually independent of all events in AΓ+(Ai).
  • neighborhood: Γ(Ai)=Γ+(Ai){Ai}, that is, Γ(Ai) contains the events in A that are dependent with Ai, not including Ai itself.

The following is the asymmetric version of the Lovász Local Lemma. This generalization is due to Spencer.

Lovász Local Lemma (general case)
Let A={A1,A2,,Am} be a set of events, where every event AiA is mutually independent of all other events excepts those in its neighborhood Γ(Ai) in the dependency graph. Suppose there exist real numbers α1,α2,,αm[0,1) such that for every AiA,
Pr[Ai]αiAjΓ(Ai)(1αj).
Then
Pr[AiAAi¯]i=1m(1αi).

This generalized version of the local lemma immediately implies the symmetric version of the lemma. Namely, Pr[iAi¯]>0 if the followings are satisfied:

  1. Pr[Ai]p for all AiA;
  2. ep(d+1)1, where d=maxAiA|Γ(Ai)| is the maximum degree of the dependency graph.

To see this, for every AiA let αi=1d+1. Note that AjΓ(Ai)(1αj)(11d+1)d>1e.

With the above two conditions satisfied, for all AiA, it is easy to verify:

Pr[Ai]p1e(d+1)<1d+1(11d+1)dαiAjΓ(Ai)(1αj),

which according to the Lovász Local Lemma (general case), implies that

Pr[i=1Ai¯]i=1m(1αi)=(11d+1)m>0.

This gives the symmetric version of the local lemma.

A non-constructive proof of LLL

We then give the proof of the generalized Lovász Local Lemma. In particular, this proof is non-constructive, in contrast to the constructive proofs that we are going to introduce later, which are basically algorithms.

Apply the chain rule. The probability that none of the bad events occurs can be expressed as:

Pr[i=1mAi¯]=i=1mPr[Ai¯j=1i1Aj¯]=i=1m(1Pr[Aij=1i1Aj¯]).

It is then sufficient to show that

Pr[Aij=1i1Aj¯]αi,

which will prove the lemma.

We then prove a slightly more general statement:

(induction hypothesis) Pr[Ai1j=2Aij¯]αi1 for any distinct events Ai1,Ai2,AiA.

The proof is by induction on . For =1, due to the assumption in the Lovász Local Lemma

Pr[Ai1]αi1AjΓ(Ai1)(1αj)αi1.

For general , assume the hypothesis is true for all smaller . Without loss of generality, assume that Ai2,,Aik are the events among Ai2,Ai that are dependent with Ai1, and Ai1 is mutually independent of the rest Aik+1,,Ai.

Then applying the following basic conditional probability identity

Pr[ABC]=Pr[ABC]Pr[BC],

we have

Pr[Ai1j=2Aij¯]=Pr[Aij=2kAij¯j=k+1Aij¯]Pr[j=2kAij¯j=k+1Aij¯]=NumeratorDenominator.

Due to the mutual independence between Ai1 and Aik+1,,Ai, the Numerator becomes

NumeratorPr[Ai1j=k+1Aij¯]=Pr[Ai1],

which according to the assumption in the Lovász Local Lemma, is bounded as

Numeratorαi1AjΓ(Ai1)(1αj).

Applying the chain rule to the Denominator we have

Denominator=j=2kPr[Aij¯r=j+1Air¯].

Note that there are always less than events involved, so we can apply the induction hypothesis and have

Denominatorj=2k(1αij)AjΓ(Ai1)(1αj),

where the last inequality is due to the fact that Ai2,,AikΓ(Ai1).

Combining everything together, we have

Pr[Ai1j=2Aij¯]αi1.

As we argued in the beginning, this proves the general Lovász Local Lemma.

Random Search for Exact-k-SAT

We start by giving the definition of k-CNF and k-SAT.

Definition (exact-k-CNF)
A logic expression ϕ defined on n Boolean variables x1,x2,,xn{true,false} is said to be a conjunctive normal form (CNF) if ϕ can be written as a conjunction(AND) of clauses as ϕ=C1C2Cm, where each clause Ci=i1i2ik is a disjunction(OR) of literals, where every literal j is either a variable xi or the negation ¬xi of a variable.
  • We call a CNF formula a exact-k-CNF if every clause consists of exact k distinct literals.

For example:

(x1¬x2¬x3)(¬x1¬x3x4)(x1x2x4)(x2x3¬x4)

is an exact-3-CNF formula.

Remark
The notion of exact-k-CNF is slightly more restrictive than the k-CNF, where each clause consists of at most k variables. The discussion of the subtle differences between these two definitions can be found here.

A logic expression ϕ is said to be satisfiable if there is an assignment of values of true or false to the variables x=(x1,x2,,xn) so that ϕ(x) is true. For a CNF ϕ, this mean that there is a truth assignment that satisfies all clauses in ϕ simultaneously.

The exact-k-satisfiability (exact-k-SAT) problem is that given as input an exact-k-CNF formula ϕ decide whether ϕ is satisfiable.

exact-k-SAT
Input: an exact-k-CNF formula ϕ.
Output: whether ϕ is satisfiable.

It is well known that k-SAT is NP-complete for any k3. The same also holds for the exact-k-SAT.

Satisfiability of exact-k-CNF

Inspired by the Lovasz local lemma, we now consider the dependencies between clauses in a CNF formula.

Given a CNF formula ϕ defined over Boolean variables X={x1,x2,,xn} and a clause C in ϕ, we use vbl(C)X to denote the set of variables that appear in C. For a clause C in a CNF formula ϕ, its degree d(C)=|{DCDC}| is the number of other clauses in ϕ that share variables with C. The maximum degree d of a CNF formula ϕ is d=maxC in ϕd(C).

By the Lovasz local lemma, we almost immediately have the following theorem for the satisfiability of exact-k-CNF with bounded degree.

Theorem
Let ϕ be an exact-k-CNF formula with maximum degree d. If d2k/e1 then ϕ is always satisfiable.
Proof.

Let X1,X2,,Xn be Boolean random variables sampled uniformly and independently from {true,false}. We are going to show that ϕ is satisfied by this random assignment with positive probability. Due to the probabilistic method, this will prove the existence of a satisfying assignment for ϕ.

Suppose there are m clauses C1,C2,,Cm in ϕ. Let Ai denote the bad event that Ci is not satisfied by the random assignment X1,X2,,Xn. Clearly, each Ai is dependent with at most d other Aj's. And our goal is to show that

Pr[i=1mAi¯]>0.

Recall that in an exact-k-CNF, every clause Ci consists of exact k variable, and is violated by precisely one local assignment among all 2k possibilities. Thus the probability that Ci is not satisfied is Pr[Ai]=2k.

Assuming that d2k/e1, i.e. e(d+1)2k1, by the Lovasz local lemma (symmetric case), we have

Pr[i=1mAi¯]>0.

The random search algorithm

The above theorem basically says that for a CNF if every individual clause is easy to satisfy and is dependent with few other clauses then the CNF should be always satisfiable. However, the theorem only states the existence of a satisfying solution, but does not specify a way to find this solution. Next we give a simple randomized algorithm and prove it can find the satisfying solution efficiently under a slightly stronger assumption than the Lovasz local lemma.

Given as input a CNF formula ϕ defined on Boolean variables X={x1,x2,,xn}, recall that for a clause C in a CNF ϕ, we use vbl(C)X to denote the set of variables on which C is defined.

The following algorithm is due to Moser in 2009. The algorithm consists of two components: the main function Solve() and a sub-routine Fix().

Solve(CNF ϕ)
Pick values of x1,x2,xn uniformly and independently at random;
While there is an unsatisfied clause C in ϕ
Fix(C);

The sub-routine Fix() is a recursive procedure:

Fix(Clause C)
Replace the values of variables in vbl(C) with new uniform and independent random values;
While there is unsatisfied clause D (including C itself) that vbl(C)vbl(D)
Fix(D);

It is an amazing discovery that this simple algorithm works well as long as the condition of Lovasz local lemma is satisfied. Here we prove a slightly weakened statement for the convenience of analysis.

Theorem
Let ϕ be an exact-k-CNF formula with maximum degree d.
If d<2k3 then the algorithm Solve(ϕ) finds a satisfying assignment for ϕ in time O(n+kmlogm) with high probability.

The analysis is based on a technique called entropy compression. This is a very clever idea and may be very different from what you might have seen so far about algorithm analysis.

We first give a high level description of the ideas behind the analysis of this brilliant algorithm:

  • We use Alg(r,ϕ) to abstractly denote an algorithm Alg running on an input ϕ with random bits r{0,1}. For an algorithm with no access to the random bits r, once the input ϕ is fixed, the behavior of the algorithm as well as its output is deterministic. But for randomized algorithms, the behavior of Alg(r,ϕ) is a random variable even when the input ϕ is fixed.
  • Fix an arbitrary (worst-case) input ϕ. We try to construct a succinct representation of the behavior of Alg(r,ϕ) in such a manner that the random bits r can always be fully recovered from this succinct representation. In other words, Alg(r,ϕ) gives an encoding (a 1-1 mapping) of the random bits r to a succinct representation.
  • It is a fundamental law that random bits cannot be compressed significantly by any encoding. Therefore if it is the case that a longer running time of Alg(r,ϕ) would imply that the random bits r can be encoded to a much shorter succinct representation, then we prove the running time of the algorithm Alg(r,ϕ) cannot be too long.



We consider a restrictive case.

Let X1,X2,,Xm{true,false} be a set of mutually independent random variables which assume boolean values. Each event Ai is an AND of at most k literals (Xi or ¬Xi). Let v(Ai) be the set of the k variables that Ai depends on. The probability that none of the bad events occurs is

Pr[i=1nAi¯].

In this particular model, the dependency graph D=(V,E) is defined as that (i,j)E iff v(Ai)v(Aj).

Observe that Ai¯ is a clause (OR of literals). Thus, i=1nAi¯ is a k-CNF, the CNF that each clause depends on k variables. The probability

i=1nAi¯>0

means that the the k-CNF i=1nAi¯ is satisfiable.

The satisfiability of k-CNF is a hard problem. In particular, 3SAT (the satisfiability of 3-CNF) is the first NP-complete problem (the Cook-Levin theorem). Given the current suspect on NP vs P, we do not expect to solve this problem generally.

However, the condition of the Lovasz local lemma has an extra assumption on the degree of dependency graph. In our model, this means that each clause shares variables with at most d other clauses. We call a k-CNF with this property a k-CNF with bounded degree d.

Therefore, proving the Lovasz local lemma on the restricted forms of events as described above, can be reduced to the following problem:

Problem
Find a condition on k and d, such that any k-CNF with bounded degree d is satisfiable.

In 2009, Moser comes up with the following procedure solving the problem. He later generalizes the procedure to general forms of events. This not only gives a beautiful constructive proof to the Lovasz local lemma, but also provides an efficient randomized algorithm for finding a satisfiable assignment for a number of events with bounded dependencies.

Let ϕ be a k-CNF of n clauses with bounded degree d, defined on variables X1,,Xm. The following procedure find a satisfiable assignment for ϕ.

Solve(ϕ)
Pick a random assignment of X1,,Xm.
While there is an unsatisfied clause C in ϕ
Fix(C).

The sub-routine Fix is defined as follows:

Fix(C)
Replace the variables in v(C) with new random values.
While there is unsatisfied clause D that v(C)v(D)
Fix(D).

The procedure looks very simple. It just recursively fixes the unsatisfied clauses by randomly replacing the assignment to the variables.

We then prove it works.

Number of top-level callings of Fix

In Solve(ϕ), the subroutine Fix(C) is called. We now upper bound the number of times it is called (not including the recursive calls).

Assume Fix(C) always terminates.

Observation
Every clause that was satisfied before Fix(C) was called will still remain satisfied and C will also be satisfied after Fix(C) returns.

The observation can be proved by induction on the structure of recursion. Since there are n clauses, Solve(ϕ) makes at most n calls to Fix.

We then prove that Fix(C) terminates.

Termination of Fix

The idea of the proof is to reconstruct a random string.

Suppose that during the running of Solve(ϕ), the Fix subroutine is called for t times (including all the recursive calls).

Let s be the sequence of the random bits used by Solve(ϕ). It is easy to see that the length of s is |s|=m+tk, because the initial random assignment of m variables takes m bits, and each time of calling Fix takes k bits.

We then reconstruct s in an alternative way.

Recall that Solve(ϕ) calls Fix(C) at top-level for at most n times. Each calling of Fix(C) defines a recursion tree, rooted at clause C, and each node corresponds to a clause (not necessarily distinct, since a clause might be fixed for several times). Therefore, the entire running history of Solve(ϕ) can be described by at most n recursion trees.

Observation 1
Fix a ϕ. The n recursion trees which capture the total running history of Solve(ϕ) can be encoded in nlogn+t(logd+O(1)) bits.

Each root node corresponds to a clause. There are n clauses in ϕ. The n root nodes can be represented in nlogn bits.

The smart part is how to encode the branches of the tree. Note that Fix(C) will call Fix(D) only for the D that shares variables with C. For a k-CNF with bounded degree d, each clause C can share variables with at most d many other clauses. Thus, each branch in the recursion tree can be represented in logd bits. There are extra O(1) bits needed to denote whether the recursion ends. So totally nlogn+t(logd+O(1)) bits are sufficient to encode all n recursion trees.

Observation 2
The random sequence s can be encoded in m+nlogn+t(logd+O(1)) bits.

With nlogn+t(logd+O(1)) bits, the structure of all the recursion trees can be encoded. With extra m bits, the final assignment of the m variables is stored.

We then observe that with these information, the sequence of the random bits s can be reconstructed from backwards from the final assignment.

The key step is that a clause C is only fixed when it is unsatisfied (obvious), and an unsatisfied clause C must have exact one assignment (a clause is OR of literals, thus has exact one unsatisfied assignment). Thus, each node in the recursion tree tells the k random bits in the random sequence s used in the call of the Fix corresponding to the node. Therefore, s can be reconstructed from the final assignment plus at most n recursion trees, which can be encoded in at most m+nlogn+t(logd+O(1)) bits.

The following theorem lies in the heart of the Kolmogorov complexity. The theorem states that random sequence is incompressible.

Theorem (Kolmogorov)
For any encoding scheme , with high probability, a random sequence s is encoded in at least |s| bits.

Applying the theorem, we have that with high probability,

m+nlogn+t(logd+O(1))|s|=m+tk.

Therefore,

t(kO(1)logd)nlogn.

In order to bound t, we need

kO(1)logd>0,

which hold for d<2kα for some constant α>0. In fact, in this case, t=O(nlogn), the running time of the procedure is bounded by a polynomial!

Back to the local lemma

We showed that for d<2kO(1), any k-CNF with bounded degree d is satisfiable, and the satisfied assignment can be found within polynomial time with high probability. Now we interprete this in a language of the local lemma.

Recall that the symmetric version of the local lemma:

Theorem (The local lemma: symmetric case)
Let A1,A2,,An be a set of events, and assume that the following hold:
  1. for all 1in, Pr[Ai]p;
  2. the maximum degree of the dependency graph for the events A1,A2,,An is d, and
ep(d+1)1.
Then
Pr[i=1nAi¯]>0.

Suppose the underlying probability space is a number of mutually independent uniform random boolean variables, and the evens Ai¯ are clauses defined on k variables. Then,

p=2k

thus, the condition ep(d+1)1 means that

d<2k/e

which means the Moser's procedure is asymptotically optimal on the degree of dependency.

Algorithmic Lovász Local Lemma