\documentclass[11pt]{article}

%\usepackage[pdftex]{graphicx}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{latexsym}
\usepackage{epsfig}

\newcommand{\ignore}[1]{}

\parindent=18pt
\oddsidemargin=0.15in
\evensidemargin=0.15in
\topmargin=-.5in
\textheight=9in
\textwidth=6.5in

\newcommand{\eps}{\epsilon}

\renewcommand{\labelenumi}{{\bf [\theenumi]}}

\begin{document}

\hfill{Instructor:  Rocco A. Servedio}

\hfill{Teaching Assistant:  Li-Yang Tan}

\bigskip

\begin{center}
{\bf Computer Science 4236:
Introduction to Computational Complexity}\\
{\bf Problem Set \#5 Spring 2010}\\
{\bf Due 1:10pm Thursday, April 15, 2010}
\end{center}

\bigskip
\bigskip

\noindent {\underline {\bf Problem 1.}}
As discussed in class, a
ZPP algorithm is a randomized algorithm $A$ which never gives the wrong
answer and which has expected running time polynomial in $n$ for
inputs of length $n.$

\medskip

\noindent (a) Suppose $A$ is a randomized algorithm which always
gives the right answer; moreover, on inputs of length $n$, for each
$1 \leq t \leq 2^n$, with probability $c/t^2$ the algorithm runs for
$n^2 \cdot t$ steps (here $c$ is a normalizing value so that the sum
of all probabilities is 1).  Show that $A$ is a ZPP algorithm.

\medskip

\noindent (b) The algorithm $A$ in part (a) above has the less-than-desirable
property that for any (arbitrarily large) polynomial $q(n)$, there is
a polynomial $r(n)$ such that the probability $A$ runs for at least
$q(n)$ steps is at least $1/r(n).$  Let's call ZPP algorithms with this
property \emph{lackadaisical}.  In contrast, let's call a ZPP algorithm
\emph{prompt} if ``the probability that the running time gets too large
decreases exponentially.''

Give a precise mathematical definition of a prompt ZPP algorithm (at
the level of formality of our definition of a lackadaisical algorithm).
Show that if there is a lackadaisical ZPP algorithm for a given problem,
then there is also a prompt ZPP algorithm.

\bigskip \bigskip

\noindent {\underline {\bf Problem 2.}}

\medskip

\noindent (a)
We say that a {\em linear form} $L$ over variables $x_1,\dots,x_n$ is an
expression of the form $L = \sum_{i=1}^n \alpha_i x_i$
where
each coefficient $\alpha_i$ is a real number.

Suppose that there is a polynomial time algorithm with the
following property:  given as input $n$ linear forms
$L_1,\dots,L_n$ over variables $x_1,\dots,x_n$ in which each
coefficient of each $L_i$ is either 0 or 1 and real values
$v_1,\dots,v_n,$ the algorithm computes the value of
$$
{\frac \partial {\partial x_1} }
\cdots
{\frac \partial {\partial x_n} }
\left(\prod_{i=1}^n L_i\right)
$$
at the point $(x_1,\dots,x_n) = (v_1,\dots,v_n).$
Show that this implies that P=NP.  (Hint:  Use the fact
that computing the permanent of a 0/1 matrix is \#P-complete.)

\medskip

\noindent (b)
We say that a {\em quadratic form} $Q$ over variables $x_1,\dots,x_n$ is an
expression of the form $Q = \sum_{i=1}^n \sum_{j=1}^n \alpha_{i,j} x_{i}x_j $
where each $\alpha_{i,j}$ is a real number.

Now suppose that there is a polynomial time algorithm with the
following property:  given as input $n$ quadratic forms
$Q_1,\dots,Q_n$ over variables $x_1,\dots,x_n$ in which each
coefficient of each $Q_i$ is either 0 or 1, the algorithm computes the
value of
$$
\int_{-1}^1 \cdots \int_{-1}^1
\left(\prod_{i=1}^n Q_i\right)
dx_1 \cdots dx_n.
$$
Show that this implies  P=NP as well.
(The same hint applies.)

\bigskip
\bigskip



\noindent {\underline {\bf Problem 3.}}
We say that a function $f: \Sigma^* \to \Sigma^*$ is \emph{downward self-reducible}
if there is a polynomial-time oracle algorithm $A$ with the following property:  given any input
$x \in \Sigma^n$, the algorithm $A^{f_{n-1}}$ run on input $x$ correctly computes $f(x)$.  Here ``$f_{n-1}$'' denotes an oracle that computes $f$ but only on inputs of length at most $n-1.$

\medskip

\noindent (a) Show that the permanent function 
\[
PERM(M) = \sum_{\pi \in S_n} M_{i \pi(1)} \cdots M_{n \pi(n)}\]
is downward self-reducible.

\medskip

\noindent (b) Show that if $f$ is downward self-reducible then $f$ is computable in polynomial space.


\bigskip \bigskip




\noindent {\underline {\bf Problem 4.}} Show that $P^{\#P} =
P^{PP}.$




\bigskip
\bigskip



\noindent {\underline {\bf Problem 5.}}  

\noindent (a)
Suppose that $A$ is a deterministic polynomial-time
algorithm which, given a 3CNF formula $\varphi$ as input, outputs the \# of satisfying
assignments for $\varphi$.  Use $A$ to give a randomized polynomial-time
algorithm which, given a 
3CNF formula $\varphi$ as input, outputs a uniformly random
satisfying assignment for $\varphi$ (i.e. each assignment $z$ that satisfies $\varphi$
is equally likely to be output by your algorithm).

\medskip

\noindent (b) Suppose now that $A$ only \emph{approximately} counts
the number of satisfying assignments to a 3CNF.  More precisely, suppose that $A$
is a randomized algorithm that has has the following performance guarantee:  
given as input $\langle \varphi, \eps \rangle$ where $\varphi$ is a 3CNF formula over $n$
variables and $0 < \eps < 1$, algorithm $A$ runs in time poly$(n,1/\eps)$ and
with probability at least $1 - 1/5^n$ it outputs a value $N$ such that
$(1-\eps)\#\varphi \leq N \leq (1+\eps)\#\varphi$, where $\#\varphi$ denotes the number of
satisfying assignments to $\varphi$.\footnote{The failure probability $1/5^n$ may seem
very low, but it is easy to achieve this using the same kind of amplification tricks we've
seen in class, given an algorithm with failure probability at most (say) $1/3$.}

Use $A$ to give a randomized algorithm $A'$ that has the following performance guarantee:  given as input $\langle \varphi, \eps \rangle $ where $\varphi$ 
is a satisfiable 3CNF formula over $n$ variables and $0 < \eps < 1$, 
algorithm $A'$ runs in poly$(n,1/\eps)$ time 
and for each satisfying assignment $z$ we have
\[
{\frac {(1 - \eps)}{\#\varphi}} \leq \Pr[A' \text{~outputs~}z] \leq {\frac {(1+\eps)}{\#\varphi}}.
\]




\bigskip \noindent Cultural note:  you don't need to show this, but it is known that the other direction of (b) holds as well:  if there is
an efficient algorithm that can output a satisfying assignment that is approximately uniformly 
random, then
there is an efficient algorithm that can approximately count satisfying assignments.


\end{document}

