hw04.tex
author Christian Urban <urbanc@in.tum.de>
Fri, 12 Oct 2012 05:45:14 +0100
changeset 32 d085fe0c086f
parent 31 e22ba348b209
child 34 eeff9953a1c1
permissions -rw-r--r--
started
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass{article}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
\usepackage{charter}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
\usepackage{hyperref}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage{amssymb}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{amsmath}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
32
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
     7
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
     8
31
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
\begin{document}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\section*{Homework 4}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
\begin{enumerate}
32
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    14
\item Give an automaton that can recognise the language 
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    15
$L(a^*\cdot b\cdot b^*\cdot(a\cdot a^*\cdot b\cdot b^*)^*)$.
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    16
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    17
\item Assume that $s^{-1}$ stands for the operation of reversing a
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    18
string $s$. Given the following \emph{reversing} function on regular 
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    19
expressions
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    20
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    21
and the set
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    22
31
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
\begin{center}
32
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    24
$Rev\,A \dn \{s^{-1} \;|\; s \in A\}$
31
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
\end{center}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
32
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    27
prove that
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    28
31
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
\begin{center}
32
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    30
$L(rev(r)) = Rev (L(r))$
31
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
\end{center}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
32
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    33
holds.
31
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
32
d085fe0c086f started
Christian Urban <urbanc@in.tum.de>
parents: 31
diff changeset
    35
\item Palindromes
31
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
\item (Optional) The tokenizer in \texttt{regexp3.scala} takes as
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
argument a string and a list of rules. The result is a list of tokens. Improve this tokenizer so 
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
that it filters out all comments and whitespace from the result.
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
\item (Optional) Modify the tokenizer in \texttt{regexp2.scala} so that it
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
implements the \texttt{findAll} function. This function takes a regular
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
expressions and a string, and returns all substrings in this string that 
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
match the regular expression.
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
\end{enumerate}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
\end{document}
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
%%% Local Variables: 
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
%%% mode: latex
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
%%% TeX-master: t
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
%%% End: