Post · 8 min read· pp. 547–550

CS276 Lecture 12: Goldreich-Levin

Scribed by Jonah Sherman

Summary

Today we prove the Goldreich-Levin theorem.

1. Goldreich-Levin Theorem

We use the notation

⟨x,r⟩:=∑ixiri mod 2     (1)\displaystyle \langle x,r \rangle := \sum_i x_ir_i \bmod 2 \ \ \ \ \ (1)

Theorem 1 (Goldreich and Levin) Let f:{0,1}n→{0,1}n{f: \{ 0,1 \}^n \rightarrow \{ 0,1 \}^n} be a permutation computable in time r{r}. Suppose that A{A} is an algorithm of complexity t{t} such that

*

Px,r[A(f(x),r)=⟨x,r⟩]≥12+ϵ     (2)\displaystyle \mathop{\mathbb P}_{x,r} [ A(f(x),r) = \langle x,r \rangle ] \geq \frac 12 + \epsilon \ \ \ \ \ (2)

Then there is an algorithm A′{A'} of complexity at most O((t+r)ϵ−2nO(1)){O((t+r) \epsilon^{-2}n^{O(1)})} such that

Px[A′(f(x))=x]≥ϵ4\displaystyle \mathop{\mathbb P}_{x} [ A'(f(x)) = x ] \geq \frac \epsilon 4
*

Last time we proved the following partial result.

Lemma 2 (Goldreich-Levin Algorithm — Weak Version) Suppose we have access to a function H:{0,1}n→{0,1}{H: \{ 0,1 \}^n \rightarrow \{ 0,1 \}} such that, for some unknown x{x}, we have

*

Pr∈{0,1}n[H(r)=⟨x,r⟩]≥78     (3)\displaystyle \mathop{\mathbb P}_{r \in \{ 0,1 \}^n} [ H(r) = \langle x,r \rangle ] \geq \frac 78 \ \ \ \ \ (3)

where x∈{0,1}n{x\in \{ 0,1 \}^n} is an unknown string.*

Then there is an algorithm GLW that runs in time O(n2log⁡n){O(n^2\log n)} and makes O(nlog⁡n){O(n\log n)} oracle queries into H{H} and, with probability at least 1−1n{1- \frac{1}{n}}, outputs x{x}.

This gave us a proof of a variant of the Goldreich-Levin Theorem in which the right-hand-side in (2) was 1516{\frac {15}{16}}. We could tweak the proof Lemma 2 so that the right-hand-side of (4) is 34+ϵ{\frac 34 + \epsilon}, leading to proving a variant of the Goldreich-Levin Theorem in which the right-hand-side in (2) is also 34+ϵ{\frac 34 + \epsilon}.

We need, however, the full Goldreich-Levin Theorem in order to construct a pseudorandom generator, and so it seems that we have to prove a strengthening of Lemma 2 in which the right-hand-side in (4) is 12+ϵ{\frac 12 + \epsilon}.

Unfortunately such a stronger version of Lemma 2 is just false: for any two different x,x′∈{0,1}n{x,x'\in \{ 0,1 \}^n} we can construct an H{H} such that

Pr∼{0,1}n[H(r)=⟨x,r⟩]=34\displaystyle \mathop{\mathbb P}_{r\sim \{ 0,1 \}^n} [ H(r) = \langle x,r \rangle ] = \frac 34

and

Pr∼{0,1}n[H(r)=⟨x′,r⟩]=34\displaystyle \mathop{\mathbb P} _{r\sim \{ 0,1 \}^n} [ H(r) = \langle x',r \rangle ] = \frac 34

so no algorithm can be guaranteed to find x{x} given an arbitrary function H{H} such that P[H(r)=⟨x,r⟩]=34{\mathop{\mathbb P} [ H(r) = \langle x,r \rangle ] = \frac 34}, because x{x} need not be uniquely defined by H{H}.

We can, however, prove the following:

Lemma 3 (Goldreich-Levin Algorithm) Suppose we have access to a function H:{0,1}n→{0,1}{H: \{ 0,1 \}^n \rightarrow \{ 0,1 \}} such that, for some unknown x{x}, we have

*

Pr∈{0,1}n[H(r)=⟨x,r⟩]≥12+ϵ     (4)\displaystyle \mathop{\mathbb P}_{r \in \{ 0,1 \}^n} [ H(r) = \langle x,r \rangle ] \geq \frac 12 + \epsilon \ \ \ \ \ (4)

where x∈{0,1}n{x\in \{ 0,1 \}^n} is an unknown string, and ϵ>0{\epsilon>0} is given.*

Then there is an algorithm GL{GL} that runs in time O(n2ϵ−4log⁡n){O(n^2 \epsilon^{-4}\log n)}, makes O(nϵ−4log⁡n){O(n\epsilon^{-4} \log n)} oracle queries into H{H}, and outputs a set L⊆{0,1}n{L \subseteq \{ 0,1 \}^n} such that ∣L∣=O(ϵ−2){|L| =O(\epsilon^{-2})} and with probability at least 1/2{1/2}, x∈L{x \in L}.

The Goldreich-Levin algorithm GL{GL} has other interpretations (an algorithm that learns the Fourier coefficients of H{H}, an algorithm that decodes the Hadamard code is sub-linear time) and various applications outside cryptography.

The Goldreich-Levin Theorem is an easy consequence of Lemma 3. Let A′{A'} take input y{y} and then run the algorithm of Lemma 3 with H(r)=A(y,r){H(r) = A(y, r)}, yielding a list L{L}. A′{A'} then checks if f(x)=y{f(x) = y} for any x∈L{x \in L}, and outputs it if one is found.

From the assumption that

Px,r[A(f(x),r)=⟨x,r⟩]≥12+ϵ\displaystyle \mathop{\mathbb P}_{x,r} [ A(f(x),r)= \langle x, r \rangle] \geq \frac 12 + \epsilon

it follows by Markov’s inequality (See Lemma 9 in the last lecture) that

Px[Pr[A(f(x),r)=⟨x,r⟩]≥12+ϵ2]≥ϵ2\displaystyle \mathop{\mathbb P}_x \left[ \mathop{\mathbb P}_r [A(f(x),r)=\langle x, r \rangle] \geq \frac 12 + \frac \epsilon 2 \right] \geq \frac \epsilon 2

Let us call an x{x} such that Pr[A(f(x),r)=⟨x,r⟩]≥12+ϵ2{\mathop{\mathbb P}_r [A(f(x),r)=\langle x, r \rangle] \geq \frac 12 + \frac \epsilon 2} a good x{x}. If we pick x{x} at random and give f(x){f(x)} to the above algorithm, there is a probability at least ϵ/2{\epsilon/2} that x{x} is good and, if so, there is a probability at least 1/2{1/2} that x{x} is in the list. Therefore, there is a probability at least ϵ/4{\epsilon/4} that the algorithm inverts f(){f()}, where the probability is over the choices of x{x} and over the internal randomness of the algorithm.

2. The Goldreich-Levin Algorithm

In this section we prove Lemma 3.

We are given an oracle H(){H()} such that H(r)=⟨x,r⟩{H(r)=\langle x, r\rangle} for an 1/2+ϵ{1/2+\epsilon} fraction of the r{r}. Our goal will be to use H(){H()} to simulate an oracle that has agreement 7/8{7/8} with ⟨x,r⟩{\langle x, r \rangle}, so that we can use the algorithm of Lemma 2 the previous section to find x{x}. We perform this “reduction” by “guessing” the value of ⟨x,r⟩{\langle x, r\rangle} at a few points.

We first choose k{k} random points r1…rk∈{0,1}n{r_1 \ldots r_k \in \{ 0,1 \}^n} where k=O(1/ϵ2).{k = O(1 / \epsilon^2).} For the moment, let us suppose that we have “magically” obtained the values ⟨x,r1⟩,…,⟨x,rk⟩{\langle x, r_1 \rangle, \ldots, \langle x, r_k \rangle}. Then define H′(r){H'(r)} as the majority value of:

H(r+rj)−⟨x,rj⟩  j=1,2,…,k     (5)\displaystyle H(r + r_j) - \langle x, r_j \rangle \ \ j = 1, 2, \ldots, k \ \ \ \ \ (5)

For each j{j}, the above expression equals ⟨x,r⟩{\langle x, r \rangle} with probability at least 12+ϵ{\frac{1}{2} + \epsilon} (over the choices of rj{r_j}) and by choosing k=O(1/ϵ2){k=O(1/\epsilon^2)} we can ensure that

Pr,r1,…,rk[H′(r)=⟨x,r⟩]≥3132.     (6)\displaystyle \mathop{\mathbb P}_{r,r_1,\ldots,r_k}\left [H'(r) = \langle x, r \rangle \right ] \ge \frac{31}{32}. \ \ \ \ \ (6)

from which it follows that

Pr1,…,rk[Pr[H′(r)=⟨x,r⟩]≥78]≥34.     (7)\displaystyle \mathop{\mathbb P}_{r_1,\ldots,r_k}\left [ \mathop{\mathbb P}_r \left [H'(r) = \langle x, r \rangle \right ] \ge \frac 78 \right ] \ge \frac{3}{4}. \ \ \ \ \ (7)

Consider the following algorithm.

  • Algorithm GL-First-Attempt
    • pick r1,…,rk∈{0,1}n{r_1, \ldots, r_k \in \{ 0,1 \}^n} where k=O(1/ϵ2){k = O(1/\epsilon^2)}
    • for all b1,…,bk∈{0,1}{b_1, \ldots, b_k \in \{ 0,1 \}}
      • define Hb1…bk′(r){H'_{b_1 \ldots b_k}(r)} as majority of: H(r+rj)−bj{ H(r + r_j) - b_j}
      • apply Algorithm GLW to Hb1…bt′{H'_{b_1 \ldots b_t}}
      • add result to list
    • return list

The idea behind this program is that we do not in fact know the values ⟨x,rj⟩{\langle x, r_j \rangle}, but we can “guess” them by considering all choices for the bits bj.{b_j.} If H(r){H(r)} agrees with ⟨x,r⟩{\langle x, r \rangle} for at least a 1/2+ϵ{1/2+\epsilon} fraction of the r{r}s, then there is a probability at least 3/4{3/4} that in one of the iteration we invoke algorithm GLW with a simulated oracle that has agreement 7/8{7/8} with ⟨x,r⟩{\langle x, r \rangle}. Therefore, the final list contains x{x} with probability at least 3/4−1/n>1/2{3/4 - 1/n > 1/2}.

The obvious problem with this algorithm is that its running time is exponential in k=O(1/ϵ2){k = O(1/\epsilon^2)} and the resulting list may also be exponentially larger than the O(1/ϵ2){O(1/\epsilon^2)} bound promised by the Lemma.

To overcome these problems, consider the following similar algorithm.

  • Algorithm GL
    • pick r1,…,rt∈{0,1}n{r_1, \ldots, r_t \in \{ 0,1 \}^n} where k=log⁡O(1/ϵ2){k = \log O(1/\epsilon^2)}
    • define rS:=∑j∈Srj{r_S := \sum_{j\in S} r_j} for each non-empty S⊆{1,…,t}{S\subseteq \{1,\ldots,t\}}
    • for all b1,…,bt∈{0,1}{b_1, \ldots, b_t \in \{ 0,1 \}}
      • define bS:=∑j∈Sbj{b_S := \sum_{j\in S} b_j} for each non-empty S⊆{1,…,t}{S\subseteq \{1,\ldots,t\}}
      • define Hb1…bk′(r){H'_{b_1 \ldots b_k}(r)} as majority of: H(r+rS)−bS{ H(r + r_S) - b_S} over non-empty S{S}
      • apply Algorithm GLW to Hb1…bt′{H'_{b_1 \ldots b_t}}
      • add result to list
    • return list

Let us now see why this algorithm works. First we define, for any nonempty S⊆{1,…,t},{S \subseteq \{1, \ldots, t\},} rS=∑j∈Srj.{r_S = \sum_{j \in S} r_j.} Then, since r1,…,rt∈{0,1}n{r_1, \ldots, r_t \in \{ 0,1 \}^n} are random, it follows that for any S≠T,{S \neq T,} rS{r_S} and rT{r_T} are independent and uniformly distributed. Now consider an x{x} such that ⟨x,r⟩{\langle x, r \rangle} and H(r){H(r)} agree on a 12+ϵ{\frac{1}{2} + \epsilon} fraction of the values of r{r}. Then for the choice of {bj}{\{b_j\}} where bj=⟨x,rj⟩{b_j = \langle x, r_j \rangle} for all j,{j,} we have that

bS=⟨x,rS⟩\displaystyle b_S = \langle x, r_S \rangle

for every non-empty S{S}. In such a case, for every S{S} and every r{r}, there is a probability at least 12+ϵ,{\frac{1}{2} +\epsilon,} over the choices of the rj{r_j} that

H(r+rS)−bS=⟨x,r⟩ ,\displaystyle H(r+ r_S) - b_S = \langle x, r \rangle\ ,

and these events are pair-wise independent. Note the following simple lemma.

Lemma 4 Let R1,…,Rk{R_1, \ldots, R_k} be a set of pairwise independent 0−1{0-1} random variables, each of which is 1{1} with probability at least 12+ϵ.{\frac{1}{2} + \epsilon.} Then P[∑iRi≥k/2]≥1−14ϵ2k{\mathop{\mathbb P}[\sum_i R_i \ge k/2] \ge 1 - \frac 1 {4\epsilon^2 k}}.

Proof: Let R=R1+⋯+Rt{R=R_1+\cdots+R_t}. The variance of a 0/1 random variable is at most 1/4{1/4}, and, because of pairwise independence, Var[R]=Var[R1+…+Rk]=∑iVar[Rk]≤k/4{{\bf Var}[R] = {\bf Var} [ R_1+\ldots+R_k] = \sum_i {\bf Var}[R_k] \leq k/4}.

We then have

P[R≤k/2]≤P[∣R−E[R]∣≥ϵk]≤Var[R]ϵ2k2≤14ϵ2k\displaystyle \mathop{\mathbb P}[ R \leq k/2] \leq \mathop{\mathbb P}[ |R - \mathop{\mathbb E}[R]| \geq \epsilon k] \leq \frac{{\bf Var}[R]}{\epsilon^2 k^2} \leq \frac 1 {4\epsilon^2 k}

□\Box

Lemma 4 allows us to upper-bound the probability that the majority operation used to compute H′{H'} gives the wrong answer. Combining this with our earlier observation that the {rS}{\{r_S\}} are pairwise independent, we see that choosing t=log⁡(128/ϵ2){t = \log (128/\epsilon^2)} suffices to ensure that Hb1…bt′(r){H'_{b_1 \ldots b_t}(r)} and ⟨x,r⟩{\langle x, r\rangle} have agreement at least 7/8{7/8} with probability at least 3/4{3/4}. Thus we can use Algorithm A78{A_{\frac 78}} to obtain x{x} with high probability. Choosing t{t} as above ensures that the list generated is of length at most 2t=128/ϵ2{2^t = 128/\epsilon^2} and the running time is then O(n2ϵ−4log⁡n){O( n^2 \epsilon^{-4} \log n)} with O(nϵ−4log⁡n){O(n\epsilon^{-4}\log n)} oracle accesses, due to the O(1/ϵ2){O(1 / \epsilon^2)} iterations of Algorithm GLW, that makes O(nlog⁡n){O(n\log n)} oracle accesses, and to the fact that one evaluation of H′(){H'()} requires O(1/ϵ2){O(1/\epsilon^2)} evaluations of H(){H()}.