slides/slides04.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sun, 01 Dec 2013 09:58:41 +0000
changeset 215 828303e8e4af
parent 145 920f675b4ed1
child 265 332fbe9c91ab
permissions -rw-r--r--
updated slides
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
     2
\usepackage{beamerthemeplaincu}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
\usepackage[absolute,overlay]{textpos}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage{ifthen}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{tikz}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
\usepackage{pgf}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\usepackage{calc} 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
\usepackage{ulem}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
\usepackage{courier}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
\usepackage{listings}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\renewcommand{\uline}[1]{#1}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
\usetikzlibrary{arrows}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
\usetikzlibrary{automata}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
\usetikzlibrary{shapes}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
\usetikzlibrary{shadows}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
\usetikzlibrary{positioning}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
\usetikzlibrary{calc}
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    18
\usetikzlibrary{fit}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    19
\usetikzlibrary{plotmarks}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    20
\usetikzlibrary{backgrounds}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
\usepackage{graphicx} 
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
    22
\usepackage{../langs}
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
    23
\usepackage{../data}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    25
\makeatletter
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    26
\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    27
\@empty\z@\@empty
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    28
\makeatother
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    29
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
    31
\renewcommand{\slidecaption}{AFL 04, King's College London, 16.~October 2013}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
\begin{document}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
\begin{frame}<1>[t]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
\frametitle{%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
  \begin{tabular}{@ {}c@ {}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
  \\[-3mm]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  \LARGE Automata and \\[-2mm] 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
  \LARGE Formal Languages (4)\\[3mm] 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
  \end{tabular}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
  \normalsize
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  \begin{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
  \begin{tabular}{ll}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  Email:  & christian.urban at kcl.ac.uk\\
142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
    51
  Office: & S1.27 (1st floor Strand Building)\\
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
  Slides: & KEATS (also home work is there)\\
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  \end{tabular}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
  \end{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    60
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    61
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    62
\mode<presentation>{
144
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    63
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    64
\frametitle{Regexps and Automata}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    66
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    67
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    68
\node (rexp)  {\bl{\bf Regexps}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    69
\node (nfa) [right=of rexp] {\bl{\bf NFAs}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    70
\node (dfa) [right=of nfa] {\bl{\bf DFAs}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    71
\onslide<3->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    72
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    73
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    74
\onslide<3->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    75
\onslide<2->{\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp);}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    76
\end{tikzpicture}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    77
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    78
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    79
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    80
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
    81
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    82
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    83
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    84
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    85
\frametitle{\begin{tabular}{c}DFAs\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    87
A deterministic finite automaton consists of:
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    88
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    89
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    90
\item a finite set of states, \bl{$Q$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    91
\item one of these states is the start state, \bl{$q_0$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    92
\item there is transition function, \bl{$\delta$}, and
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    93
\item some states are accepting states, \bl{$F$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    94
\medskip 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    95
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    96
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    97
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    98
\bl{$A(Q, q_0, \delta, F)$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    99
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   100
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   101
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   102
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   103
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   104
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   105
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   106
\frametitle{\begin{tabular}{c}State Nodes\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   107
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   108
\hspace{5mm}\mbox{{\lstset{language=Scala}\consolas\fontsize{9}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   109
\lstinputlisting{../progs/appA.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   110
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   111
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   112
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   114
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   115
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   116
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   117
\frametitle{\begin{tabular}{c}DFAs\;\;\;\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   118
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   119
\mbox{}\\[7mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   120
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   121
\mbox{{\lstset{language=Scala}\consolas\fontsize{9}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   122
\lstinputlisting{../progs/appB.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   124
\only<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   125
\begin{textblock}{9}(7.5,0.5)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   126
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   127
\draw (0,0) node[inner sep=2mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   128
{\normalsize\color{darkgray}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   129
\begin{minipage}{6cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   130
\begin{tabular}{l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   131
\bl{$\hat{\delta}(q, \texttt{""}) \dn q$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   132
\bl{$\hat{\delta}(q, c::s) \dn \hat{\delta}(\delta(q, c), s)$}\\[4mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   133
\bl{$\hat{\delta}(q_0, s) \in F$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   134
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   135
\end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   136
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   137
\end{textblock}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   138
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   139
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   140
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   141
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   142
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   143
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   144
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   146
\mbox{}\hspace{-10mm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   147
\begin{tikzpicture}[scale=0.6,>=stealth',very thick,auto,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   148
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   149
\node[state,initial]  (q_0)  {$q_0$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   150
\node[state] (q_1) [right=of q_0] {$q_1$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   151
\node[state] (q_2) [below right=of q_0] {$q_2$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   152
\node[state] (q_3) [right=of q_2] {$q_3$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   153
\node[state, accepting] (q_4) [right=of q_1] {$q_4$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   154
\path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   155
\path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   156
\path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   157
\path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   158
\path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   159
\path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   160
\path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   161
\path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   162
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   163
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   164
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   165
\only<1->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   166
\begin{textblock}{9}(7.4,3.5)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   167
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   168
\draw (0,0) node[inner sep=2mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   169
{\normalsize\color{darkgray}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   170
\begin{minipage}{6.6cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   171
\hspace{5mm}\mbox{{\lstset{language=Scala}\consolas\fontsize{8}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   172
\lstinputlisting{../progs/appC.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   173
\end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   174
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   175
\end{textblock}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   176
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   177
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   178
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   179
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   180
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   181
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   182
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   183
\frametitle{\begin{tabular}{c}NFAs\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   184
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   185
A non-deterministic finite automaton \bl{$A(Q, q_0, \delta, F)$} consists of:\medskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   186
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   187
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   188
\item a finite set of states, \bl{$Q$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   189
\item one of these states is the start state, \bl{$q_0$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   190
\item some states are accepting states, \bl{$F$},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   191
\item there is transition \alert{relation}, \bl{$\delta$}, and
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   192
\item there are \alert{silent} transitions\medskip 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   193
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   194
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   195
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   196
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   197
\begin{tabular}{c}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   198
\bl{$(q_1, a) \rightarrow q_2$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   199
\bl{$(q_1, a) \rightarrow q_3$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   200
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   201
\hspace{10mm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   202
\begin{tabular}{c}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   203
\bl{$(q_1, \epsilon) \rightarrow q_2$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   204
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   205
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   207
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   208
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   209
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   210
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   211
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   212
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   213
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   214
\hspace{5mm}\mbox{{\lstset{language=Scala}\consolas\fontsize{9}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   215
\lstinputlisting{../progs/appD.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   216
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   217
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   218
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   219
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   220
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   221
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   222
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   223
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   224
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   225
\mbox{}\hspace{-10mm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   226
\begin{tikzpicture}[scale=0.6,>=stealth',very thick,auto,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   227
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   228
\node[state,initial]  (q_0)  {$q_0$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   229
\node[state] (q_1) [above=of q_0] {$q_1$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   230
\node[state, accepting] (q_2) [below=of q_0] {$q_2$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   231
\path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   232
\path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   233
\path[->] (q_0) edge [loop right] node  {\alert{$a$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   234
\path[->] (q_1) edge [loop above] node  {\alert{$a$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   235
\path[->] (q_2) edge [loop below] node  {\alert{$b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   236
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   237
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   238
\only<1->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   239
\begin{textblock}{9}(6,1.5)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   240
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   241
\draw (0,0) node[inner sep=2mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   242
{\normalsize\color{darkgray}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   243
\begin{minipage}{7cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   244
\hspace{5mm}\mbox{{\lstset{language=Scala}\consolas\fontsize{8}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   245
\lstinputlisting{../progs/appE.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   246
\end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   247
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   248
\end{textblock}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   249
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   250
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   251
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   252
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   253
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   254
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   255
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   256
\frametitle{Rexp to NFA}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   257
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   258
Thompson's construction of a NFA from a regular expression:
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   259
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   260
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   261
\begin{tabular}[t]{l@{\hspace{10mm}}l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   262
\raisebox{1mm}{\bl{$\varnothing$}} & 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   263
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   264
\node[state, initial]  (q_0)  {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   265
\end{tikzpicture}\\\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   266
\raisebox{1mm}{\bl{$\epsilon$}} & 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   267
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   268
\node[state, initial, accepting]  (q_0)  {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   269
\end{tikzpicture}\\\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   270
\raisebox{2mm}{\bl{$c$}} & 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   271
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   272
\node[state, initial]  (q_0)  {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   273
\node[state, accepting]  (q_1)  [right=of q_0] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   274
\path[->] (q_0) edge node [below]  {\alert{$c$}} (q_1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   275
\end{tikzpicture}\\\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   276
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   277
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   278
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   279
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   280
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   281
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   282
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   283
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   284
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   285
\frametitle{Case $r_1\cdot r_2$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   286
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   287
\mbox{}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   288
\onslide<1>{By recursion we are given two automata:\bigskip}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   289
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   290
{\centering\begin{tikzpicture}[node distance=3mm,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   291
                             >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   292
\node[state, initial]  (q_0)  {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   293
\node (r_1)  [right=of q_0] {$\ldots$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   294
\only<1>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   295
\node[state, accepting]  (t_1)  [right=of r_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   296
\node[state, accepting]  (t_2)  [above=of t_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   297
\node[state, accepting]  (t_3)  [below=of t_1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   298
\only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   299
\node[state]  (t_1)  [right=of r_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   300
\node[state]  (t_2)  [above=of t_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   301
\node[state]  (t_3)  [below=of t_1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   302
\only<1>{\node[state, initial]  (a_0)  [right=2.5cm of t_1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   303
\only<2>{\node[state]  (a_0)  [right=2.5cm of t_1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   304
\node (b_1)  [right=of a_0] {$\ldots$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   305
\node[state, accepting]  (c_1)  [right=of b_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   306
\node[state, accepting]  (c_2)  [above=of c_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   307
\node[state, accepting]  (c_3)  [below=of c_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   308
\only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   309
\path[->] (t_1) edge node [above, pos=0.3]  {\alert{$\epsilon$}} (a_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   310
\path[->] (t_2) edge node [above]  {\alert{$\epsilon$}} (a_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   311
\path[->] (t_3) edge node [below]  {\alert{$\epsilon$}} (a_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   312
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   313
\begin{pgfonlayer}{background}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   314
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (q_0) (r_1) (t_1) (t_2) (t_3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   315
\only<1>{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (a_0) (b_1) (c_1) (c_2) (c_3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   316
\only<2>{\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (q_0) (c_1) (c_2) (c_3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   317
\only<1>{\node [yshift=2mm] at (1.north) {\bl{$r_1$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   318
\only<1>{\node [yshift=2mm] at (2.north) {\bl{$r_2$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   319
\only<2>{\node [yshift=2mm] at (3.north) {\bl{$r_1\cdot r_2$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   320
\end{pgfonlayer}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   321
\end{tikzpicture}}\bigskip\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   322
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   323
\small
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   324
We need to (1) change the accepting nodes of the first automaton into non-accepting nodes, and (2) connect them
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   325
via $\epsilon$-transitions to the starting state of the second automaton. 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   326
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   327
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   328
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   329
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   330
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   331
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   332
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   333
\frametitle{Case $r_1+ r_2$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   334
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   335
\onslide<1>{By recursion we are given two automata:\smallskip}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   336
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   337
\hspace{2cm}\begin{tikzpicture}[node distance=3mm,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   338
                             >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   339
\onslide<1>{\node at (0,0)  (1)  {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   340
\onslide<2>{\node at (0,0) [state, initial]  (1)  {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   341
\only<1>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   342
\node[state, initial]  (2)  [above right=16mm of 1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   343
\node[state, initial]  (3)  [below right=16mm of 1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   344
\only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   345
\node[state]  (2)  [above right=16mm of 1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   346
\node[state]  (3)  [below right=16mm of 1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   347
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   348
\node (a)  [right=of 2] {$\ldots$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   349
\node[state, accepting]  (a1)  [right=of a] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   350
\node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   351
\node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   352
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   353
\node (b)  [right=of 3] {$\ldots$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   354
\node[state, accepting]  (b1)  [right=of b] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   355
\node[state, accepting]  (b2)  [above=of b1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   356
\node[state, accepting]  (b3)  [below=of b1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   357
\only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   358
\path[->] (1) edge node [above]  {\alert{$\epsilon$}} (2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   359
\path[->] (1) edge node [below]  {\alert{$\epsilon$}} (3);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   360
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   361
\begin{pgfonlayer}{background}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   362
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   363
\only<1>{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (3) (b1) (b2) (b3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   364
\only<2>{\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3) (b2) (b3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   365
\only<1>{\node [yshift=3mm] at (1.north) {\bl{$r_1$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   366
\only<1>{\node [yshift=3mm] at (2.north) {\bl{$r_2$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   367
\only<2>{\node [yshift=3mm] at (3.north) {\bl{$r_1+ r_2$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   368
\end{pgfonlayer}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   369
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   370
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   371
\small
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   372
We (1) need to introduce a new starting state and (2) connect it to the original two starting states.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   373
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   374
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   375
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   376
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   377
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   378
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   379
\frametitle{Case $r^*$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   380
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   381
\onslide<1>{By recursion we are given an automaton for $r$:\smallskip}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   382
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   383
\hspace{2cm}\begin{tikzpicture}[node distance=3mm,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   384
                             >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   385
\onslide<1>{\node at (0,0)  (1)  {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   386
\onslide<2->{\node at (0,0) [state, initial,accepting]  (1)  {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   387
\only<1>{\node[state, initial]  (2)  [right=16mm of 1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   388
\only<2->{\node[state]  (2)  [right=16mm of 1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   389
\node (a)  [right=of 2] {$\ldots$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   390
\only<1>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   391
\node[state, accepting]  (a1)  [right=of a] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   392
\node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   393
\node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   394
\only<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   395
\node[state]  (a1)  [right=of a] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   396
\node[state]  (a2)  [above=of a1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   397
\node[state]  (a3)  [below=of a1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   398
\only<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   399
\path[->] (1) edge node [above]  {\alert{$\epsilon$}} (2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   400
\path[->] (a1) edge [bend left=45] node [above]  {\alert{$\epsilon$}} (1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   401
\path[->] (a2) edge [bend right] node [below]  {\alert{$\epsilon$}} (1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   402
\path[->] (a3) edge [bend left=45] node [below]  {\alert{$\epsilon$}} (1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   403
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   404
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   405
\begin{pgfonlayer}{background}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   406
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   407
\only<2->{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   408
\only<1>{\node [yshift=3mm] at (1.north) {\bl{$r$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   409
\only<2->{\node [yshift=3mm] at (2.north) {\bl{$r^*$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   410
\end{pgfonlayer}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   411
\end{tikzpicture}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   412
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   413
\onslide<3->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   414
Why can't we just have an epsilon transition from the accepting states to the starting state?}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   415
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   416
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   417
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   418
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   419
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   420
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   421
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   422
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   423
\frametitle{\begin{tabular}{c}\bl{$(a?\{n\}) \cdot a\{n\}$}\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   424
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   425
\mbox{}\\[-13mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   426
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   427
\begin{tikzpicture}[y=.2cm, x=.09cm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   428
 	%axis
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   429
	\draw (0,0) -- coordinate (x axis mid) (100,0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   430
    	\draw (0,0) -- coordinate (y axis mid) (0,30);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   431
    	%ticks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   432
    	\foreach \x in {0,10,...,100}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   433
     		\draw (\x,1pt) -- (\x,-3pt)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   434
			node[anchor=north] {\x};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   435
    	\foreach \y in {0,5,...,30}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   436
     		\draw (1pt,\y) -- (-3pt,\y) 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   437
     			node[anchor=east] {\y}; 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   438
	%labels      
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   439
	\node[below=0.6cm] at (x axis mid) {\bl{a}s};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   440
	\node[rotate=90, left=1.2cm] at (y axis mid) {secs};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   441
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   442
	%plots
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   443
	\draw[color=blue] plot[mark=*, mark options={fill=white}] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   444
		file {re-python.data};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   445
	\draw[color=red] plot[mark=triangle*, mark options={fill=white} ] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   446
		file {nfa.data};	  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   447
	\draw[color=brown] plot[mark=pentagon*, mark options={fill=white} ] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   448
		file {re-ruby.data};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   449
		
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   450
    
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   451
	%legend
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   452
	\begin{scope}[shift={(4,20)}] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   453
	\draw[color=blue] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   454
		plot[mark=*, mark options={fill=white}] (0.25,0) -- (0.5,0) 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   455
		node[right]{\small Python};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   456
	\draw[yshift=-\baselineskip, color=brown] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   457
		plot[mark=pentagon*, mark options={fill=white}] (0.25,0) -- (0.5,0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   458
		node[right]{\small Ruby};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   459
	\draw[yshift=\baselineskip, color=red] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   460
		plot[mark=triangle*, mark options={fill=white}] (0.25,0) -- (0.5,0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   461
		node[right]{\small NFA 1};		
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   462
	\end{scope}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   463
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   464
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   465
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   466
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   467
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   468
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   469
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   470
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   471
\frametitle{Greedy Depth-First}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   472
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   473
\hspace{5mm}\mbox{{\lstset{language=Scala}\consolas\fontsize{9}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   474
\lstinputlisting{../progs/appG.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   475
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   476
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   477
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   478
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   479
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   480
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   481
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   482
\frametitle{\begin{tabular}{c}\bl{$(a?\{n\}) \cdot a\{n\}$}\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   483
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   484
\mbox{}\\[-13mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   485
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   486
\begin{tikzpicture}[y=.2cm, x=.3cm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   487
 	%axis
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   488
	\draw (0,0) -- coordinate (x axis mid) (30,0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   489
    	\draw (0,0) -- coordinate (y axis mid) (0,30);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   490
    	%ticks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   491
    	\foreach \x in {0,5,...,30}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   492
     		\draw (\x,1pt) -- (\x,-3pt)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   493
			node[anchor=north] {\x};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   494
    	\foreach \y in {0,5,...,30}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   495
     		\draw (1pt,\y) -- (-3pt,\y) 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   496
     			node[anchor=east] {\y}; 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   497
	%labels      
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   498
	\node[below=0.6cm] at (x axis mid) {\bl{a}s};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   499
	\node[rotate=90, left=1.2cm] at (y axis mid) {secs};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   500
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   501
	%plots
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   502
	\draw[color=blue] plot[mark=*, mark options={fill=white}] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   503
		file {re-python.data};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   504
	\draw[color=red] plot[mark=triangle*, mark options={fill=white} ] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   505
		file {nfasearch.data};	  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   506
	\draw[color=brown] plot[mark=pentagon*, mark options={fill=white} ] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   507
		file {re-ruby.data};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   508
    
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   509
	%legend
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   510
	\begin{scope}[shift={(4,20)}] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   511
	\draw[color=blue] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   512
		plot[mark=*, mark options={fill=white}] (0.25,0) -- (0.5,0) 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   513
		node[right]{\small Python};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   514
	\draw[yshift=-\baselineskip, color=brown] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   515
		plot[mark=pentagon*, mark options={fill=white}] (0.25,0) -- (0.5,0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   516
		node[right]{\small Ruby};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   517
	\draw[yshift=\baselineskip, color=red] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   518
		plot[mark=triangle*, mark options={fill=white}] (0.25,0) -- (0.5,0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   519
		node[right]{\small NFA 2};		
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   520
	\end{scope}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   521
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   522
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   523
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   524
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   525
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   526
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   527
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   528
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   529
\begin{frame}<2>[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   530
\frametitle{DFA to Rexp}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   531
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   532
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   533
\begin{tikzpicture}[scale=2, line width=0.5mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   534
  \only<1>{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   535
  \only<2->{\node[state, initial,accepting]        (q0) at ( 0,1) {$q_0$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   536
  \only<1>{\node[state]                    (q1) at ( 1,1) {$q_1$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   537
  \only<2->{\node[state,accepting]                    (q1) at ( 1,1) {$q_1$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   538
  \only<1>{\node[state, accepting] (q2) at ( 2,1) {$q_2$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   539
  \only<2->{\node[state] (q2) at ( 2,1) {$q_2$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   540
  \path[->] (q0) edge[bend left] node[above] {$a$} (q1)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   541
                  (q1) edge[bend left] node[above] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   542
                  (q2) edge[bend left=50] node[below] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   543
                  (q1) edge node[above] {$a$} (q2)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   544
                  (q2) edge [loop right] node {$a$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   545
                  (q0) edge [loop below] node {$b$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   546
            ;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   547
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   548
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   549
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   550
\onslide<3>{How to get from a DFA to a regular expression?}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   551
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   552
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   553
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   554
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   555
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   556
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   557
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   558
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   559
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   560
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   561
\begin{tikzpicture}[scale=2, line width=0.5mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   562
  \only<1->{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   563
  \only<1->{\node[state]                    (q1) at ( 1,1) {$q_1$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   564
  \only<1->{\node[state] (q2) at ( 2,1) {$q_2$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   565
  \path[->] (q0) edge[bend left] node[above] {$a$} (q1)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   566
                  (q1) edge[bend left] node[above] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   567
                  (q2) edge[bend left=50] node[below] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   568
                  (q1) edge node[above] {$a$} (q2)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   569
                  (q2) edge [loop right] node {$a$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   570
                  (q0) edge [loop below] node {$b$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   571
            ;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   572
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   573
\end{center}\pause\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   574
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   575
\onslide<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   576
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   577
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   578
\bl{$q_0$} & \bl{$=$} & \bl{$2\, q_0 + 3 \,q_1 +  4\, q_2$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   579
\bl{$q_1$} & \bl{$=$} & \bl{$2 \,q_0 + 3\, q_1 + 1\, q_2$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   580
\bl{$q_2$} & \bl{$=$} & \bl{$1\, q_0 + 5\, q_1 + 2\, q_2$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   581
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   582
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   583
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   584
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   585
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   586
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   587
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   588
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   589
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   590
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   591
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   592
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   593
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   594
\begin{tikzpicture}[scale=2, line width=0.5mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   595
  \only<1->{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   596
  \only<1->{\node[state]                    (q1) at ( 1,1) {$q_1$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   597
  \only<1->{\node[state] (q2) at ( 2,1) {$q_2$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   598
  \path[->] (q0) edge[bend left] node[above] {$a$} (q1)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   599
                  (q1) edge[bend left] node[above] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   600
                  (q2) edge[bend left=50] node[below] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   601
                  (q1) edge node[above] {$a$} (q2)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   602
                  (q2) edge [loop right] node {$a$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   603
                  (q0) edge [loop below] node {$b$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   604
            ;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   605
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   606
\end{center}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   607
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   608
\onslide<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   609
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   610
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   611
\bl{$q_0$} & \bl{$=$} & \bl{$\epsilon + q_0\,b + q_1\,b +  q_2\,b$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   612
\bl{$q_1$} & \bl{$=$} & \bl{$q_0\,a$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   613
\bl{$q_2$} & \bl{$=$} & \bl{$q_1\,a + q_2\,a$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   614
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   615
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   616
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   617
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   618
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   619
\onslide<3->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   620
Arden's Lemma:
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   621
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   622
If \bl{$q = q\,r + s$}\; then\; \bl{$q = s\, r^*$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   623
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   624
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   625
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   626
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   627
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   628
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   629
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   630
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   631
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   632
\frametitle{DFA Minimisation}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   633
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   634
\begin{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   635
\item Take all pairs \bl{$(q, p)$} with \bl{$q \not= p$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   636
\item Mark all pairs that accepting and non-accepting states
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   637
\item For  all unmarked pairs \bl{$(q, p)$} and all characters \bl{$c$} tests wether
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   638
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   639
\bl{$(\delta(q, c), \delta(p,c))$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   640
\end{center} 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   641
are marked. If yes, then also mark \bl{$(q, p)$}.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   642
\item Repeat last step until no chance.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   643
\item All unmarked pairs can be merged.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   644
\end{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   645
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   646
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   647
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
144
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   648
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   649
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   650
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   651
\mode<presentation>{
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   652
\begin{frame}<1-2>[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   653
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   654
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   655
\begin{tikzpicture}[>=stealth',very thick,auto,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   656
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   657
\node[state,initial]  (q_0)  {$q_0$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   658
\node[state] (q_1) [right=of q_0] {$q_1$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   659
\node[state] (q_2) [below right=of q_0] {$q_2$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   660
\node[state] (q_3) [right=of q_2] {$q_3$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   661
\node[state, accepting] (q_4) [right=of q_1] {$q_4$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   662
\path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   663
\path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   664
\path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   665
\path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   666
\path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   667
\path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   668
\path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   669
\path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   670
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   671
\end{tikzpicture}
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   672
\end{center}\pause
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   673
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   674
\mbox{}\\[-20mm]\mbox{}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   675
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   676
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   677
\begin{tikzpicture}[>=stealth',very thick,auto,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   678
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   679
\node[state,initial]  (q_02)  {$q_{0, 2}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   680
\node[state] (q_13) [right=of q_02] {$q_{1, 3}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   681
\node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   682
\path[->] (q_02) edge [bend left] node [above]  {\alert{$a$}} (q_13);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   683
\path[->] (q_13) edge [bend left] node [below]  {\alert{$b$}} (q_02);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   684
\path[->] (q_02) edge [loop below] node  {\alert{$b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   685
\path[->] (q_13) edge node [above]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   686
\path[->] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   687
\end{tikzpicture}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   688
minimal automaton
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   689
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   690
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   691
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   692
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   693
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   694
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   695
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   696
\begin{frame}[c]
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   697
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   698
\begin{itemize}
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   699
\item Assuming you have the alphabet \bl{$\{a, b, c\}$}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   700
\item Give a regular expression that can recognise all strings that have at least one \bl{$b$}.
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   701
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   702
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   703
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   704
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   705
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   706
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   707
\end{document}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   708
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   709
%%% Local Variables:  
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   710
%%% mode: latex
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   711
%%% TeX-master: t
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   712
%%% End: 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   713