\documentstyle[11pt,twoside]{article}
\input{defs-6045}
\begin{document}

\newcommand{\mless}{\leq_m}

\handout{quiz2review}{Review Problems for Quiz 2}{April 3, 1992}


\medskip

{\bf Quiz Information}.  Quiz 1 will be held this coming Thursday,
April 9, in room {\bf 3-270} ({\bf NOT} our normal lecture hall).  The
quiz is 2 hours long, and you may choose to take the exam either from
5-7 PM, or from 7-9 PM.  If you choose the earlier exam, you {\it
must} stay until 7 PM, and if you choose the later exam, you {\it
must} arrive by 7 PM.  The exam will be open book and open notes.

\vspace{.2in}

{\bf Quiz Review Problems.} Here are some questions from previous
years' quizzes to help you prepare.  In addition to the quiz
questions, we list some homework-style questions about the past
week's material, since we haven't had a problem set on these subjects.

\medskip

\begin{enumerate}

\item {\bf Decidable and R.E. Languages}.  For each of the following
languages, indicate whether it is decidable, r.e.\ but not decidable,
co-r.e.\ but not decidable, or none of these (recall that ``co-r.e.''
means that the complement of the language is r.e.  A language is
``None'' if it is neither r.e.\ nor co-r.e.)  You may use the
abbreviations DEC, RE, CO-RE, NONE.  You do not need to prove your
answers.  \(M\), \(M'\) denote Turing machines; $M^A$ signifies a
Turing machine with an oracle for the language $A$; \(G\) denotes a
context-free grammar; and \(p\) denotes an
\(n\)-variable polynomial with integer coefficients.


\newcommand{\ssset}[1]{$\left\{ #1 \right\}$}

\begin{enumerate}

\item \ssset{M : M \mbox{ halts on input } 001}

\item \ssset{M : \exists M' \mbox{ such that } M\not=M' \mbox{ but } M \mbox{ and
} M' \mbox{ accept the same language}}

\item \ssset{G : |\complement{L(G)}| = 0}

\item \ssset{p : 
\forall x_{1},\ldots,x_{n} \in \Int : p(x_{1},\ldots,x_{n}) \not= 4  }

\item \ssset{p : 
\exists x_{1},\ldots,x_{n} \in \Int : p(x_{1},\ldots,x_{n}) \not= 4  }

\item \ssset{M^{K_0} : M^{K_0} \mbox{ halts on blank worktape} }

\item \ssset{M^{(01)^*} : M^{(01)^*} \mbox{ halts on blank worktape} }

\item \ssset{M^{K_0} : M^{K_0}\mbox{ halts
within } 99 \mbox{ steps for } \mbox{some string input } x}

\end{enumerate}

\item {\bf Contrived}.  Let $\Sigma = \{a_{1},a_{2},\ldots,a_{n}\}$ be an alphabet with \(n\)
symbols, and $w\in\Sigma^{n}$ a string of length \(n\).  Define
$h_{w}$ to be the homomorphism which sends \(a_{i}\) to the $i$'th
character of \(w\). (Note:
\(h_{w}\) preserves lengths of strings.)  For example, if \(n=3\), (using
$a,b,c$ for $a_{1},a_{2},a_{3}$):

\begin{eqnarray*}
h_{aab}(abc)  &=& aab\\
h_{cba}(cabbaa)  &=& acbbcc\\
\end{eqnarray*}

Define the {\em Contrived} Languages over the alphabet $\Sigma$ inductively
as follows:


\begin{itemize}

\item \(\{a_{1}^{n}a_{2}^{n}a_{3}^{n}: n \geq 0\}\) is a Contrived
Language.

\item If \(L_{1}\) and \(L_{2}\) are Contrived Languages, then so are
$L_{1}L_{2}$ and $L_{1} \cup L_{2}$.

\item If \(L\) is a Contrived Language, then so is $h_{w}(L)$
for any \(w\in\Sigma^{n}\).

\end{itemize}

Show that all Contrived Languages are decidable.  You may appeal to
results from class and homework.

\item {\bf Undecidability Proof.}
Let 
\[ B = \{M : M \mbox{ halts on input } 0 \mbox{ but does not halt on input }
1\}\]


\begin{enumerate}

\item Show that $K_{2} \mless B$.

\item Show that $\overline{K}_2 \mless B$.

\item Conclude that \(B\) is neither r.e. nor co-r.e.

\end{enumerate}

\iffalse
\item {\bf Computation Words}. A Two-Head Finite Automaton (2HFA) is a
generalization of a deterministic finite automaton.  The input to the automaton
is written on an input tape whose ends are marked by the special symbols ``{\bf
[}'' and ``{\bf ]}''.  The automaton has two {\em read-only, right-moving}
heads which start at the left end of the input tape.  The heads move
independently, staying still or moving one tape-square to the right at each
step.  An input word is {\em accepted} iff both heads reach the righthand
special symbol ``{\bf ]}''.


\begin{enumerate}

\item Let \(M\) be a Turing machine.  Let $x$ be the string that
lists the configurations that $M$ goes through in either accepting or
rejecting $\Lambda$ (so the first part of $x$ is
$\#(q_0,\underline{\Delta})\#...$ Briefly describe a 2HFA, \(H_{M}\), which
accepts of M.

\item Conclude that the set $\{H : H \mbox{ is a 2HFA } \mbox{ and } L(H) =
\emptyset\}$ is undecidable.

\end{enumerate}

\fi


\item {\bf Turing Machines}.

\begin{enumerate}
\item  Consider a {\it one-way resettable TM\/}, which 
is again just like our standard model of a Turing machine, except that
the head is only permitted to either move to the right one tape square or
move all the way back to the left end of the tape.  

Do the one-way
resettable TM's accept all of the Turing-acceptable languages?
Explain your answer fully, but in English.

\item Now, what if we permit {\it only\/} movement to the
right (no reset).  Do these machines accept all of the
Turing-acceptable languages?  Why?
\end{enumerate}

\item {\bf $K_0$ Is Undecidable}.

Prove (from ``first-principles,'' not by saying
``we've done this in class'')
the undecidability of the halting problem:
\[ K_0 = \{<M,x>: \hbox{\ $\,\,M$ halts on input of $x$ }\}.
\]

\item {\bf A Hard Problem}. Let 
\[
L=\{ M \suchthat \hbox{\ for each $n\ge0$, $|L(M)\cap\{0,1\}^n|=1$}\}
\]
(i.e., $L$ is the set of encodings of 
machines which accept exactly one string
of each length).

\begin{enumerate}
\item Prove that $L$ is {\it not\/} r.e.
\item Prove that $L$ is {\it not\/} co-r.e.
\end{enumerate}

\item {\bf Uncomputable functions}.  (You know what it means for a string-valued function on strings
to be Turing-computable. We now define the 
analogous concept for number-valued
functions on numbers.)

A function $f:{\bf N}\rightarrow{\bf N}$ 
is called
{\it Turing-computable\/}
if there is a Turing machine $M$ that, on input 
$1^n$, produces output
$1^{f(n)}$.


\begin{enumerate}
\item Let $L=L(M)$ be an r.e.\ but undecidable language, and
let $\#{\rm STEPS}_M(x)$ be $0$ if $M$ does not halt on $x$,
and the number of steps that a $M$ takes before it halts on $x$ if
it does halt.
Define
\[ f(n) = 
	\max_{x\in\{0,1\}^n}
		\#{\rm STEPS}_M(x).
\]
Prove that $f$ is {\it not\/} Turing-computable.

\item
Exhibit a function $f:{\bf N}\rightarrow {\bf N}$
with the property that if 
$h(n) \ge f(n)$ for all $n$, then $h$ is {\it not\/} Turing-computable.

\item
Exhibit a function $f:{\bf N}\rightarrow {\bf N}$
with the property that if
$h(n) \ge f(n)$ for infinitely many $n$, then $h$ is not Turing-computable.

\end{enumerate}

\item {\bf More Decidable and R.E.\ Languages}.  Classify each of the following languages, as either {\bf D}
(decidable), {\bf RE} (r.e., but not decidable), {\bf C} (co-r.e., but not
decidable) or {\bf N} (neither r.e. nor co-r.e.).  You need not prove your
answers. 
Here, $M$ denotes either a Turing machine or its encoding, as
appropriate. Similarly, $D$ denotes a DFA or its encoding.

\begin{enumerate}
\item $\{M : M \mbox{ accepts some string with exactly one 1}\}$

\item $\{M : M \mbox{ accepts the string 01 and does not accept the string
10}\}$

\item $\{D : D \mbox{ accepts the string 01 and does not accept the string
10}\}$ 

\item $\{M : L(M) \mbox{ contains exactly those strings whose length is
a prime}\}$

\item $\{M : L(M) \mbox{ contains exactly the strings in  }
\overline{K_{0}}\}$

\item $\{M :  L(M) = \emptyset \mbox{ and } M$ has the fewest number of
states of any Turing machine with 2 letters alphabet accepting  $\emptyset \}$

\end{enumerate}

\item {\bf Diagonalization}. Let $A=\{M : M \mbox{ halts on input
$e(M)$ with output } 0\}$ and $B=\{M : M \mbox{ halts on input $e(M)$ with output } 1\}.$
Show that there is no decidable language $D$ which ``separates'' $A$ and $B$,
that is, $A\subseteq D$ and  $B\subseteq \overline{D}$.\\
(Hint: Suppose $D$ were decidable; consider the machine $M$ that would
decide $D$.)

\item {\bf An r.e. complete language under $\mless$}.
Let $a$ be a fixed alphabet symbol.
Let $L$ be the language 
$$
 \{M: M \mbox{ never writes the symbol $a$ when started on the blank tape}\}.
$$

\begin{enumerate}
\item Explain why $L$ is co-r.e.

\item Show that $\overline{K_{2}}\mless L$, where $K_{2}=\{M : M \mbox{ halts on
input the blank tape}\}.$

\item Show that $\overline{L}$ is a $\mless$-complete r.e.-set \\
(You may appeal to the results of parts (a) and (b) even if you could
not do them.) 
\end{enumerate}

\end{enumerate}


{\bf Homework Problems.}  Here are some problems that would be similar
to those given out on a problem set about last week's material.

\begin{enumerate}

\item Martin 20.11

\item Show that $TOT \equiv_m \{M : M$ halts on infinitely many arguments $\}$
(Recall that $A \equiv_m B$ if $A \mless B$ and $B \mless A$).

\item 
\begin{enumerate}
\item Show that $\{M : M$ halts on $00$ and $11 \}$ is $\mless$-complete for 
the r.e.\ sets.  

\item Show that $\{M : M$ fails to halt on $00 \}$ is $\mless$-complete for
the co-r.e.\ sets.

\item Show that $\{M : M$ fails to halt on 00 and does halt on 11 $\}$
is $\mless$-hard for the r.e.\ sets, but is not $\mless$-complete for
the r.e.\ sets.
\end{enumerate}

\item Use the recursion theorem to give an easy proof that $\{ M $ (a
TM with input alphabet $\Sigma$): $L(M) = \emptyset \}$ is
undecidable.

\end{enumerate}


\end{document}
