\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 06 CMSC 452} \centerline{\bf Morally Due TUES March 11 11:00AM} \centerline{\bf Dead-Cat Due THU March 13 at 11:00AM} \begin{enumerate} \item (30 points) Give a CFG for the following languages The alphabet is $\{a,b\}$. \begin{enumerate} \item $\{ w \colon \#_a(w) \equiv 0 \pmod 3 \}$. \item $\{ w \colon \#_a(w) \equiv 1 \pmod 3 \}$. \end{enumerate} \newpage \item (30 points) Give a context free grammar for the following language $\overline{\{a^n b^n c^n \colon n\in\N\}}$. \newpage \item (40 points) \begin{enumerate} \item (20 points) Give a function $f$ such that the following is true, and prove it: If $\alpha$ is a regex of length $n$ then there exists a context free grammar $G$ such that $L(G)=L(\alpha)$ with $f(n)$ rules ($f(n)$ may use $O$-notation). (The CFG DOES NOT have to be in Chomsky Normal Form.) (Your proof should be an algorithm that takes $n$ and produces the grammar. You may use any theorem in class as a subroutine for this algorithm.) \item (20 points) Give a function $g$ such that the following is true, and prove it: The language $$L_n=\{ w \colon \#_a(w) \equiv 0 \pmod n \wedge \#_b(w) \equiv 0 \pmod n \}$$ has a context free grammar with $g(n)$ rules ($g(n)$ may use $O$-notation). (The CFG DOES NOT have to be in Chomsky Normal Form.) (Your proof should be an algorithm that takes $n$ and produces the grammar. You may use any theorem in class as a subroutine for this algorithm.) \end{enumerate} \end{enumerate} \end{document}