\documentclass{article}
\usepackage{enumerate,mathtools,amsmath,amssymb,amsthm}
\usepackage[margin=1in]{geometry}

\title{\vspace{-3ex} \bf Assignment 3 \\[1ex]
    \rm\normalsize CS 311, Fall 2015 \\ Due: October 28, 2014}

\date{}
\author{}

\begin{document}
\maketitle

\paragraph{Problem 1} For the language:
\[A = \{ w \in \{0,1\}^* \;|\; w \text{ is not a palindrome} \}\]
\begin{enumerate} [\indent a)]
    \item Using the pumping lemma, show that $A$ 
    is {\em not} regular. (Hint: the regular languages are closed under complement) [5 Points]
    \item Give a CFG that generates the language $A$. [5 Points]
\end{enumerate}

\paragraph{Problem 2} For the language:
\[B = \{ w \in \{a,b\}^* \;|\; \text{The first, middle, and last character are the same} \}\]
\begin{enumerate} [\indent a)]
    \item Using the pumping lemma, show that $B$ is {\em not} regular. [5 points]
    \item Give a CFG that generates the language $B$. [5 points]
\end{enumerate}

\paragraph{Problem 3} The languages $\{0^s 1^s 2^t \;|\; s,t \geq 0\}$ and $\{0^s 1^t 2^t
\;|\; s,t \geq 0\}$ are context-free. Use those languages to answer the following:
\begin{enumerate}[a)]
    \item Write down CFGs for each of the languages. [5 Points]
    \item Use the fact that both languages are context-free to show that the class of context-free
    languages is \textit{not} closed under intersection.  (Use the context-free pumping lemma to
    show that the resulting language is not context-free.) [5 Points]
    \item Use the result from part $b$ and DeMorgan's Laws to show that the class of context-free
    languages are \textit{not} closed under complement. [5 Points]
\end{enumerate}

\paragraph{Problem 4} Give a Context-Free Grammar for the following language:
\[ \{a^*b^*c^*\} - \{a^nb^nc^n \;|\; n \geq 0 \}  \]
(Hint: See if you can rephrase the language to make it easier)

\paragraph{Problem 5}
Write the context free grammar for $\{w \;|\; w \text{ is a palindrome }\}$ and then convert 
the grammar into Chomsky normal form using the procedure from class. [10 Points]

\paragraph{Problem 6} 
Prove or disprove: If $G$ is a CFG in Chomsky normal form, then for any string $w \in L(G)$ 
of length $n \ge 1$ then exactly $2n -1$ steps are required for any derivation of $w$. [10 Points]

\end{document}
