\documentclass[10pt]{article}
\usepackage{amsfonts,amsthm,amsmath,amssymb}
\usepackage{array}
\usepackage{epsfig}
\usepackage{fullpage}
\usepackage{amssymb}
\usepackage[colorlinks = false]{hyperref}
\newcommand{\1}{\mathbbm{1}}
\DeclareMathOperator*{\argmin}{argmin}
\DeclareMathOperator*{\argmax}{argmax}
\newcommand{\x}{\times}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\F}{\mathbb{F}}
\newcommand{\E}{\mathop{\mathbb{E}}}
\renewcommand{\bar}{\overline}
\renewcommand{\epsilon}{\varepsilon}
\newcommand{\eps}{\varepsilon}
\newcommand{\DTIME}{\textbf{DTIME}}
\renewcommand{\P}{\textbf{P}}
\newcommand{\SPACE}{\textbf{SPACE}}
\newcommand{\FF}{\mathbb{F}}
\newcommand{\EE}{\mathbb{E}}
\begin{document}
\input{preamble.tex}
\newtheorem{example}[theorem]{Example}
\theoremstyle{definition}
\newtheorem{defn}[theorem]{Definition}
\handout{CS 229r Essential Coding Theory}{April 20, 2020}{Instructor:
Madhu Sudan}{Scribe: Elbert Du}{Lecture 22}
\section{Coding in Complexity Theory}
\subsection{Pseudorandomness}
Goal: We wish to be able to use a pseudorandom generator $G$ which takes as input a small number of random bits and turn it into a large number of bits indistinguishable from random.\\
\begin{definition}
We define the generator $G$ to be $\epsilon$-fooling if
$$P_R[A(x,R) = 1] \approx \epsilon \Pr_z[A(x,G(z)) = 1]$$
\end{definition}
In general, we would want for all poly time $A$ but here we will only require it for a single poly time $A$.\\
The main parameter of $G$ is then the seed length (the length of $z$ in the equation above).\\
Today, we'll be using codes to get an approximate solution for Max t-SAT.\\
Input: $C_1, \dots C_m$ where we have variables $x_1,x_2, \dots x_n$ and $C_j = y_1 \vee y_2 \vee \dots \vee y_t$ where $y_i = \neg x_k$ or $y_i = x_k$ for some $k$.\\
Output: find assignment satisfying as many clauses as possible.\\
Random assignment: satisfies $\left(1-2^{-t}\right)m$ clauses on expectation since each literal has $\frac{1}{2}$ chance to be satisfied independent of the others within a clause.\\
\begin{definition}
A generator $G:\{0,1\}^S \rightarrow \{0,1\}^n$ is t-wise independent if for all $T \subseteq [n], |t| \le t$, then
$$G(z)|_T \simeq Unif(\{0,1\}^T)$$
when $z \sim Unif(\{0,1\}^S)$
\end{definition}
If $\exists$ a t-wise independent generator $G$, then we get a $m(1-2^{-t})$ approximator to Max t-SAT in time $2^S m$ by just testing out all the seeds.\\
\begin{lemma}
Given a linear code $C \subseteq \FF_2^n$ with $\Delta(C^\perp) > t$, then the encoding function $E$ of $C$ is t-wise independent.
\end{lemma}
\begin{proof}
We know from before that $E(m)|_S$ is uniform on the image for any $S \subseteq [n]$. Now, we claim that if $\Delta(C^\perp) > t$,
$$Im(E(m)|_T) = \{0,1\}^T$$
which would complete our proof.\\
Suppose for the sake of contradiction some $x \in \{0,1\}^T$ is not in the image. Then, there is some codeword with weight $t$ in $C^\perp$ since it is generated by the parity check matrix of $C$. This violates the assumption that $C^\perp$ has distance greater than $t$ so such an $x$ does not exist. Hence, all $x \in \{0,1\}^T$ is in the image and we are done.
\end{proof}
Thus, we want a small code such that the dual has distance $t$. What's the best we can do?\\
Suppose $C^\perp$ is the BCH code of distance $t+1$. Then, we get parameters $C^\perp = [n,n-(\frac{t}{2})\log n,t+1]_2$ so $C = [n,(\frac{t}{2})\log n, t+1]_2$ so $S = (\frac{t}{2})\log n$\\
Therefore this gives us a deterministic $n^{t/2}m$ time approximation algorithm for max t-SAT\\
Now, can we do any better? To do so, we will introduce a notion of bias:\\
\begin{definition}
$G: \FF_2^S \rightarrow \FF_2^n$ is $\epsilon$-biased if for every linear function $\mathcal{L}:\FF_2^n \rightarrow \FF_2$, we have
$$\abs{\Pr_{x \sim Unif}[\mathcal{L}(x)=1] - \Pr_{z \sim Unif}[\mathcal{L}(G(z)) = 1]} \le \epsilon$$
We say that $G$ is $\epsilon$-biased on $\mathcal{L}$ if it satisfies the definition for the particular function $\mathcal{L}$
\end{definition}
\begin{definition}
$G:\{0,1\}^S \rightarrow \{0,1\}^n$ is $\delta$-almost t-wise independence if $\forall T \subseteq [n], |T| \le t$ we have
$$\{G(z)|_T\}_{Z \sim Unif} \approx_{\delta} Unif(\{0,1\}^T)$$
\end{definition}
Note: using one of these gives us a $(1-2^{-t}-\delta)$ approximation in time $2^Sm$ for the same reason as above
\begin{lemma}
If $G:\FF_2^S \rightarrow \FF_2^n$ is $\epsilon$-biased, then $G(z) \approx_{2^n \epsilon} Unif(\{0,1\}^n)$
\end{lemma}
\begin{proof}
So far, we have for any nonzero linear function $\mathcal{F}$,
$$\abs{\Pr[\mathcal{L}(G(z)) = 1] - \frac{1}{2}} = \abs{\Pr[\mathcal{L}(G(z)) = 1] - \Pr[\mathcal{L}(x)=1]} \le \epsilon $$
So $\abs{E_z[(-1)^{L(G(z))}]} \le 2\epsilon$\\
What we want:
$$\sum_y \abs{\Pr[G(z) = y] - \frac{1}{2^n}} \le 2\epsilon 2^n$$
If we can show that each value in the sum is at most $2\epsilon$, we're done.\\
Now, let
$$\delta_0(x) = \frac{1}{2^n} \sum_{\mathcal{L}}(-1)^{\mathcal{L}(x)}$$
Note that $\delta_0(x) = 1$ if $x=0$. However, if $x \ne 0$ then all the terms cancel out so $\delta_0(x) = 0$.\\
Similarly, we can define $\delta_{y}(x) = \frac{1}{2^n} \sum_{\mathcal{L}}(-1)^{\mathcal{L}(x-y)}$ and get $\delta_y(y) = 1$ and $\delta_y(x) = 0$ for $x \ne y$\\
Now, we want to show
$$\abs{\Pr[G(z)=y] - \frac{1}{2^n}} \le 2\epsilon$$
which is true iff
$$\abs{\EE[\delta_y(G(z)] - \frac{1}{2^n}} \le 2\epsilon$$
and by the definition of $\delta_y$, this means what we want is
$$\abs{\EE[(-1)^{\mathcal{L}(G(z) - y)}] - \frac{1}{2^n}} \le 2\epsilon$$
and as we work through the equations, we eventually arrive at a statement which follows from $G$ being $\epsilon$-biased
\end{proof}
\begin{lemma}
If $G$ is $\epsilon$-biased, then $\forall$ t $G$ is $(\epsilon 2^t)$-almost t-wise independent.
\end{lemma}
\begin{proof}
Since $G$ is $\epsilon$-biased, then $\forall T$ $G|_T$ is $\epsilon$-biased so $G$ is almost uniform.
\end{proof}
Now, if we just set $\delta < \frac{1}{2m}$ and $\epsilon \le \frac{1}{2^t2m}$, then the $\delta$-almost t-wise independence won't give us any margin for error and we get the desired generator.
\begin{definition}
A code is $\epsilon$-balanced if the distance is between $(\frac{1}{2} \pm \epsilon)N$
\end{definition}
\begin{lemma}
If $G$ is a generator of $\epsilon$-balanced code, then the encoding given my $i \rightarrow i^{th}$ column of $G$ is $\epsilon$-biased.
\end{lemma}
\begin{proof}
Code is generated by $k \times N$ matrix $M$, take the $i^{th}$ column to get a generator $G:[N] \rightarrow \FF_2^K$.
What does linear test look like? Consider multiplying a vector $[\alpha_1, \dots \alpha_k]$ by $M$, we get $\alpha M$, the encoding of the vector. For it to be balanced, the proportion of $1$s and $0$s must be within $\frac{1}{2} \pm \epsilon$ so in particular the $i^{th}$ coordinate should be uniform over the choice of $\alpha$
\end{proof}
Conclusion: we previously constructed explicit codes w/ $N = \frac{k}{\epsilon^3}$ and $\frac{k^2}{\epsilon^2}$ so for our setting, set $K=n$ and $\epsilon = \frac{1}{2^tm}$
$2^S = N = 2^{2t}m^2n^2 = O(2^{2t}m^4)$ so runtime is $O(2^{2t}m^5)$\\
Now, what if we combined the two things we constructed today?\\
\begin{lemma}
Let $G_1$ be $\epsilon$-biased and $G_2$ be $t$-wise independent and linear. Then $G = G_2 \circ G_1$ is $\epsilon 2^t$-almost t-wise independent.
\end{lemma}
\begin{proof}
Since $G_2$ is t-wise independent, $G_2(w)|_T$ has no non-trivvial dependencies among the output regardless of distribution of $w$.\\
Now, if $G_2$ fools some linear $\mathcal{L}$, then $\mathcal{L}(G_2(w))$ is some parity of bits of $w$ so\\
$\mathcal{L} \ne 0 \implies (\mathcal{L} \circ G_2) \ne 0$\\
Furthermore, we know that $\mathcal{L} \circ G_2$ is a linear test since both are linear and $G_1$ fools all linear tests so $(G_2 \circ G_1)|_T$ is $\epsilon$-biased.
\end{proof}
Applying this we get a runtime of $\frac{2^{2t}}{\epsilon^2} \log^2n \cdot n$ for a $(1-2^{-t}-\epsilon)$-approximation
\section{Exercises}
\begin{enumerate}
\item How can you use random assignment to get a similar bound on the number of clauses satisfied in Max t-SAT with high probability?\\
Solution: Consider the probability that we get a value greater than $(1-2^{-t} - \epsilon)m$.\\
If we have $p$ probability of getting greater than $(1-2^{-t} - \epsilon)m$ and $1-p$ of getting at most $(1-2^{-t} - \epsilon)m$, then we need the expected value to be $(1-2^{-t})m$ so we have
$$pm + (1-p)(1-2^{-t} - \epsilon)m \ge (1-2^{-t})m$$
$$\frac{p}{1-p} \ge 2^t\epsilon$$
if we have $\epsilon = 2^{-t}$, then $p \ge \frac{1}{2}$. We can now repeat this process $k$ times and take the maximum for a probability of $1-2^{-k}$ of getting a result of at least $(1-2^{1-t})m$
\item Complete the proof of lemma 6.\\
Solution: in the notes Madhu posted.\\
$\epsilon$-bias of $G$ means that the difference between distribution of $\mathcal{L}(G(z) - y)$ and $\mathcal{L}(x-y)$ for $x$ chosen uniformly is $\epsilon$. Each difference in the distributions can change the value of the sum by at most $2$ as it either changes a value from $-1$ to $1$ or vice versa or it does nothing and the number of differences is at most $\epsilon$.\\
This tells us that the difference between $\EE[(-1)^{\mathcal{L}(G(z)-y)}]$ and $\EE[(-1)^{\mathcal{L}(x-y)}]$ is at most $2\epsilon$. Over random $x$ $\Pr[\mathcal{L}(x-y) = 0] - \Pr[\mathcal{L}(x-y) = 1] = 0$ if $\mathcal{L}$ is non-zero and $1$ if $\mathcal{L}$ is zero so
$$\EE[(-1)^{\mathcal{L}(x-y)}] = \Pr[\mathcal{L} = 0] = \frac{1}{2^n}$$
which gives us the desired result.
\end{enumerate}
\end{document}