adde
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Fri, 04 Oct 2013 15:55:42 +0100
changeset 124 dd8b5a3dac0a
parent 123 a75f9c9d8f94
child 125 39c75cf4e079
adde
handouts/ho02.pdf
handouts/ho02.tex
Binary file handouts/ho02.pdf has changed
--- a/handouts/ho02.tex	Fri Oct 04 15:40:10 2013 +0100
+++ b/handouts/ho02.tex	Fri Oct 04 15:55:42 2013 +0100
@@ -62,9 +62,35 @@
 then can test exhaustively, whether a string is member of this set.
 
 The algorithm we define below consists of two parts. One is the function $nullable$ which takes a
-regular expression as argument and decides whether it can match the empty string. This can be easily 
-defined recursively as follows:
+regular expression as argument and decides whether it can match the empty string (this means it returns a 
+boolean). This can be easily defined recursively as follows:
+
+\begin{center}
+\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
+$nullable(\varnothing)$      & $\dn$ & $f\!\/alse$\\
+$nullable(\epsilon)$           & $\dn$ &  $true$\\
+$nullable (c)$                    & $\dn$ &  $f\!alse$\\
+$nullable (r_1 + r_2)$       & $\dn$ &  $nullable(r_1) \vee nullable(r_2)$\\ 
+$nullable (r_1 \cdot r_2)$ & $\dn$ &  $nullable(r_1) \wedge nullable(r_2)$\\
+$nullable (r^*)$                & $\dn$ & $true$ \\
+\end{tabular}
+\end{center}
 
+\noindent
+The idea behind this function is that the following property holds:
+
+\[
+nullable(r) \;\;\text{if and only if}\;\; ""\in L(r)
+\]
+
+\noindent
+On the left-hand side we have a function we can implement; on the right we have its specification. 
+
+The other function is calculating a \emph{derivative} of a regular expression. This is a function
+which will take a regular expression, say $r$, and a character, say $c$, as argument and return 
+a new regular expression. Beware that the intuition behind this function is not so easy to grasp on first
+reading. Essentially this function solves the following problem: if $r$ can match a string of the form
+$c\!::\!s$, what does the regular expression look like that can match just $s$.
 
 \end{document}