%\documentstyle[10pt,twoside]{article}
\documentstyle[twoside, 11pt]{article}
\setlength{\oddsidemargin}{0.25 in}
\setlength{\evensidemargin}{-0.25 in}
\setlength{\topmargin}{-0.6 in}
\setlength{\textwidth}{6.5 in}
\setlength{\textheight}{8.5 in}
\setlength{\headsep}{0.75 in}
\setlength{\parindent}{0 in}
\setlength{\parskip}{0.1 in}

%
% The following commands sets up the lecnum (lecture number)
% counter and make various numbering schemes work relative
% to the lecture number.
%
\newcounter{lecnum}
\renewcommand{\thepage}{\thelecnum-\arabic{page}}
\renewcommand{\thesection}{\thelecnum.\arabic{section}}
\renewcommand{\theequation}{\thelecnum.\arabic{equation}}
\renewcommand{\thefigure}{\thelecnum.\arabic{figure}}
\renewcommand{\thetable}{\thelecnum.\arabic{table}}

%
% The following macro is used to generate the header.
%
\newcommand{\problemset}[3]{
   \pagestyle{myheadings}
   \thispagestyle{plain}
   \newpage
   \setcounter{lecnum}{#1}
   \setcounter{page}{1}
   \noindent
   \begin{center}
   \framebox{
      \vbox{\vspace{2mm}
    \hbox to 6.28in { {\bf CS~151~~~Complexity Theory
                        \hfill Spring 2023} }
       \vspace{4mm}
       \hbox to 6.28in { {\Large \hfill Problem Set #1  \hfill} }
       \vspace{2mm}
       \hbox to 6.28in { {\it Out: #2 \hfill Due: #3} }
      \vspace{2mm}}
   }
   \end{center}
   \vspace*{4mm}
}

%
% Convention for citations is authors' initials followed by the year.
% For example, to cite a paper by Leighton and Maggs you would type
% \cite{LM89}, and to cite a paper by Strassen you would type \cite{S69}.
% (To avoid bibliography problems, for now we redefine the \cite command.)
%
\renewcommand{\cite}[1]{[#1]}

\input{epsf}

%Use this command for a figure; it puts a figure in wherever you want it.
%usage: \fig{NUMBER}{FIGURE-SIZE}{CAPTION}{FILENAME}
\newcommand{\fig}[4]{
            \vspace{0.2 in}
            \setlength{\epsfxsize}{#2}
            \centerline{\epsfbox{#4}}
            \begin{center}
            Figure \thelecnum.#1:~#3
            \end{center}
    }

% Use these for theorems, lemmas, proofs, etc.
\newtheorem{theorem}{Theorem}[lecnum]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newenvironment{proof}{{\bf Proof:}}{\hfill\rule{2mm}{2mm}}

% Some useful equation alignment commands, borrowed from TeX
\makeatletter
\def\eqalign#1{\,\vcenter{\openup\jot\m@th
  \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil
      \crcr#1\crcr}}\,}
\def\eqalignno#1{\displ@y \tabskip\@centering
  \halign to\displaywidth{\hfil$\displaystyle{##}$\tabskip\z@skip
    &$\displaystyle{{}##}$\hfil\tabskip\@centering
    &\llap{$##$}\tabskip\z@skip\crcr
    #1\crcr}}
\def\leqalignno#1{\displ@y \tabskip\@centering
  \halign to\displaywidth{\hfil$\displaystyle{##}$\tabskip\z@skip
    &$\displaystyle{{}##}$\hfil\tabskip\@centering
    &\kern-\displaywidth\rlap{$##$}\tabskip\displaywidth\crcr
    #1\crcr}}
\makeatother

% **** IF YOU WANT TO DEFINE ADDITIONAL MACROS FOR YOURSELF, PUT THEM HERE:


\begin{document}
\problemset{3}{April 20}{{\bf April 27}}


Reminder: you are encouraged to work in groups of two or three;
however you must turn in your own write-up and note with whom you
worked. You may consult the course notes and the optional text (Papadimitriou). The
full honor code guidelines and collaboration policy can be found in the course syllabus.


Please attempt all problems. {\bf Please turn in your solutions via
  Gradescope, by 1pm on the due date.}


\begin{enumerate}
\item Barrington's Theorem. We begin with a few words of
background before the actual problem. A {\em branching program} is
a directed acyclic graph in which each node is labelled by a
variable $x_i$, one of these is designated as the {\em start node}
and there are two special nodes labelled ``accept'' and
``reject.'' All of the nodes labelled with variables have exactly
two outgoing edges, one labelled ``0'' and the other labelled
``1''. An input $x = x_1x_2\ldots x_n$ defines a path from the
start node to the accept or reject node as follows: at every node
labelled $x_i$, we follow the outgoing edge whose label coincides
with the value of $x_i$ in the input. If we reach the accept node,
the input is accepted; if we reach the reject node, the input is
rejected. Polynomial-size branching programs capture $\mbox{\bf
L/poly}$ in the same way that polynomial-size circuits capture
$\mbox{\bf P/poly}$.

In this problem we will consider a {\em very} restricted subclass
of polynomial-size branching programs. With the exception of the
accept and reject nodes, all of the nodes will be divided into
levels $\ell_1, \ell_2, \ldots \ell_m$, with each level containing
{\em at most 5 nodes}; the only permitted edges are directed from
a node in level $\ell_{i}$ to a node in level $\ell_{i+1}$, or a
node in level $\ell_{m}$ to either the accept or reject nodes.
Before Barrington's result in 1986, people were pretty sure these
{\em width 5 branching programs} were similar in power to finite
automata -- it was thought that they could not even maintain
counters during their computation. In this problem you will prove,
in stark contrast to this intuition, that width 5 branching
programs contain non-uniform $\mbox{\bf NC}_1$, and that in fact
they exactly characterize non-uniform $\mbox{\bf NC}_1$.
(Non-uniform $\mbox{\bf NC}_1$ is the class of languages decided
by polynomial-size, $O(\log n)$-depth Boolean circuits).

\begin{enumerate}
\item Recall that $S_5$ is the group of permutations on the
elements $\{1,2,3,4,5\}$. We will specify a sequence of $m$ {\em
instruction} triples $(i_j, \sigma_j, \tau_j)$, $j = 1\ldots m$,
where $\sigma_j, \tau_j \in S_5$ and $1 \le i_j \le n$. On an
input $x = x_1x_2\ldots x_n$ the instructions {\em yield} the
permutation $\pi_1\pi_2\ldots \pi_m$, where $\pi_j = \sigma_j$ if
$x_{i_j} = 0$ and $\pi_j = \tau_j$ if $x_{i_j}= 1$. We say that
the sequence of instructions {\em $\pi$-accepts} a set $A \subseteq
\{0,1\}^n$ if every $x \in A$ yields $\pi$ and every $x \not\in A$
yields the identity permutation $e$ (and $\pi \ne e$). Verify that
if there is a sequence of $m$ instructions that $\pi$-accepts $A$,
then there is a width-5 branching program with $m$ levels that
accepts $A$.

\item Recall that every permutation can be written as the product
of disjoint cycles. We will be concerned with elements of $S_5$
that are 5-cycles. Examples of these elements are $\sigma =
(1\;2\;3\;4\;5)$ or its inverse $\sigma^{-1} = (1\;5\;4\;3\;2)$.
Show that if $\pi$ is a 5-cycle, and a sequence of $m$
instructions $\pi$-accepts $A$, then for any 5-cycle $\pi' \in
S_5$, there is a sequence of $m$ instructions that $\pi'$-accepts
$A$.

\item Show that for any $5$-cycle $\pi$, if there is a sequence of
$m$ instructions that $\pi$-accepts $A$ then there is a sequence
of $m$ instructions that $\pi$-accepts the complement of $A$.

\item Show that if $\pi$ and $\pi'$ are 5-cycles, and there is a
sequence of $m$ instructions that $\pi$-accepts $A$, and a
sequence of $m'$ instructions that $\pi'$-accepts $B$, then there
is a sequence of $2(m + m')$ instructions that $\pi''$-accepts $(A
\cap B)$, for some 5-cycle $\pi''$. You may use the fact that
there exist 5-cycles $\sigma$ and $\tau$ whose commutator
$\sigma\tau\sigma^{-1}\tau^{-1}$ is a 5-cycle. (You may wish to
verify this fact for yourself).

\item Show that if $\pi$ and $\pi'$ are 5-cycles, and there is a
sequence of $m$ instructions that $\pi$-accepts $A$, and a
sequence of $m'$ instructions that $\pi'$-accepts $B$, then there
is a sequence of $2(m + m')$ instructions that $\pi''$-accepts $(A
\cup B)$, for some 5-cycle $\pi''$. Hint: write $A \cup B$ as an
expression involving only complements and intersection, and use
parts (c) and (d).

\item Show that if $A$ is decided by a fan-in 2, depth $d$ Boolean
circuit with $\land, \lor$ and $\neg$ gates, then there is a
sequence of at most $4^d$ instructions that $\pi$-accepts $A$, for
some 5-cycle $\pi$. Hint: induction on $d$. Conclude that every
language in non-uniform $\mbox{\bf NC}_1$ has a polynomial-size
width-5 branching program.

\item Show that every language decided by polynomial-size width-5
branching programs is in non-uniform $\mbox{\bf NC}_1$. Conclude
that the languages decided by polynomial-size width-5 branching
programs are {\em exactly} non-uniform $\mbox{\bf NC}_1$.
\end{enumerate}

\item The class $\mbox{\bf P/log}$ is the class of languages
decidable by a Turing Machines running in polynomial time that
take $O(\log n)$ bits of advice. Show that SAT$\in \mbox{\bf
P/log}$ implies $\mbox{\bf P} = \mbox{\bf NP}$.

\item The parity function on $n$ inputs is \[\bigoplus_n(x_1, x_2,
\ldots, x_n) = x_1 \oplus x_2 \oplus \cdots \oplus x_n\]i.e., it
is 1 if and only if there are an odd number of 1's among its $n$
inputs. Recall that for a Boolean function $f$, $L(f)$ denotes the
leaf-size of the smallest $(\land, \lor, \neg)$-formula that
computes it.
\begin{enumerate}
\item Show that $L(\bigoplus_n) \le n^2$ when $n$ is a power of 2.
\item A {\em formal complexity measure} $FC$ is a function mapping
Boolean functions on $n$ variables to the natural numbers, and
satisfying the following properties:
\begin{enumerate}
\item $FC(x_i) = 1$ for $1 \le i \le n$

\item $FC(f) = FC(\neg f)$ for all $f$

\item $FC(f \lor g) \le FC(f) + FC(g)$ for all $f, g$
\end{enumerate}
Show that for {\em every} formal complexity measure $FC$ we have
$FC(f) \le L(f)$. Thus $FC(f)$ is a lower bound on the formula
complexity of $f$. Hint: pick an optimal formula for $f$, and use
induction on $L(f)$.

\item We will define a formal complexity measure (due to
Krapchenko) that will allow us to prove a lower bound on
$L(\bigoplus_n)$. Let $A$ and $B$ be subsets of $\{0,1\}^n$, and
define
\begin{eqnarray*}
H(A, B) & = & \{(a,b) : a \in A, b \in B, a \mbox{ and } b \mbox{
differ in exactly 1 coordinate}\} \\
K(f) & = & \max_{A \subseteq f^{-1}(1), \; B \subseteq
f^{-1}(0)}\frac{|H(A,B)|^2}{|A||B|}.
\end{eqnarray*}
Show that $K$ is a formal complexity measure. The most difficult
part is showing that property (iii) holds. For this part, let $A$
and $B$ be subsets maximizing the expression that defines $K(f
\lor g)$, and partition $A$ into $A_f \subseteq f^{-1}(1)$ and
$A_g\subseteq g^{-1}(1)$; observe that $H(A_f, B) \cup H(A_g, B) =
H(A, B)$...

\item Show that $L(\bigoplus_n) \ge n^2$.

\end{enumerate}

\end{enumerate}


\end{document}
