<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%\documentstyle[10pt,twoside]{article}
\documentstyle[twoside, 11pt,amsfonts]{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{##}$&amp;$\displaystyle{{}##}$\hfil
      \crcr#1\crcr}}\,}
\def\eqalignno#1{\displ@y \tabskip\@centering
  \halign to\displaywidth{\hfil$\displaystyle{##}$\tabskip\z@skip
    &amp;$\displaystyle{{}##}$\hfil\tabskip\@centering
    &amp;\llap{$##$}\tabskip\z@skip\crcr
    #1\crcr}}
\def\leqalignno#1{\displ@y \tabskip\@centering
  \halign to\displaywidth{\hfil$\displaystyle{##}$\tabskip\z@skip
    &amp;$\displaystyle{{}##}$\hfil\tabskip\@centering
    &amp;\kern-\displaywidth\rlap{$##$}\tabskip\displaywidth\crcr
    #1\crcr}}
\makeatother

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

\newcommand{\set}[1]{\left\{{#1}\right\}}
\newcommand{\poly}{\mbox{poly}}

\begin{document}
\problemset{5}{May 11}{{\bf May 18}}

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 CNFs and DNFs. Recall that a Boolean formula is said to be
in {\em 3-CNF} form if it is the conjunction of {\em clauses},
with each clause being the disjunction of at most 3 literals. A
Boolean formula is said to be in {\em 3-DNF} form if it is the
disjunction of {\em terms}, with each term being the conjunction
of at most 3 literals.


Describe a polynomial-time computable function that is given as
input a fan-in two $(\land, \lor, \neg)$-circuit $C(x_1, x_2,
\ldots, x_n)$, and produces a 3-CNF Boolean formula $\phi$ on
variables $x_1, x_2, \ldots, x_n$ and additional variables $z_1,
z_2, \ldots, z_m$ for which for every setting of the $x$ variables
\[\exists z_1, z_2, \ldots, z_m \;\; \phi(x_1, x_2, \ldots, x_n, z_1, z_2, \ldots, z_m) = 1
\Leftrightarrow C(x_1, x_2, \ldots, x_n) = 1.\] Also, describe a
polynomial-time computable function that is given as input a
fan-in two $(\land, \lor, \neg)$-circuit $C(x_1, x_2, \ldots,
x_n)$, and produces a 3-DNF Boolean formula $\phi$ on variables
$x_1, x_2, \ldots, x_n$ and additional variables $z_1, z_2,
\ldots, z_m$ for which for every setting of the $x$ variables
\[\forall z_1, z_2, \ldots, z_m \;\; \phi(x_1, x_2, \ldots, x_n, z_1, z_2, \ldots, z_m) = 1
\Leftrightarrow C(x_1, x_2, \ldots, x_n) = 1.\] Hint: identify the
$z$ variables with the gates of $C$.

\item Toda's Theorem (Part I).
This problem concerns the class $\oplus\mbox{\bf P}$, which you will show to be quite powerful. A uniform way to define the classes $\mbox{\bf NP}, \mbox{\bf BPP}$ and the new class $\oplus\mbox{\bf P}$ is in terms of polynomial-time nondeterministic Turing Machines that are standardized so that they make the same number of binary nondeterministic choices on each computation path. Specifically, a language $L$ is in:
\begin{itemize}
\item $\mbox{\bf NP}$ iff there is such a polynomial-time nondeterministic Turing Machine $M$ for which $x \in L$ implies that at least one of the computation paths accepts, and $x \not\in L$ implies that no computation paths accept.
\item $\mbox{\bf BPP}$ iff there is such a polynomial-time nondeterministic Turing Machine $M$ for which $x \in L$ implies that at least $2/3$ of the computation paths accept, and $x \not\in L$ implies that at most $1/3$ of the computation paths accept.
\item $\oplus\mbox{\bf P}$ iff there is such a polynomial-time nondeterministic Turing Machine $M$ for which $x \in L$ implies that an odd number of the computation paths accept, and $x \not\in L$ implies that an even number of the computation paths accept.
\end{itemize}
Below we will also be discussing the classes $\mbox{\bf NP}^A, \mbox{\bf BPP}^A$ and $(\oplus\mbox{\bf P})^A$. These are the classes obtained by replacing the polynomial-time nondeterministic Turing Machine $M$ in the definitions above with a polynomial-time nondeterministic {\em oracle} Turing Machine $M$ that is equipped with language $A$ as its oracle. As usual, if we write ${\cal C}$ instead of $A$ in the exponent, for some complexity class ${\cal C}$, we mean that {\em any} language $A \in {\cal C}$ is permitted as the oracle. If ${\cal C}$ has a complete language (as $\mbox{\bf NP}^A$ and $(\oplus\mbox{\bf P})^A$ do, for any oracle $A$), then by using that language as the oracle we can solve any instance of a problem in ${\cal C}$ with a single call to this specific oracle.

\begin{enumerate}
\item The following is a more general restatement of the Valiant-Vazirani Theorem from Lecture 8.
\begin{lemma} There is a randomized procedure that receives as input an integer $n$, runs in $\poly(n)$ time, and outputs a $\poly(n)$-size circuit $C$ with the following property: for each subset $T \subseteq \set{0,1}^n$, if $|T| &gt; 0$, then with probability at least $1/(8n)$ over the randomness of the procedure, \[|\set{x: x \in T \mbox{ and } C(x) = 1}| = 1.\]
\label{lem:VV}
\end{lemma}
Using this lemma, prove that for every oracle $A$, $\mbox{NP}^A \subseteq \mbox{BPP}^{({\oplus\mbox{\bf P}}^A)}$. It may be helpful to think about the non-relativized statement first.


\item Prove that for every oracle $A$,
\[\mbox{\bf NP}^A \subseteq \mbox{\bf BPP}^A \;\;\Rightarrow\;\; \mbox{\bf NP}^{\mbox{(\bf NP}^{\mbox{(\bf NP}^{\mbox{(}\cdots^{\mbox{(\bf NP}^A\mbox{)}\cdots\mbox{)))}}}}} \subseteq \mbox{\bf BPP}^A\]
in which the tower of $\mbox{\bf NP}$ classes has height $i$, for $i = 1, 2, 3, \ldots$.

Hint: first, figure out how to use error-reduction to argue that $\mbox{\bf NP}^{\mbox{\bf BPP}} \subseteq \mbox{\bf BPP}^{\mbox{\bf NP}}$ and $\mbox{\bf BPP}^{\mbox{\bf BPP}} \subseteq \mbox{\bf BPP}$. If you are stuck, you can take the relativized versions of these statements as given, for partial credit.

\item Prove that co-$(\oplus\mbox{\bf P}) \subseteq \oplus\mbox{\bf P}$.

\item Prove that $(\oplus\mbox{\bf P})^{\oplus\mbox{\bf P}} \subseteq \oplus\mbox{\bf P}$.

Hint: Use the fact that odd $\times$ odd $=$ odd. For each language $L$ in $(\oplus\mbox{\bf P})^{\oplus\mbox{\bf P}}$ with associated  nondeterministic oracle TM $M$, you will be designing a nondeterministic TM $M'$. A helpful strategy is for $M'$ to begin by nondeterministically guessing a {\em transcript} of $M$ on input $x$, which contains a sequence of nondeterministic choices made by $M$, together with a sequence of queries made to the oracle, and a sequence of yes/no answers. Many of these transcripts will be inaccurate in the sense that they don't agree with the functioning of $M$ on the specified computation path, with {\em the actual oracle} in $\oplus\mbox{\bf P}$ answering queries. Nevertheless, some nondeterministic guesses produce ``correct'' transcripts...

\item Prove that $\mbox{\bf PH} \subseteq \mbox{\bf BPP}^{\oplus\mbox{\bf P}}$.

\end{enumerate}



\item Approximate counting and sampling with an $\mbox{\bf NP}$
oracle. For every $n,k$ (positive integers, with $k \le n$), there
is a multiset ${\cal H}_{n,k}$ of functions $h:\{0,1\}^n
\rightarrow \{0,1\}^k$, called an ``$n$-wise independent hash
family''. This multiset comes equipped with a probabilistic
procedure that runs in time $\mbox{poly}(n)$ and outputs a
uniformly chosen $h$ from ${\cal H}_{n,k}$, in the form of a
circuit for $h$ of size $\mbox{poly}(n)$. These functions behave
like random functions from $n$ bits to $k$ bits in the following
sense:
\begin{lemma}
For every set $S \subseteq \{0,1\}^n$ and every $y \in \{0,1\}^k$:
\[\Pr_{h \in {\cal H}_{n,k}}\left [\left |\{x : x \in S \land h(x) = y\}\right
| &gt; 2\cdot\frac{|S|}{2^k}\right] \le 2^{-2n},\] provided that $2^k
\le 4|S|/n^4$.
\end{lemma}
Note that for a random function $h$ from $n$ bits to $k$ bits, the
expected size of \[\{x : x \in S \land h(x) = y\}\] is $|S|/2^k$;
the lemma says that with high probability, the same set with
respect to a function $h$ drawn uniformly from ${\cal H}_{n,k}$
does not exceed this expected size by more than a factor of two.

In the problems below, the input is a set $S \subset \{0,1\}^n$
given {\em implicitly} by a circuit $C:\{0,1\}^n \rightarrow
\{0,1\}$ for which $C(x) = 1$ iff $x \in S$. You can think of $C$
as an instance of {\sc circuit sat}, and then the questions below
concern the problems of estimating the number of satisfying
assignment, and sampling from them, respectively.
\begin{enumerate}
\item Describe a probabilistic polynomial-time procedure, with
access to an ${\mbox{\bf NP}}$ oracle, that with probability at
least $7/8$ outputs an integer $k$ for which $2^k &lt;
\frac{|S|}{n^4} \le 2^{k+2}$. Hint: argue that deciding whether an
implicitly given set has size {\em at least} $s$, for
polynomially-large $s$, is in $\mbox{\bf NP}$, and then perform an
experiment for each $k = 1,2,3, \ldots$.

\item Describe a probabilistic polynomial-time procedure, with
access to an ${\mbox{\bf NP}}$ oracle, that outputs ``fail'' with
probability at most $7/8$ and otherwise outputs an exactly
uniformly distributed element of $S$. Hint: suppose a notebook has
$L$ lines on every page, with an enumeration of the elements of a
set $S$ are written on a subset of the lines in the notebook.
Consider selecting a random page and a random line on that page,
and outputting the element written on that line, or ``fail'' if
the line is empty. What is the probability of outputting a given
element of $S$? What is the probability of outputting ``fail''?
\end{enumerate}

\end{enumerate}


\end{document} </pre></body></html>