%%
%%
%%
%%	IMPORTANT: COMPILE USING TEX !!    (NOT LATEX)
%%
%%
%%
\documentstyle[12pt]{article}
\input{defs-6045}
%\setlength{\topmargin}{-1.0 in}
%\setlength{\oddsidemargin}{0 in} % distance from left edge of page to text
%\setlength{\parindent}{0 in} 
%\setlength{\textwidth}{6.5 in}
%\setlength{\textheight}{10 in}

%\include{/usr/leo/New/bard}

%\newtheorem{problemm}{Problem\rm}

\newcommand{\sigstar}{\mbox{$\Sigma^{*}$}}
\newcommand{\concat}{\mbox{$\circ$}}

\newcommand{\movesto}[2]{\mbox{$\:\vdash_{#1}^{#2}\:$}}
%\newcommand{\goesto}{\mbox{$\longrightarrow$}}

%\newcommand{\LP}{\mbox{ L\&P }}

\renewcommand{\labelenumi}{\alph{enumi}.}

%\newcommand{\handout}[1]{
% Prints a heading for 6.045.  The argument is the number
%\framebox{\framebox{\parbox{5.5in}{
%{\bf  Computability, Complexity, and Automata } \hfill {\bf Handout #1} \\
%{\bf MIT 6.045J/18.400J} \hfill {\bf A. Meyer} 
%}
%}}
%}

\newcommand{\complementt}[1]{\mbox{$\overline{#1} $}}
\newcommand{\manyonered}{\mbox{$\leq_{m}$}}

\newcommand{\Comment}[1]{{}}

\newcommand{\kzero}{\mathify{K_{0}}}
\newcommand{\kone}{\mathify{K_{1}}}
\newcommand{\ktwo}{\mathify{K_{2}}}
\newcommand{\ic}{\mathify{\{I,c\}^{*}}}
\newcommand{\tured}{\mathify{\leq_{T}}}

\renewcommand{\emptyset}{\mathify{\not0}}

% Prints a heading for 6.045.  The argument is the number
% The second argument is the date.
\def\boxit#1{\vbox{\hrule\hbox{\vrule\kern3pt%  from the texbook
      \vbox{\kern3pt#1\kern3pt}\kern3pt\vrule}\hrule}}

%\newcommand{\handout}[2]{
%\boxit{
%  \boxit{\bf \hbox to \hsize {Massachusetts Institute of Technology \hfill
%	Handout #1}
%             \hbox to \hsize {6.045J/18.400J Automata,
%	Computability and Complexity \hfill #2}
%       }
%      }
%}

\newcommand{\tuple}[1]{<#1>}

\setlength{\parindent}{0.3 in} 

\begin{document}

%\handout{24}

\handout{Supp-reading}{Supplementary Reading Material}{March 31, 1992}

\bigskip

These are  lecture notes from a previous year prepared by Professor
Albert Meyer. They overlap in great part with the material that you
already received in the previous handouts but might help you by giving
you another concise exposition of the subject.
\bigskip


\section{Coding Functions}



We will be deliberately informal about coding functions.  For example, we will
speak of the set of Turing machines which halt on empty input.  In fact, we
assume the existence of a straightforward coding function $\rho:\mbox{Turing
machines} \to \ic$, such that, for example, there is an effective procedure
for simulating $M$ on input $x$ given $\rho(M)$ and $x$. 
%(\ic is the language that \LP uses to write codes for things in; it could as
%easily be any other language.)
One choice of $\rho(M)$ is the ASCII coding of the tables
defining $M$.  
For example,  we will say that ``$M$ halts on input $M$'', when we
really mean that $M$ halts on input $\rho(M)$.

Similarly, we assume that there is a coding of pairs of strings as a single
string, so that (for example) when we talk of the language 
\[\{\tuple{M,x}: \mbox{Foo}(M,x)\}\]
we really mean 
\[\{z\in\ic: z \mbox{ codes the pair } \tuple{z_{1},z_{2}} \mbox{ where }
z_{1}=\rho(M) \mbox{ and } z_{2}=\rho(x), \mbox{ and Foo}(M,x)
\}\]

\section{Terminology}


\begin{definition}

A partial function $f:\sigstar \to \sigstar$ is a {\bf partial recursive
function } iff there is a Turing machine $M$ which computes it in the following
sense.  If $f(x)$ is defined, then $M$ on input $x$ halts with the value of
$f(x)$ on its tape.  On the other hand, if $f(x)$ is not defined, then
$M$ on input $x$ never halts.

\end{definition}


\begin{itemize}

\item recursive set = decidable set = Turing-decidable set

\item r.e. set = recursively enumerable set = Turing-acceptable set.

\item{} [Turing] computable partial function = partial recursive function

\item total recursive function = recursive function = [Turing] computable total function.

\end{itemize}

If $P$ is a property of sets, then we say that $A$ is ``co-$P$'' iff
$\complementt{A}$ is $P$.  

\section{Undecidability of $K_{0}$}
\begin{eqnarray*}
 K_{0}  &=&  \{\tuple{M,x} : \mbox{Turing machine } M \mbox{ halts on input }
x \} \\
 K_{1}  &=&  \{M : M \mbox{ halts on input } M\}
\end{eqnarray*}


\begin{theorem}

\kzero\ is not decidable.

\end{theorem}

\begin{proof}

We easily see that $K_{0}$ decidable implies that $K_{1}$ is decidable.
Therefore, if we prove that $K_{1}$ is undecidable, we will have shown that
$K_{0}$ is undecidable.  So, we will prove that \kone\ is undecidable.

Actually, we will show the stronger fact that $\complementt{\kone}$ is not r.e..
Since a set is decidable iff both it and its complement are r.e., this will
show that \kone is not decidable.

Assume that $\complementt{\kone}$ is r.e..  There is some Turing machine
$M^{*}$ which accepts it.  By the definition of $\complementt{\kone}$, we
have
for
any Turing machine $M$ that $M\in\complementt{\kone}$  iff $M$ does not
halt on $\rho(M)$. Now let  $M$ be $M^{*}$.  By the definition of
$M^{*}$, we have $M\in\complementt{\kone}$ iff $M^{*}$ halts on input
$M$.   Hence, $M^{*}$  halts on input $M$ iff $M$ does not halt on input
$M$, for every Turing machine $M$.   Now, let $M=M^{*}$. 

\end{proof}

{\bf Fact:} \kzero, \kone, and \ktwo\ are all r.e.

Proof: left to reader.


\section{Many-one Reducibility}


\begin{definition}

\newcommand{\sa}{\mathify{\Sigma^{*}_{A}}}
\newcommand{\sbb}{\mathify{\Sigma^{*}_{B}}}

The notion of many-one reducibility is helpful for proving undecidability
results, and for giving quantative measures of how hard problems are.  If $A
\manyonered B$, then A is ``no harder than'' B.  (Note: this is a very coarse
notion of the difficulty of a problem.  A more precise way of saying it is that
A is ``no more impossible'' than B.)

Given two languages $A \subseteq \sa$, $B \subseteq \sbb$ and a total
computable function $f:\sa\to\sbb$, $A \manyonered B (\mbox{ via } f)$ iff for
any $x\in\sa$, \[ x \in A \iff f(x) \in B\]

\end{definition}

Many-one reducibility has many useful properties:


\begin{description}

\item[Transitivity:] $A\manyonered B$ and $B\manyonered C$ implies $A
\manyonered C$.

\item[Recursiveness inherits down] $A \manyonered B$ and  $B$ recursive imply
$A$ recursive. 

\item[Non-recursiveness inherits up] $A \manyonered B$ and  $A$ not recursive
imply $B$ not recursive.

\item[R.e. inherits down] $A  \manyonered B$ and $B$ r.e. imply $A$ r.e.. 

\item[Non-r.e.ness inherits up] $A \manyonered B$ and $A$ not r.e. implies
$B$ not r.e.

\item[Congruence] $A \manyonered B$ iff $\complementt{A} \manyonered \complementt{B}$.

\end{description}


To show that a set $A$  is not r.e., it suffices to show that $K_{0}
\manyonered \complementt{A}$. 



\begin{definition}

If $R$ is a class of sets and $\leq$ is a relation on sets, then a set $K$
is $\leq$-hard for $R$ iff $C \leq R$ for all $C\in R$.   A set $K$ is
$\leq$-complete iff $K$ is both $\leq$-hard and $K\in R$. 

\end{definition}

For example, \kzero\ is $\manyonered$-complete for r.e. sets.  {\bf Any} set 
other than the empty set and $\sigstar$ is $\manyonered$-complete for
recursive sets.

If $A$ is r.e., and $\kzero \manyonered A$, then by the transitivity of $
\manyonered $, $A$ is a $\manyonered$-complete r.e. set.  \kone and \ktwo\ 
are $\manyonered$-complete r.e. sets.


\begin{lemma}

If $A$ is r.e., then $ A \manyonered K_{0}$.

\end{lemma}


\begin{proof}

Suppose $M$ accepts A.  Then $w\in A$ iff $\tuple{M,w} \in K_{0}$.

\end{proof}





\section{Undecidability of \ktwo}


\begin{theorem}

The language $\ktwo = \{M : M \mbox{ halts on blank tape}\} $ is not recursive.

\end{theorem}


\begin{proof}

\newcommand{\cpil}[2]{\mathify{ \mbox{Compile}_{#1,#2}}}

We can reduce the general halting problem \kzero to the blank-tape halting
problem \ktwo; i.e., $\kzero \manyonered \ktwo$.  For any Turing machine $M$
and string $w$, we can define a new Turing machine \cpil{M}{w} which operates
as follows: ``On input $x$, erase $x$, print $w$ on the tape as input,
and then act exactly like $M$.'' 
The compiler is constructive.  It can be written as a program that
accepts a program $M$ and a string $w$ as input, and prints out a program
that fits the description above.   It is clear that $M$ halts on input $w$
iff \cpil{M}{w} halts on any input iff \cpil{M}{w} halts on input $e$.   

Therefore, the general halting problem \kzero is at least as hard as the
blank-tape halting problem \ktwo.

\end{proof}

\section{Rice's Theorem}


\begin{definition}

A property $P$ of languages is {\bf nontrivial} iff there is some r.e.
language which has that property and some r.e. language which does not.  

\end{definition}

For example, the property of being a r.e. language is trivial (since all r.e.
languages have it); the property of containing the empty word is nontrivial.

\newcommand{\kp}{\mathify{K_{P}}}
\begin{theorem}

The set $\kp = \{M : L(M) \mbox{ has property } P\}$ is not decidable for any
nontrivial property $P$. 

\end{theorem}


\begin{proof}
\newcommand{\cko}{\mathify{\complementt{K_{0}}}}
\newcommand{\cpi}{\mathify{\mbox{Compile}^{P}_{M,w}}}

Let $\Omega$ be a Turing machine that always runs forever; $L(\Omega) =
\emptyset$. Suppose without loss of generality that $P(\emptyset)$ is true.
Since $P$ is nontrivial, there exists a machine $M_{1}$ with
language $L_{1} = L(M_{1})$ such that $\neg P(L_{1})$.  We will show that $\cko
\manyonered \kp$.  For any pair $M$ and $w$, we can construct a Turing
machine \cpi which executes as follows: ``Given input $x$, remember $x$.
Simulate $M$ on $w$ until it halts (running forever if it runs forever).
Then, behave like $M_{1}$ on input $x$.''  

If $\tuple{M,w}\not\in\cko$ (i.e., $M$ halts on $w$), then the simulation of
$M$ on $w$ also halts.  In this case, \cpi behaves like a somewhat slower
version of $M_{1}$; in particular, it accepts the same language.  Therefore,
$\cpi\not\in K_{P}$.

On the other hand, if $\tuple{M,w}\in\cko$, then $M$ does not halt on $w$.
So, \cpi runs forever on every input.  So, $L(\cpi) = \emptyset = L(\Omega)$, and
so $\cpi \in K_{P}$.

So, we have reduced the non-halting problem to $K_{P}$; therefore $K_{P}$
is undecidable.

\end{proof}





\section{Basic Properties of r.e. and Recursive sets.}



\begin{description}

\item[Lemma:]  $A$ is recursive iff $\complementt{A}$ is recursive. (i.e., a
set is recursive iff it is co-recursive.)

\item[Theorem:] $A$ is recursive iff both $A$ and $\complementt{A}$ are
r.e.; i.e., if $A$ is both r.e. and co-r.e..

\item[Corollary:] $\complementt{\kzero}$ is not r.e.

\item[Theorem:] The following are equivalent for a language $A$: 


\begin{enumerate}

\item $A$ is r.e.

\item $A$ is the domain of a partial recursive function of one argument.

\item $A$ is  the range of a partial recursive function.

\item $A=\emptyset$ or $A$ is the range of a total recursive function.

\end{enumerate}

\newcommand{\canl}{\mathify{<_{can}}}

\item[Definition:]  The canonical order of strings in $\sigstar$ (where
$\Sigma$ is ordered) is defined for all $w,u \in \sigstar$.  $w \canl u$ iff
$|w|<|u|$  or $|w|=|u|$ and $w$ precedes $u$ alphabetically.  Note that
this is different from alphabetical order; for example, $b \canl ab$ even
though $ab$ precedes $b$ alphabetically.  If $\Sigma=\{a,b\}$, then the
canonical ordering of $\sigstar$ is $e,a,b,aa,ab,ba,bb,aaa,aab,\ldots$.

\item[Definition:] A function $f:\sigstar \to \sigstar$ is an {\bf increasing}
function iff, for all strings $x$, $y$ in its domain, $x \canl y $ implies
$f(c) \canl f(y)$. 

\item[Theorem:] A language $A$ is recursive iff it is empty or the range of a
total increasing recursive function.

\item[Theorem:] Recursive sets are closed under union and intersection.

\item[Theorem:] R.e. sets are closed under union and intersection.

\end{description}


\section{Total Functions}

\newcommand{\kt}{\mathify{K_{t}}}

\[\kt = \{M : L(M) = \sigstar\}\]

\begin{lemma}

\kt\ is neither r.e. nor co-r.e..  

\end{lemma}

Proof: exercise!

\section{Undecidability Results concerning Context-Free Grammars}

Using the idea of a ``computation word'', we proved several results about the
undecidability of various problems concerning context-free languages.  The
following are $ \manyonered$-complete r.e. sets:

\begin{enumerate}

\item $\{G : G \mbox{ is a context-free grammar, and  } L(G) \not=\sigstar\}$

\item $\{\tuple{G_{1},G_{2}} : L(G_{1}) = L(G_{2})\}$

\item $\{G : G \mbox{ is ambiguous}\}$

\end{enumerate}

\newcommand{\sepp}{\$}

These proof use variations on the idea of a {\bf computation word}.  Given a
Turing machine $M$, a computation word for $M$ is a finite string
$C_{0}\sepp C_{1} \sepp \ldots \sepp C_{n}$, where $C_{0}=\#S\#$, $C_{n}$ is a
halting configuration, and $C_{i} \movesto{M}{} C_{i+1}$ for $0 \le i < n$.  In
other words, each $C_{i}$ is a snapshot of $M$'s computation, and the
computation word is the sequence of these snapshots which starts with the
starting configuration with blank tape, and ends with a final configuration.
Note that, if $M$ runs forever, there is no computation word; it is
impossible for one to end correctly.

Given a Turing machine $M$, it is possible to construct a grammar for $\neg
W$, where $W$ is the set of computation words.\footnote{This is similar to a
homework exercise in which you constructed a grammar for the set $\neg V$,
where $V = \{\sepp b0 \sepp b_{1} \sepp \ldots \sepp b_{n} \sepp\}$, where
$b_{n}$ is the binary representation of $n$. }  It is easier to think in
terms of NPDAs which recognize non-computation words.

\section{Turing Reducibility and Oracle Machines}

$\manyonered$ is a good intellectual tool for saying that one language is no
harder than another.  However, it has some intuitively unsatisfactory
properties.  For example, most languages are not many-one reducible to their
complements; but intuitively deciding a language and its complement are
the same problem.  We introduce Turing reducibility as a candidate for
expressing the property of being ``no harder than.''  

To do this, we need to allow a Turing machine to accept a language as input.
The definition we will give is that $A$ is no more undecidable (in this
sense) than $B$ if there is some program to decide membership in $A$, where
the program is allowed to ask questions about membership in $B$. It may use
the answers however it likes. (For contrast, many-one reducibility allows only
a single question about membership in $B$, viz. ``$f(x)\in B$'', and must
return the same answer as that question.)

So, a {\bf Generalized Turing Machine} is a Turing machine with one extra tape,
called the {\em language tape\/}.  Most of the components of the machine behave
as usual.  The language tape is a read-only tape with alphabet \{\sepp,0,1\}.;
and unlike usual Turing machine tapes, it will start with useful information in
every cell.  Warning: This is a mathematical trick to allow the Turing machine
access to the whole language.  There may not be any reasonable physical way to
initialize the language tape.  We take the contents of the language tape as
given, and proceed with the computation.

\newcommand{\delstar}{\mathify{\Delta^{*}}}

To run a generalized Turing machine on inputs $x \in\sigstar$ and $B
\subseteq\delstar$, we start with $\#x\#$ on the worktape in the normal way.
We initialize the language tape as follows.  (Suppose that $\Delta=\{a,b\}$,
ordered with $a $ coming before $b$.  Let $c_{w} = 1$ if $w\in\Delta$, and $0$ otherwise.)

\[
\begin{array}{|c|c|c|c|c|c|c|c|c|c|c|c}
\hline
\$ & c_{e} & c_{a} & c_{b} & c_{aa} & c_{ab} & c_{ba} & c_{bb} & c_{aaa} &
\ldots\\
\hline
\end{array}\]

In general, the leftmost symbol on the tape is a \sepp, and the $n$'th symbol
to the right of the \sepp\ is a $1$ if the $n$'th string in the canonical
order of \delstar\ is in $B$, a $0$ if it is not.  

All the other definitions for what a generalized Turing machine does are
completely standard.  

When we run a generalized machine $M$ on inputs $x$ and $B$, we are
essentially doing a computation as if we had a subroutine for deciding
membership in $B$. 

We say that $A$ is {\em Turing-reducible to} $B$ (or {\em decidable in \/}
$B$) if there is a generalized Turing machine $M$ which, given set input
$B$, halts on all string inputs $x$, printing {\bf yes} or {\bf no} as
$x\in{}A$ or $x\not\in{}A$. 

Similarly, we say that $A$ is r.e. in $B$ if there is a generalized Turing
machine $M$ such that $x\in{}A$ iff $M$ halts on inputs $x$ and $B$.


\begin{theorem}

Basic Facts about Turing Reducibility.

\begin{itemize}

\item $A$  is r.e. iff $A$  is r.e. in $\emptyset$. 

\item $A$  is decidable iff $A$ is decidable in $\emptyset$. 

\item If $R$ is a recursive set, then $A$ is recursive iff $A$ is
decidable in $R$. 


\item $A\tured{}B$ and $B \tured C$ imply $A \tured C$.

\item $A \manyonered B$ implies that $A \tured B$.

\item It is not the case that $A \tured B$ implies $A \manyonered B$.  (For
example, $\kzero \tured \complementt{\kzero}$, but it is false that $\kzero
\manyonered \complementt{\kzero}$.

\item $A \tured \complementt{A}$ for any set $A$. 

\item $A \tured B$ iff $A \tured \complementt{B}$ iff $\complementt{A} \tured B$.

\end{itemize}

\end{theorem}

We define the {\bf relativized Halting Problem in $B$ } to be
\[\kzero^{B} = \{\tuple{M,x}: M \mbox{ halts on input } x \mbox{ and } B\}
\]

\begin{theorem}

$\kzero^{B}$ is not recursive in $B$. 

\end{theorem}

The proof of this theorem is the same as the proof that the ordinary
halting problem is not recursive, with all the Turing machines and
halting-problem sets decorated with $B$'s.

So, we may define the {\bf Arithmetic Hierarchy}, an increasing family of
languages each harder to define than the preceding ones.  


\begin{definition}

The {\bf jump} $A'$ of a language $A$ is the set $\kzero^{A}$, i.e., the
relativized halting problem in $A.$ 

\end{definition}

\begin{eqnarray*}
K^{(0)}  &=&  \emptyset \\
K^{(n+1)}  &=&  (K^{(n)})'
\end{eqnarray*}

So, $K^{(1)} = \kzero$, $K^{(2)}=\kzero'$, and so forth.  By the preceding
theorem, each set $K^{(n)}$ is recursive in $K^{(n+1)}$, but not
conversely.  These sets form a strictly increasing hierarchy of harder and
harder sets.

Most of our theorems relativize; i.e., the theorem holds if you replace
normal Turing machines by generalized Turing machines with set input $B$, and
make appropriate changes to the statement of the theorem.  To prove these
relativized theorems, make the same changes in the proofs of the unrelativized theorems.


\begin{itemize}

\item[Theorem:] $A$ is r.e. in $B$ iff $A \manyonered K^{B}$.

\item[Theorem:] $A \tured B$ iff $A$ is both r.e. and co-r.e. in $B$. 

\item[Theorem:] The following are equivalent:

\begin{enumerate}

\item $A$ is r.e. in $B$;

\item $A = dom(f)$, where $f$ is a partial recursive function in $B$. 

\item $A = ran(g)$, where $g$ is a total recursive function in $B.$ 

\end{enumerate}

\item $K_{2}^{B}$ and $K_{0}^{B}$ each many-one reduce to the other.

\end{itemize}


\end{document}


