\documentstyle[11pt,twoside,psfig]{article}
\input{defs-6045}
\newcommand{\mless}{\raisebox{-1ex}{$\stackrel{<}{\ {\scriptstyle m}\ }$}}
\newcommand{\meq}{\raisebox{-1ex}{$\stackrel{\equiv}{\ {\scriptstyle m}\ }$}}
\newtheorem{prop}[theorem]{Proposition}


\begin{document}

\handout{lecture18}{Notes on Lecture 19}{March 18, 1992}

\reading{Martin 18.2, 20.2}


We introduced last time the notions of Turing-acceptability, of recursive languages and the
Halting problem. In this lecture we will provide a last characterization of Turing-acceptable 
sets in terms of enumeration. We will then study further more the halting problem.

\section{Recursively Enumerable Languages}
\label{sec:re-sets}


\begin{definition}
We say that a two tape Turing machine {\em enumerates} a set $X=\{ x_1, x_2, \ldots\}$
if it writes the encoding of the sequence $\# x_1  \# x_2 \# \ldots$ on its
output tape. (Our definition makes sense only for a multitape TM, but we know 
that such a TM can be simulated by a one tape TM).
We say that $L$ is {\em enumerated} by $M$ if, when $M$ is started  on a blank tape, it
enumerates exactly the elements of $L$. $L$ is {\em recursively enumerable} (in short {\em  r.e.})
if it is enumerated by some TM. $L$ is {\em co-r.e.} if its complement is r.e.
\end{definition}

\begin{theorem}
$L$ is r.e. iff $L$ is Turing acceptable.
\end{theorem}

\begin{proof}
$(\Rightarrow)$. Assume that $M$ enumerates $L$. We then design another machine $M'$ that accepts
$L$: on input $x$ machine $M'$ simulates $M$, letting it enumerate all
strings until $x$ appears. If (and only when) $x$ appears then $M'$ halts (else it diverges).

$(\Leftarrow)$.
Assume that machine $M$ accepts $L$. We then design another machine that enumerates $L$:
$M'$ simulates machine $M$ dovetailing on all inputs $x$. Whenever one of the parallel simulations
of $M$ halts for some $x$ then machine $M'$ outputs $x$ on its enumeration tape.
\end{proof}

\begin{definition}
We define an order $\leq'$ in $\Sigma^*$: By definition:
$$
x \leq' y  \ \mbox{ iff}
\left. \begin{array}{rcl}
       &  & |x|< |y|\\
       & \mbox{ or }& |x|= |y| \mbox{ and } $x$ \mbox{ precedes } $y$ \mbox{ in alphabetical order.}
       \end{array}
\right.
$$
\end{definition}

Note that this is {\em not} the lexicographic order, i.e, the order of the dictionary! (For 
example  $zz \leq' aaa$ .)

\begin{theorem}
$L$ is decidable iff it can be enumerated in increasing order for $\leq'$.
\end{theorem}

\begin{proof}
Done in recitation.
\end{proof}

\section{More Undecidability Problems}
\label{sec:undecidablity}

\begin{definition}[The Blank Tape Halting Problem]
$$K_2 \stackrel{\mbox{\tiny def}}{=} \{ M : M \mbox{ is a TM and halts on } \Lambda\}.$$
\end{definition}

\begin{theorem}
\label{th:k2-non-recursive}
$K_2$ is r.e. but not recursive.
\end{theorem}

\begin{proof}
$K_2$ is clearly Turing acceptable: we define a machine $M'$ which, on input
$e(M)$, simulates $M$ on input $\Lambda$. $M'$ halts if and only when 
$M$ halts in this simulation. 

We now turn to proving that $K_2$ is not 
recursive. (Note that, $K_2$ being r.e., this  last fact is equivalent to the fact
that the complement $\overline{K_2}$ of $K_2$ is not recursively enumerable i.e., that
$K_2$ is not co-r.e.)
Working by contradiction, assume that it is, so that we have a recursive procedure
$M_2$
(i.e. a Turing machine) which, on the encoding $e(M)$ of any TM $M$, decides
whether $M$ halts or
does not halt on $\Lambda$.

We first describe a {\em recursive} construction that associates a
special machine $M'_{M,x}$ to any couple $<M,x>$, where $M$ is a Turing machine and $x$ a
string on its input alphabet. The machine $M'_{M,x}$ has the property that
$$
M'_{M,x} \left\{ 
   \begin{array}{lcl} \mbox{ halts everywhere } & \mbox{if }& M \mbox{ halts on } x,\\
                     \mbox{ halts nowhere } & \mbox{if }& M \mbox{ fails to halt on } x.
    \end{array}
 \right.
$$
The construction of $M'_{M,x}$ is very simple:
on any input $w$, $M'_{M,x}$ simply ignores $w$ and runs $M$ on input $x$. 
$M'_{M,x}$ halts if and only when $M$ halts in this simulation.
By construction $M'_{M,x}$  halts everywhere or nowhere: this depends solely
on the behavior of $M$ on $x$.

We then show how the previous construction, along with the {\em assumed} existence
of the procedure $M_2$ shows that $K_0$ is recursive. For this, we define the procedure
$M_0$. On input $<M,x>$ (or more precisely on input $e(<M,x>)$) the procedure  $M_0$:
\begin{itemize}
\item  constructs the machine $M'_{M,x}$,
\item runs procedure $M_2$ on $M'_{M,x}$ (i.e. asks $M_2$ whether {\em or not} $M'_{M,x}$
      halts on its blank tape),
\item outputs the answer provided by $M_2$.
\end{itemize}
It is clear that on input  $<M,x>$ machine $M_0$ decides ``yes'' exactly when
$M'_{M,x}$ halts on  $\Lambda$ i.e., when $M$ halts on $x$, and
that $M_0$ decides ``no'' exactly when 
$M'_{M,x}$ does not halts on  $\Lambda$ i.e., when $M$ does not halt halts on $x$.

The preceding means that $K_0$  is decided by $M_0$ and is therefore  recursive.
But this contradicts the result of Lecture~18. Hence our hypothesis
does not hold and $K_2$ is not recursive.
\end{proof}

The technique used in this proof is called the {\em reducibility} technique:
we reduced the problem of deciding $K_0$ to the one of deciding $K_2$. As we 
already knew that $K_0$ was not decidable we were able to deduce that 
$K_2$ was not decidable either. Note though
that the preceding argument depended critically on the fact that the reduction
that we exhibited was computable: in our example this meant that there
existed a {\em computable} procedure (i.e, a computable TM) producing
machine $M'_{M,x}$ from the input $<M,x>$. 

We are now in measure of extending this technique into a general
paradigm.

\section{Many-One Reducibility}
\label{sec:many-one-red}

\begin{definition}[Many-One-Reducibility]
\label{def:many-reducibility}
If $A\subseteq \Sigma^*$ and $B\subseteq \Delta^*$ are two languages
we say that $A$ is many one reducible to $B$ (in short 
$A \mless B$) if there exists some total {\em recursive} function
$f: \Sigma^* \rightarrow \Delta^*$ such that for all strings
$x \in \Sigma^*$, $x\in A$ iff $f(x)\in B$.
\end{definition}

We can extend this definition to other languages besides $\Sigma^*$ and $\Delta^*$, via the encoding
into recursive sets of strings. The domain of the function $f$ is then 
a subset of all valid encodings. $f$ is said to be total when 
its domain is
the set of all valid encodings. The notion of recursiveness is 
 defined via the encodings  (as
we saw in Lecture~16 and 17).

The result of the previous Section can be rephrased as
stating that $K_0 \mless K_2$ via the recursive function $f$ defined
by $f(<M,x>)= M'_{M,x}$. In effect, we showed that 
$<M,x> \in K_0$ iff $f(<M,x>) =  M'_{M,x} \in K_2$.

\begin{theorem}
\label{th:many-reducibility}
If $A\mless B$ then $[B \mbox{ decidable } \Rightarrow A \mbox{ decidable}].$
\end{theorem}

\begin{proof}
If $B$ is not decidable the implication 
$[B \mbox{ decidable } \Rightarrow A \mbox{ decidable}]$ is trivially true.

Assume now that $B$ is decidable, and
let as in Definition~\ref{def:many-reducibility} $f$ denote the reduction function
from $A$ to $B$.
We define a {\em recursive} procedure which, on input $x$, decides whether
$x$ is in $A$: 
\begin{itemize}
\item Compute $f(x)$,
\item Ask whether $f(x)$ is in $B$ by applying the decision procedure for $B$,
\item Output the answer returned by this last procedure.
\end{itemize}
The correctness of this procedure comes directly from the many one reduction
assumption.
\end{proof}

Let's emphasize what we mean by ``recursive procedure'': this might appear to
be a tautology, because a procedure seems to be recursive by definition.
The point is that we need to insure that the three parts of the previous proof can be implemented
by some Turing machine. Upon closer analysis we see that this requirement is
 met exactly when $f$ is recursive, which is insured by 
Definition~\ref{def:many-reducibility}. (It is fair to say that Definition~\ref{def:many-reducibility}
and Theorem~\ref{th:many-reducibility} go hand in hand and that 
Definition~\ref{def:many-reducibility} was introduced for the sole purpose of stating the inheritance
property of Theorem~\ref{th:many-reducibility}.)

Note also that the result of Theorem~\ref{th:many-reducibility} does not require
as a prerequisite the {\em knowledge} that $B$ is decidable.
It does not even require that $B$ is decidable (indeed $B$ could be decidable without
our knowing it: see for instance Example~5 in Lecture~17.) It just says that
{\em if} $B$ is recursive then $A$ is also recursive: the decision procedure for $B$
 is used as a {\em black box} in the decision procedure for $A$ as is shown in
Figure~\ref{fig:many-reducibility}.


\begin{figure}[ht]
\centerline{\mbox{\psfig{figure=fig1.ps,width=12cm}}}
\caption{The decision procedure for $A$ when $A$ is many one reducible to $B$}
\label{fig:many-reducibility}
\end{figure}



Theorem~\ref{th:many-reducibility} can be informally restated 
as ``recursiveness inherits downwards''.
Taking the contrapositive we get also that ``non-recursiveness inherits upwards'':
\begin{center}
If $A\mless B$ then $[A \mbox{ non decidable } \Rightarrow B \mbox{ non decidable}].$
\end{center}
This result is exactly the one that we used in the proof of 
Theorem~\ref{th:k2-non-recursive}. But beware!
We have to be careful in the direction of these implications: it is {\em not} true,
as the next result shows,
that if  $A\mless B$ then $[B \mbox{ non decidable } \Rightarrow A \mbox{ non decidable}].$

\begin{prop}
\label{prop:wrong}
Let $A$ be any recursive set and $B$ be any set such that $B\not = \emptyset$ and
$\overline{B}\not = \emptyset$. Then $A\mless B$.
\end{prop}
\begin{proof}
Let $b_1\in B$ and $b_2\in \overline{B}$. Define the function $f$ by
$$ f(x) =
\left\{ 
   \begin{array}{lcl} b_1 & \mbox{if }& x \in A\\
                      b_2 & \mbox{if }& x\not \in A.
   \end{array}
         \right.
$$
As $A$ is recursive, $f$ is also recursive (make sure you understand this!)
and $x\in A$ iff $f(x) \in B$.
\end{proof}


\begin{prop}
The binary relation is $\mless$ is transitive, reflexive, non symmetric and non antisymmetric.
\end{prop}
\begin{proof}
\begin{itemize}
\item Transitive: Assume that $A\mless B$ via $f$ and that 
             $B\mless C$ via $g$ . Then
             $A\mless C$ via $g\circ f$. 
       (Recall that $g\circ f(x) \stackrel{\mbox{\tiny def}}{=} g(f(x)).$)
\item Reflexive: $A\mless A$ via $f=$ identity.
\item Not symmetric: Any recursive set $A$ it such that $A \mless K_0$
 (by Proposition~\ref{prop:wrong}). But it is not true that
 $K_0 \mless A$, for it this was the case, $K_0$ would  then be reducible
 by ``downwards inheritance'',
\item Not antisymmetric:  $[A\mless B$ and  $B\mless A]$ $\not \Rightarrow [A\ =\ B]$.
An example of this situation is provided by Proposition~\ref{prop:equi-example}
below.

\end{itemize}
{\hfill \mbox{ }}\end{proof}



\begin{definition}[Many-One Equivalence]
$A \meq B$ means that $A\mless B$ and $B\mless A$.
\end{definition}

We easily check that $\meq$ is an equivalence relation (i.e. reflexive,
transitive and symmetric). 

\begin{prop}
\label{prop:equi-example}
$K_0\meq K_2$.
\end{prop}

\begin{proof}
We already saw  that $K_0 \mless K_2$ so that we only need to establish
that  $K_2 \mless K_0$. For this we need to find a recursive function 
$f : M \rightarrow\ <M',x>$ such that $M$ halts on $\Lambda$ iff 
$f(M) =$ $<M',x>$ satisfies the condition that $M'$ halts on $x$.
We easily check that $f(M)= <M',\Lambda>$ answers the question.
\end{proof}





\end{document}


