Binary file handouts/ho03.pdf has changed
--- a/handouts/ho03.tex Wed Oct 03 13:37:11 2018 +0100
+++ b/handouts/ho03.tex Fri Oct 05 11:07:57 2018 +0100
@@ -131,7 +131,7 @@
\begin{figure}[p]
\small
\lstinputlisting[numbers=left]{../progs/display/dfa.scala}
-\caption{A Scala implementation of DFAs using partial functions.
+\caption{An implementation of DFAs in Scala using partial functions.
Note some subtleties: \texttt{deltas} implements the delta-hat
construction by lifting the (partial) transition function to lists
of characters. Since \texttt{delta} is given as a partial function,
@@ -160,7 +160,7 @@
definition, but a function from states to booleans (this function is
supposed to return true whenever a state is final; false
otherwise). While this boolean function is different from the sets of
-states, Scala allows to use sets for such functions (see Line 40 where
+states, Scala allows us to use sets for such functions (see Line 40 where
the DFA is initialised). Again it will become clear later on why I use
functions for final states, rather than sets.
@@ -191,9 +191,9 @@
Finally, I let you ponder whether this is a good implementation of
DFAs or not. In doing so I hope you notice that the $\varSigma$ and
-$Qs$ components (the alphabet and the set of finite states,
+$Qs$ components (the alphabet and the set of \emph{finite} states,
respectively) are missing from the class definition. This means that
-the implementation allows you to do some fishy things you are not
+the implementation allows you to do some ``fishy'' things you are not
meant to do with DFAs. Which fishy things could that be?
--- a/progs/pow.scala Wed Oct 03 13:37:11 2018 +0100
+++ b/progs/pow.scala Fri Oct 05 11:07:57 2018 +0100
@@ -10,6 +10,7 @@
pow(A, 4).size // -> 256
val B = Set("a", "b", "c", "")
+pow(B, 4)
pow(B, 4).size // -> 121
@@ -25,15 +26,15 @@
pow(C, 3).size // -> 15
-val A = Set("a", "b", "c", "d")
-pow(A, 4).size
+//val A = Set("a", "b", "c", "d")
+//pow(A, 4).size
-val A = Set("a", "b", "c")
-pow(A, 5).size
+//val A = Set("a", "b", "c")
+//pow(A, 5).size
-val A = Set("a", "b", "")
-pow(A, 5).size
+//val A = Set("a", "b", "")
+//pow(A, 5).size
-for (n <- (0 to 12).toList)
- yield pow(A, n).size
\ No newline at end of file
+for (n <- (0 to 6).toList)
+ yield pow(B, n).size
Binary file slides/slides03.pdf has changed
--- a/slides/slides03.tex Wed Oct 03 13:37:11 2018 +0100
+++ b/slides/slides03.tex Fri Oct 05 11:07:57 2018 +0100
@@ -28,7 +28,7 @@
\begin{center}
\begin{tabular}{lp{8cm}}
Email: & christian.urban at kcl.ac.uk\\
- Office: & N7.07 (North Wing, Bush House)\\
+ Office: & N\liningnums{7.07} (North Wing, Bush House)\\
Slides: & KEATS (also homework and coursework is there)\\
\end{tabular}
\end{center}
@@ -42,7 +42,7 @@
\begin{itemize}
\item \small https://nms.kcl.ac.uk/christian.urban/ProgInScala2ed.pdf\normalsize
-\item homeworks (written exam 80\%)
+\item homework (written exam 80\%)
\item coursework (20\%)\bigskip
\item short survey at KEATS; to be answered until Sunday
\end{itemize}
@@ -173,7 +173,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
-We proved partially
+We proved
\begin{center}
\bl{$nullable(r)$} \;if and only if\; \bl{$[] \in L(r)$}