slides/slides04.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Fri, 01 Nov 2013 11:57:04 +0000
changeset 173 7cfb7a6f7c99
parent 145 920f675b4ed1
child 215 828303e8e4af
permissions -rw-r--r--
added slides
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
     2
\usepackage{beamerthemeplaincu}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
     3
%%%\usepackage[T1]{fontenc}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage[latin1]{inputenc}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{mathpartir}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
\usepackage[absolute,overlay]{textpos}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\usepackage{ifthen}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
\usepackage{tikz}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
\usepackage{pgf}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
\usepackage{calc} 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\usepackage{ulem}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
\usepackage{courier}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
\usepackage{listings}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
\renewcommand{\uline}[1]{#1}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
\usetikzlibrary{arrows}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
\usetikzlibrary{automata}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
\usetikzlibrary{shapes}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
\usetikzlibrary{shadows}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
\usetikzlibrary{positioning}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
\usetikzlibrary{calc}
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    21
\usetikzlibrary{fit}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    22
\usetikzlibrary{plotmarks}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    23
\usetikzlibrary{backgrounds}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
\usepackage{graphicx} 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
\definecolor{javared}{rgb}{0.6,0,0} % for strings
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    31
\makeatletter
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    32
\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    33
\@empty\z@\@empty
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    34
\makeatother
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    35
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
\lstset{language=Java,
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    37
	basicstyle=\consolas,
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
	keywordstyle=\color{javapurple}\bfseries,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
	stringstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
	commentstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
	morecomment=[s][\color{javadocblue}]{/**}{*/},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
	numbers=left,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
	numberstyle=\tiny\color{black},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
	stepnumber=1,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
	numbersep=10pt,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
	tabsize=2,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
	showspaces=false,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
	showstringspaces=false}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
\lstdefinelanguage{scala}{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  morekeywords={abstract,case,catch,class,def,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
    do,else,extends,false,final,finally,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
    for,if,implicit,import,match,mixin,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
    new,null,object,override,package,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
    private,protected,requires,return,sealed,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
    super,this,throw,trait,true,try,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
    type,val,var,while,with,yield},
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    58
  otherkeywords={=>,<-,<\%,<:,>:,\#,@,->},
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
  sensitive=true,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
  morecomment=[l]{//},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
  morecomment=[n]{/*}{*/},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
  morestring=[b]",
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
  morestring=[b]',
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
  morestring=[b]"""
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
\lstset{language=Scala,
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    68
	basicstyle=\consolas,
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
	keywordstyle=\color{javapurple}\bfseries,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
	stringstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
	commentstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
	morecomment=[s][\color{javadocblue}]{/**}{*/},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
	numbers=left,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
	numberstyle=\tiny\color{black},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
	stepnumber=1,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
	numbersep=10pt,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
	tabsize=2,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
	showspaces=false,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
	showstringspaces=false}
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    80
	
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
% beamer stuff 
142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
    82
\renewcommand{\slidecaption}{AFL 04, King's College London, 16.~October 2013}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    86
% The data files, written on the first run.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    87
\begin{filecontents}{re-python.data}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    88
1 0.029
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    89
5 0.029
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    90
10 0.029
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    91
15 0.032
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    92
16 0.042
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    93
17 0.042
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    94
18 0.055
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    95
19 0.084
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    96
20 0.136
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    97
21 0.248
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    98
22 0.464
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
    99
23 0.899
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   100
24 1.773
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   101
25 3.505
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   102
26 6.993
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   103
27 14.503
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   104
28 29.307
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   105
#29 58.886
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   106
\end{filecontents}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   107
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   108
\begin{filecontents}{re-ruby.data}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   109
1 0.00006
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   110
2 0.00003
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   111
3 0.00001
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   112
4 0.00001
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   113
5 0.00001
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   114
6 0.00002
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   115
7 0.00002
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   116
8 0.00004
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   117
9 0.00007
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   118
10 0.00013
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   119
11 0.00026
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   120
12 0.00055
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   121
13 0.00106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   122
14 0.00196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   123
15 0.00378
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   124
16 0.00764
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   125
17 0.01606
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   126
18 0.03094
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   127
19 0.06508
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   128
20 0.12420
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   129
21 0.25393
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   130
22 0.51449
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   131
23 1.02174
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   132
24 2.05998
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   133
25 4.22514
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   134
26 8.42479
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   135
27 16.88678
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   136
28 34.79653
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   137
\end{filecontents}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   138
 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   139
\begin{filecontents}{nfa.data}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   140
0  0.00099
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   141
5  0.01304
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   142
10  0.05350
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   143
15  0.10152
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   144
20  0.10876
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   145
25  0.06984
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   146
30  0.09693
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   147
35  0.04805
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   148
40  0.07512
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   149
45  0.07624
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   150
50  0.10451
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   151
55  0.13285
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   152
60  0.15748
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   153
65  0.19982
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   154
70  0.24075
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   155
75  0.28963
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   156
80  0.35734
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   157
85  0.43735
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   158
90  0.49692
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   159
95  0.59551
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   160
100  0.72236
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   161
\end{filecontents}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   162
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   163
\begin{filecontents}{nfasearch.data}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   164
0  0.00009
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   165
1  0.00147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   166
2  0.00030
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   167
3  0.00062
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   168
4  0.00132
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   169
5  0.00177
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   170
6  0.00487
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   171
7  0.00947
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   172
8  0.01757
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   173
9  0.02050
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   174
10  0.02091
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   175
11  0.04002
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   176
12  0.08662
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   177
13  0.17269
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   178
14  0.37255
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   179
15  0.81935
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   180
16  1.76254
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   181
17  3.89442
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   182
18  8.42263
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   183
19  17.89661
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   184
20  38.21481
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   185
\end{filecontents}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   186
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
\begin{document}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
\begin{frame}<1>[t]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
\frametitle{%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
  \begin{tabular}{@ {}c@ {}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
  \\[-3mm]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
  \LARGE Automata and \\[-2mm] 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
  \LARGE Formal Languages (4)\\[3mm] 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
  \end{tabular}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
  \normalsize
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
  \begin{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
  \begin{tabular}{ll}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
  Email:  & christian.urban at kcl.ac.uk\\
142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 139
diff changeset
   203
  Office: & S1.27 (1st floor Strand Building)\\
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
  Slides: & KEATS (also home work is there)\\
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
  \end{tabular}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
  \end{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   212
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   213
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   214
\mode<presentation>{
144
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   215
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   216
\frametitle{Regexps and Automata}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   217
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   218
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   219
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   220
\node (rexp)  {\bl{\bf Regexps}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   221
\node (nfa) [right=of rexp] {\bl{\bf NFAs}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   222
\node (dfa) [right=of nfa] {\bl{\bf DFAs}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   223
\onslide<3->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   224
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   225
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   226
\onslide<3->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   227
\onslide<2->{\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp);}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   228
\end{tikzpicture}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   229
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   230
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   231
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   232
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   233
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   234
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   235
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   236
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   237
\frametitle{\begin{tabular}{c}DFAs\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   238
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   239
A deterministic finite automaton consists of:
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   240
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   241
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   242
\item a finite set of states, \bl{$Q$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   243
\item one of these states is the start state, \bl{$q_0$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   244
\item there is transition function, \bl{$\delta$}, and
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   245
\item some states are accepting states, \bl{$F$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   246
\medskip 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   247
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   248
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   249
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   250
\bl{$A(Q, q_0, \delta, F)$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   251
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   252
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   253
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   254
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   255
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   256
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   257
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   258
\frametitle{\begin{tabular}{c}State Nodes\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   259
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   260
\hspace{5mm}\mbox{{\lstset{language=Scala}\consolas\fontsize{9}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   261
\lstinputlisting{../progs/appA.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   262
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   263
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   264
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   265
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   266
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   267
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   268
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   269
\frametitle{\begin{tabular}{c}DFAs\;\;\;\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   270
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   271
\mbox{}\\[7mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   272
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   273
\mbox{{\lstset{language=Scala}\consolas\fontsize{9}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   274
\lstinputlisting{../progs/appB.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   275
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   276
\only<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   277
\begin{textblock}{9}(7.5,0.5)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   278
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   279
\draw (0,0) node[inner sep=2mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   280
{\normalsize\color{darkgray}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   281
\begin{minipage}{6cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   282
\begin{tabular}{l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   283
\bl{$\hat{\delta}(q, \texttt{""}) \dn q$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   284
\bl{$\hat{\delta}(q, c::s) \dn \hat{\delta}(\delta(q, c), s)$}\\[4mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   285
\bl{$\hat{\delta}(q_0, s) \in F$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   286
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   287
\end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   288
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   289
\end{textblock}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   290
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   291
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   292
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   293
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   294
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   295
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   296
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   297
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   298
\mbox{}\hspace{-10mm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   299
\begin{tikzpicture}[scale=0.6,>=stealth',very thick,auto,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   300
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   301
\node[state,initial]  (q_0)  {$q_0$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   302
\node[state] (q_1) [right=of q_0] {$q_1$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   303
\node[state] (q_2) [below right=of q_0] {$q_2$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   304
\node[state] (q_3) [right=of q_2] {$q_3$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   305
\node[state, accepting] (q_4) [right=of q_1] {$q_4$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   306
\path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   307
\path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   308
\path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   309
\path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   310
\path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   311
\path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   312
\path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   313
\path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   314
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   315
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   316
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   317
\only<1->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   318
\begin{textblock}{9}(7.4,3.5)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   319
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   320
\draw (0,0) node[inner sep=2mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   321
{\normalsize\color{darkgray}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   322
\begin{minipage}{6.6cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   323
\hspace{5mm}\mbox{{\lstset{language=Scala}\consolas\fontsize{8}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   324
\lstinputlisting{../progs/appC.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   325
\end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   326
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   327
\end{textblock}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   328
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   329
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   330
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   331
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   332
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   333
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   334
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   335
\frametitle{\begin{tabular}{c}NFAs\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   336
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   337
A non-deterministic finite automaton \bl{$A(Q, q_0, \delta, F)$} consists of:\medskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   338
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   339
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   340
\item a finite set of states, \bl{$Q$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   341
\item one of these states is the start state, \bl{$q_0$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   342
\item some states are accepting states, \bl{$F$},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   343
\item there is transition \alert{relation}, \bl{$\delta$}, and
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   344
\item there are \alert{silent} transitions\medskip 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   345
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   346
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   347
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   348
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   349
\begin{tabular}{c}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   350
\bl{$(q_1, a) \rightarrow q_2$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   351
\bl{$(q_1, a) \rightarrow q_3$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   352
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   353
\hspace{10mm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   354
\begin{tabular}{c}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   355
\bl{$(q_1, \epsilon) \rightarrow q_2$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   356
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   357
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   358
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   359
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   360
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   361
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   362
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   363
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   364
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   365
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   366
\hspace{5mm}\mbox{{\lstset{language=Scala}\consolas\fontsize{9}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   367
\lstinputlisting{../progs/appD.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   368
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   369
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   370
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   371
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   372
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   373
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   374
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   375
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   376
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   377
\mbox{}\hspace{-10mm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   378
\begin{tikzpicture}[scale=0.6,>=stealth',very thick,auto,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   379
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   380
\node[state,initial]  (q_0)  {$q_0$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   381
\node[state] (q_1) [above=of q_0] {$q_1$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   382
\node[state, accepting] (q_2) [below=of q_0] {$q_2$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   383
\path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   384
\path[->] (q_0) edge node [left]  {\alert{$\epsilon$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   385
\path[->] (q_0) edge [loop right] node  {\alert{$a$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   386
\path[->] (q_1) edge [loop above] node  {\alert{$a$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   387
\path[->] (q_2) edge [loop below] node  {\alert{$b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   388
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   389
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   390
\only<1->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   391
\begin{textblock}{9}(6,1.5)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   392
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   393
\draw (0,0) node[inner sep=2mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   394
{\normalsize\color{darkgray}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   395
\begin{minipage}{7cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   396
\hspace{5mm}\mbox{{\lstset{language=Scala}\consolas\fontsize{8}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   397
\lstinputlisting{../progs/appE.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   398
\end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   399
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   400
\end{textblock}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   401
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   402
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   403
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   404
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   405
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   406
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   407
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   408
\frametitle{Rexp to NFA}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   409
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   410
Thompson's construction of a NFA from a regular expression:
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   411
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   412
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   413
\begin{tabular}[t]{l@{\hspace{10mm}}l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   414
\raisebox{1mm}{\bl{$\varnothing$}} & 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   415
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   416
\node[state, initial]  (q_0)  {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   417
\end{tikzpicture}\\\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   418
\raisebox{1mm}{\bl{$\epsilon$}} & 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   419
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   420
\node[state, initial, accepting]  (q_0)  {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   421
\end{tikzpicture}\\\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   422
\raisebox{2mm}{\bl{$c$}} & 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   423
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   424
\node[state, initial]  (q_0)  {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   425
\node[state, accepting]  (q_1)  [right=of q_0] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   426
\path[->] (q_0) edge node [below]  {\alert{$c$}} (q_1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   427
\end{tikzpicture}\\\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   428
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   429
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   430
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   431
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   432
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   433
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   434
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   435
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   436
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   437
\frametitle{Case $r_1\cdot r_2$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   438
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   439
\mbox{}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   440
\onslide<1>{By recursion we are given two automata:\bigskip}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   441
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   442
{\centering\begin{tikzpicture}[node distance=3mm,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   443
                             >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   444
\node[state, initial]  (q_0)  {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   445
\node (r_1)  [right=of q_0] {$\ldots$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   446
\only<1>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   447
\node[state, accepting]  (t_1)  [right=of r_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   448
\node[state, accepting]  (t_2)  [above=of t_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   449
\node[state, accepting]  (t_3)  [below=of t_1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   450
\only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   451
\node[state]  (t_1)  [right=of r_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   452
\node[state]  (t_2)  [above=of t_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   453
\node[state]  (t_3)  [below=of t_1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   454
\only<1>{\node[state, initial]  (a_0)  [right=2.5cm of t_1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   455
\only<2>{\node[state]  (a_0)  [right=2.5cm of t_1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   456
\node (b_1)  [right=of a_0] {$\ldots$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   457
\node[state, accepting]  (c_1)  [right=of b_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   458
\node[state, accepting]  (c_2)  [above=of c_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   459
\node[state, accepting]  (c_3)  [below=of c_1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   460
\only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   461
\path[->] (t_1) edge node [above, pos=0.3]  {\alert{$\epsilon$}} (a_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   462
\path[->] (t_2) edge node [above]  {\alert{$\epsilon$}} (a_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   463
\path[->] (t_3) edge node [below]  {\alert{$\epsilon$}} (a_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   464
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   465
\begin{pgfonlayer}{background}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   466
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (q_0) (r_1) (t_1) (t_2) (t_3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   467
\only<1>{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (a_0) (b_1) (c_1) (c_2) (c_3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   468
\only<2>{\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (q_0) (c_1) (c_2) (c_3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   469
\only<1>{\node [yshift=2mm] at (1.north) {\bl{$r_1$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   470
\only<1>{\node [yshift=2mm] at (2.north) {\bl{$r_2$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   471
\only<2>{\node [yshift=2mm] at (3.north) {\bl{$r_1\cdot r_2$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   472
\end{pgfonlayer}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   473
\end{tikzpicture}}\bigskip\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   474
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   475
\small
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   476
We need to (1) change the accepting nodes of the first automaton into non-accepting nodes, and (2) connect them
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   477
via $\epsilon$-transitions to the starting state of the second automaton. 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   478
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   479
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   480
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   481
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   482
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   483
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   484
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   485
\frametitle{Case $r_1+ r_2$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   486
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   487
\onslide<1>{By recursion we are given two automata:\smallskip}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   488
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   489
\hspace{2cm}\begin{tikzpicture}[node distance=3mm,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   490
                             >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   491
\onslide<1>{\node at (0,0)  (1)  {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   492
\onslide<2>{\node at (0,0) [state, initial]  (1)  {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   493
\only<1>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   494
\node[state, initial]  (2)  [above right=16mm of 1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   495
\node[state, initial]  (3)  [below right=16mm of 1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   496
\only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   497
\node[state]  (2)  [above right=16mm of 1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   498
\node[state]  (3)  [below right=16mm of 1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   499
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   500
\node (a)  [right=of 2] {$\ldots$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   501
\node[state, accepting]  (a1)  [right=of a] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   502
\node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   503
\node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   504
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   505
\node (b)  [right=of 3] {$\ldots$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   506
\node[state, accepting]  (b1)  [right=of b] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   507
\node[state, accepting]  (b2)  [above=of b1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   508
\node[state, accepting]  (b3)  [below=of b1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   509
\only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   510
\path[->] (1) edge node [above]  {\alert{$\epsilon$}} (2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   511
\path[->] (1) edge node [below]  {\alert{$\epsilon$}} (3);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   512
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   513
\begin{pgfonlayer}{background}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   514
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   515
\only<1>{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (3) (b1) (b2) (b3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   516
\only<2>{\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3) (b2) (b3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   517
\only<1>{\node [yshift=3mm] at (1.north) {\bl{$r_1$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   518
\only<1>{\node [yshift=3mm] at (2.north) {\bl{$r_2$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   519
\only<2>{\node [yshift=3mm] at (3.north) {\bl{$r_1+ r_2$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   520
\end{pgfonlayer}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   521
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   522
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   523
\small
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   524
We (1) need to introduce a new starting state and (2) connect it to the original two starting states.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   525
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   526
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   527
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   528
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   529
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   530
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   531
\frametitle{Case $r^*$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   532
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   533
\onslide<1>{By recursion we are given an automaton for $r$:\smallskip}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   534
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   535
\hspace{2cm}\begin{tikzpicture}[node distance=3mm,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   536
                             >=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   537
\onslide<1>{\node at (0,0)  (1)  {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   538
\onslide<2->{\node at (0,0) [state, initial,accepting]  (1)  {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   539
\only<1>{\node[state, initial]  (2)  [right=16mm of 1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   540
\only<2->{\node[state]  (2)  [right=16mm of 1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   541
\node (a)  [right=of 2] {$\ldots$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   542
\only<1>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   543
\node[state, accepting]  (a1)  [right=of a] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   544
\node[state, accepting]  (a2)  [above=of a1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   545
\node[state, accepting]  (a3)  [below=of a1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   546
\only<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   547
\node[state]  (a1)  [right=of a] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   548
\node[state]  (a2)  [above=of a1] {$\mbox{}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   549
\node[state]  (a3)  [below=of a1] {$\mbox{}$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   550
\only<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   551
\path[->] (1) edge node [above]  {\alert{$\epsilon$}} (2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   552
\path[->] (a1) edge [bend left=45] node [above]  {\alert{$\epsilon$}} (1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   553
\path[->] (a2) edge [bend right] node [below]  {\alert{$\epsilon$}} (1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   554
\path[->] (a3) edge [bend left=45] node [below]  {\alert{$\epsilon$}} (1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   555
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   556
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   557
\begin{pgfonlayer}{background}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   558
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   559
\only<2->{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3)] {};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   560
\only<1>{\node [yshift=3mm] at (1.north) {\bl{$r$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   561
\only<2->{\node [yshift=3mm] at (2.north) {\bl{$r^*$}};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   562
\end{pgfonlayer}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   563
\end{tikzpicture}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   564
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   565
\onslide<3->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   566
Why can't we just have an epsilon transition from the accepting states to the starting state?}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   567
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   568
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   569
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   570
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   571
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   572
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   573
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   574
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   575
\frametitle{\begin{tabular}{c}\bl{$(a?\{n\}) \cdot a\{n\}$}\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   576
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   577
\mbox{}\\[-13mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   578
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   579
\begin{tikzpicture}[y=.2cm, x=.09cm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   580
 	%axis
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   581
	\draw (0,0) -- coordinate (x axis mid) (100,0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   582
    	\draw (0,0) -- coordinate (y axis mid) (0,30);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   583
    	%ticks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   584
    	\foreach \x in {0,10,...,100}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   585
     		\draw (\x,1pt) -- (\x,-3pt)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   586
			node[anchor=north] {\x};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   587
    	\foreach \y in {0,5,...,30}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   588
     		\draw (1pt,\y) -- (-3pt,\y) 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   589
     			node[anchor=east] {\y}; 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   590
	%labels      
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   591
	\node[below=0.6cm] at (x axis mid) {\bl{a}s};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   592
	\node[rotate=90, left=1.2cm] at (y axis mid) {secs};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   593
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   594
	%plots
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   595
	\draw[color=blue] plot[mark=*, mark options={fill=white}] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   596
		file {re-python.data};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   597
	\draw[color=red] plot[mark=triangle*, mark options={fill=white} ] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   598
		file {nfa.data};	  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   599
	\draw[color=brown] plot[mark=pentagon*, mark options={fill=white} ] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   600
		file {re-ruby.data};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   601
		
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   602
    
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   603
	%legend
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   604
	\begin{scope}[shift={(4,20)}] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   605
	\draw[color=blue] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   606
		plot[mark=*, mark options={fill=white}] (0.25,0) -- (0.5,0) 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   607
		node[right]{\small Python};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   608
	\draw[yshift=-\baselineskip, color=brown] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   609
		plot[mark=pentagon*, mark options={fill=white}] (0.25,0) -- (0.5,0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   610
		node[right]{\small Ruby};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   611
	\draw[yshift=\baselineskip, color=red] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   612
		plot[mark=triangle*, mark options={fill=white}] (0.25,0) -- (0.5,0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   613
		node[right]{\small NFA 1};		
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   614
	\end{scope}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   615
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   616
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   617
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   618
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   619
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   620
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   621
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   622
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   623
\frametitle{Greedy Depth-First}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   624
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   625
\hspace{5mm}\mbox{{\lstset{language=Scala}\consolas\fontsize{9}{10}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   626
\lstinputlisting{../progs/appG.scala}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   627
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   628
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   629
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   630
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   631
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   632
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   633
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   634
\frametitle{\begin{tabular}{c}\bl{$(a?\{n\}) \cdot a\{n\}$}\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   635
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   636
\mbox{}\\[-13mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   637
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   638
\begin{tikzpicture}[y=.2cm, x=.3cm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   639
 	%axis
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   640
	\draw (0,0) -- coordinate (x axis mid) (30,0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   641
    	\draw (0,0) -- coordinate (y axis mid) (0,30);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   642
    	%ticks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   643
    	\foreach \x in {0,5,...,30}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   644
     		\draw (\x,1pt) -- (\x,-3pt)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   645
			node[anchor=north] {\x};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   646
    	\foreach \y in {0,5,...,30}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   647
     		\draw (1pt,\y) -- (-3pt,\y) 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   648
     			node[anchor=east] {\y}; 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   649
	%labels      
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   650
	\node[below=0.6cm] at (x axis mid) {\bl{a}s};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   651
	\node[rotate=90, left=1.2cm] at (y axis mid) {secs};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   652
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   653
	%plots
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   654
	\draw[color=blue] plot[mark=*, mark options={fill=white}] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   655
		file {re-python.data};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   656
	\draw[color=red] plot[mark=triangle*, mark options={fill=white} ] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   657
		file {nfasearch.data};	  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   658
	\draw[color=brown] plot[mark=pentagon*, mark options={fill=white} ] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   659
		file {re-ruby.data};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   660
    
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   661
	%legend
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   662
	\begin{scope}[shift={(4,20)}] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   663
	\draw[color=blue] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   664
		plot[mark=*, mark options={fill=white}] (0.25,0) -- (0.5,0) 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   665
		node[right]{\small Python};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   666
	\draw[yshift=-\baselineskip, color=brown] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   667
		plot[mark=pentagon*, mark options={fill=white}] (0.25,0) -- (0.5,0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   668
		node[right]{\small Ruby};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   669
	\draw[yshift=\baselineskip, color=red] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   670
		plot[mark=triangle*, mark options={fill=white}] (0.25,0) -- (0.5,0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   671
		node[right]{\small NFA 2};		
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   672
	\end{scope}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   673
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   674
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   675
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   676
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   677
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   678
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   679
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   680
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   681
\begin{frame}<2>[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   682
\frametitle{DFA to Rexp}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   683
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   684
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   685
\begin{tikzpicture}[scale=2, line width=0.5mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   686
  \only<1>{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   687
  \only<2->{\node[state, initial,accepting]        (q0) at ( 0,1) {$q_0$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   688
  \only<1>{\node[state]                    (q1) at ( 1,1) {$q_1$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   689
  \only<2->{\node[state,accepting]                    (q1) at ( 1,1) {$q_1$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   690
  \only<1>{\node[state, accepting] (q2) at ( 2,1) {$q_2$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   691
  \only<2->{\node[state] (q2) at ( 2,1) {$q_2$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   692
  \path[->] (q0) edge[bend left] node[above] {$a$} (q1)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   693
                  (q1) edge[bend left] node[above] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   694
                  (q2) edge[bend left=50] node[below] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   695
                  (q1) edge node[above] {$a$} (q2)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   696
                  (q2) edge [loop right] node {$a$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   697
                  (q0) edge [loop below] node {$b$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   698
            ;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   699
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   700
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   701
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   702
\onslide<3>{How to get from a DFA to a regular expression?}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   703
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   704
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   705
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   706
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   707
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   708
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   709
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   710
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   711
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   712
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   713
\begin{tikzpicture}[scale=2, line width=0.5mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   714
  \only<1->{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   715
  \only<1->{\node[state]                    (q1) at ( 1,1) {$q_1$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   716
  \only<1->{\node[state] (q2) at ( 2,1) {$q_2$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   717
  \path[->] (q0) edge[bend left] node[above] {$a$} (q1)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   718
                  (q1) edge[bend left] node[above] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   719
                  (q2) edge[bend left=50] node[below] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   720
                  (q1) edge node[above] {$a$} (q2)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   721
                  (q2) edge [loop right] node {$a$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   722
                  (q0) edge [loop below] node {$b$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   723
            ;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   724
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   725
\end{center}\pause\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   726
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   727
\onslide<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   728
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   729
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   730
\bl{$q_0$} & \bl{$=$} & \bl{$2\, q_0 + 3 \,q_1 +  4\, q_2$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   731
\bl{$q_1$} & \bl{$=$} & \bl{$2 \,q_0 + 3\, q_1 + 1\, q_2$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   732
\bl{$q_2$} & \bl{$=$} & \bl{$1\, q_0 + 5\, q_1 + 2\, q_2$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   733
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   734
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   735
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   736
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   737
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   738
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   739
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   740
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   741
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   742
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   743
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   744
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   745
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   746
\begin{tikzpicture}[scale=2, line width=0.5mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   747
  \only<1->{\node[state, initial]        (q0) at ( 0,1) {$q_0$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   748
  \only<1->{\node[state]                    (q1) at ( 1,1) {$q_1$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   749
  \only<1->{\node[state] (q2) at ( 2,1) {$q_2$};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   750
  \path[->] (q0) edge[bend left] node[above] {$a$} (q1)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   751
                  (q1) edge[bend left] node[above] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   752
                  (q2) edge[bend left=50] node[below] {$b$} (q0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   753
                  (q1) edge node[above] {$a$} (q2)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   754
                  (q2) edge [loop right] node {$a$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   755
                  (q0) edge [loop below] node {$b$} ()
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   756
            ;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   757
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   758
\end{center}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   759
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   760
\onslide<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   761
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   762
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   763
\bl{$q_0$} & \bl{$=$} & \bl{$\epsilon + q_0\,b + q_1\,b +  q_2\,b$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   764
\bl{$q_1$} & \bl{$=$} & \bl{$q_0\,a$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   765
\bl{$q_2$} & \bl{$=$} & \bl{$q_1\,a + q_2\,a$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   766
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   767
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   768
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   769
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   770
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   771
\onslide<3->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   772
Arden's Lemma:
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   773
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   774
If \bl{$q = q\,r + s$}\; then\; \bl{$q = s\, r^*$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   775
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   776
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   777
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   778
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   779
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   780
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   781
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   782
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   783
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   784
\frametitle{DFA Minimisation}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   785
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   786
\begin{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   787
\item Take all pairs \bl{$(q, p)$} with \bl{$q \not= p$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   788
\item Mark all pairs that accepting and non-accepting states
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   789
\item For  all unmarked pairs \bl{$(q, p)$} and all characters \bl{$c$} tests wether
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   790
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   791
\bl{$(\delta(q, c), \delta(p,c))$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   792
\end{center} 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   793
are marked. If yes, then also mark \bl{$(q, p)$}.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   794
\item Repeat last step until no chance.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   795
\item All unmarked pairs can be merged.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   796
\end{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   797
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   798
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   799
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
144
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   800
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   801
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   802
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 142
diff changeset
   803
\mode<presentation>{
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   804
\begin{frame}<1-2>[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   805
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   806
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   807
\begin{tikzpicture}[>=stealth',very thick,auto,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   808
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   809
\node[state,initial]  (q_0)  {$q_0$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   810
\node[state] (q_1) [right=of q_0] {$q_1$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   811
\node[state] (q_2) [below right=of q_0] {$q_2$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   812
\node[state] (q_3) [right=of q_2] {$q_3$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   813
\node[state, accepting] (q_4) [right=of q_1] {$q_4$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   814
\path[->] (q_0) edge node [above]  {\alert{$a$}} (q_1);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   815
\path[->] (q_1) edge node [above]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   816
\path[->] (q_4) edge [loop right] node  {\alert{$a, b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   817
\path[->] (q_3) edge node [right]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   818
\path[->] (q_2) edge node [above]  {\alert{$a$}} (q_3);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   819
\path[->] (q_1) edge node [right]  {\alert{$b$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   820
\path[->] (q_0) edge node [above]  {\alert{$b$}} (q_2);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   821
\path[->] (q_2) edge [loop left] node  {\alert{$b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   822
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (q_0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   823
\end{tikzpicture}
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   824
\end{center}\pause
139
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   825
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   826
\mbox{}\\[-20mm]\mbox{}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   827
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   828
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   829
\begin{tikzpicture}[>=stealth',very thick,auto,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   830
                             every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   831
\node[state,initial]  (q_02)  {$q_{0, 2}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   832
\node[state] (q_13) [right=of q_02] {$q_{1, 3}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   833
\node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   834
\path[->] (q_02) edge [bend left] node [above]  {\alert{$a$}} (q_13);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   835
\path[->] (q_13) edge [bend left] node [below]  {\alert{$b$}} (q_02);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   836
\path[->] (q_02) edge [loop below] node  {\alert{$b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   837
\path[->] (q_13) edge node [above]  {\alert{$a$}} (q_4);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   838
\path[->] (q_4) edge [loop above] node  {\alert{$a, b$}} ();
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   839
\end{tikzpicture}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   840
minimal automaton
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   841
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   842
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   843
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   844
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   845
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   846
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   847
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   848
\begin{frame}[c]
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   849
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   850
\begin{itemize}
145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   851
\item Assuming you have the alphabet \bl{$\{a, b, c\}$}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 144
diff changeset
   852
\item Give a regular expression that can recognise all strings that have at least one \bl{$b$}.
38
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   853
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 37
diff changeset
   854
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   855
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   856
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   857
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   858
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   859
\end{document}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   860
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   861
%%% Local Variables:  
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   862
%%% mode: latex
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   863
%%% TeX-master: t
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   864
%%% End: 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   865