\documentclass[11pt]{article}
%%%
%%% You should not need to change anything between here and the after the next %%% block
%%%
\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in}
\setlength{\textwidth}{6.25in}
\setlength{\topmargin}{-0.4in}
\setlength{\textheight}{8.5in}
\setlength{\parindent}{0em}
\setlength{\parskip}{1.5ex}
\usepackage{mathpazo} % palatino math fonts
\usepackage{palatino}
\usepackage{amssymb, amsmath, amsfonts}
\usepackage{verbatim}
\usepackage{graphics}
\usepackage[hyperindex]{hyperref}
\usepackage{url}
\urlstyle{sf}
\newcommand{\nonterminal}[1]{{\sl #1}}
\newcommand{\terminal}[1] {{\textbf{#1}}}
\newcommand{\produces}{$\rightarrow$}
\newenvironment{bnfgrammar}{\begin{quote}\begin{tabbing} \hspace*{12em}\=\ \produces\quad\= \kill}{\end{tabbing}\end{quote}}
\newenvironment{smallbnfgrammar}{\begin{quote}\begin{tabbing} \hspace*{3em}\=\ \produces\quad\= \kill}{\end{tabbing}\end{quote}}
\newcommand{\bnfrule}[2]{\hfill\nonterminal{#1}\>\produces\>#2\\}
\newenvironment{bnfgrammarm}[1]{\begin{quote}\begin{tabbing} #1\qquad\=\ \produces\quad\= \kill}{\end{tabbing}\end{quote}}
\renewcommand\theenumi{\alph{enumi}}
\newcounter{problemno}
\newcommand{\problem}[1]{\stepcounter{problemno}{\bf Problem \theproblemno: #1.}}
\newcommand{\handout}[3]{
\noindent\begin{center}\vspace{-10mm}{\bf University of Virginia - cs3102: Theory of Computation (Spring 2010)}\end{center}
{\Large \bf #1 \hfill Due: #3}}
\newcommand{\collaboration}[1]{
\begin{center}{\bf Collaborators and Resources:}\par{\framebox{\parbox[t]{5.5in}{#1}}}\end{center}
%{\bf Collaboration and Resource Policy.} For this assignment, follow the same collaboration and resource policy as on Problem Sets 1 and 2. See the Problem Set 1 handout for a full description of the policy.
}
\newcommand{\handin}[2]{
{\Large \bf Name: \fbox{\Large #1 (#2)}}
\renewcommand{\thepage}{#2-\arabic{page}}}
\newenvironment{smallquote}{\begin{list}{}{%
\setlength\rightmargin{1.5em}\setlength\leftmargin{1.5em}\setlength\labelwidth{0pt}\setlength\itemindent{0pt}}\item[]}{\end{list}\vspace*{-1.3ex}}
\newcommand{\answer}[1]{\begin{smallquote}\emph{Answer:} #1\end{smallquote}}
\begin{document}
\handout{Problem Set 4}{PS4}{23 March 2010 (2:00pm)}
%%%
%%% ===========================================================
%%% Start editing here
%%%
\handin{Your Name}{abacbca} %%% replace with your name and email ID
\collaboration{
List your collaborators here.
}
\bigskip
This problem set covers material through the end of Chapter 3. Answer all five questions. For full credit, answers must be concise, clear, and convincing, not just correct. Note that you only have \emph{one week} for this problem set, please get started on it early.
%You are strongly encouraged to use LaTeX to produce your submission, and we have provided a \href{http://www.cs.virginia.edu/cs3102/ps/ps4/ps4-template.tex}{LaTeX template} to assist with this. You may, however, handwrite your answers \emph{so long as your writing is legible and easily interpreted}.
For full credit, answers must be concise, clear, and convincing, not just correct.
%\begin{center}
%\fbox{
%\parbox{6in}{
{\bf Collaboration Policy.} For this assignment, we will follow the same collaboration and resource policy as on Problem Sets 1-3. See the Problem Set 1 handout for a full description of the policy. Use collaboration to help you learn, but not in ways that prevent you from learning to solve problems on your own.
\bigskip
\problem{Designing Turing Machines} Design a deterministic Turing Machine that decides the language $\left\{0^{n}1^{n}2^{n} \mid n \ge 0\right\}$. You should provide descriptions of your Turing Machine at the three levels of detail described in Section 3.3:
\begin{enumerate}
\item Provide a \emph{high-level description} of your machine.
\answer{Your answer here.}
\item Provide an \emph{implementation description} of your machine.
\answer{Your answer here.}
\item Provide a full \emph{formal description} of your machine (this is tedious, but everyone should do it once!). You may use any TM simulator you want to develop and test your solutiemon, but it is not necessary to do so. One good TM simulator is JFLAP: \url{http://www.jflap.org/jflaptmp/}. But be careful, it simulates a doubly-infinite tape TM (see Problem 4), not the standard TM we defined.
\answer{Your answer here. (I recommend just drawing this one on paper, unless you use a TM simulator tool, and then you can include a screen shot or formal description generated by the tool.)}
\end{enumerate}
\problem{Deciding \emph{SQUAREFREE}} Provide an \emph{implementation description} of a Turing Machine that decides the language of squarefree sequences in $\left\{ a, b, c\right\}^{*}$ (from Exam 1). A \emph{squarefree} sequence is a sequence that contains no adjacent repeating subsequences of any non-zero length. For example, $ab$ and $abcba$ are squarefree, but $aa$ is not since it contains $a^{2}$ and $abcbacbab$ is not since it contains $(cba)^{2}$. Your description can be at a high-level, but should be detailed enough to convince a skeptical reader that there is a TM that decides \emph{SQUAREFREE}. (For clarity of presentation, you may want to start by providing a high-level description.)
\answer{Your answer here.}
\problem{Equivalence of 2-DPDA+$\epsilon$ and Turing Machine} In Class 14, we informally argued that a 2-stack deterministic pushdown automaton (with forced $\epsilon$-transitions) is equivalent to a Turing Machine. For this problem, prove one direction of the equivalence: that a 2-DPDA+$\epsilon$ can simulate any Turing Machine. (Hint: your proof should show how to construct a 2-DPDA+$\epsilon$ from a given Turing Machine. For a clear proof, you will need to define a formal notation for describing a 2-DPDA+$\epsilon$.)
\answer{Your answer here.}
\problem{Robustness of Turing's Model} (Sipser problem 3.11) A \emph{Turing machine with doubly infinite tape} is similar to an ordinary Turing machine, but its tape is infinite to the left as well as to the right. The tape is initially filled with blanks except for the portion that contains the input. Computation is defined as usual except that the head never encounters an end to the tape as it moves leftward. Show that the class of languages recognized by a Turing machine with doubly infinite tape is equivalent to the class of languages recognized by a regular Turing machine.
\answer{Your answer here.}
\problem{Deciders and Recognizers} In Class 15, we argue that DFAs, DPDAs, and NFAs always terminate, hence the sets of languages that can be recognized by these machines are equivalent to the sets of languages that can be decided by them. By contrast, a Turing Machine may run forever on some inputs, so there may be languages which can be recognized but not decided by a Turing Machine (we will see examples of such languages next week). What about nondeterministic pushdown automata?
\begin{enumerate}
\item Draw a Venn diagram including these sets:
\begin{itemize}
\item \emph{DPDA-Decidable} (DPDA-D): languages that can be \emph{decided} by a deterministic PDA.
\item \emph{NPDA-Decidable} (NPDA-D): languages that can be \emph{decided} by a nondeterministic PDA.
\item \emph{TM-Decidable} (TM-D): languages that can be \emph{decided} by a Turing Machine.
\item \emph{NPDA-Recognizable} (NPDA-R): languages that can be \emph{recognized} by a nondeterministic PDA.
\item \emph{TM-Recognizable} (TM-R): languages that can be \emph{recognized} by a Turing Machine.
\end{itemize}
\answer{Your answer here.}
\item Prove that your diagram correctly depicts the relationship between {\em NDPDA-Recognizable} and {\em TM-Decidable}.
\answer{Your answer here.}
\item Prove that your diagram correctly depicts the relationship between {\em NDPDA-Recognizable} and {\em NDPDA-Decidable}. (For example, if your diagram showed them as the same circle, prove that the sets are equivalent. If your diagram shows one set inside the other, prove that all languages in one set are in the other set but that there is some language in the outer set that is outside the inner set.)
\answer{Your answer here.}
\end{enumerate}
\end{document}