\documentclass[12pt]{article}

\usepackage{times,mathptm}
\pagestyle{myheadings}



\parindent 0in
\setlength{\parindent}{0in}
\setlength{\parskip}{1ex}

\topmargin -0.1in \headheight\baselineskip
\textheight 8.5in         % 1in top and bottom margin
\textwidth 6.5in        % 1in left and right margin
\oddsidemargin 0in
\evensidemargin 0in




\usepackage{amsmath}
\usepackage{amssymb}


% \setlength{\itemsep}{0pt}

\markright{\footnotesize CS 451 Programming Paradigms, Spring 2001}

\begin{document}

\section*{Homework set 4: Grammars, regular languages, and context-free languages --- due Monday 5 February}

Total number of points available on this homework is 150. Full credit
is equivalent to 100 points.

%\small

\begin{enumerate}


\item (20 pts.)  
What is the language generated by the grammar
$S \rightarrow SSS \mid a $ \ ?


\item (20 pts.)  
Write a grammar for the language of the regular expression 
$((a + b^{\star}c)d)^{\star}$.


\item (30 pts.)  
Give examples of languages that satisfy the following conditions:
\begin{enumerate}
\item $L_1$ is regular and infinite, $L_2$ is not regular, 
and $L_1 \subset L_2$.
\item $L_3$ is regular, $L_4$ is not regular,
and $L_4 \subset L_3$.
\end{enumerate}


\item (30 pts.)
The reverse of a string $x$ is denoted $x^R$, 
and is defined recursively as follows:
$\epsilon^R = \epsilon$, 
and for $\sigma \in \Sigma$, $(x \sigma)^R = \sigma x^R$.

Consider the following grammar $G$ over $\Sigma = \{a, b\}$:
\begin{quote}
$S \rightarrow a S a$  \\
$S \rightarrow b S b$  \\
$S \rightarrow \epsilon$
\end{quote}

Prove that it is possible to derive from $S$ any string of the form
$x S x^R$, where $x$ is any string over $\{a, b\}$.


\item (50 pts. - extra credit)
Show that English is not context-free.



\end{enumerate}


If you wish to study formal languages beyond the brief introduction
we were able to do in class, here are some good books, ordered from
more theoretical to more applied:

\begin{itemize}

\item Harry Lewis and Christos Papadimitriou:
  \textit{Elements of the Theory of Computation},
  Prentice-Hall, 1981

\item Gy\"{o}rgy E. R\'{e}v\'{e}sz: 
  \textit{Introduction to Formal Languages}, 
  Dover, 1991, \$6.95

\item Alfred V. Aho and Jeffrey D. Ullman: 
  \textit{The Theory of Parsing, Translation, and Compiling}, (2 vols.),
  Prentice-Hall, 1972-73

\item Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman: 
  \textit{Compilers: Principles, Techniques, and Tools},
  Addison-Wesley, 1988

\end{itemize}


\end{document}

