\documentclass[11pt]{article}

\usepackage{fullpage,times,epsfig}

\begin{document}

\section*{Computability and Logic Homework 5}

\noindent
\textbf{Due: } Thursday, October 6, 2005

\bigskip\noindent
Problems 1 and 4 are worth 10 points each; problems 2 and 3 are worth
15 points each.

\paragraph{1. CFG's into PDA's}  
Consider the following context-free grammar:
\[
S \to \Lambda\ |\ aSbS\ |\ bSaS
\]
\begin{itemize}
\item[a.] What is the language generated by this grammar?  (You need
  not prove your answer.)
\item[b.] Use the construction given in class
to find a pushdown automaton accepting the language generated by this grammar.
\item[c.] Show the steps your automaton takes to accept the string $aabbba$.
\end{itemize}

\paragraph{2. Pushdown Automaton Execution} Let $M = (Q,V,s,R,T)$ be a
pushdown automaton over $\Sigma$.  Using induction on the number of
steps in the computation, prove that if $(p,w,\gamma) \mapsto^*
(q,w',\gamma')$ then for any $v \in \Sigma^*$ and any $\delta \in
V^*$, $(p,wv,\gamma\delta) \mapsto^* (q,w'v,\gamma'\delta)$.

\paragraph{3. Simple Pushdown Automata} Recall from lecture that a
pushdown automaton $M = (Q,V,s,R,T)$ is \emph{simple} if for every
transition $p \stackrel{a,\alpha/\beta}{\longrightarrow} q \in T$:
\begin{enumerate}
\item $q \neq s$ (that is, the automaton never returns to its start
  state).
\item If $p = s$ then $a = \Lambda$, $\alpha=\Lambda$ and $|\beta|=1$
  (that is, the first step in any computation consumes no input and
  pushes a single symbol onto the stack).
\item If $p \neq s$ then $|\alpha| = 1$ and $|\beta| \leq 2$ (that is,
  every step after the first step pops exactly one symbol from the
  stack and replaces it with at most two others).
\end{enumerate}
Suppose $M$ is a simple pushdown automaton.  Prove that if
$(p,w,\gamma_1\gamma_2) \mapsto^* (q,\Lambda,\Lambda)$ and $p \neq s$,
then there must exist a state $r$ and strings $w_1$ and $w_2$ such
that $w = w_1w_2$ and $(p,w_1,\gamma_1) \mapsto^* (r,\Lambda,\Lambda)$
and $(r,w_2,\gamma_2) \mapsto^* (q,\Lambda,\Lambda)$.  Your proof
should be by induction on the number of steps in the given computation.


\paragraph{4. PDA's into CFG's}
Consider the pushdown automaton
  having states $\{s,t,u,v\}$, ($s$ is the start state, $v$ is the
  only final state), stack alphabet $\{a,\#\}$ and transitions:
\[
\begin{array}{l}
s \stackrel{\Lambda,\Lambda/\#}{\longrightarrow} t \\
t \stackrel{a,\#/a\#}{\longrightarrow} t \qquad
t \stackrel{a,a/aa}{\longrightarrow} t \\
t \stackrel{\Lambda,\#/\#}{\longrightarrow} u \qquad
t \stackrel{\Lambda,a/a}{\longrightarrow} u \\
u \stackrel{b,a/\Lambda}{\longrightarrow} u \\
u \stackrel{\Lambda,\#/\Lambda}{\longrightarrow} v
\end{array}
\]
\begin{itemize}
\item[a.] What is the language accepted by this automaton?  Briefly
  and informally describe its operation.
\item[b.] Verify for yourself that this pushdown automaton is simple;
  then, use the construction given in class to find a context-free
  grammar that generates the language it accepts.  This grammar will
  contain many rules that cannot be used to derive strings of
  terminals; you do not need to show these rules.  ({\bf Note:} You
  already know an elegant grammar for this language, but it is not a
  correct answer to this problem!)
\item[c.] Show a derivation of $aabb$ using the grammar you produced
  in part (b).
\end{itemize}


\end{document}