hws/hw02.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Mon, 06 Oct 2014 20:55:16 +0100
changeset 266 ae039d6ae3f2
parent 258 1e4da6d2490c
child 267 a1544b804d1e
permissions -rw-r--r--
fixed typo
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}
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    12
\item Review the first handout about sets of strings and read
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    13
      the second handout. Assuming the alphabet is $\{a, b\}$,
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    14
      decide which of the following equations are true in
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    15
      general for arbitrary languages $A$, $B$ and $C$:
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    16
115
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    17
\begin{eqnarray}
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    18
(A \cup B) @ C & =^? & A @ C \cup B @ C\nonumber\\
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    19
A^* \cup B^*   & =^? & (A \cup B)^*\nonumber\\
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    20
A^* @ A^*      & =^? & A^*\nonumber\\
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    21
(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
    22
\end{eqnarray}
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    23
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    24
\noindent In case an equation is true, give an explanation;
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    25
otherwise give a counter-example.
115
86c1c049eb3e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 104
diff changeset
    26
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    27
\item What is the meaning of a regular expression? Give an
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    28
      inductive definition.
104
ffde837b1db1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
    29
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    30
\item Given the regular expressions $r_1 = \epsilon$ and $r_2
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    31
      = \varnothing$ and $r_3 = a$. How many strings can the
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    32
      regular expressions $r_1^*$, $r_2^*$ and $r_3^*$ each
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    33
      match?
104
ffde837b1db1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
    34
ffde837b1db1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
    35
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    36
\item Give regular expressions for (a) decimal numbers and for
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    37
      (b) binary numbers. (Hint: Observe that the empty string
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    38
      is not a number. Also observe that leading 0s are
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    39
      normally not written.)
22
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    41
\item Decide whether the following two regular expressions are
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    42
      equivalent $(\epsilon + a)^* \equiv^? a^*$ and $(a \cdot
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    43
      b)^* \cdot a \equiv^? a \cdot (b \cdot a)^*$.
22
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    45
\item Given the regular expression $r = (a \cdot b + b)^*$.
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    46
      Compute what the derivative of $r$ is with respect to
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    47
      $a$, $b$ and $c$. Is $r$ nullable?
22
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
\item Prove that for all regular expressions $r$ we have
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    50
      
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    51
\begin{center} 
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    52
  $\textit{nullable}(r) \quad \text{if and only if} 
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    53
  \quad [] \in L(r)$ 
22
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
\end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    56
  Write down clearly in each case what you need to prove and
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    57
  what are the assumptions. 
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 132
diff changeset
    58
  
22
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
\end{enumerate}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
\end{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
%%% Local Variables: 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
%%% mode: latex
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
%%% TeX-master: t
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
%%% End: