\documentstyle[12pt,twoside,amssymb]{article}
\input{defs-6045}


\newcommand{\defi}{\stackrel{\mbox{\tiny def}}{=}}

\newcommand{\poly}{{\Bbb P}}
\newcommand{\npoly}{{\Bbb NP}}
\newcommand{\Lsp}{{\Bbb L}}
\newcommand{\NL}{{\Bbb NL}}
\newcommand{\pspace}{{\Bbb PSPACE}}
\newcommand{\npspace}{{\Bbb NPSPACE}}

\newcommand{\RP}{{\Bbb RP}}
\newcommand{\nat}{{\Bbb N}}

\newcommand{\fa}{\forall}
\newcommand{\sig}{\Sigma}
\newcommand{\arr}{\rightarrow}
\newcommand{\pless}{\leq_{P}}
\newcommand{\mless}{\leq_m}
\newcommand{\Lless}{\leq_L}

\newcommand{\spa}{\mbox{SPACE}}
\newcommand{\nspa}{\mbox{NSPACE}}
\newcommand{\ttime}{\mbox{TIME}}
\newcommand{\ntime}{\mbox{NTIME}}
\newcommand{\llog}{\mbox{log}}
\newcommand{\sllog}{\mbox{{\tiny log}}}

\begin{document}


\handout{finalreview}{Review Problems for the final}{May 8, 1992}


\medskip

{\bf Final Information}.  The final will be held on  Tuesday, May 19
in the Athletic Center from 1:30PM to 4:30PM. 
  The exam will be open book and open notes. The subjects covered
will consist for one half of the material seen before quiz2 and for
the other half of the last material about complexity theory and PRAMS.

\vspace{.2in}
{\bf Statistics}. Here are the statistics about the grades
for homeworks 7, 8 and 9:
\begin{center}
\begin{tabular}{|l||l|l|l|} \hline  
	& PS 7 & PS 8 & PS 9 \\ \hline   \hline  
Average & 79.54 & 70.89 & 64.89\\ \hline  
Std. Dev. & 19.11 & 18.41 & 16.88 \\ \hline  
\end{tabular}
\end{center}

Note that PS 9 was graded over only 86 points and not over 100 points.


\vspace{.2in}

{\bf Quiz Review Problems}. Here are some questions from different previous
years' exams to help you prepare. The exam will not be as long!
\medskip




%%%%%%%%%%\input cmacs

%%%%%%%\hsize=5.5in
%\hoffset=1.50in
%%%%%%%\topskip=30pt
%%%%%%%\footline={\hfil\folio\hfil}
%%%%%%%\newskip\leftparskip
%%%%%%%\leftparskip=15pt
%%%%%%%\def\leftpar{\par\vskip \leftparskip\noindent}

%%%%%%%\handout 25 {May 18, 1987} Final Exam 1

\begin{enumerate}
\item
{\bf True-false-unknown.}  For each part tell whether the statement
is true, false, or currently unknown to the research community (not
just you).  There is no penalty for guessing.

\begin{enumerate}
\item
If a language is accepted by a 20-state DFA, then its complement also 
must be accepted by a 20-state DFA.
\item
If a language is accepted by a 20-state NFA in which all edges are 
labelled by strings of length at most 1, then it must also be
accepted by a 20-state DFA.
\item
Every ambiguous context-free grammar has an equivalent unambiguous
context-free grammar.
\item
If $G$ is a context-free grammar and $w$ is a word in $L(G)$ of length $n$,
then there is a derivation of $w$ in $G$ of length at most $n$.
\item It is decidable whether a given context-free grammar generates 
exactly the words of even length.
\item If $L_1$ and $L_2$ are undecidable, then $L_1 \cup L_2$
must be undecidable.
\item $K_0 \pless K_3$, where $K_3 = \{\rho(M) : M$ halts
on some input$\,\}$.
\item $K_3$ is $\pless$-complete for the r.e. sets.
\item $\{\rho(M) : L(M) \in NP\}$ is decidable.
\item $A \le_m B$ implies that $\overline{A} \le_m \overline{B}$
for every pair of languages $A$ and $B$.
\item There is an effective procedure (TM which always halts) which, 
for every Turing machine $M$, produces a context-free grammar which generates
all strings that are not halting computations of $M$ on the empty string.
\item There is an effective procedure which,
for every Turing machine $M$, produces a context-free grammar which generates
all strings that are halting computations of $M$ on the empty string.
\item NONTOTAL $= \{\rho(M) : L(M) \ne \Sigma^*\}$ is 
$\le_T$-complete for class $K^{(2)}$ in the arithmetical hierarchy.
\item A Turing machine with a $d$-dimensional infinite grid as a
storage structure is a feasible model of computation,
in that any language that can be recognized within a polynomial number of
steps on such a machine is in P.
\item There is a universal Turing machine $U$ which
can determine whether an arbitrary 1-tape, 2-symbol Turing machine $M$
halts on an arbitrary input $x$ within $T(|x|)$ steps, where $U$
itself uses at most time $T(|x|)$.
\item $TIME(2^{2^{\epsilon n}})$ is a proper subset of
$TIME(2^{2^n})$ for any $\epsilon, 0 < \epsilon < 1$.
\item 2SAT $\in$ P.
\item $PATH = \{(G,a,b) : G$ is a graph containing vertices $a$ and
$b$ such that there is a path from $a$ to $b$ in $G\,\}$ is NP-complete.
%TSP (the travelling salesman problem) $\in$ P.
\item The set of unsatisfiable Boolean formulas in 3-CNF
is $\pless$-complete for co-NP (the set of languages whose complements
are in NP).
\item CLIQUE $\pless$ GSAT.
\end{enumerate}




\item
Give examples of each or show that no such example exists.
\begin{enumerate}
\item
A language which is not regular, but which is both context-free and
co-context-free.
\item A language which can be accepted by a deterministic 2-stack
machine (2PDA) but not by any nondeterministic 1-stack machine (NPDA).
\item A language $L \subseteq 0^*$ which is undecidable.
\item A sequence of languages $L_1, L_2, \ldots$ each a subset of
%the previous one, such that each $L_{i}$ is regular, but the union of all
%of the $L_i$ is undecidable.
\item A language in $TIME(n^5) - TIME(n^2)$.
\end{enumerate}

\item
\begin{enumerate}
\item Prove that $\{\,a^ib^ja^k : j = max(i,k)\,\}$ is not
context-free.
\item Show that $\{\,xy : |x| = |y|$ and $x \ne y\,\}$
is context-free.
\end{enumerate}

\item
For each of the three problems below, answer both of the following questions.
\begin{enumerate}
\item Can one apply Rice's Theorem to show that the problem
is undecidable?  If so, explain why.  If not, explain why not.
\item Is this problem decidable or undecidable?  Explain your answer.
\smallskip
\item $A = \{\rho(M) : L(M)$ is finite$\,\}$.

\item $B = \{\rho(M) : L(M)$ is accepted by some Turing machine
with either fewer than 10 or more than 20 states$\,\}$.

\item $C = \{\rho(M) :$ there is some input string $w$ such that
the head of $M$ visits infinitely many tape squares during the computation
of $M$ on input $w\,\}$.
\end{enumerate}

\item
%Let $G = (V,E)$ be an undirected graph.
%A set $V' \subseteq V$ is an {\it independent} set if for all $u,v \in V'$,
%there is no edge $(u,v) \in E$.
%That is, no two vertices in $V'$ are adjacent.
%Define $IND = \{\,(G,k) : G$ has an independent set $V'$ of size $|V'|
%\ge k\,\}$.
A graph $G = (V,E)$ can be used to represent program resource requirement
conflicts:  Each vertex in $V$ represents a program, and each edge $e =
(u,v)$ in $E$ represents a conflict in resources required by programs
$u$ and $v$.  A set $V' \subseteq V$ is a {\it compatible} set of programs
(i.e., a set of programs which can be allowed to run simultaneously) provided
for all $u,v \in V'$, there is no edge $(u,v) \in E$.

Define COMSET $=
\{\,(G,k) : G$ has a compatible set $V'$ of size $|V'| \ge k\,\}$.  (A
pair $(G,k)$ is in COMSET provided $G$ is a description of compatibility
relationships among programs for which there are $k$ programs which
can be run simultaneously.)

$G$ is assumed to be represented as an
adjacency matrix:  First the number $n$ of vertices in binary, then
$n^2$ bits representing edges.  If edge $(v_i,v_j), 0 \le i < j < n$
is present in the graph, then bits $in+j$ and $jn+i$ are both $1$,
otherwise they are both $0$.

\begin{enumerate}
\item Explain how a deterministic $t$-tape Turing machine
can accept COMSET.
Give an asymptotic upper bound on the time complexity.

\item Explain how a nondeterministic $t$-tape Turing machine
can accept COMSET. Give an asymptotic upper bound on the time compleixty.

\item Show that COMSET is NP-hard by reducing an NP-complete
problem that has been given in class to COMSET.  Conclude that COMSET is
NP-complete.
\end{enumerate}

\item
Let $S$ be any function from $N$ to $N$, $L$ a language and $M$ a
Turing machine.
We say that $M$ decides $L$ in space $S$ provided that $M$ decides $L$
and uses at most
$S(n)$ tape squares on any input of length $n$.
Let $SPACE(S)$ be the set of languages which are decidable in space $S$ by some
Turing machine.

\begin{enumerate}
\item Show that if $L \in SPACE(S)$ and $\epsilon > 0$, 
then $L \in SPACE(n + 2 + \epsilon S)$.  Just give a rough sketch
to show how this would be done.

\item Show that $TIME(T) \subseteq SPACE(T)$ for all functions $T$.

\item Show that $SPACE(S) \subseteq \bigcup(TIME(c^S) : c \ge 1)$
for all functions $S$.
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%\newcommand{\PP}{\mbox{\bf P}}
%\newcommand{\BPP}{\mbox{\bf BPP}}
%\renewcommand{\IP}{\mbox{\bf IP}}
%\renewcommand{\PP}{\mbox{\bf P}}
%\renewcommand{\NP}{\mbox{\bf NP}}
\newcommand{\tf}{{\hfill\fbox{{\large\bf True}}\qquad\fbox{{\large\bf False}}}}
\newcommand{\validinvalid}{{\hfill\fbox{{\large\bf Valid}}\qquad
		\fbox{{\large\bf Invalid}}}}


\item

Mark the correct box,  \fbox{{\bf True}} or \fbox{{\bf False}}.
No explanation is required.

\bigskip
\mbox{}

\begin{itemize}


\hrule
\item[{\bf 1.}] 
	If $L_1\in\poly$ and $L_2\in\poly$, then
	$L_1\union L_2\in\poly$.  \tf

\bigskip\hrule

\item[{\bf 2.}]
	If $L={\displaystyle
	\union_{i=1}^{\infty}} L_i$, and each $L_i\in\poly$, then $L\in\poly$.
	\tf
\bigskip\hrule

\item[{\bf 3.}] 
	If $L\in\npoly$, $L_0, L_1\in \poly$, then $(L-L_0)\cup L_1
	\in\npoly$.
	\tf
\bigskip\hrule

\item[{\bf 4.}] 
	The language $L=\{\langle M\rangle: L(M)\in\npoly\}\in\npoly$.
	\tf
\bigskip\hrule

\item[{\bf 5.}] The language 
	$\mbox{\sc Primes}_1=\{1^k: k\mbox{ is prime}\}$ is in $\poly$.
	\tf
\bigskip\hrule

\item[{\bf 6.}] To show that ``if $L\in\poly$ then $\poly=\npoly$,''
	it is enough to show that
	$\mbox{\sc 3SAT}\pless L$.

	\tf

\bigskip\hrule

\item[{\bf 7.}] $\mbox{\sc 3SAT}\pless K_{\rm TM}$
	(``{\sc 3SAT} is polynomial time reducible to the halting problem.'')

	\tf

\bigskip\hrule
	
\item[{\bf 8.}] $K_{\rm TM}$ is $\npoly$-complete.
	\tf

\bigskip\hrule

\item[{\bf 9.}] If $L\in\npoly$, then $L^*\in\npoly$.
	(Recall that $L^*$ is the Kleene closure of $L$.)

	\tf

\bigskip\hrule

\end{itemize}



\item {\bf $\npoly$-Completeness}

Show that the following {\sc Non-Constant-3SAT} problem
is $\npoly$-Complete:

\begin{quote}
{\tt Instance:} A 3-CNF Boolean formula $\phi$.\footnote{Recall that
a 3-CNF formula is an AND of terms, each
term being an OR of three literals, where a literal is a variable
or its negation.}


{\tt Question:} Is $\phi$ non-constant? That is,  does $\phi$ have
both a satisfying assignment and non-satisfying assignment?
\end{quote}

\item {\bf Decision {\it vs.}~Optimization}

Recall the Hamiltonian circuit problem,

\begin{quote}
{\sc HAMC}$=\{ \langle G\rangle \colon$
	$G$ is a graph which has a Hamiltonian circuit$\}$.\footnote{Recall
	that a {\it Hamiltonian cirucit\/} of a graph $G=(V,E)$ is 
	a circuit that visits each vertex of $G$ exactly once---that is, 
	an ordering
	of the vertices $V$,  $(v_1,v_2,\ldots,v_n)$,  such that
	$\{v_1,v_2\}\in E$, $\{v_2,v_3\}\in E$, $\ldots$, 
	$\{v_{n-1},v_n\}\in E$,  and $\{v_n,v_1\}\in E$.}
\end{quote}



Suppose you are given a subroutine $B$ that, if you call it with a 
graph $G$, returns whether or not $G$ has a Hamiltonian circuit.

Describe an algorithm that on input of a graph $G$ uses the subroutine
$B$ to {\it find\/} a Hamiltonian circuit or identify that there is
none.  Ignoring the computation that $B$ internally requires, your procedure
should run in polynomial-time.

(In other words, you are given an ``oracle'' for the decision problem 
{\sc HAMC}, and you want to use it to efficeintly solve the
corresponding optimization problem.)


\end{enumerate}

\end{document}
