hws/hw02.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 13 Nov 2013 06:40:37 +0000
changeset 188 12ef150273ce
parent 132 04264d0c43bb
child 258 1e4da6d2490c
permissions -rw-r--r--
added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass{article}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
\usepackage{charter}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
\usepackage{hyperref}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage{amssymb}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{amsmath}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\begin{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
\section*{Homework 2}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\begin{enumerate}
115
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    12
\item Review the first handout about sets of strings and read the second handout. 
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    13
Assuming the alphabet is $\{a, b\}$, decide which of the following equations are true
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    14
in general for arbitrary languages $A$, $B$ and $C$:
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    15
\begin{eqnarray}
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    16
(A \cup B) @ C & = & A @ C \cup B @ C\nonumber\\
132
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 115
diff changeset
    17
A^* \cup B^* & = & (A \cup B)^*\nonumber\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 115
diff changeset
    18
A^* @ A^*  & = & A^*\nonumber\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 115
diff changeset
    19
(A \cap B)@ C & = & (A@C) \cap (B@C)\nonumber
115
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    20
\end{eqnarray}
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    21
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    22
\noindent
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    23
In case an equation is true, give an explanation; otherwise give a counter-example.
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    24
104
ffde837b1db1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
    25
\item What is the meaning of a regular expression? Give an inductive definition.
ffde837b1db1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
    26
ffde837b1db1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
    27
\item Given the regular expressions $r_1 = \epsilon$ and $r_2 = \varnothing$ and $r_3 = a$.
ffde837b1db1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
    28
How many strings can the regular expressions $r_1^*$, $r_2^*$ and $r_3^*$ each match?
ffde837b1db1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
    29
ffde837b1db1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
    30
22
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
\item Give regular expressions for (a) decimal numbers and for (b) binary numbers. 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
(Hint: Observe that the empty string is not a number. Also observe that leading 0s 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
are normally not written.)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
\item Decide whether the following two regular expressions are equivalent $(\epsilon + a)^* \equiv^? a^*$ and 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
$(a \cdot b)^* \cdot a \equiv^? a \cdot (b \cdot a)^*$.
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
\item Given the regular expression $r = (a \cdot b + b)^*$. Compute what the derivative of $r$ is with respect to
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
$a$ and $b$. Is $r$ nullable?
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
\item Prove that for all regular expressions $r$ we have
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
$\text{nullable}(r)$ \quad if and only if \quad $\texttt{""} \in L(r)$
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
\end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
\end{enumerate}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
\end{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
%%% Local Variables: 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
%%% mode: latex
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
%%% TeX-master: t
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
%%% End: