\documentclass[11pt]{article}

\usepackage{lecture}
\begin{document}

\lecture{19}{4/8/2013}{Pseudorandomness for Regular Branching Programs}{Nick Pappas}

\newtheorem{gc}{Claim}
\newtheorem{weight}{Lemma}

\draft

Until now, our exploration of pseudorandomness for ROBP only exploits that ``small width''
indicates small-entropy loss of the seed conditioned on the middle state.
In this section we consider exploiting more structural properties of ROBP.
Towards this end, we will prove that INW generator fools poly-logarithmic width \emph{regular} branching programs
using seed length $O(\log n\log\log n)$ (the dependence on error $\varepsilon$ will be elaborated later).

An ROBP is regular if every vertex (except the starting one) has exactly two incoming edges.
In the highest level, we will exploit regularity to improve the ordinary INW hybrid-argument analysis:
The key concept we shall exploit is the \emph{weight} of a program.

To get some first intuitions about weight, let's consider, for each vertex $v$,
the quantity $q(v)$ which is the accepting probability of running the program starting at $v$ \emph{over uniform input}.
An important observation is that, if for a layer $i$ and any two vertices $u$ and $v$ in that layer, we have $q(u) = q(v)$,
then we could forget about all the layers before $i$.
This is simply because the end goal of pseudorandomness is to approximate the accepting probability,
and no matter which vertex we start, we will end with the same.

To capture this intuition, for each edge $(u,v)$, we define the \emph{weight of the edge} to be $|q(u) - q(v)|$.
Then, in the above case, every edge before layer $i$ has weight zero.
This leads us to a natural measure of weight of a program, by summing up the weights of all edges:
\begin{definition}[Weight of a Program]
  Given an ROBP $P$, its weight is defined to be the sum of weights of all edges.
\end{definition}
Intuitively, a program with small weight means that most part of the program has little impact on the accepting probability,
and thus could be ``forgotten''. To analyze the effect of weight, we introduce the concept of \emph{valuation function}.
Given a program $P$ on $m$ inputs, its valuation function is a function ${\rm val}_P:\zo^m \mapsto {\tt R}$,
so that on input $x \in \zo^m$, returns $q({\rm path}(x)_{m+1})$, where ${\rm path}(x)$ is the sequence of vertices
induced by starting vertex of $P$ and reading input $x$.

We will use INW generator of the following form
\begin{align*}
  G_j: \zo^{k + kj} \mapsto \zo^{2^j}
\end{align*}
where the extractor we use one with the following special property:
\begin{fact}
  \label{fact:GW-extractor}
  For any $\beta > 0$, there exists $k = \Theta(\log\frac{1}{\beta})$ and
  an explicit extractor $E_j: \zo^{kj} \times \zo^k \mapsto \zo^{kj}$ such that the following holds:
  let $z = (z_0,z_1,\dots,z_{j-1}) \sim \zo^{kj}$, and $z_i \sim \zo^k$,
  then for any event $A$ that only depends on $z$ and $\Pr_z[A] \geqslant \beta$,
  $\Delta\Big(E_j(z \ |\ A, z_i), U_{kj}\Big) \leqslant \beta$.
\end{fact}
\begin{proof}
  Let $X$ be the uniform distribution over $\zo^{kj}$, let's consider the min-entropy of $X$ conditioned on $A$,
  which is defined to be
  \begin{align*}
    {\rm H}_\infty(X | A) = \log\frac{1}{\max_x \Pr\Big[ X=x | A\Big]}
  \end{align*}
  Note that
  \begin{align*}
    \Pr\Big[ X = x | A \Big] = \frac{\Pr\Big[ X = x, A \Big]}{\Pr\Big[ A \Big]}
    \leqslant \frac{\Pr\Big[ X=x \Big]}{\Pr\Big[ A \Big]} \leqslant \frac{\Pr\Big[ X=x \Big]}{\beta}
  \end{align*}
  Thus ${\rm H}_\infty(X|A) \geqslant {\rm H}_\infty(X) - \log(1/\beta)$.
  It follows that the source has entropy at least $n-\log(1/\beta)$ conditioned on $A$.
  Using spectral extractor, we have that by supplying a seed of length $\log(1/\beta) + \log(1/\varepsilon)$
  the output of the extractor is $\varepsilon$-close to uniform, the fact follows by setting $\varepsilon = \beta$.
\end{proof}

For a program $P$ reading $2^j$ input bits, our end goal is to bound
\begin{align*}
  \bigg| \Exp_{x \sim U_{kj}, y \sim U_k}\Big[{\rm val}_P(G_j(x,y))\Big] - \Exp_{u_1,u_2 \sim U_{2^{j-1}}}\Big[{\rm val}_P(u_1,u_2)\Big] \bigg| \tag{1}
\end{align*}
\emph{The bound will depend on ``the weight'' of $P$, so we write the bound as $e_j(P)$}.
By definition, (1) is nothing more than
\begin{align*}
  \bigg| &\Exp_{x \sim U_{kj}, y \sim U_k}\bigg[{\rm val}_P\Big( G_{j-1}(x), G_{j-1}(E_j(x,y)) \Big)\bigg] \\
         &- \Exp_{u_1,u_2 \sim U_{2^{j-1}}}\bigg[{\rm val}_P\Big( u_1, u_2 \Big)\bigg] \bigg|
\end{align*}

As the first step to derive the bound, we insert a hybrid ${\rm val}_P\Big( G_{j-1}(x), u_2 \Big)$.
Thus it suffices to bound
\begin{align*}
  &\bigg| \Exp_{x \sim U_{kj}, y \sim U_k}\bigg[{\rm val}_P\Big( G_{j-1}(x), G_{j-1}(E_j(x,y)) \Big)\bigg]
         - \Exp_{x \sim U_{kj}, u_2 \sim U_{2^{j-1}}}\bigg[{\rm val}_P\Big( G_{j-1}(x), u_2 \Big)\bigg] \bigg| \tag{2} \\
  &\bigg| \Exp_{x \sim U_{kj}, u_2 \sim U_{2^{j-1}}}\bigg[{\rm val}_P\Big( G_{j-1}(x), u_2 \Big)\bigg]
         - \Exp_{u_1,u_2 \sim U_{2^{j-1}}}\bigg[ {\rm val}_P\Big( u_1, u_2 \Big) \bigg] \bigg| \tag{3}
\end{align*}
The following fact indicates that (3) can be bounded using $e_{j-1}$.
\begin{fact}
  $\Exp_{u \sim U_r}[{\rm val}_P(x,u)] = {\rm val}_P(x)$.
\end{fact}
Let's be very careful, we have made it clear that the bound $e_j$ shall depend on the structure of a program.
In this case, $e_{j-1}$ depends on the first half of $P$. Thus we decompose $P$ into two halves $Q$ and $R$,
so (3) is bounded by $e_{j-1}(Q)$.

To bound (2), we write it according to $x$,
\begin{align*}
  \bigg| \Exp_{x}\bigg[
  &\Exp_{y}\Big[{\rm val}_P\Big( G_{j-1}(x), G_{j-1}(E_j(x,y)) \Big)\Big] \\
  &- \Exp_{u_2}\Big[{\rm val}_P\Big( G_{j-1}(x), u_2 \Big)\Big]\bigg] \bigg|
\end{align*}

We rewrite this expression according to the state we reach after reading $G_{j-1}(x)$.
Formally, for $b \in [w]$, let $A_b$ be the event that we reach vertex $b$ in layer $2^{j-1}+1$ after reading $G_{j-1}(x)$,
and $R_b$ be the program starting at $b$,
thus the above can be written as
\begin{align*}
  &\ \bigg| \sum_{b}\Pr_x[A_b] \bigg(
    \Exp_{y}  \Big[{\rm val}_{R_b}\Big( G_{j-1}(E_j(x | A_b, y)) \Big) \Big]
  - \Exp_{u_2}\Big[{\rm val}_{R_b}\Big( u_2                     \Big) \Big]
  \bigg) \bigg| \\
  \leqslant&\ 
  \sum_{b}\Pr_x[A_b] \bigg|
    \Exp_{y}  \Big[{\rm val}_{R_b}\Big( G_{j-1}(E_j(x | A_b, y)) \Big) \Big]
  - \Exp_{u_2}\Big[{\rm val}_{R_b}\Big( u_2                     \Big) \Big] \bigg| \tag{4}
\end{align*}

We need the following simple fact:
\begin{fact}
  For any two distributions $X,Y$
  \begin{align*}
    \bigg| \Exp[{\rm val}_P(X)] - \Exp[{\rm val}_P(Y)] \bigg| \leqslant {\rm weight}(P) \cdot \Delta(X,Y)
  \end{align*}
\end{fact}

There are two cases
\begin{enumerate}
\item [(I).] $\Pr_x[A_b] < \beta$,
\begin{align*}
  &\ \bigg|
    \Exp_{y}  \Big[{\rm val}_{R_b}\Big( G_{j-1}(E_j(x | E_b, y)) \Big) \Big]
  - \Exp_{u_2}\Big[{\rm val}_{R_b}\Big( u_2                     \Big) \Big] \bigg|
  \leqslant 1
\end{align*}
This is because both expectations are convex combinations of values in $[0,1]$.

\item [(II).] $\Pr_x[A_b] \geqslant \beta$,
  then Fact~\ref{fact:GW-extractor} tells that $G_{j-1}(E_j(x\ |\ A_b, y))$ is $\beta$-close to $G_{j-1}(U_{kj})$, thus
  \begin{align*}
    &\ \bigg| \Exp_{y}     \Big[{\rm val}_{R_b}\Big( G_{j-1}(E_j(x | A_b, y)) \Big) \Big]
    - \Exp_{u_2}\Big[{\rm val}_{R_b}\Big( u_2                   \Big) \Big] \bigg| \\
    \leqslant&\ 
    \bigg|  \Exp_{y}  \Big[{\rm val}_{R_b}\Big( G_{j-1}(E_j(x | A_b, y)) \Big) \Big]
    - \Exp\Big[{\rm val}_{R_b}\Big( G_{j-1}(U_{kj}           \Big) \Big] \bigg|
    + 
    \bigg|  \Exp_{y}  \Big[{\rm val}_{R_b}\Big( G_{j-1}(U_{kj}) \Big) \Big]
    - \Exp_{u_2}\Big[{\rm val}_{R_b}\Big( u_2   \Big) \Big] \bigg| \\
    \leqslant&\ {\rm weight}(R_b) \cdot \beta + e_{j-1}(R_b) \\
  \end{align*}
\end{enumerate}
Let $B = \{b\ :\ \Pr[A_b] < \beta\}$, and put $e_j(P) := a_j{\rm weight}(P)$,
thus (4) is bounded as follows:
\begin{align*}
  &\ \sum_{b}\Pr_x[A_b] \bigg|
    \Exp_{y}  \Big[{\rm val}_{R_b}\Big( G_{j-1}(E_j(x | A_b, y)) \Big) \Big]
  - \Exp_{u_2}\Big[{\rm val}_{R_b}\Big( u_2                     \Big) \Big] \bigg|  \\
  =&\   \sum_{b \in B}\Pr_x[A_b] \cdot 1
      + \sum_{b \notin B}\Pr_x[A_b] \cdot \Big( {\rm weight}(R_b) \cdot \beta + e_{j-1}(R_b) \Big) \\
  \leqslant&\
        \sum_{b \in B}\Pr_x[A_b] \cdot 1
      + \sum_{b \notin B}\Pr_x[A_b] \cdot \Big( {\rm weight}(R) \cdot \beta + e_{j-1}(R) \Big) \\
  \leqslant&\
        \sum_{b \in B}\beta
      + \sum_{b \notin B}\Pr_x[A_b] \cdot \Big( {\rm weight}(R) \cdot \beta + e_{j-1}(R) \Big) \\
  \leqslant&\ w\beta + \Big( {\rm weight}(R) \cdot \beta + e_{j-1}(R) \Big) \\
  =&\ \Big( w+ {\rm weight}(R) \Big) \cdot \beta + e_{j-1}(R)
\end{align*}

Thus the total error is
\begin{align*}
  e_j(P) \leqslant e_{j-1}(Q) + \Big( w + {\rm weight}(R) \Big) \cdot \beta + e_{j-1}(R)
\end{align*}
Let's determine $a_j$ now, expanding and use the fact that ${\rm weight}(R) \leqslant {\rm weight}(P)$,
we have
\begin{align*}
  a_j \leqslant a_{j-1} + \Big( w + {\rm weight}(P) \Big) \cdot \beta
\end{align*}
Given $a_0=0$, thus it suffices to set $a_j = j \cdot \Big(w + {\rm weight}(P) \Big) \cdot \beta$.
This gives our main theorem:

\begin{theorem}
  $G_j$ fools an ROBP $P$ on $2^j$ inputs with error $j \cdot \Big(w + {\rm weight}(P) \Big) \cdot \beta$.
\end{theorem}

\section{Weight of Regular Programs}

For regular programs, indeed we can show that the weight is small.
\begin{theorem}
  \label{thm:rROBP-weight}
  Consider regular programs with only one accept state,
  then the weight of a regular program is bounded by $2(w-1)$.
\end{theorem}

Given width $w$, we use $(i,j) \in [n] \times [w]$ to denote the $j$-th vertex at layer $i$.
Let $q((n,j))=1$ if it's an accept state and $0$ otherwise,
then Theorem~\ref{thm:rROBP-weight} is a corollary of the following lemma.
\begin{lemma}
  The weight of a regular program is bounded by $2\sum_{i \neq j \in [w]}|q((n,i)) - q((n,j))|$.
\end{lemma}

Because in Theorem~\ref{thm:rROBP-weight} we have only one accept state, it follows that this quantity is $2(w-1)$, as desired.
Note in general we could have multiple accept states for a regular branching programs,
and the maximum bound achieves when half of the states are accept states,
the weight is roughly $2 \cdot (w/2)^2 = w^2/2$.
\begin{proof}
  The lemma is proved by considering following game.
  We have $2w$ pebbles on real line $q_1,q_2,\dots,q_{2w-1},q_{2w}$.
  We can do the following move, for two numbers $q_i,q_j$ of distance at least $2\delta$,
  one can move them towards each other by a distance of $\delta$, and the gain is $2\delta$.
  The goal of this game is to maximize the gain.

  What is the connection of this game to the weight? Consider two vertices $j,k \in [w]$ at layer $i$,
  and $\ell$ at layer $i-1$ has two outgoing edges to $j,k$.
  Suppose we have two numbers $q((i,j))$ and $q((i,k))$ in the game. Then moving them to the middle position,
  $\big( q(i,j) + q(i,k) \big)/2$, gives gain $|q((i,j)) - q((i,k))|$.
  This is exactly \emph{the sum of the weights of edges $\ell \rightarrow j$ and $\ell \rightarrow k$}.
  Note that, once $q(i,j)$ and $q(i,k)$ are moved to their median,
  we have two pebbles of value $q(i-1, \ell)$.

  Let's start with
  $$q_1=q((n,1)), q_2=q((n,1)), \dots, q_{2w-1}=q((n,w)), q_{2w}=q((n,w))$$
  The crucial thing is that \emph{if we play the game according to the transition function at the current layer (starting with $n$),
    we will get into the same game with these numbers set as probability mass at layer $i-1$}:
  This is because the program is regular,
  it follows that each vertex contributes \emph{exactly twice} to construct the probability mass in the previous layer.
  That is, if we play the game according to the transitions at layer $i$,
  not only we get exactly two pebbles for each vertex in layer $i-1$, but also it suffices we put two pebble for each vertex at layer $i$.

  It follows that if we move backward layer by layer,
  the weight of the program is bounded by the maximum gain of the game,
  which we claim to be
  $$\sum_{i\neq j \in [2w]}|q_i-q_j| = 2\sum_{i\neq j \in [w]}|q((n,i))-q((n,j))|$$
  Two facts establishes the claim: First, we only need to consider moving \emph{neighboring} pebbles (i.e. no pebble between them),
  second, if we start with $L = \sum_{i\neq j \in [2w]}|q_i-q_j|$, and move two neighboring numbers $a,b$ close to each other by a distance of $2\delta$,
  then for any other pebble $c$, the sum of distance between $c$ and $a$, and between $c$ and $b$ remains unchanged,
  and so $L$ only decreases by $2\delta$. Because $L$ has to be non-negative, it follows that the gain is upper bound by that.
  Note we can be arbitrarily close to $L$, so the bound is tight.  
\end{proof}

As a result, we have that $G_j$ fools a width-$w$ regular program $P$ on $2^j$-inputs with error $O\Big(j \cdot w \cdot \beta \Big)$,
using seed length $(k+1)j$
where $k = \Theta(\log\frac{1}{\beta})$.
Put $j = \log n$, with total error $\varepsilon$,
we have $\beta = O(\frac{\varepsilon}{w\log n})$, and so the seed length is
\begin{align*}
  O(jk) = O\bigg(\log n \cdot \bigg( \log w + \log\log n  + \log\frac{1}{\varepsilon} \bigg) \bigg)
\end{align*}
For $w = \polylog(n)$ and $\varepsilon = 1/\polylog(n)$, the seed length is $O\Big( \log n \log\log n \Big)$.

\end{document}
