\documentclass[11pt]{article}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{epsfig}           %This allows to insert figures in .eps format
\setlength{\oddsidemargin}{.25in}
\setlength{\evensidemargin}{.25in}
\setlength{\textwidth}{6in}
\setlength{\topmargin}{-0.4in}
\setlength{\textheight}{8.5in}

\newcommand{\handout}[5]{\renewcommand{\thepage}{#1-\arabic{page}}\noindent\begin{center}\framebox{\vbox{\hbox to 5.78in { {\bf Finite Automata and Theory of Computation} \hfill #2 }\vspace{4mm}\hbox to 5.78in { {\Large \hfill #5  \hfill} }\vspace{2mm}\hbox to 5.78in { {\it #3 \hfill #4} }}}\end{center}\vspace*{4mm}}
\newcommand{\ho}[5]{\handout{#1}{#2}{Professor: #3}{#4}{Handout #1: #5}}
\newcommand{\exam}[4]{\handout{#1}{#2}{Professor: #3}{#4}{Exam #1}}
\newcommand{\pset}[4]{\handout{HW#1}{#2}{Professor: #3}{}{#4: Homework#1}}

\newcommand \lang {\mathcal{L}}

\begin{document}
\pset{5}{October 18, 2007}{Moses Liskov}{****INSERT YOUR NAME****}

\section*{Problem 1}
For each language, determine if that language is context-free or not,
and prove your answer.

\bigskip {\bf (a)} $L_1 = \{w | w = w^{\mathcal{R}}$ and $w$ contains
an equal number of 0s and 1s$\}.$ (Recall, $w^{\mathcal{R}}$ is the
``reverse'' of $w$, that is, $w$ written backwards.)

\bigskip {\bf Solution: } ****INSERT SOLUTION****

\bigskip {\bf (b)} $L_2 = \{0^a1^b2^c | a \neq b$ or $a \neq c\}$.

\bigskip {\bf Solution: } ****INSERT SOLUTION****


\section*{Problem 2}

Prove that the language $\{\#0^n\#0^m\#0^l\#| l = mn\}$ is
Turing-recognizable by giving a detailed description of a Turing
machine that accepts it, and proving that your construction works.
Give your Turing machine as an algorithm.

\bigskip {\bf Solution: } ****INSERT SOLUTION****

\section*{Problem 3}

Prove that the language $\{\#0^n\#| n$ is a prime number$\}$ is
Turing-recognizable by giving a description of a Turing machine that
accepts it, and proving that your construction works.  Give your
Turing machine as an algorithm.

\bigskip {\bf Solution: } ****INSERT SOLUTION****

\section*{Problem 4}

A {\em Turing machine with doubly-infinite tape} is similar to an
ordinary TM, except that there is no left edge of the tape.
Initially, the head is positioned over the first symbol of the input;
all symbols on the tape other than the input are blank. Show that the
class of languages recognized by this kind of Turing machine is the
same as the class of Turing-recognizable languages.  To do this, show
how to simulate an ordinary TM with a TM with doubly-infinite tape,
and vice versa.

\bigskip {\bf Solution: } ****INSERT SOLUTION****

\section*{Problem 5}
A {\em Turing machine with left reset} is similar to an ordinary TM,
except that the transition function has the form $\delta: Q \times
\Gamma \rightarrow Q \times \Gamma \times \{R, LR\}$.  If
$\delta(q,\sigma) = (q',\sigma',LR)$, then when the machine is in
state $q$ and reads a $\sigma$, the machine replaces $\sigma$ with
$\sigma'$, and then the head jumps to the left-hand end of the input
tape, and the machine then enters state $r$.

Prove that the class of languages accepted by Turing machines with
left reset is the same as the class of Turing-recognizable
languages. In other words, prove that TMs with left reset are
equivalent to ordinary TMs.  To do this, show how to simulate an
ordinary TM with a TM with left reset and vice versa.

\bigskip {\bf Solution: } ****INSERT SOLUTION****

\section*{Problem 6 (optional)}
A {\em queue automaton} is just like a PDA, except that instead of
maintaining a stack, it maintains a queue.  The difference betwen a
stack and a queue is that in a stack, the most recently added item is
the next to be removed, whereas in a queue, it's the {\em least}
recently-added item that will be removed next.  Instead of ``push''
and ``pop'', the equivalent terms for a queue are ``push'' and
``pull''.  Prove that the class of languages accepted by queue
automata is the sclass of Turing-recognizable languages.  ({\em Hint:
it may be easier to show that queue automata are equivalent to some TM
variant, rather than showing queue automata are equivalent to ordinary
TMs directly.})

\bigskip {\bf Solution: } ****INSERT SOLUTION****


\end{document}
