slides/slides03.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Mon, 05 Oct 2015 04:05:20 +0100
changeset 346 a98794b11ac4
parent 265 332fbe9c91ab
child 348 31e89128ccd2
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     2
\usepackage{../slides}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     3
\usepackage{../graphics}
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
     4
\usepackage{../langs}
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
     5
\usepackage{../data}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     7
\hfuzz=220pt 
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     8
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     9
\pgfplotsset{compat=1.11}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    10
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    11
\newcommand{\bl}[1]{\textcolor{blue}{#1}}  
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
% beamer stuff 
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    14
\renewcommand{\slidecaption}{AFL 03, King's College London}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
\begin{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    19
\begin{frame}[t]
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
\frametitle{%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
  \begin{tabular}{@ {}c@ {}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
  \\[-3mm]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
  \LARGE Automata and \\[-2mm] 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
  \LARGE Formal Languages (3)\\[3mm] 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
  \end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
\normalsize
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
  \begin{center}
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
    29
  \begin{tabular}{lp{8cm}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
  Email:  & christian.urban at kcl.ac.uk\\
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    31
  Office: & S1.27 (1st floor Strand Building)\\
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
    32
  Slides: & KEATS (also home work and coursework is there)\\
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  \end{tabular}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  \end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    36
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
\begin{frame}[c]
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
    41
\frametitle{Regular Expressions}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
    43
In programming languages they are often used to recognise:\medskip
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
\begin{itemize}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    46
\item symbols, digits
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    47
\item identifiers
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    48
\item numbers (non-leading zeros)
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    49
\item keywords
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    50
\item comments
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    51
\end{itemize}\bigskip
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    52
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    53
\mbox{}\hfill\bl{\url{http://www.regexper.com}}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    54
\end{frame}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    55
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    56
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    57
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    58
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    59
\begin{frame}[c]
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    60
\frametitle{Last Week}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    61
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    62
Last week I showed you a regular expression matcher 
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
    63
that works provably correct in all cases (we only
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
    64
started with the proving part though)
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
\begin{center}
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
    67
\bl{$matches\,s\,r$} \;\;if and only if \;\; \bl{$s \in L(r)$}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    68
\end{center}\bigskip\bigskip 
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    69
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    70
\small
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    71
\textcolor{gray}{\mbox{}\hfill{}by Janusz Brzozowski (1964)}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    72
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    73
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
\begin{frame}[c]
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    78
\frametitle{The Derivative of a Rexp}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    82
  \bl{$der\, c\, (\varnothing)$}      & \bl{$\dn$} & \bl{$\varnothing$} & \\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    83
  \bl{$der\, c\, (\epsilon)$}           & \bl{$\dn$} & \bl{$\varnothing$} & \\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    84
  \bl{$der\, c\, (d)$}                     & \bl{$\dn$} & \bl{if $c = d$ then $\epsilon$ else $\varnothing$} & \\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    85
  \bl{$der\, c\, (r_1 + r_2)$}        & \bl{$\dn$} & \bl{$der\, c\, r_1 + der\, c\, r_2$} & \\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    86
  \bl{$der\, c\, (r_1 \cdot r_2)$}  & \bl{$\dn$}  & \bl{if $nullable (r_1)$}\\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    87
  & & \bl{then $(der\,c\,r_1) \cdot r_2 + der\, c\, r_2$}\\ 
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    88
  & & \bl{else $(der\, c\, r_1) \cdot r_2$}\\
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    89
  \bl{$der\, c\, (r^*)$}          & \bl{$\dn$} & \bl{$(der\,c\,r) \cdot (r^*)$} &\medskip\\
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    90
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    91
  \bl{$\textit{ders}\, []\, r$}     & \bl{$\dn$} & \bl{$r$} & \\
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    92
  \bl{$\textit{ders}\, (c\!::\!s)\, r$} & \bl{$\dn$} & \bl{$\textit{ders}\,s\,(der\,c\,r)$} & \\
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
  \end{tabular}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
\end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    96
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   102
To see what is going on, define
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
\begin{center}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   105
\bl{$Der\,c\,A \dn \{ s \;|\;  c\!::\!s \in A\}$ } 
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   106
\end{center}\bigskip\bigskip
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   108
For \bl{$A = \{\textit{foo}, \textit{bar}, \textit{frak}\}$} then
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
\begin{center}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   111
\bl{\begin{tabular}{l@{\hspace{2mm}}c@{\hspace{2mm}}l}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   112
$Der\,f\,A$ & $=$ & $\{\textit{oo}, \textit{rak}\}$\\
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   113
$Der\,b\,A$ & $=$ &  $\{\textit{ar}\}$\\  
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   114
$Der\,a\,A$ & $=$ & $\varnothing$\\
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   115
\end{tabular}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
\end{center}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   117
 
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   118
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
\begin{frame}[c]
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   124
\frametitle{The Idea of the Algorithm}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   126
If we want to recognise the string \bl{$abc$} with regular
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   127
expression \bl{$r$} then\medskip
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
\begin{enumerate}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   130
\item \bl{$Der\,a\,(L(r))$}\pause
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   131
\item \bl{$Der\,b\,(Der\,a\,(L(r)))$}\pause
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   132
\item \bl{$Der\,c\,(Der\,b\,(Der\,a\,(L(r))))$}\bigskip\pause
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   133
\item finally we test whether the empty string is in this set\pause\medskip
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
\end{enumerate}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   136
The matching algorithm works similarly, just over regular expressions instead of sets.
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   137
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   144
Input: string \bl{$abc$} and regular expression \bl{$r$} 
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
\begin{enumerate}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   147
\item \bl{$der\,a\,r$}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   148
\item \bl{$der\,b\,(der\,a\,r)$}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   149
\item \bl{$der\,c\,(der\,b\,(der\,a\,r))$}\bigskip\pause
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   150
\item finally check whether the last regular expression can match the empty string
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
\end{enumerate}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   153
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   159
We proved already
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   160
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   161
\begin{center}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   162
\bl{$nullable(r)$} \;if and only if\;  \bl{$[] \in L(r)$}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   163
\end{center}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   164
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   165
by induction on the regular expression.\bigskip\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   166
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   167
\begin{center}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   168
{\huge\bf\alert{Any Questions?}}
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   169
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   170
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   171
\end{frame}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   172
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   173
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   174
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   175
\begin{frame}[c]
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   176
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
We need to prove
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
\begin{center}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   180
\bl{$L(der\,c\,r) = Der\,c\,(L(r))$}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
\end{center}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
by induction on the regular expression.
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   184
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
\begin{frame}[c]
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   189
\frametitle{Proofs about Rexps}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
\item \bl{$P$} holds for \bl{$\varnothing$}, \bl{$\epsilon$} and \bl{c}\bigskip
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   193
\item \bl{$P$} holds for \bl{$r_1 + r_2$} under the assumption that \bl{$P$} already
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   194
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   195
\item \bl{$P$} holds for \bl{$r_1 \cdot r_2$} under the assumption that \bl{$P$} already
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   196
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   197
\item \bl{$P$} holds for \bl{$r^*$} under the assumption that \bl{$P$} already
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   198
holds for \bl{$r$}.
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   201
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
\begin{frame}[c]
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   206
\frametitle{\begin{tabular}{c}Proofs about Natural\\[-1mm] Numbers and Strings\end{tabular}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
\item \bl{$P$} holds for \bl{$0$} and
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
\item \bl{$P$} holds for \bl{$n + 1$} under the assumption that \bl{$P$} already
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
holds for \bl{$n$}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
\end{itemize}\bigskip
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
\begin{itemize}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   215
\item \bl{$P$} holds for \bl{$[]$} and
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
\item \bl{$P$} holds for \bl{$c\!::\!s$} under the assumption that \bl{$P$} already
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
holds for \bl{$s$}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   220
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
\begin{frame}[t]
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   225
\frametitle{Regular Expressions}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
\begin{center}
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   228
   \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   229
  \bl{$r$} & \bl{$::=$}  & \bl{$\varnothing$}  & null\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   230
         & \bl{$\mid$} & \bl{$\epsilon$}        & empty string / "" / $[]$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   231
         & \bl{$\mid$} & \bl{$c$}                         & character\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   232
         & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   233
         & \bl{$\mid$} & \bl{$r_1 + r_2$}  & alternative / choice\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   234
         & \bl{$\mid$} & \bl{$r^*$}                   & star (zero or more)\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   235
  \end{tabular}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
  \end{center}
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   237
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   238
How about ranges \bl{$[a\mbox{-}z]$}, \bl{$r^+$} and \bl{$\sim{}r$}? Do they increase the
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   239
set of languages we can recognise?
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
  
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   241
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
\begin{frame}[c]
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   246
\frametitle{Negation of Regular Expr's}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
\begin{itemize}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   249
\item \bl{$\sim{}r$}  \hspace{6mm} (everything that \bl{$r$} cannot recognise)\medskip
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   250
\item \bl{$L(\sim{}r) \dn UNIV - L(r)$}\medskip
136
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 135
diff changeset
   251
\item \bl{$nullable (\sim{}r) \dn not\, (nullable(r))$}\medskip
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   252
\item \bl{$der\,c\,(\sim{}r) \dn \;\sim{}(der\,c\,r)$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   253
\end{itemize}\bigskip\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   254
136
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 135
diff changeset
   255
Used often for recognising comments:
134
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   256
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   257
\[
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   258
\bl{/ \cdot * \cdot (\sim{}([a\mbox{-}z]^* \cdot * \cdot / \cdot [a\mbox{-}z]^*)) \cdot * \cdot /}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   259
\]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 133
diff changeset
   260
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   261
\end{frame}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   264
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   265
\begin{frame}[c]
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   266
\frametitle{Negation}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   267
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   268
Assume you have an alphabet consisting of the letters \bl{$a$}, \bl{$b$} and \bl{$c$} only.
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   269
Find a (basic!) regular expression that matches all strings \emph{\alert{except}} 
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   270
\bl{$ab$} and \bl{$ac$}!
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   271
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   272
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   273
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   274
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   277
%\mode<presentation>{
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   278
%\begin{frame}[c]
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   279
%\frametitle{\begin{tabular}{c}Regular Exp's for Lexing\end{tabular}}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   280
%
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   281
%Lexing separates strings into ``words'' / components.
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   282
%
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   283
%\begin{itemize}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   284
%\item Identifiers (non-empty strings of letters or digits, starting with a letter)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   285
%\item Numbers (non-empty sequences of digits omitting leading zeros)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   286
%\item Keywords (else, if, while, \ldots)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   287
%\item White space (a non-empty sequence of blanks, newlines and tabs)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   288
%\item Comments
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   289
%\end{itemize}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   290
%
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   291
%\end{frame}}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
\begin{frame}[c]
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   296
\frametitle{Automata}
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   298
A \alert{\bf deterministic finite automaton}, DFA, consists of:
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
\begin{itemize}
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   301
\item a set of states \bl{$Q$}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   302
\item one of these states is the start state \bl{$q_0$}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   303
\item some states are accepting states \bl{$F$}, and
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   304
\item there is transition function \bl{$\delta$}\bigskip 
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
\small
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   307
which takes a state as argument and a character and produces a 
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   308
new state; this function might not be everywhere defined
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   309
\end{itemize}
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   310
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   311
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   312
\bl{$A(Q, q_0, F, \delta)$}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   313
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   314
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   315
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   316
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   317
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   318
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   319
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   320
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   321
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   322
\begin{center}
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   323
\begin{tikzpicture}[>=stealth',very thick,auto,
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   324
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   325
\node[state,initial]  (q_0)  {$q_0$};
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   326
\node[state] (q_1) [right=of q_0] {$q_1$};
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   327
\node[state] (q_2) [below right=of q_0] {$q_2$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   328
\node[state] (q_3) [right=of q_2] {$q_3$};
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   329
\node[state, accepting] (q_4) [right=of q_1] {$q_4$};
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   330
\path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   331
\path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   332
\path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   333
\path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   334
\path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   335
\path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   336
\path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   337
\path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   338
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   339
\end{tikzpicture}
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   340
\end{center}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   341
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   342
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   343
\begin{itemize}
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   344
\item the start state can be an accepting state
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   345
\item it is possible that there is no accepting state
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   346
\item all states might be accepting (but this does not necessarily mean all strings are accepted)
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   347
\end{itemize}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   348
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   349
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   350
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   351
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   352
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   353
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   354
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   355
\begin{center}
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   356
\begin{tikzpicture}[>=stealth',very thick,auto,
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   357
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   358
\node[state,initial]  (q_0)  {$q_0$};
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   359
\node[state] (q_1) [right=of q_0] {$q_1$};
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   360
\node[state] (q_2) [below right=of q_0] {$q_2$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   361
\node[state] (q_3) [right=of q_2] {$q_3$};
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   362
\node[state, accepting] (q_4) [right=of q_1] {$q_4$};
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   363
\path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   364
\path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   365
\path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   366
\path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   367
\path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   368
\path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   369
\path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   370
\path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   371
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   372
\end{tikzpicture}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   373
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   374
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   375
for this automaton \bl{$\delta$} is the function\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   376
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   377
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   378
\begin{tabular}{lll}
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   379
\bl{$(q_0, a) \rightarrow q_1$} & \bl{$(q_1, a) \rightarrow q_4$} & \bl{$(q_4, a) \rightarrow q_4$}\\
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   380
\bl{$(q_0, b) \rightarrow q_2$} & \bl{$(q_1, b) \rightarrow q_2$} & \bl{$(q_4, b) \rightarrow q_4$}\\
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   381
\end{tabular}\ldots
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   382
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   383
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   384
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   385
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   386
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   387
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   388
\begin{frame}[t]
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   389
\frametitle{Accepting a String}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   390
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   391
Given
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   392
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   393
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   394
\bl{$A(Q, q_0, F, \delta)$}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   395
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   396
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   397
you can define
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   398
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   399
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   400
\begin{tabular}{l}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   401
\bl{$\hat{\delta}(q, []) \dn q$}\\
143
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   402
\bl{$\hat{\delta}(q, c::s) \dn \hat{\delta}(\delta(q, c), s)$}\\
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   403
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   404
\end{center}\pause
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   405
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   406
Whether a string \bl{$s$} is accepted by \bl{$A$}?
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   407
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   408
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   409
\hspace{5mm}\bl{$\hat{\delta}(q_0, s) \in F$}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   410
\end{center}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   411
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   412
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   413
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   414
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   415
\begin{frame}[c]
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   416
\frametitle{Regular Languages}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   417
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   418
A \alert{\bf language} is a set of strings.\bigskip
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   419
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   420
A \alert{\bf regular expression} specifies a language.\bigskip
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   421
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   422
A language is \alert{\bf regular} iff there exists
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   423
a regular expression that recognises all its strings.\bigskip\bigskip\pause
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   424
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   425
not all languages are regular, e.g.~\bl{$a^nb^n$} is not
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   426
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   427
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   428
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   429
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   430
\begin{frame}[c]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   431
\frametitle{Regular Languages (2)}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   432
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   433
A language is \alert{\bf regular} iff there exists a regular
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   434
expression that recognises all its strings.\bigskip\medskip
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   435
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   436
or {\bf equivalently}\bigskip\medskip
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   437
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   438
A language is \alert{\bf regular} iff there exists a
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   439
deterministic finite automaton that recognises all its
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   440
strings.
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   441
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   442
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   443
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   444
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   445
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   446
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   447
\begin{frame}[c]
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   448
\frametitle{\begin{tabular}{c}Non-Deterministic\\[-1mm] Finite Automata\end{tabular}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   449
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   450
A non-deterministic finite automaton consists again of:
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   451
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   452
\begin{itemize}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   453
\item a finite set of states
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   454
\item one of these states is the start state
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   455
\item some states are accepting states, and
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   456
\item there is transition \alert{relation}\medskip 
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   457
\end{itemize}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   458
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   459
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   460
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   461
\begin{tabular}{c}
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   462
\bl{$(q_1, a) \rightarrow q_2$}\\
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   463
\bl{$(q_1, a) \rightarrow q_3$}\\
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   464
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   465
\hspace{10mm}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   466
\begin{tabular}{c}
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   467
\bl{$(q_1, \epsilon) \rightarrow q_2$}\\
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   468
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   469
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   470
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   471
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   472
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   473
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   474
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   475
\begin{frame}[c]
143
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   476
\frametitle{Two NFA Examples}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   477
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   478
\small
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   479
\begin{center}
143
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   480
\begin{tabular}[t]{c@{\hspace{9mm}}c}
136
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 135
diff changeset
   481
\begin{tikzpicture}[scale=0.7,>=stealth',very thick,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 135
diff changeset
   482
                             every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   483
\node[state,initial]  (q_0)  {$q_0$};
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   484
\node[state] (q_1) [above=of q_0] {$q_1$};
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   485
\node[state, accepting] (q_2) [below=of q_0] {$q_2$};
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   486
\path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_1);
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   487
\path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_2);
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   488
\path[->] (q_0) edge [loop right] node  {\alert{$a$}} ();
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   489
\path[->] (q_1) edge [loop above] node  {\alert{$a$}} ();
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   490
\path[->] (q_2) edge [loop below] node  {\alert{$b$}} ();
143
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   491
\end{tikzpicture} &
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   492
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   493
\raisebox{20mm}{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   494
\begin{tikzpicture}[scale=0.7,>=stealth',very thick,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   495
                             every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   496
\node[state,initial]  (r_1)  {$r_1$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   497
\node[state] (r_2) [above=of r_1] {$r_2$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   498
\node[state, accepting] (r_3) [right=of r_1] {$r_3$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   499
\path[->] (r_1) edge node [below]  {\alert{$b$}} (r_3);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   500
\path[->] (r_2) edge [bend left] node [above]  {\alert{$a$}} (r_3);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   501
\path[->] (r_1) edge [bend left] node  [left] {\alert{$\epsilon$}} (r_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   502
\path[->] (r_2) edge [bend left] node  [right] {\alert{$a$}} (r_1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   503
\end{tikzpicture}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   504
\end{tabular}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   505
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   506
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   507
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   508
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   509
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   510
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   511
\begin{frame}[c]
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   512
\frametitle{Rexp to NFA}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   513
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   514
\begin{center}
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   515
\begin{tabular}[t]{l@{\hspace{10mm}}l}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   516
\raisebox{1mm}{\bl{$\varnothing$}} & 
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   517
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   518
\node[state, initial]  (q_0)  {$\mbox{}$};
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   519
\end{tikzpicture}\\\\
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   520
\raisebox{1mm}{\bl{$\epsilon$}} & 
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   521
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   522
\node[state, initial, accepting]  (q_0)  {$\mbox{}$};
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   523
\end{tikzpicture}\\\\
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   524
\raisebox{2mm}{\bl{$c$}} & 
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   525
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   526
\node[state, initial]  (q_0)  {$\mbox{}$};
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   527
\node[state, accepting]  (q_1)  [right=of q_0] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   528
\path[->] (q_0) edge node [below]  {\alert{$c$}} (q_1);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   529
\end{tikzpicture}\\\\
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   530
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   531
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   532
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   533
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   534
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   535
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   536
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   537
\begin{frame}[t]
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   538
\frametitle{Case $r_1\cdot r_2$}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   539
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   540
\mbox{}\bigskip
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   541
\onslide<1>{By recursion we are given two automata:\bigskip}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   542
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   543
{\centering\begin{tikzpicture}[node distance=3mm,
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   544
                             >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   545
\node[state, initial]  (q_0)  {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   546
\node (r_1)  [right=of q_0] {$\ldots$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   547
\only<1>{
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   548
\node[state, accepting]  (t_1)  [right=of r_1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   549
\node[state, accepting]  (t_2)  [above=of t_1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   550
\node[state, accepting]  (t_3)  [below=of t_1] {$\mbox{}$};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   551
\only<2>{
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   552
\node[state]  (t_1)  [right=of r_1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   553
\node[state]  (t_2)  [above=of t_1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   554
\node[state]  (t_3)  [below=of t_1] {$\mbox{}$};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   555
\only<1>{\node[state, initial]  (a_0)  [right=2.5cm of t_1] {$\mbox{}$};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   556
\only<2>{\node[state]  (a_0)  [right=2.5cm of t_1] {$\mbox{}$};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   557
\node (b_1)  [right=of a_0] {$\ldots$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   558
\node[state, accepting]  (c_1)  [right=of b_1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   559
\node[state, accepting]  (c_2)  [above=of c_1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   560
\node[state, accepting]  (c_3)  [below=of c_1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   561
\only<2>{
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   562
\path[->] (t_1) edge node [above, pos=0.3]  {\alert{$\epsilon$}} (a_0);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   563
\path[->] (t_2) edge node [above]  {\alert{$\epsilon$}} (a_0);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   564
\path[->] (t_3) edge node [below]  {\alert{$\epsilon$}} (a_0);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   565
}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   566
\begin{pgfonlayer}{background}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   567
\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)] {};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   568
\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)] {};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   569
\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)] {};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   570
\only<1>{\node [yshift=2mm] at (1.north) {\bl{$r_1$}};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   571
\only<1>{\node [yshift=2mm] at (2.north) {\bl{$r_2$}};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   572
\only<2>{\node [yshift=2mm] at (3.north) {\bl{$r_1\cdot r_2$}};}
143
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   573
\end{pgfonlayer}
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   574
\end{tikzpicture}}\bigskip\bigskip
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   575
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   576
\small
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   577
We need to (1) change the accepting nodes of the first automaton into non-accepting nodes, and (2) connect them
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   578
via $\epsilon$-transitions to the starting state of the second automaton. 
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   579
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   580
\end{frame}
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   581
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   582
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   583
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   584
\begin{frame}[t]
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   585
\frametitle{Case $r_1+ r_2$}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   586
\mbox{}\\[-10mm]
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   587
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   588
\onslide<1>{By recursion we are given two automata:\smallskip}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   589
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   590
\hspace{2cm}\begin{tikzpicture}[node distance=3mm,
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   591
                             >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   592
\onslide<1>{\node at (0,0)  (1)  {$\mbox{}$};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   593
\onslide<2>{\node at (0,0) [state, initial]  (1)  {$\mbox{}$};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   594
\only<1>{
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   595
\node[state, initial]  (2)  [above right=16mm of 1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   596
\node[state, initial]  (3)  [below right=16mm of 1] {$\mbox{}$};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   597
\only<2>{
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   598
\node[state]  (2)  [above right=16mm of 1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   599
\node[state]  (3)  [below right=16mm of 1] {$\mbox{}$};}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   600
137
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   601
\node (a)  [right=of 2] {$\ldots$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   602
\node[state, accepting]  (a1)  [right=of a] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   603
\node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   604
\node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   605
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   606
\node (b)  [right=of 3] {$\ldots$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   607
\node[state, accepting]  (b1)  [right=of b] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   608
\node[state, accepting]  (b2)  [above=of b1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   609
\node[state, accepting]  (b3)  [below=of b1] {$\mbox{}$};
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   610
\only<2>{
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   611
\path[->] (1) edge node [above]  {\alert{$\epsilon$}} (2);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   612
\path[->] (1) edge node [below]  {\alert{$\epsilon$}} (3);
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   613
}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   614
\begin{pgfonlayer}{background}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   615
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   616
\only<1>{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (3) (b1) (b2) (b3)] {};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   617
\only<2>{\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3) (b2) (b3)] {};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   618
\only<1>{\node [yshift=3mm] at (1.north) {\bl{$r_1$}};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   619
\only<1>{\node [yshift=3mm] at (2.north) {\bl{$r_2$}};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   620
\only<2>{\node [yshift=3mm] at (3.north) {\bl{$r_1+ r_2$}};}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   621
\end{pgfonlayer}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   622
\end{tikzpicture}
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   623
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   624
\small
69cec773736b added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 136
diff changeset
   625
We (1) need to introduce a new starting state and (2) connect it to the original two starting states.
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   626
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   627
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   628
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   629
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   630
\begin{frame}[c]
138
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   631
\frametitle{Case $r^*$}
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   632
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   633
\onslide<1>{By recursion we are given an automaton for $r$:\smallskip}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   634
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   635
\hspace{2cm}\begin{tikzpicture}[node distance=3mm,
138
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   636
                             >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   637
\onslide<1>{\node at (0,0)  (1)  {$\mbox{}$};}
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   638
\onslide<2->{\node at (0,0) [state, initial,accepting]  (1)  {$\mbox{}$};}
138
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   639
\only<1>{\node[state, initial]  (2)  [right=16mm of 1] {$\mbox{}$};}
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   640
\only<2->{\node[state]  (2)  [right=16mm of 1] {$\mbox{}$};}
138
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   641
\node (a)  [right=of 2] {$\ldots$};
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   642
\only<1>{
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   643
\node[state, accepting]  (a1)  [right=of a] {$\mbox{}$};
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   644
\node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   645
\node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};}
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   646
\only<2->{
138
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   647
\node[state]  (a1)  [right=of a] {$\mbox{}$};
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   648
\node[state]  (a2)  [above=of a1] {$\mbox{}$};
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   649
\node[state]  (a3)  [below=of a1] {$\mbox{}$};}
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   650
\only<2->{
138
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   651
\path[->] (1) edge node [above]  {\alert{$\epsilon$}} (2);
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   652
\path[->] (a1) edge [bend left=45] node [above]  {\alert{$\epsilon$}} (1);
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   653
\path[->] (a2) edge [bend right] node [below]  {\alert{$\epsilon$}} (1);
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   654
\path[->] (a3) edge [bend left=45] node [below]  {\alert{$\epsilon$}} (1);
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   655
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   656
}
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   657
\begin{pgfonlayer}{background}
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   658
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};}
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   659
\only<2->{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3)] {};}
138
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   660
\only<1>{\node [yshift=3mm] at (1.north) {\bl{$r$}};}
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   661
\only<2->{\node [yshift=3mm] at (2.north) {\bl{$r^*$}};}
138
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   662
\end{pgfonlayer}
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   663
\end{tikzpicture}\bigskip
138
b98a0a49c432 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 137
diff changeset
   664
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   665
\onslide<3->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   666
Why can't we just have an epsilon transition from the accepting states to the starting state?}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   667
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   668
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   669
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   670
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   671
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   672
\begin{frame}[c]
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   673
\frametitle{Subset Construction}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   674
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   675
136
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 135
diff changeset
   676
\begin{textblock}{5}(1,1)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 135
diff changeset
   677
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 135
diff changeset
   678
\begin{tikzpicture}[scale=0.7,>=stealth',very thick,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 135
diff changeset
   679
                             every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   680
\node[state,initial]  (q_0)  {$q_0$};
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   681
\node[state] (q_1) [above=of q_0] {$q_1$};
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   682
\node[state, accepting] (q_2) [below=of q_0] {$q_2$};
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   683
\path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_1);
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   684
\path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_2);
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   685
\path[->] (q_0) edge [loop right] node  {\alert{$a$}} ();
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   686
\path[->] (q_1) edge [loop above] node  {\alert{$a$}} ();
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 143
diff changeset
   687
\path[->] (q_2) edge [loop below] node  {\alert{$b$}} ();
136
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 135
diff changeset
   688
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 135
diff changeset
   689
\end{center}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   690
\end{textblock}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   691
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   692
\begin{textblock}{11}(6.5,4.5)
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   693
\begin{tabular}{r|cl}
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   694
nodes \textcolor{white}{*} & $a$ & $b$\\
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   695
\hline
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   696
$\{\}$ \textcolor{white}{*} & \onslide<2->{$\{\}$} & \onslide<2->{$\{\}$}\\
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   697
$\{0\}$ \textcolor{white}{*} & \onslide<3->{$\{0,1,2\}$} & \onslide<3->{$\{2\}$}\\
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   698
$\{1\}$ \textcolor{white}{*} & \onslide<3->{$\{1\}$} & \onslide<3->{$\{\}$}\\
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   699
$\{2\}$ \onslide<5->{*} & \onslide<3->{$\{\}$} & \onslide<3->{$\{2\}$}\\
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   700
$\{0,1\}$ \textcolor{white}{*} &\onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   701
$\{0,2\}$ \onslide<5->{*} &\onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   702
$\{1,2\}$ \onslide<5->{*} & \onslide<4->{$\{1\}$} & \onslide<4->{$\{2\}$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
   703
\onslide<5->{s:} $\{0,1,2\}$ \onslide<5->{*}& \onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   704
\end{tabular}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   705
\end{textblock}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   706
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   707
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   708
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   709
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   710
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   711
\begin{frame}[c]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   712
\frametitle{The Result}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   713
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   714
\footnotesize
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   715
\begin{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   716
\begin{tikzpicture}[scale=0.5,>=stealth',very thick,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   717
                    every state/.style={minimum size=0pt,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   718
                    draw=blue!50,very thick,fill=blue!20},
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   719
                    baseline=0mm]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   720
\node[state,initial,accepting]  (q012)  {$\{0,1,2\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   721
\node[state,accepting] (q02) [right=of q012] {$\{0,2\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   722
\node[state] (q01) [above=of q02] {$\{0,1\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   723
\node[state,accepting] (q12) [below=of q02] {$\{1,2\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   724
\node[state] (q0) [right=2cm of q01] {$\{0\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   725
\node[state] (q1) [right=2.5cm of q02] {$\{1\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   726
\node[state,accepting] (q2) [right=1.5cm of q12] {$\{2\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   727
\node[state] (qn) [right=of q1] {$\{\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   728
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   729
\path[->] (q012) edge [loop below] node  {$a$} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   730
\path[->] (q012) edge node [above]  {$b$} (q2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   731
\path[->] (q12) edge [bend left] node [below,pos=0.4]  {$a$} (q1);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   732
\path[->] (q12) edge node [below]  {$b$} (q2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   733
\path[->] (q02) edge node [above]  {$a$} (q012);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   734
\path[->] (q02) edge [bend left] node [above, pos=0.8]  {$b$} (q2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   735
\path[->] (q01) edge node [below]  {$a$} (q012);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   736
\path[->] (q01) edge [bend left] node [above]  {$b$} (q2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   737
\path[->] (q0) edge node [below]  {$a$} (q012);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   738
\path[->] (q0) edge node [right, pos=0.2]  {$b$} (q2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   739
\path[->] (q1) edge [loop above] node  {$a$} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   740
\path[->] (q1) edge node [above]  {$b$} (qn);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   741
\path[->] (q2) edge [loop right] node  {$b$} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   742
\path[->] (q2) edge node [below]  {$a$} (qn);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   743
\path[->] (qn) edge [loop above] node  {$a,b$} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   744
\end{tikzpicture}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   745
\end{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   746
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   747
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   748
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   749
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
   750
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   751
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   752
\begin{frame}[c]
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   753
\frametitle{Removing Dead States}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   754
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   755
\footnotesize
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   756
\begin{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   757
\begin{tabular}{ll}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   758
DFA: & NFA:\\
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   759
\raisebox{10mm}{%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   760
\begin{tikzpicture}[scale=0.7,>=stealth',very thick,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   761
                    every state/.style={minimum size=0pt,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   762
                    draw=blue!50,very thick,fill=blue!20}]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   763
\node[state,initial,accepting]  (q012)  {$\{0,1,2\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   764
\node[state,accepting] (q2) [right=of q012] {$\{2\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   765
\node[state] (qn) [right=of q2] {$\{\}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   766
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   767
\path[->] (q012) edge [loop below] node  {\alert{$a$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   768
\path[->] (q012) edge node [above]  {\alert{$b$}} (q2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   769
\path[->] (q2) edge [loop below] node  {\alert{$b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   770
\path[->] (q2) edge node [below]  {\alert{$a$}} (qn);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   771
\path[->] (qn) edge [loop above] node 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   772
   {$\alert{a},\alert{b}$} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   773
\end{tikzpicture}}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   774
&
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   775
\begin{tikzpicture}[scale=0.7,>=stealth',very thick,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   776
                    every state/.style={minimum size=0pt,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   777
                    draw=blue!50,very thick,fill=blue!20},]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   778
\node[state,initial]  (q_0)  {$q_0$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   779
\node[state] (q_1) [above=of q_0] {$q_1$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   780
\node[state, accepting] (q_2) [below=of q_0] {$q_2$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   781
\path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_1);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   782
\path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   783
\path[->] (q_0) edge [loop right] node  {\alert{$a$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   784
\path[->] (q_1) edge [loop above] node  {\alert{$a$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   785
\path[->] (q_2) edge [loop below] node  {\alert{$b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   786
\end{tikzpicture}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   787
\end{tabular}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   788
\end{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   789
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   790
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   791
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   792
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   793
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   794
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   795
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   796
\begin{frame}[c]
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   797
\frametitle{Regexps and Automata}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   798
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   799
\begin{center}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   800
\begin{tikzpicture}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   801
\node (rexp)  {\bl{\bf Regexps}};
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   802
\node (nfa) [right=of rexp] {\bl{\bf NFAs}};
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   803
\node (dfa) [right=of nfa] {\bl{\bf DFAs}};
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   804
\onslide<2->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   805
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa);
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   806
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa);
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   807
\onslide<2->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   808
\end{tikzpicture}\\
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   809
\end{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   810
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   811
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   812
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   813
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   814
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   815
\begin{frame}[c]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   816
\frametitle{DFA Minimisation}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   817
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   818
\begin{enumerate}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   819
\item Take all pairs \bl{$(q, p)$} with \bl{$q \not= p$}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   820
\item Mark all pairs that accepting and non-accepting states
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   821
\item For  all unmarked pairs \bl{$(q, p)$} and all characters \bl{$c$} test whether
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   822
\begin{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   823
\bl{$(\delta(q, c), \delta(p,c))$}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   824
\end{center} 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   825
are marked. If yes, then also mark \bl{$(q, p)$}.
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   826
\item Repeat last step until no change.
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   827
\item All unmarked pairs can be merged.
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   828
\end{enumerate}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   829
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   830
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   831
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   832
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   833
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   834
\begin{frame}[c]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   835
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   836
\begin{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   837
\begin{tikzpicture}[>=stealth',very thick,auto,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   838
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   839
\node[state,initial]  (q_0)  {$q_0$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   840
\node[state] (q_1) [right=of q_0] {$q_1$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   841
\node[state] (q_2) [below right=of q_0] {$q_2$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   842
\node[state] (q_3) [right=of q_2] {$q_3$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   843
\node[state, accepting] (q_4) [right=of q_1] {$q_4$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   844
\path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   845
\path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   846
\path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   847
\path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   848
\path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   849
\path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   850
\path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   851
\path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   852
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   853
\end{tikzpicture}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   854
\end{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   855
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   856
\mbox{}\\[-20mm]\mbox{}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   857
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   858
\begin{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   859
\begin{tikzpicture}[scale=0.8,line width=0.8mm]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   860
\draw (0,0) -- (4,0);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   861
\draw (0,1) -- (4,1);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   862
\draw (0,2) -- (3,2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   863
\draw (0,3) -- (2,3);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   864
\draw (0,4) -- (1,4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   865
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   866
\draw (0,0) -- (0, 4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   867
\draw (1,0) -- (1, 4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   868
\draw (2,0) -- (2, 3);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   869
\draw (3,0) -- (3, 2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   870
\draw (4,0) -- (4, 1);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   871
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   872
\draw (0.5,-0.5) node {$q_0$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   873
\draw (1.5,-0.5) node {$q_1$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   874
\draw (2.5,-0.5) node {$q_2$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   875
\draw (3.5,-0.5) node {$q_3$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   876
 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   877
\draw (-0.5, 3.5) node {$q_1$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   878
\draw (-0.5, 2.5) node {$q_2$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   879
\draw (-0.5, 1.5) node {$q_3$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   880
\draw (-0.5, 0.5) node {$q_4$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   881
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   882
\draw (0.5,0.5) node {\large$\star$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   883
\draw (1.5,0.5) node {\large$\star$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   884
\draw (2.5,0.5) node {\large$\star$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   885
\draw (3.5,0.5) node {\large$\star$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   886
\end{tikzpicture}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   887
\end{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   888
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   889
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   890
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   891
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   892
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   893
\begin{frame}[c]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   894
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   895
\begin{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   896
\begin{tabular}{@{\hspace{-8mm}}cc@{}}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   897
\begin{tikzpicture}[>=stealth',very thick,auto,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   898
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   899
\node[state,initial]  (q_0)  {$q_0$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   900
\node[state] (q_1) [right=of q_0] {$q_1$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   901
\node[state] (q_2) [below right=of q_0] {$q_2$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   902
\node[state] (q_3) [right=of q_2] {$q_3$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   903
\node[state, accepting] (q_4) [right=of q_1] {$q_4$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   904
\path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   905
\path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   906
\path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   907
\path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   908
\path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   909
\path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   910
\path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   911
\path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   912
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   913
\end{tikzpicture}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   914
&
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   915
\raisebox{9mm}{\begin{tikzpicture}[scale=0.6,line width=0.8mm]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   916
\draw (0,0) -- (4,0);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   917
\draw (0,1) -- (4,1);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   918
\draw (0,2) -- (3,2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   919
\draw (0,3) -- (2,3);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   920
\draw (0,4) -- (1,4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   921
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   922
\draw (0,0) -- (0, 4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   923
\draw (1,0) -- (1, 4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   924
\draw (2,0) -- (2, 3);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   925
\draw (3,0) -- (3, 2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   926
\draw (4,0) -- (4, 1);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   927
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   928
\draw (0.5,-0.5) node {$q_0$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   929
\draw (1.5,-0.5) node {$q_1$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   930
\draw (2.5,-0.5) node {$q_2$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   931
\draw (3.5,-0.5) node {$q_3$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   932
 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   933
\draw (-0.5, 3.5) node {$q_1$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   934
\draw (-0.5, 2.5) node {$q_2$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   935
\draw (-0.5, 1.5) node {$q_3$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   936
\draw (-0.5, 0.5) node {$q_4$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   937
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   938
\draw (0.5,0.5) node {\large$\star$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   939
\draw (1.5,0.5) node {\large$\star$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   940
\draw (2.5,0.5) node {\large$\star$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   941
\draw (3.5,0.5) node {\large$\star$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   942
\draw (0.5,1.5) node {\large$\star$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   943
\draw (2.5,1.5) node {\large$\star$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   944
\draw (0.5,3.5) node {\large$\star$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   945
\draw (1.5,2.5) node {\large$\star$}; 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   946
\end{tikzpicture}}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   947
\end{tabular}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   948
\end{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   949
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   950
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   951
\mbox{}\\[-20mm]\mbox{}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   952
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   953
\begin{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   954
\begin{tikzpicture}[>=stealth',very thick,auto,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   955
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   956
\node[state,initial]  (q_02)  {$q_{0, 2}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   957
\node[state] (q_13) [right=of q_02] {$q_{1, 3}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   958
\node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   959
\path[->] (q_02) edge [bend left] node [above]  {\alert{$a$}} (q_13);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   960
\path[->] (q_13) edge [bend left] node [below]  {\alert{$b$}} (q_02);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   961
\path[->] (q_02) edge [loop below] node  {\alert{$b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   962
\path[->] (q_13) edge node [above]  {\alert{$a$}} (q_4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   963
\path[->] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   964
\end{tikzpicture}\\
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   965
minimal automaton
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   966
\end{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   967
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   968
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   969
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   970
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   971
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   972
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   973
\begin{frame}[c]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   974
\frametitle{Alternatives}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   975
\mbox{}\\[-17mm]\mbox{}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   976
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   977
\begin{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   978
\begin{tikzpicture}[>=stealth',very thick,auto,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   979
                    every state/.style={minimum size=0pt,
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   980
                    inner sep=2pt,draw=blue!50,very thick,fill=blue!20}]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   981
\only<1>{\node[state,initial]  (q_0)  {$q_0$};}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   982
\only<2->{\node[state,accepting]  (q_0)  {$q_0$};}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   983
\node[state] (q_1) [right=of q_0] {$q_1$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   984
\node[state] (q_2) [below right=of q_0] {$q_2$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   985
\node[state] (q_3) [right=of q_2] {$q_3$};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   986
\only<1>{\node[state, accepting] (q_4) [right=of q_1] {$q_4$};}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   987
\only<2->{\node[state, initial right] (q_4) [right=of q_1] {$q_4$};}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   988
\only<1-2>{
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   989
\path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   990
\path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   991
\path[->] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   992
\path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   993
\path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   994
\path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   995
\path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   996
\path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   997
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   998
\only<3->{
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
   999
\path[<-] (q_0) edge node [above]  {\alert{$a$}} (q_1);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1000
\path[<-] (q_1) edge node [above]  {\alert{$a$}} (q_4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1001
\path[<-] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1002
\path[<-] (q_3) edge node [right]  {\alert{$a$}} (q_4);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1003
\path[<-] (q_2) edge node [above]  {\alert{$a$}} (q_3);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1004
\path[<-] (q_1) edge node [right]  {\alert{$b$}} (q_2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1005
\path[<-] (q_0) edge node [above]  {\alert{$b$}} (q_2);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1006
\path[<-] (q_2) edge [loop left] node  {\alert{$b$}} ();
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1007
\path[<-] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1008
\end{tikzpicture}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1009
\end{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1010
\mbox{}\\[-18mm]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1011
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1012
\small
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1013
\begin{itemize}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1014
\item<2-> exchange initial / accepting states\\[-2mm]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1015
\item<3-> reverse all edges\\[-2mm]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1016
\item<4-> subset construction $\Rightarrow$ DFA\\[-2mm]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1017
\item<5-> remove dead states\\[-2mm]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1018
\item<6-> repeat once more 
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1019
          \onslide<6->{$\Rightarrow$ minimal DFA}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1020
\end{itemize}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1021
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1022
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1023
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1024
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1025
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1026
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1027
\begin{frame}[c]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1028
\frametitle{Regexps and Automata}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1029
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1030
\begin{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1031
\begin{tikzpicture}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1032
\node (rexp)  {\bl{\bf Regexps}};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1033
\node (nfa) [right=of rexp] {\bl{\bf NFAs}};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1034
\node (dfa) [right=of nfa] {\bl{\bf DFAs}};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1035
\onslide<1->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1036
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1037
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1038
\onslide<1->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1039
\onslide<2->{\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp);}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1040
\end{tikzpicture}\\
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1041
\end{center}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1042
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1043
\end{frame}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1044
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1045
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1046
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1047
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1048
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1049
\begin{frame}<2>[c]
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1050
\frametitle{DFA to Rexp}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1051
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1052
\begin{center}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1053
\begin{tikzpicture}[scale=2,>=stealth',very thick,
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1054
                             every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1055
  \only<1>{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1056
  \only<2->{\node[state, initial,accepting]        (q0) at ( 0,1) {$q_0$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1057
  \only<1>{\node[state]                    (q1) at ( 1,1) {$q_1$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1058
  \only<2->{\node[state,accepting]                    (q1) at ( 1,1) {$q_1$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1059
  \only<1>{\node[state, accepting] (q2) at ( 2,1) {$q_2$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1060
  \only<2->{\node[state] (q2) at ( 2,1) {$q_2$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1061
  \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1062
                  (q1) edge[bend left] node[above] {\alert{$b$}} (q0)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1063
                  (q2) edge[bend left=50] node[below] {\alert{$b$}} (q0)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1064
                  (q1) edge node[above] {\alert{$a$}} (q2)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1065
                  (q2) edge [loop right] node {\alert{$a$}} ()
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1066
                  (q0) edge [loop below] node {\alert{$b$}} ()
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1067
            ;
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1068
\end{tikzpicture}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1069
\end{center}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1070
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1071
\onslide<3>{How to get from a DFA to a regular expression?}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1072
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1073
\end{frame}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1074
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1075
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1076
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1077
\begin{frame}[c]
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1078
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1079
\begin{center}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1080
\begin{tikzpicture}[scale=2,>=stealth',very thick,
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1081
                             every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1082
  \only<1->{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1083
  \only<1->{\node[state]                    (q1) at ( 1,1) {$q_1$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1084
  \only<1->{\node[state] (q2) at ( 2,1) {$q_2$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1085
  \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1086
                  (q1) edge[bend left] node[above] {\alert{$b$}} (q0)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1087
                  (q2) edge[bend left=50] node[below] {\alert{$b$}} (q0)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1088
                  (q1) edge node[above] {\alert{$a$}} (q2)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1089
                  (q2) edge [loop right] node {\alert{$a$}} ()
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1090
                  (q0) edge [loop below] node {\alert{$b$}} ()
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1091
            ;
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 138
diff changeset
  1092
\end{tikzpicture}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1093
\end{center}\pause\bigskip
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1094
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1095
\onslide<2->{
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1096
\begin{center}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1097
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1098
\bl{$q_0$} & \bl{$=$} & \bl{$2\, q_0 + 3 \,q_1 +  4\, q_2$}\\
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1099
\bl{$q_1$} & \bl{$=$} & \bl{$2 \,q_0 + 3\, q_1 + 1\, q_2$}\\
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1100
\bl{$q_2$} & \bl{$=$} & \bl{$1\, q_0 + 5\, q_1 + 2\, q_2$}\\
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1101
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1102
\end{tabular}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1103
\end{center}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1104
}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1105
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1106
\end{frame}
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1107
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1108
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1109
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1110
\begin{frame}[c]
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1111
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1112
\begin{center}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1113
\begin{tikzpicture}[scale=2,>=stealth',very thick,
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1114
                             every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},]
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1115
  \only<1->{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1116
  \only<1->{\node[state]                    (q1) at ( 1,1) {$q_1$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1117
  \only<1->{\node[state] (q2) at ( 2,1) {$q_2$};}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1118
  \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1119
                  (q1) edge[bend left] node[above] {\alert{$b$}} (q0)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1120
                  (q2) edge[bend left=50] node[below] {\alert{$b$}} (q0)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1121
                  (q1) edge node[above] {\alert{$a$}} (q2)
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1122
                  (q2) edge [loop right] node {\alert{$a$}} ()
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1123
                  (q0) edge [loop below] node {\alert{$b$}} ()
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1124
            ;
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1125
\end{tikzpicture}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1126
\end{center}\bigskip
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1127
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1128
\onslide<2->{
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1129
\begin{center}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1130
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1131
\bl{$q_0$} & \bl{$=$} & \bl{$\epsilon + q_0\,b + q_1\,b +  q_2\,b$}\\
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1132
\bl{$q_1$} & \bl{$=$} & \bl{$q_0\,a$}\\
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1133
\bl{$q_2$} & \bl{$=$} & \bl{$q_1\,a + q_2\,a$}\\
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1134
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1135
\end{tabular}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1136
\end{center}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1137
}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1138
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1139
\onslide<3->{
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1140
Arden's Lemma:
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1141
\begin{center}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1142
If \bl{$q = q\,r + s$}\; then\; \bl{$q = s\, r^*$}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1143
\end{center}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1144
}
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1145
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1146
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1147
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1148
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1149
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1150
\begin{frame}[c]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1151
\frametitle{Regexps and Automata}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1152
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1153
\begin{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1154
\begin{tikzpicture}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1155
\node (rexp)  {\bl{\bf Regexps}};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1156
\node (nfa) [right=of rexp] {\bl{\bf NFAs}};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1157
\node (dfa) [right=of nfa] {\bl{\bf DFAs}};
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1158
\onslide<1->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1159
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1160
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa);
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1161
\onslide<1->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1162
\onslide<1->{\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp);}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1163
\end{tikzpicture}\\
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1164
\end{center}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1165
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1166
\end{frame}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1167
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1168
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1169
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1170
\begin{frame}[c]
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1171
\frametitle{Regular Languages (3)}
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1172
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1173
A language is \alert{\bf regular} iff there exists a regular
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1174
expression that recognises all its strings.\bigskip\medskip
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1175
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1176
or {\bf equivalently}\bigskip\medskip
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1177
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1178
A language is \alert{\bf regular} iff there exists a
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1179
deterministic finite automaton that recognises all its
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1180
strings.\bigskip\medskip\pause
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1181
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1182
Why is every finite set of strings a regular language?
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1183
\end{frame}
265
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1184
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1185
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1186
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1187
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1188
\begin{frame}[c]
332fbe9c91ab added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
  1189
135
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1190
Given the function 
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1191
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1192
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1193
\bl{\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1194
$rev(\varnothing)$   & $\dn$ & $\varnothing$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1195
$rev(\epsilon)$         & $\dn$ & $\epsilon$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1196
$rev(c)$                      & $\dn$ & $c$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1197
$rev(r_1 + r_2)$        & $\dn$ & $rev(r_1) + rev(r_2)$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1198
$rev(r_1 \cdot r_2)$  & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1199
$rev(r^*)$                   & $\dn$ & $rev(r)^*$\\
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1200
\end{tabular}}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1201
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1202
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1203
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1204
and the set
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1205
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1206
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1207
\bl{$Rev\,A \dn \{s^{-1} \;|\; s \in A\}$}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1208
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1209
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1210
prove whether
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1211
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1212
\begin{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1213
\bl{$L(rev(r)) = Rev (L(r))$}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1214
\end{center}
72b686e1c974 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 134
diff changeset
  1215
346
a98794b11ac4 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 265
diff changeset
  1216
\end{frame}
133
09efdf5cf07c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
  1217
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
25
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1218
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1219
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1220
\end{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1221
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1222
%%% Local Variables:  
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1223
%%% mode: latex
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1224
%%% TeX-master: t
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1225
%%% End: 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1226