Removing randomness while keeping the speed: enumeration, non-uniform advice, conditional probabilities with pessimistic estimators, k-wise independence, and PRGs (Nisan–Wigderson).
Last updated 27 June 2026
Lecture 8 — Derandomization (Derandomizácia)
Course 2-INF-135/15 Pravdepodobnostné algoritmy, LS 2025/26.
Source slides: 07_RA_slidy_derandAlg.pdf (22 pages) + RA_slidy_derand.pdf (23 pages).
Štátnicové syllabus topics covered here: derandomization — the method of
conditional probabilities (with pessimistic estimators), limited (k-wise)
independence and small sample spaces, pseudorandom generators, and the
hardness-vs-randomness paradigm (Nisan–Wigderson). Worked algorithms:
Schöning k-SAT via covering codes, parallel MIS, MaxCut, Set Balancing.
The one-paragraph map of the whole lecture
A randomized algorithm is allowed to flip coins. Derandomization asks: can we
get the same guarantee without the coins — deterministically — and not pay too
much in running time? The whole lecture is a menu of five answers, ordered from
“brute and obvious” to “deep and conditional”:
Enumeration — just try all coin sequences. Always works, but costs
2(#random bits). Cheap only if the algorithm uses O(logn) bits.
Non-uniform / non-constructive advice — one fixed bit-string works for all
inputs of a given length. It exists by counting, but we may not be able to
find it. Lands us in P/poly, not P.
Method of conditional probabilities — fix the random choices one at a time,
always steering toward a better-than-average outcome. The workhorse for
“the average object is good, give me a concrete good one.”
Limited (k-wise) independence — if the analysis only ever uses interactions
among k variables at a time, replace true randomness by a tiny sample space
that looksk-wise independent. Few random bits ⇒ small space
⇒ enumerate it.
Pseudorandom generators (PRG) — stretch a short truly-random seed into a long
string that no small circuit can tell from random. Then enumerate seeds. This
is the heavy machinery, and it rests on a beautiful trade: a hard function
buys you randomness (Nisan–Wigderson).
The recurring question is always the same: what exactly did the probabilistic
analysis actually need? The less it needed (only the expectation? only pairwise
interactions? only fooling small circuits?), the cheaper the derandomization.
0. Two flavors, and the two trivial bookends
The slides split derandomization into:
Algorithmic (problem-specific): take this concrete Monte-Carlo / RP algorithm
and surgically remove its coins.
Complexity-theoretic (general strategies): theorems of the form “if such-and-such
exists, then a whole class of randomized algorithms can be derandomized.”
Before the clever methods, two bookends that need almost no thought.
Bookend 1 — Enumeration (“hrubá sila”)
If A(x,r) uses r(∣x∣) random bits, simulate it for everyr∈{0,1}r(∣x∣)
and take a majority vote (or, for RP, an OR). Correct by definition. Cost: a factor
2r(∣x∣). So this is polynomial iff the algorithm uses only O(logn) random
bits. That single observation is why so much of the lecture is about squeezing
the random-bit budget down to O(logn) — see limited independence (§4) and PRGs (§7).
Bookend 2 — Non-constructive / non-uniform advice
Lemma. If A(x;r) decides a language L with error <2−∣x∣, then for every
n there is a fixed string r(n) such that A(x;r(n)) is correct for allx∈{0,1}n simultaneously.
Proof (probabilistic method / union bound). Fix n. For a random r, the bad event
“A(⋅;r) is wrong on x” has probability <2−n for each fixed x. There are
2n inputs of length n, so
A bad event of probability <1 leaves room for a good r, so a universal r(n)
exists. □
Punchline. This puts every BPP language in P/poly
(the r(n) are the polynomial advice). But the proof is non-constructive —
it tells you a good advice string exists, not how to compute it. Turning
“exists” into “here it is, in polynomial time” is the entire art of the rest of
the lecture.
The first amplification step (error →2−∣x∣) is just running the algorithm
O(n) times and voting — standard probability amplification from Lecture 3.
1. The RP “small witness set” theorem — a greedy set cover
This is the first non-trivial complexity-theoretic statement, and its proof is a
clean greedy set-cover argument worth keeping.
Theorem. Let M be an RP algorithm using k random bits on inputs of
length n. Then there is a set S⊆{0,1}k with ∣S∣=n such that for
every input w of length n, some r∈S makes M(w,r) answer correctly.
So instead of 2k random strings, n fixed strings suffice — we just don’t yet
know how to find them in poly time, but they exist and are few.
Proof. Build the Boolean matrix A of size 2n×2k:
A[input,rand]={10if M(input,rand) is correct,otherwise.
Because M is RP (after one amplification, say), every row has at least
2k−1 ones. Now greedily cover the rows:
S ← ∅
while A still has uncovered rows:
every remaining row has ≥ 2^{k-1} ones
⇒ by averaging, ∃ a column j hitting ≥ half of the remaining rows
S ← S ∪ {j}; delete the rows covered by column j
Each chosen column halves the number of uncovered rows. Starting from 2n rows,
after n steps fewer than 1 remain. Hence ∣S∣≤n. □
Why a column with “half the ones” must exist. If every remaining row has a
≥1/2 fraction of 1s, then the total count of 1s is $\ge \tfrac12 \cdot
(#\text{rows}) \cdot 2^k; by averaging over the $2^k columns, some column carries
≥21(#rows) of them. This “an average column is good” move is
the seed of the conditional-probabilities method.
There is also a direct probabilistic proof (the “inak” on the slide): let Fx be the
event that n independent runs of M all fail on x. Then Pr[Fx]<(1/2)n, and
Pr[⋃xFx]≤∑xPr[Fx]<2n⋅2−n=1, so a single universal
random string r works — the same union bound as Bookend 2.
2. The method of conditional probabilities (metóda podmienených pravdepodobností)
This is the most important constructive technique in the lecture, and the one the
exams hammer (3-cuts, monochromatic edges, K4 colorings). Master this section.
The idea in one sentence
The probabilistic method says “a random object is good on average.” Conditional
probabilities turns that existence proof into an algorithm: decide the random
choices x1,x2,…,xnone at a time, and at each step pick the value that
keeps the conditional expectation at least as good as before. Since the
conditional expectation never drops below the unconditional one, the final fully-fixed
object is at least as good as average.
Formally, suppose we want a large quantity C and we know E[C]≥μ. We fix
x1,…,xn in order so that
The middle inequalities hold because, by the law of total expectation,
E[C∣x1,…,xi]=21E[C∣…,xi+1=0]+21E[C∣…,xi+1=1]≤max{the two children}.
So always walk to the larger child. The conditional expectation is an average of
its two children, hence at most the larger one — you can always avoid going down.
The one prerequisite. You must be able to compute the conditional expectation
in polynomial time at each node. When you can compute it exactly, you greedily
maximize it (§2.1). When you can’t, you replace it with a cleverly chosen
pessimistic estimator (§2.2).
2.1 Worked example — MaxCut / LargeCut
Color each vertex vi with xi∈{0,1}. An edge is cut if its endpoints get
different colors. Under a uniformly random coloring each edge is cut with probability
1/2, so E[C]=m/2. We want a deterministic cut of size ≥m/2.
Decide colors x1,…,xn in order. After fixing x1,…,xi, split the first
i vertices into V0(i) (colored 0) and V1(i) (colored 1). Let Ci be the
edges already cut, and Ei the still-undecided edges (both endpoints uncolored). When
we color vi+1:
Reading this off: coloring vi+1 with 0 newly cuts its edges to the already-1
neighbors; coloring it 1 cuts its edges to the already-0 neighbors; the
not-yet-decided edges still contribute 1/2 each either way. So the rule is simply:
Greedy rule. Color vi+1 the opposite of the majority color among its
already-colored neighbors (break ties arbitrarily). Equivalently, place it on the
side it has more edges to — those edges become cut.
Each step keeps E[C∣⋅] from dropping, so the final cut has size
≥m/2. Pure O(n+m) greedy, no coins.
Exam bridge (exam-1, the 3-cut). Partition vertices into three sets S,T,U.
A random 3-partition cuts each edge with probability 2/3, so $\mathbb{E}[\text{3-cut}]
= \tfrac23 m$. The identical conditional-expectation argument — at each vertex pick
the part it has the fewest already-placed neighbors in — deterministically yields a
3-cut of size ≥32m in polynomial time. The generalization to k parts /
k colors and “few monochromatic edges ≤m/k” (exam-3) is the same machinery.
2.2 Worked example — Set Balancing (Spencer) and the pessimistic estimator
This is the subtle, professor-pleasing case: what if the “good event” is not an
expectation you can track? Then you track a pessimistic upper bound on the
probability of failure instead.
Problem (Set Balancing). Given sets S1,…,Sm⊆B={b1,…,bn},
find a 2-coloring f:B→{+1,−1} making every set as balanced as possible.
The discrepancy of set Si is
Δ(Si,f)=bj∈Si∑fj,Δ(S,f)=imaxΔ(Si,f).
Assume (as the slides do) n=m and each ∣Si∣=δ.
Spencer '85: there is always a coloring with Δ(S,f)≤6n — but his
proof is non-constructive.
Easy randomized bound. Color each bj∈R{+1,−1}. Then Ti:=Δ(Si,f)
is a sum of δ independent ±1’s, E[Ti]=0, so by Chernoff
Now derandomize. The obstacle: the “good” event (Δ small) is a max of
absolute values, not a sum — its conditional expectation is awkward. Fix: drive
down a pessimistic estimatorPv of the probability that the final leaf
is a bad coloring. Build the binary tree over colorings; a root-to-leaf path is
good if it induces Δ(S,f)≤2δln2n, bad otherwise. Let Pv
be the true fraction of bad leaves under v. We have $P_v = \tfrac12(P_{v1}+P_{v,-1})
\ge \min{P_{v1}, P_{v,-1}}, so walking to the smaller child never increases $P. We
can’t compute Pv, so we want Pv satisfying four conditions:
Proot<1,
Pv≤Pv at every node (it really is an upper bound),
Pv≥min{Pv1,Pv,−1} (a child is no worse),
Pv is computable in polynomial time.
The estimator comes from the Chernoff moment-generating-function bound before
taking limits. For a parameter t,
Because a coloring with Δ≤2δln2n exists, there is a t making
Proot<1 (condition 1). At a node v where f1,…,fj are
already decided, split Ti=Ti,dj+Ti,nj into the decided and
not-yet-decided parts, and estimate
Pv=i=1∑net(Δ−Ti,dj)E[etTi,nj].
The “averaging over the next bit” identity
$\widetilde P_v = \tfrac12 \widetilde P_{v1} + \tfrac12 \widetilde P_{v,-1} \ge
\min{\widetilde P_{v1}, \widetilde P_{v,-1}}$ gives condition 3, and each
E[etTi,n] is a product of per-element factors 21(et+e−t),
computable in polynomial time (condition 4).
The finish (why P<1 forces a good leaf). Walk down always to the
smaller-P child. By condition 3, P never increases, so the
leaf has P<1. But at a leaf the coloring is fully fixed, so the true
P is either 0 (good) or 1 (bad), and P≤P<1 forces P=0.
We have constructed a good coloring. □
The deep point. Conditional probabilities does not require the quantity you
care about to be an expectation. It only requires a polynomial-time-computable
quantity that (i) upper-bounds the failure probability, (ii) starts below 1, and
(iii) has the “average-of-children” property. That quantity is the pessimistic
estimator, and the MGF/Chernoff bound is the standard place to get one.
3. Parallel MIS (Luby) and derandomization via pairwise independence
The Maximal Independent Set problem: find an inclusion-maximal independent set.
Luby’s randomized algorithm is parallel and finishes in O(logn) rounds; the
point here is that it can be derandomized into NC2 (poly processors,
O(log2n) depth) because its analysis only ever uses pairwise independence.
The algorithm
MIS ← ∅
repeat:
each vertex v marks itself with probability 1/(2·d(v)) → set S
on each edge with both endpoints marked, the higher-degree endpoint wins → S′
MIS ← MIS ∪ S′
V ← V − ( S′ ∪ N(S′) ) (remove the new IS vertices and their neighbors)
until V = ∅
Two claims drive everything:
E[#iterations]=O(logn);
in every iteration a constant fraction of the edges is removed.
The good/bad bookkeeping
Call a vertex bad if more than 2/3 of its neighbors have degree ≥d(v)
(it is “dominated”); otherwise good. An edge is bad if both endpoints are bad.
L1 — at least half the edges are good. Orient each edge toward its higher-degree
endpoint and define an injection f:EB→E that charges each bad edge to two
out-edges of its endpoints; this is impossible for more than ∣E∣/2 edges. So
≥∣E∣/2 edges are good.
L2 (uses full independence). If v is good, Pr[N(v)∩S=∅]>2α,
where α:=(1−e−1/6)/2. Proof: let L(v)={w∈N(v):d(w)≤d(v)};
goodness gives ∣L(v)∣≥d(v)/3, and
L3 (uses only pairwise independence).Pr[w∈/S′∣w∈S]≤1/2.
Proof:w is killed only by a marked neighbor z of ≥ degree; sum over
H(w)={z∈N(w):d(z)≥d(w)} and use pairwise independence:
L4. If v good, Pr[v∈N(S′)]≥α. Combine L2 and L3:
Pr[v∈N(S′)]≥Pr[w∈S′∣w∈S]⋅Pr[N(v)∩S=∅]≥21⋅2α=α.
Corollaries. A good vertex is removed with prob ≥α; a good edge is removed
with prob ≥α.
Progress lemma.E[∣Ej∣∣Ej−1]≤∣Ej−1∣(1−α/2), because
≥ half the edges are good (L1) and each good edge dies with prob ≥α.
Iterating, E[∣Ej∣]≤m(1−α/2)j≤me−jα/2≤1 once
j>α2lnm=O(logn).
Why this derandomizes
The progress lemma is the crux, and its proof (L3, the part that actually bounds
removals) uses only pairwise independence of the marks. So:
replace the truly-random marks by marks drawn from a pairwise-independent sample
space of polynomial size (§4);
there are only polynomially many sample points, so spread them across polynomially
many processors; by the lemma, at least one sample point removes ≥ the expected
fraction of edges. Pick it (a deterministic max over poly choices).
Each round is one deterministic parallel step over a poly-size space; O(logn)
rounds ⇒NC2.
The lemma that licenses the swap (full → pairwise). For indicators Xi with
pi=Pr[Xi=1]:
Part 2 is a Bonferroni / inclusion–exclusion bound:
$\Pr[\sum X_i>0] \ge \sum_i p_i - \tfrac12\sum_{i\neq j}\Pr[X_i=X_j=1]
= \sum p_i - \tfrac12\sum_{i\neq j}p_i p_j \ge \sum p_i\big(1 - \tfrac12\sum p_i\big)$,
which is ≥21∑pi when ∑pi≤1; and when ∑pi≥1 pick a
sub-collection with 21≤∑Spi≤1 to get ≥1/4. The point:
“at least one event fires” needs only pairwise correlations — exactly what a
small sample space can supply.
4. Limited independence and small sample spaces
This is the engine behind §3 and the exams. The principle:
If the analysis of a randomized algorithm only ever uses interactions among k
variables at a time, then we may feed it variables that are merely k-wise
independent instead of fully independent. Such variables live in a tiny sample
space, generated from few truly-random bits, which we can then enumerate.
We want f:Σℓ(n)→Σr(n) (short seed → long pseudo-random
output) with Prr[A(x,r)=1]≈Pry[A(x,y)=1] for the real uniform y.
4.1 n pairwise-independent uniform bits from ⌈log(n+1)⌉ truly-random bits
This is the construction to have at your fingertips (it is the answer to the
pairwise-independent-coloring exam questions).
Let t=⌈log(n+1)⌉ and draw b1,…,bttruly uniform.
Pick n distinct nonempty subsets J1,…,Jn⊆{1,…,t} (there
are 2t−1≥n of them).
Output ri:=⨁j∈Jibj.
Uniform: each ri contains at least one bs; conditioning on the others,
ri=(⨁j∈Ji∖{s}bj)⊕bs flips with bs, so it is
fair.
Pairwise independent: for Ji=Ji′ there is (wlog) an s∈Ji∖Ji′;
bs randomizes ri but not ri′, so
Pr[ri=a∧ri′=a′]=41=Pr[ri=a]Pr[ri′=a′].
Punchline.n pairwise-independent bits cost only t=O(logn) truly-random
bits, i.e. a sample space of size 2t=O(n). Enumerate all O(n) seeds in
polynomial time and keep the best outcome — the random bits are gone. This is exactly
how the pairwise-independent graph-colorings of the exams are derandomized: the random
coloring uses O(logn) true bits, you try all O(poly) seeds, and you keep
the coloring with ≤m/k monochromatic edges. Running time is poly(n,m,k).
A function f is an (m,t,ℓ)-2-independent generator if
f:Σm→Σℓ⋅t, output split as f(x)=f1(x)f2(x)⋯fℓ(x), each ∣fi(x)∣=t;
f is computable in time poly(tℓ);
∀i=j,∀α,β∈Σt:Pr[fi(x)=α∧fj(x)=β]=2−2t.
Theorem. For all ℓ,t,m with 2m≥ℓ and m≥t, an
(2m,t,ℓ)-2-independent generator exists.
Construction. Use the 2-universal family $H = {h_{a,b}(x) = ax+b : a,b \in
GF[2^m]}. Fix distinct $\alpha_1,\dots,\alpha_\ell \in GF[2^m] and set
f(a,b)=ha,b(α1)ha,b(α2)⋯ha,b(αℓ),keeping t bits of each ha,b(αi).
Pairwise independence of ha,b over the random seed (a,b) gives
Pra,b[fi=u∧fj=v]=2−2t — exactly property 3. The seed is 2m
bits, far fewer than the ℓt output bits.
4.3 k-independent uniform bits from linear codes (Alon–Babai–Itai)
To go beyond pairwise, the right language is linear codes.
Theorem (Alon–Babai–Itai). Let L1,…,Lm∈{0,1}ℓ be such that any
k of them are linearly independent over GF[2]. Draw R∈R{0,1}ℓ and set
Xi:=⟨Li,R⟩=∑j=1ℓLi,jrjmod2. Then
X1,…,Xm are k-wise independent (and uniform).
Proof. Take any k indices i1,…,ik. The corresponding rows form a k×ℓ
matrix H of rank k (independence), so R↦(Xi1,…,Xik)=HR⊤
is a surjective linear map whose every fiber has size 2ℓ−k. Hence
Where do the Li come from? From the parity-check matrix of a code: for an
[n,k,d] code, any d−1 columns of H are linearly independent. Take the
BCH-style check matrix with n=2d−1 columns and rows the odd powers of the field
elements y1,…,yn∈GF[2d],
which has minimum distance 2t+2, so every 2t+1 columns are independent. The
columns live in {0,1}ℓ with ℓ=(t+1)d=(t+1)logn. Thus from
R∈R{0,1}(t+1)logn we obtain n variables that are (2t+1)-wise
independent and uniform — using only O(tlogn) random bits.
4.4 k-independent bits with an arbitrary distribution
Finally, k-wise independent variables with prescribed (possibly biased) marginalsPr[Xi=1]=pi, using a sample space of size O(nk).
Theorem. For a prime p with n≤p≤2n and k≥1, there is a uniform
probability space (Ω,P) with ∣Ω∣=pk and k-independent variables
X1,…,Xn over it whose marginals match the targets up to
rounding: dist(Xi,Xi)≤1/p≤1/n.
Construction. Let Ω be all polynomials q=q1+q2x+⋯+qkxk−1
of degree ≤k−1 over F=GF(p) (so ∣Ω∣=pk), chosen uniformly. Set
Yi=q(i), then threshold: Xi=1 iff q(i)<p⋅pi. Because
is a Vandermonde (regular) system, for every target (d1,…,dk) there is a
uniqueq producing Yij=dj, so Pr[Yi1=d1,…,Yik=dk]=p−k
— exactly k-wise independence and Pr[q(i)=c]=1/p. The threshold induces at most a
1/p rounding error on each marginal. □
5. Schöning’s k-SAT, Promise-Ball-k-SAT, and covering codes
A self-contained, beautiful derandomization: Schöning’s random-walk k-SAT algorithm is
turned into the fastest known deterministic k-SAT algorithm, via covering codes,
losing only an ε in the exponent.
Schöning’s randomized algorithm
choose α ∈ {0,1}^n uniformly at random
repeat (a bounded number of times):
if F(α)=1 return α
pick an unsatisfied clause C; flip one of its literals chosen uniformly at random
Theorem (Schöning). If F∈SAT (k-CNF), one run finds a satisfying
assignment with probability ≥(2(k−1)k)n.
Proof. Let α∗ be a satisfying assignment and α the random start. Then
Pr[dist(α,α∗)=r]=(rn)2−n. From Hamming distance
r, the random walk drifts toward α∗ — each forced flip moves towardα∗ with probability ≥1/(k−1) (the unsatisfied clause has a literal wrong
in α but right in α∗). So $\Pr[\text{reach } \alpha^* \mid \mathrm{dist}=r]
\ge (k-1)^{-r}$, and
Repeating (k2(k−1))n times gives an RP algorithm running
in O∗(1.33n) for 3-SAT and O∗(1.5n) for 4-SAT.
Promise-Ball-k-SAT, deterministically
Promise-Ball-k-SAT.Promise: a satisfying assignment lies inside
Ballr(α) for given α,r. Find any satisfying assignment (not
necessarily inside the ball).
Schöning’s lemma. If Ballr(α) contains a satisfying β, then
Schöning finds some satisfying assignment with probability ≥(k−1)−r.
The deterministic version is a bounded-depth search:
Search(F, α, r):
if F(α)=1 return true
if r=0 return false
C ← an unsatisfied clause of F (length ≤ k)
for each literal u in C:
if Search(F|u=1, flip α at u, r−1) = true return true
return false
The recursion branches on the literals of an unsatisfied clause. A naïve count gives
kr leaves; the sharper analysis notes that an unsatisfied clause needs to flip only
k−1 “useful” literals (the assignment already disagrees with one), so
time(Search(F,α,r))=O∗((k−1)r).
From the ball back to the whole cube — covering codes (Dantsin et al.)
We do not know where α∗ is, so we cover{0,1}n by balls and run
Search from each ball’s center.
Reduction. If A solves Promise-Ball-k-SAT in O∗(ar), then there is a B
solving k-SAT in O∗((a+12a)n); B is
deterministic if A is.
Idea. Take a covering code: a set of codewords (ball centers) such that every
α∈{0,1}n is within distance r of some center. Run the deterministic
Promise-Ball solver from each center. If F∈SAT, some satisfying assignment
sits within r of a center, and that call finds it. Balancing the ball radius against
the number of centers (more, smaller balls vs fewer, larger ones) gives the
(a+12a)n bound.
With a=k−1 (deterministic Search), B runs in
O∗((k2(k−1))n) — matching the randomized Schöning
running time, deterministically.
The covering-code existence lemma. Work over the alphabet {1,…,k}t (a
k-ary code, because each useful flip in a clause is one of k literal choices). With
Br(k)(u)={u′:dH(u,u′)≤r} and volk(t,r)=(rt)(k−1)r,
there exists a code C⊆{1,…,k}t of covering radius r with
∣C∣≤(rt)(k−1)rtlnk⋅kt.
Proof (probabilistic method). Pick m=(rt)(k−1)rtlnk⋅kt
centers uniformly at random. A fixed word w′ is uncovered with probability
(1−ktvolk(t,r))m<e−volk(t,r)m/kt=e−tlnk=k−t.
Union over all kt words gives <1, so with positive probability every word is
covered ⇒ such a code exists. The lecture then makes the radius r=t/k
and uses (t/kt)(k−1)t/k estimates to push the deterministic
Promise-Ball-k-SAT to O∗((k−1+ε)r) for any
ε>0.
Why “find a good code” is the hard part. The probabilistic argument shows a
covering code exists; the algorithm needs an explicit one. The slides resolve
this by pre-computing a small code for fixed r,k,t (via a maximal independent
family of unsatisfied clauses), so the search tree has only ≈(k−1+ε)r
leaves. The recursion (α,r)⇝(α(w′),r−Δ) shrinks
the radius by Δ=t−2t/k each level, and the number of leaves is bounded by
∣C∣r/Δ≤(k−1)t2/Δ⋅r/t⇝(k−1+ε)r.
6. Pseudorandom generators and hardness vs. randomness
The deepest part: a general theorem that derandomizes all of BPP under a
plausible hardness assumption. The slogan:
Hardness ⇒ randomness. A function that is hard to predict can be used
to manufacture pseudo-randomness; pseudo-randomness lets us replace coins by
enumeration. If sufficiently hard functions exist, BPP=P.
Definitions
(S,ε)-pseudorandom. A distribution R over {0,1}m is
(S,ε)-pseudorandom if every circuit C of size ≤S is fooled:
Pr[C(R)=1]−Pr[C(Um)=1]<ε. (Um = uniform.)
PRG. A function G:{0,1}∗→{0,1}∗, computable in time 2n, is an
S(ℓ)-pseudorandom generator if ∣G(z)∣=S(∣z∣) and for every ℓ the
distribution G(Uℓ) is (S(ℓ)3,101)-pseudorandom.
The generator stretches an ℓ-bit seed into S(ℓ) output bits that fool every
circuit of size S(ℓ)3. The bigger the stretch we can certify, the more
randomness we save.
PRG ⇒ derandomization of BPP
Theorem. If an S(ℓ)-PRG exists (S time-constructible, nondecreasing), then
for every polytime ℓ:N→N,
BPTIME(S(ℓ(n)))⊆DTIME(2cℓ(n)).
Proof sketch. Let L∈BPTIME(S(ℓ(n))) via A(x,r) with r of length
m≤S(ℓ(n)) and Prr[A(x,r)=L(x)]≥2/3. Replace the m truly-random bits by
G(z) for z∈R{0,1}ℓ(n). Enumerate all 2ℓ(n) seeds, compute each
G(z) (time 2ℓ(n)), run the length-S(ℓ) computation, and take a majority.
The success probability can shift by at most 1/10 in passing from Um to G(Uℓ)
— otherwise A(x,⋅) (a small circuit) would distinguishG(Uℓ) from uniform,
contradicting the PRG. So correctness stays ≥2/3−1/10. Total time
max{2c1ℓ(n),S(ℓ(n))}=2cℓ(n).
Punchline. For ℓ(n)=logn this is 2clogn=poly(n), i.e.
BPP=P. Derandomizing BPP reduces to building a PRG
with a logarithmic-length seed.
The hardness assumption
Average-case hardness.Havg(f)(n) is the largest circuit size S such that
no circuit C of size S satisfies $\Pr_{x\in{0,1}^n}[C(x)=f(x)] \ge \tfrac12 +
\tfrac1S. I.e. $f cannot even be approximated — predicted noticeably better than a
coin flip — by circuits up to size S.
Such hard f are believed to exist (e.g. they follow from $\mathsf{NP} \not\subseteq
\mathsf{P/poly}$, “3-SAT is hard”).
Warm-ups — append one or two hard bits (via Yao)
Yao’s theorem (unpredictability = pseudorandomness). If for a distribution Y on
{0,1}m no size-2S circuit predicts bit i from bits 1..i−1 with advantage
>ε/m, then Y is (S,ε)-pseudorandom.
One hard bit. If ∃f∈DTIME(2O(n)) with Havg(f)≥n4,
then G(z)=z⋅f(z) is an (ℓ+1)-PRG. The only “new” bit is f(z); predicting
it with advantage >1/(20(ℓ+1)) would give a circuit approximating f better than
1/2+1/ℓ4 — contradicting Havg(f)≥n4. By Yao, G(Uℓ) is
pseudorandom.
Two hard bits. $G(z) = z_{1…\ell/2}, f(z_{1…\ell/2}), z_{\ell/2+1…\ell},
f(z_{\ell/2+1…\ell})$ is an (ℓ+2)-PRG. The second hard bit is handled by an
averaging argument: a predictor depending on two independent halves X,Y can be
fixed on one half (∃x with PrY[A(x,Y)]≥PrX,Y[A(X,Y)]), reducing to a
circuit D that approximates f on the other half — again a contradiction with
Havg(f).
The Nisan–Wigderson generator (the real thing)
Theorem (Nisan–Wigderson).S time-constructible, nondecreasing. If there is
f∈DTIME(2O(n)) with Havg(f)(n)≥S(n), then there is an
S(δℓ)δ-PRG, for some δ>0.
The two warm-ups appended one or two independent hard bits. NW appends many hard
bits f(ZI1),…,f(ZIm) — but to make m large from a seed of length ℓ,
the index sets Ij must overlap. They must overlap little, or the outputs would be
correlated. The right object is a combinatorial design.
(ℓ,n,d)-design. A family I={I1,…,Im} with Ij⊆{1,…,ℓ},
∣Ij∣=n, and pairwise overlaps ∣Ij∩Ij′∣≤d. (Almost-disjoint n-subsets
of an ℓ-universe.)
NW generator.NWIf(Z)=f(ZI1)⋅f(ZI2)⋯f(ZIm),
where Z∈{0,1}ℓ and ZIj is Z restricted to the indices in Ij.
Two lemmas assemble the theorem:
L14 (designs exist & are constructible). For n>d and ℓ>10n2/d, an
algorithm computes an (ℓ,n,d)-design with m=2d/10 subsets in time
2O(ℓ). Greedy + probabilistic: a random J (each element in with prob 2n/ℓ)
has E[∣J∣]=2n and E[∣J∩Ii∣]=2n2/ℓ<d/5; Chernoff makes
∣J∣≥n and all overlaps ≤d simultaneously with probability ≥0.4, so the
greedy “add the first valid J” succeeds and builds 2d/10 sets.
L15 (a hard f on a design ⇒ PRG). If I is an (ℓ,n,d)-design with
∣I∣=2d/10 and Havg(f)>22d, then NWIf(Uℓ) is
(Havg/10,1/10)-pseudorandom.
Proof of L15 — the key “overlap pays off” step. Suppose (for contradiction, via
Yao) a size-S/2 circuit C predicts output bit i, i.e.
PrZ[C(f(ZI1),…,f(ZIi−1))=f(ZIi)]≥21+10⋅2d/101.
Split Z=(Z1,Z2) into the bits inside Ii and the rest, and fix Z2 by an
averaging argument. Now every other output f(ZIj) depends on the variable Z1
only through ∣Ii∩Ij∣≤d coordinates — so each is computed by a tiny circuit of
size ≤d2d. Hard-wiring these into C yields a circuit B of size
#other outputs2d/10⋅each cheapd2d+CS/2<S
that approximates f on n-bit inputs with advantage ≥21+S1 —
contradicting Havg(f)>22d.□
The whole arc in one breath. A function f that is hard on average (no small
circuit approximates it) can be sampled at malmost-independent windows of one short
seed; because the windows overlap in ≤d places, an adversary trying to predict one
output bit could be turned into a small circuit for f — impossible. So the output
looks random to all small circuits: a PRG. Plug the PRG into the BPP theorem, set the
seed to O(logn), and randomness was never needed: BPP=P.
Closing themes table
Method
What the analysis needed
What you replace coins with
Cost / Yield
Enumeration
nothing
try all 2r(n) seeds
poly iff r(n)=O(logn)
Non-uniform advice
error <2−n
one fixed string per length
BPP⊆P/poly, non-constructive
RP matrix theorem
majority of seeds correct
n seeds (greedy set cover)
small witness set, size n
Conditional probabilities
only the expectationE[C]
fix bits one-by-one, steer to better child
deterministic ≥E[C] object
Pessimistic estimator
a poly-computable upper bound on failure
drive Proot<1 down the tree
works when Pr[good] is not an expectation (Set Balancing)
Pairwise independence
only 2-variable interactions
⨁j∈Jibj, O(logn) bits
O(n)-size space, enumerate (MIS →NC2)
k-wise independence
k-variable interactions
linear codes (any k columns indep.)
space poly(n) / O(nk)
Covering codes
a ball contains a solution
run Promise-Ball solver at every center
deterministic k-SAT ≈ randomized time
PRG (Nisan–Wigderson)
fool size-S circuits
stretch hard function over a design
hardness ⇒BPP=P
The unifying lesson: derandomization is accounting. Find out exactly how much
randomness the proof actually consumed — the expectation only? pairwise correlations
only? indistinguishability to small circuits only? — and supply precisely that much
from a tiny, enumerable source. The less the analysis truly needed, the cheaper (and
sometimes free) the coins turn out to be.