%\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{\exam}[3]{
   \pagestyle{myheadings}
   \thispagestyle{plain}
   \newpage

   \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 #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{lemma}{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}
\exam{Final}{June 1}{{\bf 1pm, Thursday June 8}}


This is a final exam. Collaboration is not allowed. You may consult the course notes and the text (Papadimitriou), but not any other source or person. The full honor code guidelines 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.}




\medskip



\begin{enumerate}

\item Define $\mbox{\bf L}_i$ to be the class of languages
decidable by a deterministic Turing Machine using at most
$O(\log^i n)$ space, and $\mbox{\bf NL}_i$ to be the class of
languages decidable by a non-deterministic Turing Machine using at
most $O(\log^i n)$ space. The classes $\mbox{\bf L}_1$ and
$\mbox{\bf NL}_1$ should be familiar -- they are just
deterministic logspace and nondeterministic logspace,
respectively.
\begin{enumerate}
\item Show that for all $i$, $\mbox{\bf NC}_i \subseteq \mbox{\bf
L}_i$.

\item Show that for all $i$, $\mbox{\bf NL}_i$ has $O(\log^{2i}
n)$ depth, fan-in 2, Boolean circuits. Your circuits do not need
to be uniform.

\item It is tempting to try to show that for all $i$, $\mbox{\bf
NL}_i \subseteq \mbox{\bf NC}_{2i}$ (since this holds for $i =
1$). Show that this would solve a major open problem. Try to give
the strongest implication you can, i.e., if the containment
implies $A$, and $A$ implies $B$, you should pick $A$.
\end{enumerate}




\item Consider the following generic setup: out of all $2^n$
strings in $\{0,1\}^n$, some subset $A \subseteq \{0,1\}^n$ of
them are ``distinguished.'' You don't know $A$
directly, but you do have an efficient way to recognize a distinguished
string when you see one. That is, there is a small Boolean circuit
$C$ with $n$ inputs for which $C(x) = 1$ if and only if $x \in A$. A natural thing to want to do is to estimate the number of distinguished
strings. Determining $|A|$ exactly is $\mbox{\bf \#P}$-complete but you showed on Problem Set 6 that $|A|$ can be
determined {\em approximately} in $\mbox{\bf ZPP}^{\mbox{\bf NP}}$. Here you will show that the related problem of ``proving that $|A|$ is large'' is in $\mbox{\bf AM}$. We can formalize this as the task of deciding the
following promise problem $\sc largeset$:

\begin{itemize}
\item Input: circuit $C$ with $n$ inputs, integer $k$

\item YES instances: those pairs $(C, k)$ for which $|\{x : C(x) =
1\}| \ge 3\cdot 2^k$

\item NO instances: those pairs $(C, k)$ for which $|\{x : C(x) =
1\}| \le \frac{1}{3}\cdot 2^k$


\end{itemize}

You will show that $\sc largeset$ has an $\mbox{\bf
AM}$ protocol. The precise meaning of this statement is as follows: given mutual input $(C, k)$, Arthur and Merlin engage in a constant round interactive protocol. If $(C, k)$ is a YES instance, then Merlin has a strategy that causes Arthur to accept with probability $1$; if $(C, k)$ is a NO instance, then Arthur rejects with probability at least $1/2$ no matter what Merlin does. The behavior of the protocol is not specified when $(C, k)$ is neither a YES instance nor an NO instance.

\begin{enumerate}
\item For a $k \times n$ matrix $M$ with 0/1 entries and a vector
$b \in \{0,1\}^k$, define the function $h_{M, b}(x):\{0,1\}^n
\rightarrow \{0,1\}^k$ by $h_{M, b}(x) = Mx + b$ (where all
arithmetic is performed modulo 2). Prove that for all $x \in
\{0,1\}^n$ and $y \in \{0,1\}^k$,
\[\Pr_{M, b}[h_{M, b}(x) = y] = 2^{-k}\] and that for all $x_1,
x_2 \in \{0,1\}^n$, $x_1 \ne x_2$, and $y_1, y_2 \in \{0,1\}^k$,
\[\Pr[h_{M, b}(x_1) = y_1 \land h_{M, b}(x_2) = y_2] = 2^{-2k}.\]
This shows that the family of functions $H = \{h_{M, b}\}$ is a
{\em pairwise independent} family of hash functions from $n$ bits to $k$
bits. The following is a consequence (that you can verify using
Chebyshev's Inequality, but you need not prove here): for each fixed $y \in \{0,1\}^k$,
\[\Pr_{M, b}[\exists x \in A \;\; h_{M, b}(x) = y] \ge 1 - \frac{2^k}{|A|}.\]

\item Using part (a), give an $\mbox{\bf AM}$ protocol for
$\sc largeset$.
\end{enumerate}


\item Prove that if $\mbox{\bf PSPACE} \subseteq \mbox{\bf
P}/\mbox{\bf poly}$, then $\mbox{\bf PSPACE} = \mbox{\bf MA}$. You
may use the following fact: in the proof that $\mbox{\bf IP} =
\mbox{\bf PSPACE}$, the function describing what message the
(honest) prover should send in each round (as a function of the
mutual input and the messages seen so far) is computable in
polynomial space.

\item Here is a new class involving alternating quantifiers:
${\mathbf S_2^p}$ (the ``S'' stands for ``symmetric
alternation''). A language $L$ is in ${\mathbf S_2^p}$ if and only
if there is a language $R \in \mbox{\bf P}$ for which
\begin{eqnarray*}
x \in L & \Rightarrow & \exists y \; \forall z \; (x, y, z) \in
R \\
x \not\in L & \Rightarrow & \exists z \; \forall y \; (x, y, z)
\not\in R
\end{eqnarray*}
where as usual $|y| = \mbox{poly}(|x|)$ and $|z| =
\mbox{poly}(|x|)$. To make sense of this definition it is useful
to think of $R$ as defining for each $x$ a 0/1 matrix $M_x$ whose
rows are indexed by $y$ and whose columns are indexed by $z$.
Entry $(y, z)$ of matrix $M_x$ is 1 if $(x, y, z) \in R$ and 0
otherwise. Now, the definition says that $x \in L$ if there is an
all-ones row in $M_x$ and $x \not\in L$ if there is an all-zeros
column in $M_x$ (and it is clear that these configurations are
mutually exclusive).

\begin{enumerate}

\item Argue that ${\mathbf S_2^p} \subseteq ({\mathbf \Sigma_2^p}
\cap {\mathbf \Pi_2^p})$.

\item The language {\sc lex-first-acceptance} consists of those
pairs $(C_1, C_2)$ for which $C_1, C_2$ are circuits, and the
lexicographically first string $x$ for which $C_1(x) = 1$ is also
accepted by $C_2$. (If there is no lexicographically first string, i.e., $C_1$ is unsatisfiable, then $(C_1, C_2)$ is not in the language). A bitstring $x$ lexicographically precedes a
bitstring $y$ if the first position $i$ in which they differ has $x_i
= 0$ and $y_i = 1$. Prove that {\sc lex-first-acceptance} is
$\mbox{\bf P}^{\mbox{\bf NP}}$-complete. Note: this problem is intended to be challenging.

Hint: as a warm-up, it
may be useful to give the reduction from a language $L \in
\mbox{\bf P}^{\mbox{\bf NP}}$ that is decided by a oracle Turing
Machine that makes only a {\em single} oracle query.

\item Use the previous part to show that $\mbox{\bf P}^{\mbox{\bf
NP}} \subseteq {\mathbf S_2^p}$.

\item Prove that $\mbox{\bf MA} \subseteq {\mathbf S_2^p}$.

\item Prove a stronger form of the Sipser-Lautemann Theorem (Lecture 13):
$\mbox{\bf BPP} \subseteq {\mathbf S_2^p}$.

\item Prove a stronger form of the Karp-Lipton Theorem (Lecture 13): if SAT has
polynomial-size circuits then $\mbox{\bf PH} = {\mathbf S_2^p}$.
\end{enumerate}


\end{enumerate}

\end{document}

