\documentclass[12pt,ifthen]{article}
\usepackage{url}
\usepackage{comment}

\newif{\ifshowsoln}
% \showsolntrue

\newcommand{\und}{\_\_\_\_\_\_\_\_\_}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\lf}{\left\lfloor}
\newcommand{\rf}{\right\rfloor}
\newcommand{\lc}{\left\lceil}
\newcommand{\rc}{\right\rceil}
\newcommand{\Ceil}[1]{\left\lceil {#1}\right\rceil}
\newcommand{\ceil}[1]{\left\lceil {#1}\right\rceil}
\newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor}

\newcommand{\goes}{\rightarrow}
\usepackage{amsmath}
\usepackage{amssymb}  % for \nmid

\begin{document}

\centerline{\bf HW 09 CMSC 452}
\centerline{\bf Morally Due TUES April 8 11:00AM} 
\centerline{\bf Dead-Cat Due THU April 10 11:00AM} 


\begin{enumerate}

\item
(50 points) A Leo-Grammar is a grammar where each rule is of one of the following forms:

$AB\goes CDE$

$AB\goes CD$

$A\goes BC$

$A\goes \sigma$

$A\goes e$

For example, the following is a Leo-Grammar

$S\goes AA$

$SS\goes ABB$

$A\goes BB$

$AA \goes AAA$

$A\goes a$

$B\goes b$

I have no idea what this grammar generates, nor do I care. 

(Note that Leo-Grammars are NOT context free grammars.) 

We assume $\Sigma=\{a,b\}$. 

If $G$ is a Leo-Grammar then $L(G)$ is the set of strings in $\{a,b\}^*$ that $G$ generates. 

\begin{enumerate}
\item
(15 points)
Find a function $f$ such that the following is true:

{\it A Leo-Grammar with $t$ nonterminals has $O(f(t))$ rules.}

\item
(15 points)
Find a function $g$ such that the following is true:

{\it The number of Leo-Grammars with $t$ nonterminals is $O(g(t))$. }

\item
(20 points)
Find a function $h$ such that the following is true:


{\it $\exists w\in\{a,b\}^*$ of length $O(h(t))$ such that 
there is NO Leo-Grammar $G$ with $t$ nonterminals such that $L(G)=\{w\}$. }
\end{enumerate}

\newpage


\item
(50 points) 

\begin{enumerate}
\item
(15 points) 
Let $\Sigma=\{a,b,c,d\}$. 

Give a Context Sensitive Grammar for the language

$$\{ w \colon \#_a(w)=\#_b(w)=\#_c(w)=\#_d(w) \}.$$


How many rules does it have?

\item
(15 points) 
Let $\Sigma = \{a_1,a_2,\ldots,a_n\}$. 

Give a Context Sensitive Grammar for the language

$$\{ w \colon \#_{a_1}(w)=\#_{a_2}(w)=\cdots=\#_{a_n}(w) \}.$$

(you may use DOT DOT DOT in your grammar)

\item
(20 points)
Find a function $r$ such that your Context Sensitive Grammar
from the last part has $O(r(n))$ rules.
\end{enumerate}



\end{enumerate}

\end{document}