author | Christian Urban <christian.urban@kcl.ac.uk> |
Fri, 13 Oct 2023 15:07:37 +0100 | |
changeset 941 | 66adcae6c762 |
parent 940 | 46eee459a999 |
child 967 | ce5de01b9632 |
permissions | -rw-r--r-- |
651 | 1 |
% !TEX program = xelatex |
743 | 2 |
\documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
3 |
\usepackage{../slides} |
871 | 4 |
\usepackage{../graphicss} |
215
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
5 |
\usepackage{../langs} |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
6 |
\usepackage{../data} |
25 | 7 |
|
781 | 8 |
\usepackage{tcolorbox} |
9 |
\newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black} |
|
10 |
\newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1} |
|
11 |
\newtcolorbox{mybox3}[1]{colback=Cyan!5!white,colframe=Cyan!75!black,fonttitle=\bfseries,title=#1} |
|
12 |
||
13 |
||
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
14 |
\hfuzz=220pt |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
15 |
|
781 | 16 |
\pgfplotsset{compat=1.17} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
17 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
18 |
\newcommand{\bl}[1]{\textcolor{blue}{#1}} |
25 | 19 |
|
20 |
% beamer stuff |
|
445 | 21 |
\renewcommand{\slidecaption}{CFL 03, King's College London} |
25 | 22 |
|
23 |
\begin{document} |
|
24 |
||
25 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
26 |
\begin{frame}[t] |
25 | 27 |
\frametitle{% |
28 |
\begin{tabular}{@ {}c@ {}} |
|
29 |
\\[-3mm] |
|
889 | 30 |
\LARGE Compilers and \\[-1mm] |
31 |
\LARGE Formal Languages\\[-5mm] |
|
25 | 32 |
\end{tabular}} |
33 |
||
651 | 34 |
\normalsize |
25 | 35 |
\begin{center} |
651 | 36 |
\begin{tabular}{ll} |
889 | 37 |
Email: & christian.urban at kcl.ac.uk\\ |
940 | 38 |
Office Hour: & Thurdays 15 -- 16\\ |
889 | 39 |
Location: & N7.07 (North Wing, Bush House)\\ |
40 |
Slides \& Progs: & KEATS\\ |
|
41 |
Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\ |
|
25 | 42 |
\end{tabular} |
889 | 43 |
\end{center} |
743 | 44 |
|
45 |
\begin{center} |
|
46 |
\begin{tikzpicture} |
|
47 |
\node[drop shadow,fill=white,inner sep=0pt] |
|
48 |
{\footnotesize\rowcolors{1}{capri!10}{white} |
|
49 |
\begin{tabular}{|p{4.8cm}|p{4.8cm}|}\hline |
|
50 |
1 Introduction, Languages & 6 While-Language \\ |
|
51 |
2 Regular Expressions, Derivatives & 7 Compilation, JVM \\ |
|
52 |
\cellcolor{blue!50} |
|
53 |
3 Automata, Regular Languages & 8 Compiling Functional Languages \\ |
|
54 |
4 Lexing, Tokenising & 9 Optimisations \\ |
|
55 |
5 Grammars, Parsing & 10 LLVM \\ \hline |
|
56 |
\end{tabular}% |
|
57 |
}; |
|
58 |
\end{tikzpicture} |
|
25 | 59 |
\end{center} |
60 |
||
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
61 |
\end{frame} |
445 | 62 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
63 |
||
941 | 64 |
{ |
65 |
\setbeamercolor{background canvas}{bg=cream} |
|
66 |
\begin{frame}<1-10>[c] |
|
67 |
\end{frame} |
|
68 |
} |
|
69 |
||
70 |
||
71 |
||
72 |
||
445 | 73 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
776 | 74 |
%\begin{frame}[c] |
75 |
%\frametitle{Scala Book, Exams} |
|
76 |
% |
|
77 |
%\begin{itemize} |
|
78 |
%\item \small https://nms.kcl.ac.uk/christian.urban/ProgInScala2ed.pdf\normalsize |
|
79 |
%\item homework (written exam 80\%) |
|
80 |
%\item coursework (20\%)\bigskip |
|
81 |
%\item short survey at KEATS; to be answered until Sunday |
|
82 |
%\end{itemize} |
|
445 | 83 |
|
776 | 84 |
%\end{frame} |
445 | 85 |
%%%%%%%%%%% |
25 | 86 |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
87 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
88 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
89 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
25 | 90 |
\begin{frame}[t] |
651 | 91 |
\frametitle{(Basic) Regular Expressions} |
25 | 92 |
|
93 |
\begin{center} |
|
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
94 |
\begin{tabular}{@ {}rrl@ {\hspace{13mm}}l} |
515 | 95 |
\bl{$r$} & \bl{$::=$} & \bl{$\ZERO$} & nothing\\ |
445 | 96 |
& \bl{$\mid$} & \bl{$\ONE$} & empty string / "" / $[]$\\ |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
97 |
& \bl{$\mid$} & \bl{$c$} & character\\ |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
98 |
& \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\ |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
99 |
& \bl{$\mid$} & \bl{$r_1 + r_2$} & alternative / choice\\ |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
100 |
& \bl{$\mid$} & \bl{$r^*$} & star (zero or more)\\ |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
101 |
\end{tabular} |
25 | 102 |
\end{center} |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
103 |
|
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
104 |
How about ranges \bl{$[a\mbox{-}z]$}, \bl{$r^+$} and \bl{$\sim{}r$}? Do they increase the |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
105 |
set of languages we can recognise? |
25 | 106 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
107 |
\end{frame} |
25 | 108 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
109 |
||
110 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
776 | 111 |
\begin{frame}[t] |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
112 |
\frametitle{Negation} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
113 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
114 |
Assume you have an alphabet consisting of the letters \bl{$a$}, \bl{$b$} and \bl{$c$} only. |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
115 |
Find a (basic!) regular expression that matches all strings \emph{\alert{except}} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
116 |
\bl{$ab$} and \bl{$ac$}! |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
117 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
118 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
119 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
120 |
|
25 | 121 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
573 | 122 |
\begin{frame}[t] |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
123 |
\frametitle{Automata} |
25 | 124 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
125 |
A \alert{\bf deterministic finite automaton}, DFA, consists of: |
25 | 126 |
|
127 |
\begin{itemize} |
|
515 | 128 |
\item an alphabet \bl{$\varSigma$} |
574 | 129 |
\item a set of states \bl{$\mbox{Qs}$} |
515 | 130 |
\item one of these states is the start state \bl{$\mbox{Q}_0$} |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
131 |
\item some states are accepting states \bl{$F$}, and |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
132 |
\item there is transition function \bl{$\delta$}\bigskip |
25 | 133 |
|
134 |
\small |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
135 |
which takes a state as argument and a character and produces a |
515 | 136 |
new state; this function might not be everywhere defined $\Rightarrow$ partial function |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
137 |
\end{itemize} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
138 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
139 |
\begin{center} |
574 | 140 |
\bl{$A(\varSigma, \mbox{Qs}, \mbox{Q}_0, F, \delta)$} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
141 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
142 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
143 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
144 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
145 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
146 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
147 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
148 |
\begin{frame}[c] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
149 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
150 |
\begin{center} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
151 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
573 | 152 |
every state/.style={minimum size=0pt,inner sep=2pt, |
153 |
draw=blue!50,very thick,fill=blue!20},] |
|
515 | 154 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
155 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$}; |
|
156 |
\node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$}; |
|
157 |
\node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$}; |
|
158 |
\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$}; |
|
159 |
\path[->] (Q_0) edge node [above] {\alert{$a$}} (Q_1); |
|
160 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_4); |
|
161 |
\path[->] (Q_4) edge [loop right] node {\alert{$a, b$}} (); |
|
162 |
\path[->] (Q_3) edge node [right] {\alert{$a$}} (Q_4); |
|
163 |
\path[->] (Q_2) edge node [above] {\alert{$a$}} (Q_3); |
|
164 |
\path[->] (Q_1) edge node [right] {\alert{$b$}} (Q_2); |
|
165 |
\path[->] (Q_0) edge node [above] {\alert{$b$}} (Q_2); |
|
166 |
\path[->] (Q_2) edge [loop left] node {\alert{$b$}} (); |
|
167 |
\path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (Q_0); |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
168 |
\end{tikzpicture} |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
169 |
\end{center} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
170 |
|
573 | 171 |
\mbox{}\\[-14mm] |
172 |
\only<1>{ |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
173 |
\begin{itemize} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
174 |
\item the start state can be an accepting state |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
175 |
\item it is possible that there is no accepting state |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
176 |
\item all states might be accepting (but this does not necessarily mean all strings are accepted) |
573 | 177 |
\end{itemize}} |
178 |
\only<2>{ |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
179 |
for this automaton \bl{$\delta$} is the function\\ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
180 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
181 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
182 |
\begin{tabular}{lll} |
515 | 183 |
\bl{$(\mbox{Q}_0, a) \rightarrow \mbox{Q}_1$} & \bl{$(\mbox{Q}_1, a) \rightarrow \mbox{Q}_4$} |
184 |
& \bl{$(\mbox{Q}_4, a) \rightarrow \mbox{Q}_4$}\\ |
|
185 |
\bl{$(\mbox{Q}_0, b) \rightarrow \mbox{Q}_2$} & \bl{$(\mbox{Q}_1, b) \rightarrow \mbox{Q}_2$} & |
|
186 |
\bl{$(\mbox{Q}_4, b) \rightarrow \mbox{Q}_4$}\\ |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
187 |
\end{tabular}\ldots |
573 | 188 |
\end{center} |
189 |
} |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
190 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
191 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
192 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
193 |
|
573 | 194 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
195 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
196 |
\begin{frame}[t] |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
197 |
\frametitle{Accepting a String} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
198 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
199 |
Given |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
200 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
201 |
\begin{center} |
574 | 202 |
\bl{$A(\varSigma, \mbox{Qs}, \mbox{Q}_0, F, \delta)$} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
203 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
204 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
205 |
you can define |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
206 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
207 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
208 |
\begin{tabular}{l} |
778 | 209 |
\bl{$\widehat{\delta}(Q, []) \dn Q$}\\ |
210 |
\bl{$\widehat{\delta}(Q, c::s) \dn \widehat{\delta}(\delta(Q, c), s)$}\\ |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
211 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
212 |
\end{center}\pause |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
213 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
214 |
Whether a string \bl{$s$} is accepted by \bl{$A$}? |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
215 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
216 |
\begin{center} |
517 | 217 |
\hspace{5mm}\bl{$\widehat{\delta}(\mbox{Q}_0, s) \in F$} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
218 |
\end{center} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
219 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
220 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
221 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
222 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
223 |
\begin{frame}[c] |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
224 |
\frametitle{Regular Languages} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
225 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
226 |
A \alert{\bf language} is a set of strings.\bigskip |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
227 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
228 |
A \alert{\bf regular expression} specifies a language.\bigskip |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
229 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
230 |
A language is \alert{\bf regular} iff there exists |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
231 |
a regular expression that recognises all its strings.\bigskip\bigskip\pause |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
232 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
233 |
not all languages are regular, e.g.~\bl{$a^nb^n$} is not |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
234 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
235 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
236 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
237 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
238 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
239 |
\frametitle{Regular Languages (2)} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
240 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
241 |
A language is \alert{\bf regular} iff there exists a regular |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
242 |
expression that recognises all its strings.\bigskip\medskip |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
243 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
244 |
or {\bf equivalently}\bigskip\medskip |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
245 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
246 |
A language is \alert{\bf regular} iff there exists a |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
247 |
deterministic finite automaton that recognises all its |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
248 |
strings. |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
249 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
250 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
251 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
252 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
253 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
254 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
255 |
\begin{frame}[c] |
348
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
256 |
\frametitle{\begin{tabular}{c} |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
257 |
Non-Deterministic\\[-1mm] |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
258 |
Finite Automata\end{tabular}} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
259 |
|
779 | 260 |
\bl{$N(\varSigma, \mbox{Qs}, \mbox{Qs}_0, F, \rho)$}\\ |
261 |
A non-deterministic finite automaton (NFA) consists of: |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
262 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
263 |
\begin{itemize} |
779 | 264 |
\item a finite set of states, \bl{$Qs$} |
265 |
\item \underline{some} these states are the start states, \bl{$Qs_0$} |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
266 |
\item some states are accepting states, and |
779 | 267 |
\item there is transition \alert{relation}, \bl{$\rho$}\medskip |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
268 |
\end{itemize} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
269 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
270 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
271 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
272 |
\begin{tabular}{c} |
515 | 273 |
\bl{$(\mbox{Q}_1, a) \rightarrow \mbox{Q}_2$}\\ |
274 |
\bl{$(\mbox{Q}_1, a) \rightarrow \mbox{Q}_3$}\\ |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
275 |
\end{tabular} |
515 | 276 |
\bl{\ldots} |
277 |
\hspace{10mm}\pause |
|
278 |
\bl{$(\mbox{Q}_1, a) \rightarrow \{\mbox{Q}_2, \mbox{Q}_3\}$} |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
279 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
280 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
281 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
282 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
283 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
284 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
285 |
\begin{frame}[c] |
515 | 286 |
\frametitle{An NFA Example} |
287 |
||
288 |
% A NFA for (ab* + b)*a |
|
289 |
\begin{center} |
|
290 |
\begin{tikzpicture}[>=stealth',very thick, auto, |
|
291 |
every state/.style={minimum size=0pt,inner sep=3pt, |
|
292 |
draw=blue!50,very thick,fill=blue!20},scale=2] |
|
293 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
|
294 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$}; |
|
295 |
\node[state, accepting] (Q_2) [right=of Q_1] {$\mbox{Q}_2$}; |
|
296 |
\path[->] (Q_0) edge [loop above] node {\alert{$b$}} (); |
|
297 |
\path[<-] (Q_0) edge node [below] {\alert{$b$}} (Q_1); |
|
298 |
\path[->] (Q_0) edge [bend left] node [above] {\alert{$a$}} (Q_1); |
|
299 |
\path[->] (Q_0) edge [bend right] node [below] {\alert{$a$}} (Q_2); |
|
300 |
\path[->] (Q_1) edge [loop above] node {\alert{$a,b$}} (); |
|
301 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_2); |
|
302 |
\end{tikzpicture} |
|
303 |
\end{center} |
|
304 |
||
305 |
\end{frame} |
|
306 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
307 |
||
308 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
309 |
\begin{frame}[c] |
|
574 | 310 |
\frametitle{Another Example} |
311 |
||
312 |
For the regular expression \bl{$(.^*)a\,(.^{\{n\}})bc$}\bigskip\bigskip |
|
313 |
||
314 |
% \begin{center} |
|
650 | 315 |
\mbox{}\hspace{-11.5mm} |
574 | 316 |
\begin{tikzpicture}[>=stealth',very thick, auto, |
317 |
every state/.style={minimum size=5pt,inner sep=1pt, |
|
318 |
draw=blue!50,very thick,fill=blue!20},scale=1, node distance=5mm, |
|
319 |
decoration={brace,mirror,amplitude=7}] |
|
320 |
\node[state,initial] (Q_0) {$\;0\;$}; |
|
321 |
\node[state] (Q_1) [right=of Q_0] {$\;1\;$}; |
|
322 |
\node[state] (Q_2) [right=of Q_1] {$\;2\;$}; |
|
323 |
\node (Q_3) [right=of Q_2] {$\hspace{-1mm}\ldots\hspace{-3mm}$}; |
|
324 |
\node[state] (Q_4) [right=of Q_3] {$\;\phantom{1}\;$}; |
|
325 |
\node (Q_5) [right=of Q_4] {$\hspace{-1mm}\ldots\hspace{-3mm}$}; |
|
326 |
\node[state] (Q_6) [right=of Q_5] {\tiny$n+1$}; |
|
327 |
\node[state] (Q_7) [right=of Q_6] {\tiny$n+2$}; |
|
328 |
\node[state,accepting] (Q_8) [right=of Q_7] {\tiny$n+3$}; |
|
329 |
||
330 |
\path[->] (Q_0) edge [loop above] node {$*$} (); |
|
331 |
\path[->] (Q_0) edge node [above] {$a$} (Q_1); |
|
332 |
\path[->] (Q_1) edge node [above] {$*$} (Q_2); |
|
333 |
\path[->] (Q_2) edge node [above] {$*$} (Q_3); |
|
334 |
\path[->] (Q_4) edge node [above] {$*$} (Q_5); |
|
335 |
\path[->] (Q_5) edge node [above] {$*$} (Q_6); |
|
336 |
\path[->] (Q_6) edge node [above] {$b$} (Q_7); |
|
337 |
\path[->] (Q_7) edge node [above] {$c$} (Q_8); |
|
338 |
||
339 |
\draw [decorate] ([yshift=-5mm]Q_1.east) --node[below=3mm]{$n$} ([yshift=-5mm]Q_6.west); |
|
340 |
\end{tikzpicture}\bigskip |
|
341 |
||
342 |
||
343 |
{\small Note the star-transitions: accept any character.} |
|
344 |
||
345 |
\end{frame} |
|
346 |
||
347 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
348 |
\begin{frame}[c] |
|
515 | 349 |
\frametitle{Two Epsilon NFA Examples} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
350 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
351 |
\small |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
352 |
\begin{center} |
143
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
353 |
\begin{tabular}[t]{c@{\hspace{9mm}}c} |
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
354 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, |
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
355 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
215
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
356 |
\node[state,initial] (q_0) {$q_0$}; |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
357 |
\node[state] (q_1) [above=of q_0] {$q_1$}; |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
358 |
\node[state, accepting] (q_2) [below=of q_0] {$q_2$}; |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
359 |
\path[->] (q_0) edge node [left] {\alert{$\epsilon$}} (q_1); |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
360 |
\path[->] (q_0) edge node [left] {\alert{$\epsilon$}} (q_2); |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
361 |
\path[->] (q_0) edge [loop right] node {\alert{$a$}} (); |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
362 |
\path[->] (q_1) edge [loop above] node {\alert{$a$}} (); |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
363 |
\path[->] (q_2) edge [loop below] node {\alert{$b$}} (); |
143
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
364 |
\end{tikzpicture} & |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
365 |
|
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
366 |
\raisebox{20mm}{ |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
367 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
368 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
369 |
\node[state,initial] (r_1) {$r_1$}; |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
370 |
\node[state] (r_2) [above=of r_1] {$r_2$}; |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
371 |
\node[state, accepting] (r_3) [right=of r_1] {$r_3$}; |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
372 |
\path[->] (r_1) edge node [below] {\alert{$b$}} (r_3); |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
373 |
\path[->] (r_2) edge [bend left] node [above] {\alert{$a$}} (r_3); |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
374 |
\path[->] (r_1) edge [bend left] node [left] {\alert{$\epsilon$}} (r_2); |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
375 |
\path[->] (r_2) edge [bend left] node [right] {\alert{$a$}} (r_1); |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
376 |
\end{tikzpicture}} |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
377 |
\end{tabular} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
378 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
379 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
380 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
381 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
382 |
|
515 | 383 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
384 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
385 |
\begin{frame}[c] |
779 | 386 |
\frametitle{Thompson: Rexp to $\epsilon$NFA} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
387 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
388 |
\begin{center} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
389 |
\begin{tabular}[t]{l@{\hspace{10mm}}l} |
445 | 390 |
\raisebox{1mm}{\bl{$\ZERO$}} & |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
391 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 392 |
\node[state, initial] (Q_0) {$\mbox{}$}; |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
393 |
\end{tikzpicture}\\\\ |
445 | 394 |
\raisebox{1mm}{\bl{$\ONE$}} & |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
395 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 396 |
\node[state, initial, accepting] (Q_0) {$\mbox{}$}; |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
397 |
\end{tikzpicture}\\\\ |
651 | 398 |
\raisebox{5mm}{\bl{$c$}} & |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
399 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 400 |
\node[state, initial] (Q_0) {$\mbox{}$}; |
401 |
\node[state, accepting] (Q_1) [right=of Q_0] {$\mbox{}$}; |
|
402 |
\path[->] (Q_0) edge node [below] {\alert{$c$}} (Q_1); |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
403 |
\end{tikzpicture}\\\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
404 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
405 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
406 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
407 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
408 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
409 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
410 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
411 |
\begin{frame}[t] |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
412 |
\frametitle{Case $r_1\cdot r_2$} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
413 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
414 |
\mbox{}\bigskip |
515 | 415 |
\onslide<1->{By recursion we are given two automata:\bigskip} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
416 |
|
515 | 417 |
{\centering% |
418 |
\only<1>{% |
|
419 |
\begin{tikzpicture}[node distance=3mm, |
|
420 |
>=stealth',very thick, |
|
421 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}] |
|
422 |
\node[state, initial] (Q_0) {$\mbox{}$}; |
|
423 |
\node[state, initial] (Q_01) [below=1mm of Q_0] {$\mbox{}$}; |
|
424 |
\node[state, initial] (Q_02) [above=1mm of Q_0] {$\mbox{}$}; |
|
425 |
\node (R_1) [right=of Q_0] {$\ldots$}; |
|
426 |
\node[state, accepting] (T_1) [right=of R_1] {$\mbox{}$}; |
|
427 |
\node[state, accepting] (T_2) [above=of T_1] {$\mbox{}$}; |
|
428 |
\node[state, accepting] (T_3) [below=of T_1] {$\mbox{}$}; |
|
429 |
||
430 |
\node (A_0) [right=2.5cm of T_1] {$\mbox{}$}; |
|
431 |
\node[state, initial] (A_01) [above=1mm of A_0] {$\mbox{}$}; |
|
432 |
\node[state, initial] (A_02) [below=1mm of A_0] {$\mbox{}$}; |
|
433 |
||
434 |
\node (b_1) [right=of A_0] {$\ldots$}; |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
435 |
\node[state, accepting] (c_1) [right=of b_1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
436 |
\node[state, accepting] (c_2) [above=of c_1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
437 |
\node[state, accepting] (c_3) [below=of c_1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
438 |
\begin{pgfonlayer}{background} |
515 | 439 |
\node (1) [rounded corners, inner sep=1mm, thick, |
440 |
draw=black!60, fill=black!20, fit= (Q_0) (R_1) (T_1) (T_2) (T_3)] {}; |
|
441 |
\node (2) [rounded corners, inner sep=1mm, thick, |
|
442 |
draw=black!60, fill=black!20, fit= (A_0) (b_1) (c_1) (c_2) (c_3)] {}; |
|
443 |
\node [yshift=2mm] at (1.north) {$r_1$}; |
|
444 |
\node [yshift=2mm] at (2.north) {$r_2$}; |
|
143
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
445 |
\end{pgfonlayer} |
515 | 446 |
\end{tikzpicture}} |
447 |
\only<2>{% |
|
448 |
\begin{tikzpicture}[node distance=3mm, |
|
449 |
>=stealth',very thick, |
|
450 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
|
451 |
\node[state, initial] (Q_0) {$\mbox{}$}; |
|
452 |
\node[state, initial] (Q_01) [below=1mm of Q_0] {$\mbox{}$}; |
|
453 |
\node[state, initial] (Q_02) [above=1mm of Q_0] {$\mbox{}$}; |
|
454 |
\node (r_1) [right=of Q_0] {$\ldots$}; |
|
455 |
\node[state] (t_1) [right=of r_1] {$\mbox{}$}; |
|
456 |
\node[state] (t_2) [above=of t_1] {$\mbox{}$}; |
|
457 |
\node[state] (t_3) [below=of t_1] {$\mbox{}$}; |
|
458 |
||
459 |
\node (A_0) [right=2.5cm of t_1] {$\mbox{}$}; |
|
460 |
\node[state] (A_01) [above=1mm of A_0] {$\mbox{}$}; |
|
461 |
\node[state] (A_02) [below=1mm of A_0] {$\mbox{}$}; |
|
462 |
||
463 |
\node (b_1) [right=of A_0] {$\ldots$}; |
|
464 |
\node[state, accepting] (c_1) [right=of b_1] {$\mbox{}$}; |
|
465 |
\node[state, accepting] (c_2) [above=of c_1] {$\mbox{}$}; |
|
466 |
\node[state, accepting] (c_3) [below=of c_1] {$\mbox{}$}; |
|
467 |
\path[->] (t_1) edge (A_01); |
|
468 |
\path[->] (t_2) edge node [above] {$\epsilon$s} (A_01); |
|
469 |
\path[->] (t_3) edge (A_01); |
|
470 |
\path[->] (t_1) edge (A_02); |
|
471 |
\path[->] (t_2) edge (A_02); |
|
472 |
\path[->] (t_3) edge node [below] {$\epsilon$s} (A_02); |
|
473 |
||
474 |
\begin{pgfonlayer}{background} |
|
475 |
\node (3) [rounded corners, inner sep=1mm, thick, |
|
476 |
draw=black!60, fill=black!20, fit= (Q_0) (c_1) (c_2) (c_3)] {}; |
|
477 |
\node [yshift=2mm] at (3.north) {$r_1\cdot r_2$}; |
|
478 |
\end{pgfonlayer} |
|
479 |
\end{tikzpicture}} |
|
480 |
% |
|
481 |
}\bigskip\bigskip |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
482 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
483 |
\small |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
484 |
We need to (1) change the accepting nodes of the first automaton into non-accepting nodes, and (2) connect them |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
485 |
via $\epsilon$-transitions to the starting state of the second automaton. |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
486 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
487 |
\end{frame} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
488 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
489 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
490 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
491 |
\begin{frame}[t] |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
492 |
\frametitle{Case $r_1+ r_2$} |
515 | 493 |
\mbox{}\\[-8mm] |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
494 |
|
515 | 495 |
\onslide<1->{By recursion we are given two automata:\smallskip} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
496 |
|
515 | 497 |
\hspace{2cm} |
498 |
\only<1>{% |
|
499 |
\begin{tikzpicture}[node distance=3mm, |
|
500 |
>=stealth',very thick, |
|
501 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
|
502 |
baseline=(current bounding box.center)] |
|
503 |
\node at (0,0) (1) {$\mbox{}$}; |
|
504 |
\node (2) [above=14mm of 1] {}; |
|
505 |
\node[state, initial] (4) [above=1mm of 2] {$\mbox{}$}; |
|
506 |
\node[state, initial] (5) [below=1mm of 2] {$\mbox{}$}; |
|
507 |
\node[state, initial] (3) [below=10mm of 1] {$\mbox{}$}; |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
508 |
|
515 | 509 |
\node (a) [right=of 2] {$\ldots\,$}; |
510 |
\node (a1) [right=of a] {$$}; |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
511 |
\node[state, accepting] (a2) [above=of a1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
512 |
\node[state, accepting] (a3) [below=of a1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
513 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
514 |
\node (b) [right=of 3] {$\ldots$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
515 |
\node[state, accepting] (b1) [right=of b] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
516 |
\node[state, accepting] (b2) [above=of b1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
517 |
\node[state, accepting] (b3) [below=of b1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
518 |
\begin{pgfonlayer}{background} |
515 | 519 |
\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {}; |
520 |
\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (3) (b1) (b2) (b3)] {}; |
|
521 |
\node [yshift=3mm] at (1.north) {$r_1$}; |
|
522 |
\node [yshift=3mm] at (2.north) {$r_2$}; |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
523 |
\end{pgfonlayer} |
515 | 524 |
\end{tikzpicture}} |
525 |
\only<2>{% |
|
526 |
\begin{tikzpicture}[node distance=3mm, |
|
527 |
>=stealth',very thick, |
|
528 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
|
529 |
baseline=(current bounding box.center)] |
|
530 |
\node at (0,0) (1) {$\mbox{}$}; |
|
531 |
\node (2) [above=14mm of 1] {$$}; |
|
532 |
\node[state, initial] (4) [above=1mm of 2] {$\mbox{}$}; |
|
533 |
\node[state, initial] (5) [below=1mm of 2] {$\mbox{}$}; |
|
534 |
\node[state, initial] (3) [below=10mm of 1] {$\mbox{}$}; |
|
535 |
||
536 |
\node (a) [right=of 2] {$\ldots\,$}; |
|
537 |
\node (a1) [right=of a] {$$}; |
|
538 |
\node[state, accepting] (a2) [above=of a1] {$\mbox{}$}; |
|
539 |
\node[state, accepting] (a3) [below=of a1] {$\mbox{}$}; |
|
540 |
||
541 |
\node (b) [right=of 3] {$\ldots$}; |
|
542 |
\node[state, accepting] (b1) [right=of b] {$\mbox{}$}; |
|
543 |
\node[state, accepting] (b2) [above=of b1] {$\mbox{}$}; |
|
544 |
\node[state, accepting] (b3) [below=of b1] {$\mbox{}$}; |
|
545 |
||
546 |
%\path[->] (1) edge node [above] {$\epsilon$} (2); |
|
547 |
%\path[->] (1) edge node [below] {$\epsilon$} (3); |
|
548 |
||
549 |
\begin{pgfonlayer}{background} |
|
550 |
\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3) (b2) (b3)] {}; |
|
551 |
\node [yshift=3mm] at (3.north) {$r_1+ r_2$}; |
|
552 |
\end{pgfonlayer} |
|
553 |
\end{tikzpicture}} |
|
554 |
% |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
555 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
556 |
\small |
515 | 557 |
\mbox{}\\\medskip |
517 | 558 |
We can just put both automata together. |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
559 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
560 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
561 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
562 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
563 |
\begin{frame}[c] |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
564 |
\frametitle{Case $r^*$} |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
565 |
|
515 | 566 |
\onslide<1->{By recursion we are given an automaton for $r$:\smallskip} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
567 |
|
515 | 568 |
\hspace{2cm} |
569 |
\only<1>{\begin{tikzpicture}[node distance=3mm, |
|
570 |
>=stealth',very thick, |
|
571 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
|
572 |
baseline=(current bounding box.north)] |
|
573 |
\node (2) {$\mbox{}$}; |
|
574 |
\node[state, initial] (4) [above=1mm of 2] {$\mbox{}$}; |
|
575 |
\node[state, initial] (5) [below=1mm of 2] {$\mbox{}$}; |
|
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
576 |
\node (a) [right=of 2] {$\ldots$}; |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
577 |
\node[state, accepting] (a1) [right=of a] {$\mbox{}$}; |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
578 |
\node[state, accepting] (a2) [above=of a1] {$\mbox{}$}; |
515 | 579 |
\node[state, accepting] (a3) [below=of a1] {$\mbox{}$}; |
580 |
\begin{pgfonlayer}{background} |
|
581 |
\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {}; |
|
582 |
\node [yshift=3mm] at (1.north) {$r$}; |
|
583 |
\end{pgfonlayer} |
|
584 |
\end{tikzpicture}} |
|
585 |
\only<2->{\begin{tikzpicture}[node distance=3mm, |
|
586 |
>=stealth',very thick, |
|
587 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
|
588 |
baseline=(current bounding box.north)] |
|
589 |
\node at (0,0) [state, initial,accepting] (1) {$\mbox{}$}; |
|
590 |
\node (2) [right=16mm of 1] {$\mbox{}$}; |
|
591 |
\node[state] (4) [above=1mm of 2] {$\mbox{}$}; |
|
592 |
\node[state] (5) [below=1mm of 2] {$\mbox{}$}; |
|
593 |
\node (a) [right=of 2] {$\ldots$}; |
|
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
594 |
\node[state] (a1) [right=of a] {$\mbox{}$}; |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
595 |
\node[state] (a2) [above=of a1] {$\mbox{}$}; |
515 | 596 |
\node[state] (a3) [below=of a1] {$\mbox{}$}; |
597 |
\path[->] (1) edge node [below] {$\epsilon$} (4); |
|
598 |
\path[->] (1) edge node [below] {$\epsilon$} (5); |
|
599 |
\path[->] (a1) edge [bend left=45] node [below] {$\epsilon$} (1); |
|
600 |
\path[->] (a2) edge [bend right] node [below] {$\epsilon$} (1); |
|
601 |
\path[->] (a3) edge [bend left=45] node [below] {$\epsilon$} (1); |
|
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
602 |
\begin{pgfonlayer}{background} |
515 | 603 |
\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3)] {}; |
604 |
\node [yshift=3mm] at (2.north) {$r^*$}; |
|
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
605 |
\end{pgfonlayer} |
515 | 606 |
\end{tikzpicture}} |
607 |
\bigskip |
|
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
608 |
|
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
609 |
\onslide<3->{ |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
610 |
Why can't we just have an epsilon transition from the accepting states to the starting state?} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
611 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
612 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
613 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
614 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
615 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
616 |
\begin{frame}[c] |
779 | 617 |
\frametitle{\mbox{NFA Breadth-First: \boldmath{}$a^{?\{n\}}\!\cdot\! a^{\{n\}}$}} |
618 |
||
619 |
\begin{tikzpicture} |
|
620 |
\begin{axis}[xlabel={\pcode{a}s}, |
|
621 |
ylabel={time in secs}, |
|
622 |
enlargelimits=false, |
|
623 |
xtick={0,5,...,30}, |
|
624 |
xmax=30, |
|
625 |
ymax=35, |
|
626 |
ytick={0,5,...,30}, |
|
627 |
scaled ticks=false, |
|
628 |
axis lines=left, |
|
629 |
width=9cm, |
|
630 |
height=6cm, |
|
631 |
legend entries={Python,Ruby,my NFA}, |
|
632 |
legend pos=outer north east, |
|
633 |
legend cell align=left] |
|
634 |
\addplot[blue,mark=*, mark options={fill=white}] table {re-python.data}; |
|
635 |
\addplot[brown,mark=pentagon*, mark options={fill=white}] table {re-ruby.data}; |
|
636 |
\addplot[red,mark=triangle*, mark options={fill=red}] table {nfabreadth.data}; |
|
637 |
\end{axis} |
|
638 |
\end{tikzpicture} |
|
639 |
||
640 |
\end{frame} |
|
641 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
642 |
||
643 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
644 |
\begin{frame}[c] |
|
645 |
\frametitle{NFA Breadth-First:\boldmath{}$(a^*)^* \cdot b$} |
|
646 |
||
647 |
\bigskip |
|
648 |
\begin{center} |
|
649 |
\begin{tikzpicture} |
|
650 |
\begin{axis}[ |
|
651 |
xlabel={\pcode{a}s}, |
|
652 |
%%x label style={at={(1.05,0.0)}}, |
|
653 |
ylabel={time in secs}, |
|
654 |
enlargelimits=false, |
|
655 |
xtick={0,10,...,100}, |
|
656 |
xmax=103, |
|
657 |
ymax=35, |
|
658 |
ytick={0,5,...,30}, |
|
659 |
scaled ticks=false, |
|
660 |
axis lines=left, |
|
661 |
width=9cm, |
|
662 |
height=6cm, |
|
663 |
legend entries={Java 8,Python,JavaScript,Swift,Dart,my NFA}, |
|
664 |
legend pos=outer north east, |
|
665 |
legend cell align=left] |
|
666 |
\addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data}; |
|
667 |
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data}; |
|
668 |
\addplot[red,mark=*, mark options={fill=white}] table {re-js.data}; |
|
669 |
\addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data}; |
|
670 |
\addplot[brown,mark=*, mark options={fill=white}] table {re-dart.data}; |
|
671 |
||
672 |
\addplot[red,mark=triangle*, mark options={fill=red}] table {nfabreadth2.data}; |
|
673 |
\end{axis} |
|
674 |
\end{tikzpicture} |
|
675 |
\end{center} |
|
676 |
||
677 |
||
678 |
\end{frame} |
|
679 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
680 |
||
681 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
682 |
\begin{frame}[c] |
|
683 |
\frametitle{NFA Depth-First: \boldmath$a^{?\{n\}} \cdot a^{\{n\}}$} |
|
684 |
||
685 |
\begin{tikzpicture} |
|
686 |
\begin{axis}[xlabel={\pcode{a}s}, |
|
687 |
ylabel={time in secs}, |
|
688 |
enlargelimits=false, |
|
689 |
xtick={0,5,...,30}, |
|
690 |
xmax=30, |
|
691 |
ymax=35, |
|
692 |
ytick={0,5,...,30}, |
|
693 |
scaled ticks=false, |
|
694 |
axis lines=left, |
|
695 |
width=9cm, |
|
696 |
height=6cm, |
|
697 |
legend entries={Python,Ruby,my NFA}, |
|
698 |
legend pos=outer north east, |
|
699 |
legend cell align=left] |
|
700 |
\addplot[blue,mark=*, mark options={fill=white}] table {re-python.data}; |
|
701 |
\addplot[brown,mark=pentagon*, mark options={fill=white}] table {re-ruby.data}; |
|
702 |
\addplot[red,mark=triangle*, mark options={fill=red}] table {nfadepth.data}; |
|
703 |
\end{axis} |
|
704 |
\end{tikzpicture} |
|
705 |
||
706 |
\end{frame} |
|
707 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
708 |
||
709 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
710 |
\begin{frame}[c] |
|
711 |
\frametitle{NFA Depth-First: \boldmath$(a^*)^* \cdot b$} |
|
712 |
||
713 |
\bigskip |
|
714 |
\begin{center} |
|
715 |
\begin{tikzpicture} |
|
716 |
\begin{axis}[ |
|
717 |
xlabel={\pcode{a}s}, |
|
718 |
%%x label style={at={(1.05,0.0)}}, |
|
719 |
ylabel={time in secs}, |
|
720 |
enlargelimits=false, |
|
721 |
xtick={0,15,...,30}, |
|
722 |
xmax=33, |
|
723 |
ymax=35, |
|
724 |
ytick={0,5,...,30}, |
|
725 |
scaled ticks=false, |
|
726 |
axis lines=left, |
|
727 |
width=9cm, |
|
728 |
height=6cm, |
|
729 |
legend entries={Java 8,Python,JavaScript,Swift,Dart,my NFA}, |
|
730 |
legend pos=outer north east, |
|
731 |
legend cell align=left] |
|
732 |
\addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data}; |
|
733 |
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data}; |
|
734 |
\addplot[red,mark=*, mark options={fill=white}] table {re-js.data}; |
|
735 |
\addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data}; |
|
736 |
\addplot[brown,mark=*, mark options={fill=white}] table {re-dart.data}; |
|
737 |
||
738 |
\addplot[red,mark=triangle*, mark options={fill=red}] table {nfadepth2.data}; |
|
739 |
\end{axis} |
|
740 |
\end{tikzpicture} |
|
741 |
\end{center} |
|
742 |
||
743 |
The punchline is that many existing libraries do depth-first search |
|
744 |
in NFAs (with backtracking). |
|
745 |
||
746 |
\end{frame} |
|
747 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
748 |
||
782 | 749 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
750 |
\begin{frame}[c] |
|
751 |
\frametitle{Subset Construction} |
|
752 |
||
753 |
||
754 |
\begin{textblock}{5}(1,3.5) |
|
755 |
\begin{center} |
|
756 |
\begin{tikzpicture}[node distance=6mm,scale=0.7,>=stealth',very thick, |
|
757 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
|
758 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
|
759 |
\node[state] (Q_1) [below=of Q_0] {$\mbox{Q}_1$}; |
|
760 |
\node[state, accepting] (Q_2) [below=of Q_1] {$\mbox{Q}_2$}; |
|
761 |
||
762 |
\path[->] (Q_0) edge node [left] {\alert{$1$}} (Q_1); |
|
763 |
\path[->] (Q_1) edge node [left] {\alert{$0,1$}} (Q_2); |
|
764 |
\path[->] (Q_0) edge [loop right] node {\alert{$0,1$}} (); |
|
765 |
%\path[->] (Q_1) edge [loop above] node {\alert{$a$}} (); |
|
766 |
%\path[->] (Q_2) edge [loop below] node {\alert{$b$}} (); |
|
767 |
\end{tikzpicture} |
|
768 |
\end{center} |
|
769 |
\end{textblock} |
|
770 |
||
771 |
\begin{textblock}{11}(6.5,4) |
|
772 |
\begin{tabular}{r|cl} |
|
773 |
nodes \textcolor{white}{*} & $0$ & $1$\\ |
|
774 |
\hline |
|
775 |
$\{\}$ \textcolor{white}{*} & \onslide<2->{$\{\}$} & \onslide<2->{$\{\}$}\\ |
|
776 |
\onslide<5->{s:} $\{0\}$ \textcolor{white}{*} & \onslide<3->{$\{0\}$} & \onslide<3->{$\{0,1\}$}\\ |
|
777 |
$\{1\}$ \textcolor{white}{*} & \onslide<3->{$\{2\}$} & \onslide<3->{$\{2\}$}\\ |
|
778 |
$\{2\}$ \onslide<5->{*} & \onslide<3->{$\{\}$} & \onslide<3->{$\{\}$}\\ |
|
779 |
$\{0,1\}$ \textcolor{white}{*} &\onslide<4->{$\{0,2\}$} & \onslide<4->{$\{0,1,2\}$}\\ |
|
780 |
$\{0,2\}$ \onslide<5->{*} &\onslide<4->{$\{0\}$} & \onslide<4->{$\{0,1\}$}\\ |
|
781 |
$\{1,2\}$ \onslide<5->{*} & \onslide<4->{$\{2\}$} & \onslide<4->{$\{2\}$}\\ |
|
782 |
$\{0,1,2\}$ \onslide<5->{*}& \onslide<4->{$\{0,2\}$} & \onslide<4->{$\{0,1,2\}$}\\ |
|
783 |
\end{tabular} |
|
784 |
\end{textblock} |
|
785 |
||
786 |
\end{frame} |
|
787 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
779 | 788 |
|
782 | 789 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
790 |
\begin{frame}[c] |
|
791 |
\frametitle{The Result} |
|
792 |
||
793 |
\footnotesize |
|
794 |
\begin{center} |
|
795 |
\begin{tikzpicture}[scale=0.5,>=stealth',very thick, |
|
796 |
every state/.style={minimum size=0pt, |
|
797 |
draw=blue!50,very thick,fill=blue!20}, |
|
798 |
baseline=0mm] |
|
799 |
\node[state,initial] (q0) {$\{0\}$}; |
|
800 |
\node[state] (q01) [right=of q0] {$\{0,1\}$}; |
|
801 |
\node[state,accepting] (q12) [above=of q01] {$\{1,2\}$}; |
|
802 |
\node[state,accepting] (q02) [below=of q01] {$\{0,2\}$}; |
|
803 |
\node[state] (q1) [right=2cm of q12] {$\{1\}$}; |
|
804 |
\node[state,accepting] (q2) [right=2.5cm of q01] {$\{2\}$}; |
|
805 |
\node[state,accepting] (q012) [right=1.5cm of q02] {$\{0,1,2\}$}; |
|
806 |
\node[state] (Qn) [right=of q2] {$\{\}$}; |
|
807 |
||
808 |
\path[->] (q0) edge [loop above] node {\alert{$0$}} (); |
|
809 |
\path[->] (q0) edge node [above] {\alert{$1$}} (q01); |
|
810 |
\path[->] (q02) edge [bend left] node [left] {\alert{$1$}} (q01); |
|
811 |
\path[->] (q02) edge node [below] {\alert{$0$}} (q0); |
|
812 |
\path[->] (q01) edge node [above] {\alert{$1$}} (q012); |
|
813 |
\path[->] (q01) edge [bend left] node [right] {\alert{$0$}} (q02); |
|
814 |
\path[->] (q12) edge node [below] {\alert{$0,1$}} (q2); |
|
815 |
\path[->] (q1) edge node [right] {\alert{$0,1$}} (q2); |
|
816 |
\path[->] (q2) edge node [above] {\alert{$0,1$}} (Qn); |
|
817 |
\path[->] (q012) edge [loop right] node {\alert{$1$}} (); |
|
818 |
\path[->] (q012) edge node [below] {\alert{$0$}} (q02); |
|
819 |
\path[->] (Qn) edge [loop above] node {$\alert{0},\alert{1}$} (); |
|
820 |
\end{tikzpicture} |
|
821 |
\end{center} |
|
822 |
||
823 |
||
824 |
\end{frame} |
|
825 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
826 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
827 |
\begin{frame}[c] |
|
828 |
\frametitle{Removing Dead States} |
|
829 |
||
830 |
\footnotesize |
|
831 |
\begin{center} |
|
832 |
\begin{tabular}{ll} |
|
833 |
\large DFA: & \large (original) NFA:\\ |
|
834 |
\raisebox{0mm}{% |
|
835 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, |
|
836 |
every state/.style={minimum size=0pt, |
|
837 |
draw=blue!50,very thick,fill=blue!20}] |
|
838 |
\node[state,initial] (q0) {$\{0\}$}; |
|
839 |
\node[state] (q01) [right=of q0] {$\{0,1\}$}; |
|
840 |
\node[state,accepting] (q02) [below=of q01] {$\{0,2\}$}; |
|
841 |
\node[state,accepting] (q012) [right=1.5cm of q02] {$\{0,1,2\}$}; |
|
842 |
||
843 |
\path[->] (q0) edge [loop above] node {\alert{$0$}} (); |
|
844 |
\path[->] (q0) edge node [above] {\alert{$1$}} (q01); |
|
845 |
\path[->] (q02) edge [bend left] node [left] {\alert{$1$}} (q01); |
|
846 |
\path[->] (q02) edge node [below] {\alert{$0$}} (q0); |
|
847 |
\path[->] (q01) edge node [above] {\alert{$1$}} (q012); |
|
848 |
\path[->] (q01) edge [bend left] node [right] {\alert{$0$}} (q02); |
|
849 |
\path[->] (q012) edge [loop right] node {\alert{$1$}} (); |
|
850 |
\path[->] (q012) edge node [below] {\alert{$0$}} (q02); |
|
851 |
\end{tikzpicture}} |
|
852 |
& |
|
853 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, |
|
854 |
every state/.style={minimum size=0pt, |
|
855 |
draw=blue!50,very thick,fill=blue!20},] |
|
856 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
|
857 |
\node[state] (Q_1) [below=of Q_0] {$\mbox{Q}_1$}; |
|
858 |
\node[state, accepting] (Q_2) [below=of Q_1] {$\mbox{Q}_2$}; |
|
859 |
||
860 |
\path[->] (Q_0) edge node [left] {\alert{$1$}} (Q_1); |
|
861 |
\path[->] (Q_1) edge node [left] {\alert{$0,1$}} (Q_2); |
|
862 |
\path[->] (Q_0) edge [loop right] node {\alert{$0,1$}} (); |
|
863 |
\end{tikzpicture} |
|
864 |
\end{tabular} |
|
865 |
\end{center} |
|
866 |
||
867 |
\end{frame} |
|
868 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
779 | 869 |
|
870 |
||
871 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
872 |
\begin{frame}[c] |
|
782 | 873 |
\frametitle{Subset Construction ($\epsilon$NFA)} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
874 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
875 |
|
662 | 876 |
\begin{textblock}{5}(1,1.5) |
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
877 |
\begin{center} |
515 | 878 |
\begin{tikzpicture}[node distance=6mm,scale=0.7,>=stealth',very thick, |
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
879 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 880 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
881 |
\node[state] (Q_1) [above=of Q_0] {$\mbox{Q}_1$}; |
|
882 |
\node[state, accepting] (Q_2) [below=of Q_0] {$\mbox{Q}_2$}; |
|
883 |
\path[->] (Q_0) edge node [left] {\alert{$\epsilon$}} (Q_1); |
|
884 |
\path[->] (Q_0) edge node [left] {\alert{$\epsilon$}} (Q_2); |
|
885 |
\path[->] (Q_0) edge [loop right] node {\alert{$a$}} (); |
|
886 |
\path[->] (Q_1) edge [loop above] node {\alert{$a$}} (); |
|
887 |
\path[->] (Q_2) edge [loop below] node {\alert{$b$}} (); |
|
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
888 |
\end{tikzpicture} |
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
889 |
\end{center} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
890 |
\end{textblock} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
891 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
892 |
\begin{textblock}{11}(6.5,4.5) |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
893 |
\begin{tabular}{r|cl} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
894 |
nodes \textcolor{white}{*} & $a$ & $b$\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
895 |
\hline |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
896 |
$\{\}$ \textcolor{white}{*} & \onslide<2->{$\{\}$} & \onslide<2->{$\{\}$}\\ |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
897 |
$\{0\}$ \textcolor{white}{*} & \onslide<3->{$\{0,1,2\}$} & \onslide<3->{$\{2\}$}\\ |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
898 |
$\{1\}$ \textcolor{white}{*} & \onslide<3->{$\{1\}$} & \onslide<3->{$\{\}$}\\ |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
899 |
$\{2\}$ \onslide<5->{*} & \onslide<3->{$\{\}$} & \onslide<3->{$\{2\}$}\\ |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
900 |
$\{0,1\}$ \textcolor{white}{*} &\onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\ |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
901 |
$\{0,2\}$ \onslide<5->{*} &\onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\ |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
902 |
$\{1,2\}$ \onslide<5->{*} & \onslide<4->{$\{1\}$} & \onslide<4->{$\{2\}$}\\ |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
903 |
\onslide<5->{s:} $\{0,1,2\}$ \onslide<5->{*}& \onslide<4->{$\{0,1,2\}$} & \onslide<4->{$\{2\}$}\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
904 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
905 |
\end{textblock} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
906 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
907 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
908 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
909 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
910 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
911 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
912 |
\frametitle{The Result} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
913 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
914 |
\footnotesize |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
915 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
916 |
\begin{tikzpicture}[scale=0.5,>=stealth',very thick, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
917 |
every state/.style={minimum size=0pt, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
918 |
draw=blue!50,very thick,fill=blue!20}, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
919 |
baseline=0mm] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
920 |
\node[state,initial,accepting] (q012) {$\{0,1,2\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
921 |
\node[state,accepting] (q02) [right=of q012] {$\{0,2\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
922 |
\node[state] (q01) [above=of q02] {$\{0,1\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
923 |
\node[state,accepting] (q12) [below=of q02] {$\{1,2\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
924 |
\node[state] (q0) [right=2cm of q01] {$\{0\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
925 |
\node[state] (q1) [right=2.5cm of q02] {$\{1\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
926 |
\node[state,accepting] (q2) [right=1.5cm of q12] {$\{2\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
927 |
\node[state] (qn) [right=of q1] {$\{\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
928 |
|
348
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
929 |
\path[->] (q012) edge [loop below] node {\alert{$a$}} (); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
930 |
\path[->] (q012) edge node [above] {\alert{$b$}} (q2); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
931 |
\path[->] (q12) edge [bend left] node [below,pos=0.4] {\alert{$a$}} (q1); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
932 |
\path[->] (q12) edge node [below] {\alert{$b$}} (q2); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
933 |
\path[->] (q02) edge node [above] {\alert{$a$}} (q012); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
934 |
\path[->] (q02) edge [bend left] node [above, pos=0.8] {\alert{$b$}} (q2); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
935 |
\path[->] (q01) edge node [below] {\alert{$a$}} (q012); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
936 |
\path[->] (q01) edge [bend left] node [above] {\alert{$b$}} (q2); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
937 |
\path[->] (q0) edge node [below] {\alert{$a$}} (q012); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
938 |
\path[->] (q0) edge node [right, pos=0.2] {\alert{$b$}} (q2); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
939 |
\path[->] (q1) edge [loop above] node {\alert{$a$}} (); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
940 |
\path[->] (q1) edge node [above] {\alert{$b$}} (qn); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
941 |
\path[->] (q2) edge [loop right] node {\alert{$b$}} (); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
942 |
\path[->] (q2) edge node [below] {\alert{$a$}} (qn); |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
943 |
\path[->] (qn) edge [loop above] node {$\alert{a},\alert{b}$} (); |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
944 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
945 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
946 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
947 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
948 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
949 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
950 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
951 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
952 |
\begin{frame}[c] |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
953 |
\frametitle{Removing Dead States} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
954 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
955 |
\footnotesize |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
956 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
957 |
\begin{tabular}{ll} |
445 | 958 |
DFA: & (original) NFA:\\ |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
959 |
\raisebox{10mm}{% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
960 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
961 |
every state/.style={minimum size=0pt, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
962 |
draw=blue!50,very thick,fill=blue!20}] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
963 |
\node[state,initial,accepting] (q012) {$\{0,1,2\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
964 |
\node[state,accepting] (q2) [right=of q012] {$\{2\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
965 |
\node[state] (qn) [right=of q2] {$\{\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
966 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
967 |
\path[->] (q012) edge [loop below] node {\alert{$a$}} (); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
968 |
\path[->] (q012) edge node [above] {\alert{$b$}} (q2); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
969 |
\path[->] (q2) edge [loop below] node {\alert{$b$}} (); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
970 |
\path[->] (q2) edge node [below] {\alert{$a$}} (qn); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
971 |
\path[->] (qn) edge [loop above] node |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
972 |
{$\alert{a},\alert{b}$} (); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
973 |
\end{tikzpicture}} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
974 |
& |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
975 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
976 |
every state/.style={minimum size=0pt, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
977 |
draw=blue!50,very thick,fill=blue!20},] |
515 | 978 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
979 |
\node[state] (Q_1) [above=of Q_0] {$\mbox{Q}_1$}; |
|
980 |
\node[state, accepting] (Q_2) [below=of Q_0] {$\mbox{Q}_2$}; |
|
981 |
\path[->] (Q_0) edge node [left] {\alert{$\epsilon$}} (Q_1); |
|
982 |
\path[->] (Q_0) edge node [left] {\alert{$\epsilon$}} (Q_2); |
|
983 |
\path[->] (Q_0) edge [loop right] node {\alert{$a$}} (); |
|
984 |
\path[->] (Q_1) edge [loop above] node {\alert{$a$}} (); |
|
985 |
\path[->] (Q_2) edge [loop below] node {\alert{$b$}} (); |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
986 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
987 |
\end{tabular} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
988 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
989 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
990 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
991 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
992 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
993 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
994 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
995 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
996 |
\begin{frame}[c] |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
997 |
\frametitle{Regexps and Automata} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
998 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
999 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1000 |
\begin{tikzpicture} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1001 |
\node (rexp) {\bl{\bf Regexps}}; |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1002 |
\node (nfa) [right=of rexp] {\bl{\bf NFAs}}; |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1003 |
\node (dfa) [right=of nfa] {\bl{\bf DFAs}}; |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1004 |
\onslide<2->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1005 |
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa); |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1006 |
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa); |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1007 |
\onslide<2->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1008 |
\end{tikzpicture}\\ |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1009 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1010 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1011 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1012 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1013 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1014 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1015 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1016 |
\frametitle{DFA Minimisation} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1017 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1018 |
\begin{enumerate} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1019 |
\item Take all pairs \bl{$(q, p)$} with \bl{$q \not= p$} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1020 |
\item Mark all pairs that accepting and non-accepting states |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1021 |
\item For all unmarked pairs \bl{$(q, p)$} and all characters \bl{$c$} test whether |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1022 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1023 |
\bl{$(\delta(q, c), \delta(p,c))$} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1024 |
\end{center} |
348
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
1025 |
are marked. If yes in at least one case, then also mark \bl{$(q, p)$}. |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1026 |
\item Repeat last step until no change. |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1027 |
\item All unmarked pairs can be merged. |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1028 |
\end{enumerate} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1029 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1030 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1031 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1032 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1033 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1034 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1035 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1036 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1037 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1038 |
every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 1039 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
1040 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$}; |
|
1041 |
\node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$}; |
|
1042 |
\node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$}; |
|
1043 |
\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$}; |
|
1044 |
\path[->] (Q_0) edge node [above] {\alert{$a$}} (Q_1); |
|
1045 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_4); |
|
1046 |
\path[->] (Q_4) edge [loop right] node {\alert{$a, b$}} (); |
|
1047 |
\path[->] (Q_3) edge node [right] {\alert{$a$}} (Q_4); |
|
1048 |
\path[->] (Q_2) edge node [above] {\alert{$a$}} (Q_3); |
|
1049 |
\path[->] (Q_1) edge node [right] {\alert{$b$}} (Q_2); |
|
1050 |
\path[->] (Q_0) edge node [above] {\alert{$b$}} (Q_2); |
|
1051 |
\path[->] (Q_2) edge [loop left] node {\alert{$b$}} (); |
|
1052 |
\path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (Q_0); |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1053 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1054 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1055 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1056 |
\mbox{}\\[-20mm]\mbox{} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1057 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1058 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1059 |
\begin{tikzpicture}[scale=0.8,line width=0.8mm] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1060 |
\draw (0,0) -- (4,0); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1061 |
\draw (0,1) -- (4,1); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1062 |
\draw (0,2) -- (3,2); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1063 |
\draw (0,3) -- (2,3); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1064 |
\draw (0,4) -- (1,4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1065 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1066 |
\draw (0,0) -- (0, 4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1067 |
\draw (1,0) -- (1, 4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1068 |
\draw (2,0) -- (2, 3); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1069 |
\draw (3,0) -- (3, 2); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1070 |
\draw (4,0) -- (4, 1); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1071 |
|
515 | 1072 |
\draw (0.5,-0.5) node {$\mbox{Q}_0$}; |
1073 |
\draw (1.5,-0.5) node {$\mbox{Q}_1$}; |
|
1074 |
\draw (2.5,-0.5) node {$\mbox{Q}_2$}; |
|
1075 |
\draw (3.5,-0.5) node {$\mbox{Q}_3$}; |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1076 |
|
515 | 1077 |
\draw (-0.5, 3.5) node {$\mbox{Q}_1$}; |
1078 |
\draw (-0.5, 2.5) node {$\mbox{Q}_2$}; |
|
1079 |
\draw (-0.5, 1.5) node {$\mbox{Q}_3$}; |
|
1080 |
\draw (-0.5, 0.5) node {$\mbox{Q}_4$}; |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1081 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1082 |
\draw (0.5,0.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1083 |
\draw (1.5,0.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1084 |
\draw (2.5,0.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1085 |
\draw (3.5,0.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1086 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1087 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1088 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1089 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1090 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1091 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1092 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1093 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1094 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1095 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1096 |
\begin{tabular}{@{\hspace{-8mm}}cc@{}} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1097 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1098 |
every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 1099 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
1100 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$}; |
|
1101 |
\node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$}; |
|
1102 |
\node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$}; |
|
1103 |
\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$}; |
|
1104 |
\path[->] (Q_0) edge node [above] {\alert{$a$}} (Q_1); |
|
1105 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_4); |
|
1106 |
\path[->] (Q_4) edge [loop right] node {\alert{$a, b$}} (); |
|
1107 |
\path[->] (Q_3) edge node [right] {\alert{$a$}} (Q_4); |
|
1108 |
\path[->] (Q_2) edge node [above] {\alert{$a$}} (Q_3); |
|
1109 |
\path[->] (Q_1) edge node [right] {\alert{$b$}} (Q_2); |
|
1110 |
\path[->] (Q_0) edge node [above] {\alert{$b$}} (Q_2); |
|
1111 |
\path[->] (Q_2) edge [loop left] node {\alert{$b$}} (); |
|
1112 |
\path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (Q_0); |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1113 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1114 |
& |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1115 |
\raisebox{9mm}{\begin{tikzpicture}[scale=0.6,line width=0.8mm] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1116 |
\draw (0,0) -- (4,0); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1117 |
\draw (0,1) -- (4,1); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1118 |
\draw (0,2) -- (3,2); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1119 |
\draw (0,3) -- (2,3); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1120 |
\draw (0,4) -- (1,4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1121 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1122 |
\draw (0,0) -- (0, 4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1123 |
\draw (1,0) -- (1, 4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1124 |
\draw (2,0) -- (2, 3); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1125 |
\draw (3,0) -- (3, 2); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1126 |
\draw (4,0) -- (4, 1); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1127 |
|
515 | 1128 |
\draw (0.5,-0.5) node {$\mbox{Q}_0$}; |
1129 |
\draw (1.5,-0.5) node {$\mbox{Q}_1$}; |
|
1130 |
\draw (2.5,-0.5) node {$\mbox{Q}_2$}; |
|
1131 |
\draw (3.5,-0.5) node {$\mbox{Q}_3$}; |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1132 |
|
515 | 1133 |
\draw (-0.5, 3.5) node {$\mbox{Q}_1$}; |
1134 |
\draw (-0.5, 2.5) node {$\mbox{Q}_2$}; |
|
1135 |
\draw (-0.5, 1.5) node {$\mbox{Q}_3$}; |
|
1136 |
\draw (-0.5, 0.5) node {$\mbox{Q}_4$}; |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1137 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1138 |
\draw (0.5,0.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1139 |
\draw (1.5,0.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1140 |
\draw (2.5,0.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1141 |
\draw (3.5,0.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1142 |
\draw (0.5,1.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1143 |
\draw (2.5,1.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1144 |
\draw (0.5,3.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1145 |
\draw (1.5,2.5) node {\large$\star$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1146 |
\end{tikzpicture}} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1147 |
\end{tabular} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1148 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1149 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1150 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1151 |
\mbox{}\\[-20mm]\mbox{} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1152 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1153 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1154 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1155 |
every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 1156 |
\node[state,initial] (Q_02) {$\mbox{Q}_{0, 2}$}; |
1157 |
\node[state] (Q_13) [right=of Q_02] {$\mbox{Q}_{1, 3}$}; |
|
1158 |
\node[state, accepting] (Q_4) [right=of Q_13] {$\mbox{Q}_{4\phantom{,0}}$}; |
|
1159 |
\path[->] (Q_02) edge [bend left] node [above] {\alert{$a$}} (Q_13); |
|
1160 |
\path[->] (Q_13) edge [bend left] node [below] {\alert{$b$}} (Q_02); |
|
1161 |
\path[->] (Q_02) edge [loop below] node {\alert{$b$}} (); |
|
1162 |
\path[->] (Q_13) edge node [above] {\alert{$a$}} (Q_4); |
|
1163 |
\path[->] (Q_4) edge [loop above] node {\alert{$a, b$}} (); |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1164 |
\end{tikzpicture}\\ |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1165 |
minimal automaton |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1166 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1167 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1168 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1169 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1170 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1171 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1172 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1173 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1174 |
\frametitle{Alternatives} |
573 | 1175 |
\mbox{}\\[-14mm]\mbox{} |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1176 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1177 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1178 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1179 |
every state/.style={minimum size=0pt, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1180 |
inner sep=2pt,draw=blue!50,very thick,fill=blue!20}] |
515 | 1181 |
\only<1>{\node[state,initial] (Q_0) {$\mbox{Q}_0$};} |
1182 |
\only<2->{\node[state,accepting] (Q_0) {$\mbox{Q}_0$};} |
|
1183 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$}; |
|
1184 |
\node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$}; |
|
1185 |
\node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$}; |
|
1186 |
\only<1>{\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};} |
|
1187 |
\only<2->{\node[state, initial right] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};} |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1188 |
\only<1-2>{ |
515 | 1189 |
\path[->] (Q_0) edge node [above] {\alert{$a$}} (Q_1); |
1190 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_4); |
|
1191 |
\path[->] (Q_4) edge [loop above] node {\alert{$a, b$}} (); |
|
1192 |
\path[->] (Q_3) edge node [right] {\alert{$a$}} (Q_4); |
|
1193 |
\path[->] (Q_2) edge node [above] {\alert{$a$}} (Q_3); |
|
1194 |
\path[->] (Q_1) edge node [right] {\alert{$b$}} (Q_2); |
|
1195 |
\path[->] (Q_0) edge node [above] {\alert{$b$}} (Q_2); |
|
1196 |
\path[->] (Q_2) edge [loop left] node {\alert{$b$}} (); |
|
1197 |
\path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (Q_0);} |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1198 |
\only<3->{ |
515 | 1199 |
\path[<-] (Q_0) edge node [above] {\alert{$a$}} (Q_1); |
1200 |
\path[<-] (Q_1) edge node [above] {\alert{$a$}} (Q_4); |
|
1201 |
\path[<-] (Q_4) edge [loop above] node {\alert{$a, b$}} (); |
|
1202 |
\path[<-] (Q_3) edge node [right] {\alert{$a$}} (Q_4); |
|
1203 |
\path[<-] (Q_2) edge node [above] {\alert{$a$}} (Q_3); |
|
1204 |
\path[<-] (Q_1) edge node [right] {\alert{$b$}} (Q_2); |
|
1205 |
\path[<-] (Q_0) edge node [above] {\alert{$b$}} (Q_2); |
|
1206 |
\path[<-] (Q_2) edge [loop left] node {\alert{$b$}} (); |
|
1207 |
\path[<-] (Q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (Q_0);} |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1208 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1209 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1210 |
\mbox{}\\[-18mm] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1211 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1212 |
\small |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1213 |
\begin{itemize} |
573 | 1214 |
\item<1-> exchange initial / accepting states\\[-2mm] |
1215 |
\item<2-> reverse all edges\\[-2mm] |
|
1216 |
\item<3-> subset construction $\Rightarrow$ DFA\\[-2mm] |
|
1217 |
\item<4-> remove dead states\\[-2mm] |
|
1218 |
\item<5-> repeat once more |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1219 |
\onslide<6->{$\Rightarrow$ minimal DFA} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1220 |
\end{itemize} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1221 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1222 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1223 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1224 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1225 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1226 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1227 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1228 |
\frametitle{Regexps and Automata} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1229 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1230 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1231 |
\begin{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1232 |
\node (rexp) {\bl{\bf Regexps}}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1233 |
\node (nfa) [right=of rexp] {\bl{\bf NFAs}}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1234 |
\node (dfa) [right=of nfa] {\bl{\bf DFAs}}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1235 |
\onslide<1->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1236 |
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1237 |
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1238 |
\onslide<1->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1239 |
\onslide<2->{\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp);} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1240 |
\end{tikzpicture}\\ |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1241 |
\end{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1242 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1243 |
\end{frame} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1244 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1245 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1246 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1247 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1248 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1249 |
\begin{frame}<2>[c] |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1250 |
\frametitle{DFA to Rexp} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1251 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1252 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1253 |
\begin{tikzpicture}[scale=2,>=stealth',very thick, |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1254 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 1255 |
\only<1>{\node[state, initial] (q0) at ( 0,1) {$\mbox{Q}_0$};} |
1256 |
\only<2->{\node[state, initial,accepting] (q0) at ( 0,1) {$\mbox{Q}_0$};} |
|
1257 |
\only<1>{\node[state] (q1) at ( 1,1) {$\mbox{Q}_1$};} |
|
1258 |
\only<2->{\node[state,accepting] (q1) at ( 1,1) {$\mbox{Q}_1$};} |
|
1259 |
\only<1>{\node[state, accepting] (q2) at ( 2,1) {$\mbox{Q}_2$};} |
|
1260 |
\only<2->{\node[state] (q2) at ( 2,1) {$\mbox{Q}_2$};} |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1261 |
\path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1262 |
(q1) edge[bend left] node[above] {\alert{$b$}} (q0) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1263 |
(q2) edge[bend left=50] node[below] {\alert{$b$}} (q0) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1264 |
(q1) edge node[above] {\alert{$a$}} (q2) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1265 |
(q2) edge [loop right] node {\alert{$a$}} () |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1266 |
(q0) edge [loop below] node {\alert{$b$}} () |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1267 |
; |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1268 |
\end{tikzpicture} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1269 |
\end{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1270 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1271 |
\onslide<3>{How to get from a DFA to a regular expression?} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1272 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1273 |
\end{frame} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1274 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1275 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1276 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1277 |
\begin{frame}[c] |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1278 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1279 |
\begin{center} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1280 |
\begin{tikzpicture}[scale=2,>=stealth',very thick, |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1281 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
783 | 1282 |
\only<1->{\node[state, initial,accepting] (q0) at ( 0,1) {$\mbox{Q}_0$};} |
1283 |
\only<1->{\node[state,accepting] (q1) at ( 1,1) {$\mbox{Q}_1$};} |
|
515 | 1284 |
\only<1->{\node[state] (q2) at ( 2,1) {$\mbox{Q}_2$};} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1285 |
\path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1286 |
(q1) edge[bend left] node[above] {\alert{$b$}} (q0) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1287 |
(q2) edge[bend left=50] node[below] {\alert{$b$}} (q0) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1288 |
(q1) edge node[above] {\alert{$a$}} (q2) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1289 |
(q2) edge [loop right] node {\alert{$a$}} () |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1290 |
(q0) edge [loop below] node {\alert{$b$}} () |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1291 |
; |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
1292 |
\end{tikzpicture} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1293 |
\end{center}\pause\bigskip |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1294 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1295 |
\onslide<2->{ |
445 | 1296 |
You know how to solve since school days, no? |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1297 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1298 |
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
515 | 1299 |
\bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$2\, \mbox{Q}_0 + 3 \,\mbox{Q}_1 + 4\, \mbox{Q}_2$}\\ |
1300 |
\bl{$\mbox{Q}_1$} & \bl{$=$} & \bl{$2 \,\mbox{Q}_0 + 3\, \mbox{Q}_1 + 1\, \mbox{Q}_2$}\\ |
|
1301 |
\bl{$\mbox{Q}_2$} & \bl{$=$} & \bl{$1\, \mbox{Q}_0 + 5\, \mbox{Q}_1 + 2\, \mbox{Q}_2$}\\ |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1302 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1303 |
\end{tabular} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1304 |
\end{center} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1305 |
} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1306 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1307 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1308 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1309 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1310 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1311 |
\begin{frame}[c] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1312 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1313 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1314 |
\begin{tikzpicture}[scale=2,>=stealth',very thick, |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1315 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 1316 |
\only<1->{\node[state, initial] (q0) at ( 0,1) {$\mbox{Q}_0$};} |
1317 |
\only<1->{\node[state] (q1) at ( 1,1) {$\mbox{Q}_1$};} |
|
1318 |
\only<1->{\node[state] (q2) at ( 2,1) {$\mbox{Q}_2$};} |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1319 |
\path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1320 |
(q1) edge[bend left] node[above] {\alert{$b$}} (q0) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1321 |
(q2) edge[bend left=50] node[below] {\alert{$b$}} (q0) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1322 |
(q1) edge node[above] {\alert{$a$}} (q2) |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1323 |
(q2) edge [loop right] node {\alert{$a$}} () |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1324 |
(q0) edge [loop below] node {\alert{$b$}} () |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1325 |
; |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1326 |
\end{tikzpicture} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1327 |
\end{center}\bigskip |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1328 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1329 |
\onslide<2->{ |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1330 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1331 |
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
650 | 1332 |
\bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$\mbox{Q}_0\,b + \mbox{Q}_1\,b + \mbox{Q}_2\,b + \ONE$}\\ |
515 | 1333 |
\bl{$\mbox{Q}_1$} & \bl{$=$} & \bl{$\mbox{Q}_0\,a$}\\ |
1334 |
\bl{$\mbox{Q}_2$} & \bl{$=$} & \bl{$\mbox{Q}_1\,a + \mbox{Q}_2\,a$}\\ |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1335 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1336 |
\end{tabular} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1337 |
\end{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1338 |
} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1339 |
|
783 | 1340 |
|
1341 |
\only<3-9>{\small |
|
1342 |
\begin{textblock}{6}(1,0.8) |
|
1343 |
\begin{bubble}[6.7cm] |
|
1344 |
\begin{tabular}{r@ {\hspace{1mm}}c@ {\hspace{1mm}}l} |
|
1345 |
\multicolumn{3}{@{}l}{substitute \bl{$\mbox{Q}_1$} into \bl{$\mbox{Q}_0$} \& \bl{$\mbox{Q}_2$}:}\\ |
|
1346 |
\bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$\mbox{Q}_0\,b + \mbox{Q}_0\,a\,b + \mbox{Q}_2\,b + \ONE$}\\ |
|
1347 |
\bl{$\mbox{Q}_2$} & \bl{$=$} & \bl{$\mbox{Q}_0\,a\,a + \mbox{Q}_2\,a$} |
|
1348 |
\end{tabular} |
|
1349 |
\end{bubble} |
|
1350 |
\end{textblock}} |
|
1351 |
||
1352 |
\only<4-9>{\small |
|
1353 |
\begin{textblock}{6}(2,4.15) |
|
1354 |
\begin{bubble}[6.7cm] |
|
1355 |
\begin{tabular}{r@ {\hspace{1mm}}c@ {\hspace{1mm}}l} |
|
1356 |
\multicolumn{3}{@{}l}{simplifying \bl{$\mbox{Q}_0$}:}\\ |
|
1357 |
\bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$\mbox{Q}_0\,(b + a\,b) + \mbox{Q}_2\,b + \ONE$}\\ |
|
1358 |
\bl{$\mbox{Q}_2$} & \bl{$=$} & \bl{$\mbox{Q}_0\,a\,a + \mbox{Q}_2\,a$} |
|
1359 |
\end{tabular} |
|
1360 |
\end{bubble} |
|
1361 |
\end{textblock}} |
|
1362 |
||
1363 |
\only<6-9>{\small |
|
1364 |
\begin{textblock}{6}(3,7.55) |
|
1365 |
\begin{bubble}[6.7cm] |
|
1366 |
\begin{tabular}{r@ {\hspace{1mm}}c@ {\hspace{1mm}}l} |
|
1367 |
\multicolumn{3}{@{}l}{Arden for \bl{$\mbox{Q}_2$}:}\\ |
|
1368 |
\bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$\mbox{Q}_0\,(b + a\,b) + \mbox{Q}_2\,b + \ONE$}\\ |
|
1369 |
\bl{$\mbox{Q}_2$} & \bl{$=$} & \bl{$\mbox{Q}_0\,a\,a\,(a^*)$} |
|
1370 |
\end{tabular} |
|
1371 |
\end{bubble} |
|
1372 |
\end{textblock}} |
|
1373 |
||
1374 |
\only<7-9>{\small |
|
1375 |
\begin{textblock}{6}(4,10.9) |
|
1376 |
\begin{bubble}[7.5cm] |
|
1377 |
\begin{tabular}{r@ {\hspace{1mm}}c@ {\hspace{1mm}}l} |
|
1378 |
\multicolumn{3}{@{}l}{Substitute \bl{$\mbox{Q}_2$} and simplify:}\\ |
|
1379 |
\bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$\mbox{Q}_0\,(b + a\,b + a\,a\,(a^*)\,b) + \ONE$}\\ |
|
1380 |
\end{tabular} |
|
1381 |
\end{bubble} |
|
1382 |
\end{textblock}} |
|
1383 |
||
1384 |
\only<8-9>{\small |
|
1385 |
\begin{textblock}{6}(5,13.4) |
|
1386 |
\begin{bubble}[7.5cm] |
|
1387 |
\begin{tabular}{r@ {\hspace{1mm}}c@ {\hspace{1mm}}l} |
|
1388 |
\multicolumn{3}{@{}l}{Arden again for \bl{$\mbox{Q}_0$}:}\\ |
|
1389 |
\bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$(b + a\,b + a\,a\,(a^*)\,b)^*$}\\ |
|
1390 |
\end{tabular} |
|
1391 |
\end{bubble} |
|
1392 |
\end{textblock}} |
|
1393 |
||
1394 |
||
1395 |
\only<9-10>{\small |
|
1396 |
\begin{textblock}{6}(6,11.5) |
|
1397 |
\begin{bubble}[6.7cm] |
|
1398 |
\begin{tabular}{r@ {\hspace{1mm}}c@ {\hspace{1mm}}l} |
|
1399 |
\multicolumn{3}{@{}l}{Finally:}\\ |
|
1400 |
\bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$(b + a\,b + a\,a\,(a^*)\,b)^*$}\\ |
|
1401 |
\bl{$\mbox{Q}_1$} & \bl{$=$} & \bl{$(b + a\,b + a\,a\,(a^*)\,b)^*\,a$}\\ |
|
1402 |
\bl{$\mbox{Q}_2$} & \bl{$=$} & \bl{$(b + a\,b + a\,a\,(a^*)\,b)^*\,a\,a\,(a^*)$}\\ |
|
1403 |
\end{tabular} |
|
1404 |
\end{bubble} |
|
1405 |
\end{textblock}} |
|
1406 |
||
1407 |
||
1408 |
||
1409 |
||
1410 |
||
1411 |
\only<5-6>{ |
|
1412 |
\begin{textblock}{6}(0.7,11.9) |
|
1413 |
\begin{bubble}[6.7cm] |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1414 |
Arden's Lemma: |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1415 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1416 |
If \bl{$q = q\,r + s$}\; then\; \bl{$q = s\, r^*$} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1417 |
\end{center} |
783 | 1418 |
\end{bubble} |
1419 |
\end{textblock}} |
|
1420 |
||
1421 |
\only<8>{ |
|
1422 |
\begin{textblock}{6}(1.1,7.8) |
|
1423 |
\begin{bubble}[6.7cm] |
|
1424 |
Arden's Lemma: |
|
1425 |
\begin{center} |
|
1426 |
If \bl{$q = q\,r + s$}\; then\; \bl{$q = s\, r^*$} |
|
1427 |
\end{center} |
|
1428 |
\end{bubble} |
|
1429 |
\end{textblock}} |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1430 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1431 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1432 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1433 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1434 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1435 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1436 |
\frametitle{Regexps and Automata} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1437 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1438 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1439 |
\begin{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1440 |
\node (rexp) {\bl{\bf Regexps}}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1441 |
\node (nfa) [right=of rexp] {\bl{\bf NFAs}}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1442 |
\node (dfa) [right=of nfa] {\bl{\bf DFAs}}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1443 |
\onslide<1->{\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}};} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1444 |
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1445 |
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1446 |
\onslide<1->{\path[->, red, line width=2mm] (dfa) edge node [below=9mm, black] {minimisation} (mdfa);} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1447 |
\onslide<1->{\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp);} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1448 |
\end{tikzpicture}\\ |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1449 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1450 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1451 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1452 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1453 |
|
941 | 1454 |
{ |
1455 |
\setbeamercolor{background canvas}{bg=cream} |
|
1456 |
\begin{frame}<1-10>[c] |
|
1457 |
\end{frame} |
|
1458 |
} |
|
1459 |
||
1460 |
||
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1461 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1462 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1463 |
\frametitle{Regular Languages (3)} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1464 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1465 |
A language is \alert{\bf regular} iff there exists a regular |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1466 |
expression that recognises all its strings.\bigskip\medskip |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1467 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1468 |
or {\bf equivalently}\bigskip\medskip |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1469 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1470 |
A language is \alert{\bf regular} iff there exists a |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1471 |
deterministic finite automaton that recognises all its |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1472 |
strings.\bigskip\medskip\pause |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1473 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1474 |
Why is every finite set of strings a regular language? |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1475 |
\end{frame} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1476 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1477 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1478 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1479 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
783 | 1480 |
%\begin{frame}[c] |
1481 |
% |
|
1482 |
%Given the function |
|
1483 |
% |
|
1484 |
%\begin{center} |
|
1485 |
%\bl{\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l} |
|
1486 |
%$rev(\ZERO)$ & $\dn$ & $\ZERO$\\ |
|
1487 |
%$rev(\ONE)$ & $\dn$ & $\ONE$\\ |
|
1488 |
%$rev(c)$ & $\dn$ & $c$\\ |
|
1489 |
%$rev(r_1 + r_2)$ & $\dn$ & $rev(r_1) + rev(r_2)$\\ |
|
1490 |
%$rev(r_1 \cdot r_2)$ & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\ |
|
1491 |
%$rev(r^*)$ & $\dn$ & $rev(r)^*$\\ |
|
1492 |
%\end{tabular}} |
|
1493 |
%\end{center} |
|
1494 |
% |
|
1495 |
% |
|
1496 |
%and the set |
|
1497 |
% |
|
1498 |
%\begin{center} |
|
1499 |
%\bl{$Rev\,A \dn \{s^{-1} \;|\; s \in A\}$} |
|
1500 |
%\end{center} |
|
1501 |
% |
|
1502 |
%prove whether |
|
1503 |
% |
|
1504 |
%\begin{center} |
|
1505 |
%\bl{$L(rev(r)) = Rev (L(r))$} |
|
1506 |
%\end{center} |
|
1507 |
% |
|
1508 |
%\end{frame} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
1509 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
25 | 1510 |
|
1511 |
||
743 | 1512 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1513 |
\begin{frame}[c] |
|
1514 |
\frametitle{Regexps and Automata} |
|
1515 |
||
1516 |
\begin{center} |
|
1517 |
\begin{tikzpicture} |
|
1518 |
\node (rexp) {\bl{\bf Regexps}}; |
|
1519 |
\node (nfa) [right=of rexp] {\bl{\bf NFAs}}; |
|
1520 |
\node (dfa) [right=of nfa] {\bl{\bf DFAs}}; |
|
1521 |
\node (mdfa) [right=of dfa] {\bl{\bf \begin{tabular}{c}minimal\\ DFAs\end{tabular}}}; |
|
1522 |
\path[->,red, line width=2mm] (rexp) edge node [above=4mm, black] |
|
1523 |
{\begin{tabular}{c@{\hspace{9mm}}}Thompson's\\[-1mm] construction\end{tabular}} (nfa); |
|
1524 |
\path[->,red, line width=2mm] (nfa) edge node [above=4mm, black] |
|
1525 |
{\begin{tabular}{c}subset\\[-1mm] construction\end{tabular}}(dfa); |
|
1526 |
\path[->, red, line width=2mm] (dfa) edge node [below=5mm, black] {minimisation} (mdfa); |
|
1527 |
%%\path[->, red, line width=2mm] (dfa) edge [bend left=45] (rexp); |
|
1528 |
\path[->, red, line width=2mm] (dfa) edge [bend left=45] node [below, black] {\begin{tabular}{l}Brzozowski's\\ method\end{tabular}} (rexp); |
|
1529 |
||
1530 |
\end{tikzpicture}\\ |
|
1531 |
\end{center} |
|
1532 |
||
1533 |
\end{frame} |
|
1534 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1535 |
||
1536 |
||
1537 |
||
1538 |
||
1539 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1540 |
% \begin{frame}[c] |
|
1541 |
% \frametitle{DFA to Rexp} |
|
1542 |
||
1543 |
% \begin{center} |
|
1544 |
% \begin{tikzpicture}[scale=2,>=stealth',very thick, |
|
1545 |
% every state/.style={minimum size=0pt, |
|
1546 |
% draw=blue!50,very thick,fill=blue!20},] |
|
1547 |
% \node[state, initial] (q0) at ( 0,1) {$q_0$}; |
|
1548 |
% \node[state] (q1) at ( 1,1) {$q_1$}; |
|
1549 |
% \node[state, accepting] (q2) at ( 2,1) {$q_2$}; |
|
1550 |
% \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1) |
|
1551 |
% (q1) edge[bend left] node[above] {\alert{$b$}} (q0) |
|
1552 |
% (q2) edge[bend left=50] node[below] {\alert{$b$}} (q0) |
|
1553 |
% (q1) edge node[above] {\alert{$a$}} (q2) |
|
1554 |
% (q2) edge [loop right] node {\alert{$a$}} () |
|
1555 |
% (q0) edge [loop below] node {\alert{$b$}} (); |
|
1556 |
% \end{tikzpicture} |
|
1557 |
% \end{center}\bigskip |
|
1558 |
||
1559 |
% \begin{center} |
|
1560 |
% \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l@{\hspace{7mm}}l} |
|
1561 |
% \bl{$q_0$} & \bl{$=$} & \bl{$\ONE + q_0\,b + q_1\,b + q_2\,b$} & (start state)\\ |
|
1562 |
% \bl{$q_1$} & \bl{$=$} & \bl{$q_0\,a$}\\ |
|
1563 |
% \bl{$q_2$} & \bl{$=$} & \bl{$q_1\,a + q_2\,a$}\\ |
|
1564 |
||
1565 |
% \end{tabular} |
|
1566 |
% \end{center} |
|
1567 |
||
1568 |
% Arden's Lemma: |
|
1569 |
% \begin{center} |
|
1570 |
% If \bl{$q = q\,r + s$}\; then\; \bl{$q = s\, r^*$} |
|
1571 |
% \end{center} |
|
1572 |
||
1573 |
||
1574 |
% \end{frame} |
|
1575 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1576 |
||
1577 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1578 |
% \begin{frame}[c] |
|
1579 |
% \frametitle{DFA Minimisation} |
|
1580 |
||
1581 |
% \begin{enumerate} |
|
1582 |
% \item Take all pairs \bl{$(q, p)$} with \bl{$q \not= p$} |
|
1583 |
% \item Mark all pairs that accepting and non-accepting states |
|
1584 |
% \item For all unmarked pairs \bl{$(q, p)$} and all characters \bl{$c$} test whether |
|
1585 |
% \begin{center} |
|
1586 |
% \bl{$(\delta(q, c), \delta(p,c))$} |
|
1587 |
% \end{center} |
|
1588 |
% are marked. If yes, then also mark \bl{$(q, p)$}. |
|
1589 |
% \item Repeat last step until no change. |
|
1590 |
% \item All unmarked pairs can be merged. |
|
1591 |
% \end{enumerate} |
|
1592 |
||
1593 |
% \end{frame} |
|
1594 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1595 |
||
1596 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1597 |
% \begin{frame}[c] |
|
1598 |
||
1599 |
% \begin{center} |
|
1600 |
% \begin{tabular}{@{\hspace{-8mm}}cc@{}} |
|
1601 |
% \begin{tikzpicture}[>=stealth',very thick,auto, |
|
1602 |
% every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
|
1603 |
% \node[state,initial] (q_0) {$q_0$}; |
|
1604 |
% \node[state] (q_1) [right=of q_0] {$q_1$}; |
|
1605 |
% \node[state] (q_2) [below right=of q_0] {$q_2$}; |
|
1606 |
% \node[state] (q_3) [right=of q_2] {$q_3$}; |
|
1607 |
% \node[state, accepting] (q_4) [right=of q_1] {$q_4$}; |
|
1608 |
% \path[->] (q_0) edge node [above] {\alert{$a$}} (q_1); |
|
1609 |
% \path[->] (q_1) edge node [above] {\alert{$a$}} (q_4); |
|
1610 |
% \path[->] (q_4) edge [loop right] node {\alert{$a, b$}} (); |
|
1611 |
% \path[->] (q_3) edge node [right] {\alert{$a$}} (q_4); |
|
1612 |
% \path[->] (q_2) edge node [above] {\alert{$a$}} (q_3); |
|
1613 |
% \path[->] (q_1) edge node [right] {\alert{$b$}} (q_2); |
|
1614 |
% \path[->] (q_0) edge node [above] {\alert{$b$}} (q_2); |
|
1615 |
% \path[->] (q_2) edge [loop left] node {\alert{$b$}} (); |
|
1616 |
% \path[->] (q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (q_0); |
|
1617 |
% \end{tikzpicture} |
|
1618 |
% & |
|
1619 |
% \raisebox{9mm}{\begin{tikzpicture}[scale=0.6,line width=0.8mm] |
|
1620 |
% \draw (0,0) -- (4,0); |
|
1621 |
% \draw (0,1) -- (4,1); |
|
1622 |
% \draw (0,2) -- (3,2); |
|
1623 |
% \draw (0,3) -- (2,3); |
|
1624 |
% \draw (0,4) -- (1,4); |
|
1625 |
||
1626 |
% \draw (0,0) -- (0, 4); |
|
1627 |
% \draw (1,0) -- (1, 4); |
|
1628 |
% \draw (2,0) -- (2, 3); |
|
1629 |
% \draw (3,0) -- (3, 2); |
|
1630 |
% \draw (4,0) -- (4, 1); |
|
1631 |
||
1632 |
% \draw (0.5,-0.5) node {$q_0$}; |
|
1633 |
% \draw (1.5,-0.5) node {$q_1$}; |
|
1634 |
% \draw (2.5,-0.5) node {$q_2$}; |
|
1635 |
% \draw (3.5,-0.5) node {$q_3$}; |
|
1636 |
||
1637 |
% \draw (-0.5, 3.5) node {$q_1$}; |
|
1638 |
% \draw (-0.5, 2.5) node {$q_2$}; |
|
1639 |
% \draw (-0.5, 1.5) node {$q_3$}; |
|
1640 |
% \draw (-0.5, 0.5) node {$q_4$}; |
|
1641 |
||
1642 |
% \draw (0.5,0.5) node {\large$\star$}; |
|
1643 |
% \draw (1.5,0.5) node {\large$\star$}; |
|
1644 |
% \draw (2.5,0.5) node {\large$\star$}; |
|
1645 |
% \draw (3.5,0.5) node {\large$\star$}; |
|
1646 |
% \draw (0.5,1.5) node {\large$\star$}; |
|
1647 |
% \draw (2.5,1.5) node {\large$\star$}; |
|
1648 |
% \draw (0.5,3.5) node {\large$\star$}; |
|
1649 |
% \draw (1.5,2.5) node {\large$\star$}; |
|
1650 |
% \end{tikzpicture}} |
|
1651 |
% \end{tabular} |
|
1652 |
% \end{center} |
|
1653 |
||
1654 |
||
1655 |
% \mbox{}\\[-20mm]\mbox{} |
|
1656 |
||
1657 |
% \begin{center} |
|
1658 |
% \begin{tikzpicture}[>=stealth',very thick,auto, |
|
1659 |
% every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
|
1660 |
% \node[state,initial] (q_02) {$q_{0, 2}$}; |
|
1661 |
% \node[state] (q_13) [right=of q_02] {$q_{1, 3}$}; |
|
1662 |
% \node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$}; |
|
1663 |
% \path[->] (q_02) edge [bend left] node [above] {\alert{$a$}} (q_13); |
|
1664 |
% \path[->] (q_13) edge [bend left] node [below] {\alert{$b$}} (q_02); |
|
1665 |
% \path[->] (q_02) edge [loop below] node {\alert{$b$}} (); |
|
1666 |
% \path[->] (q_13) edge node [above] {\alert{$a$}} (q_4); |
|
1667 |
% \path[->] (q_4) edge [loop above] node {\alert{$a, b$}} (); |
|
1668 |
% \end{tikzpicture}\\ |
|
1669 |
% minimal automaton |
|
1670 |
% \end{center} |
|
1671 |
||
1672 |
% \end{frame} |
|
1673 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1674 |
||
1675 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1676 |
\begin{frame}[c] |
|
1677 |
\frametitle{Regular Languages} |
|
1678 |
||
1679 |
Two equivalent definitions:\bigskip |
|
1680 |
||
1681 |
\begin{quote}\rm A language is \alert{regular} iff there exists a |
|
1682 |
regular expression that recognises all its strings. |
|
1683 |
\end{quote} |
|
1684 |
||
1685 |
\begin{quote}\rm A language is \alert{regular} iff there exists an |
|
1686 |
automaton that recognises all its strings. |
|
1687 |
\end{quote}\bigskip\bigskip |
|
1688 |
||
1689 |
||
1690 |
\small |
|
1691 |
for example \bl{$a^nb^n$} is not regular |
|
1692 |
\end{frame} |
|
1693 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1694 |
||
1695 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1696 |
\begin{frame}[c] |
|
1697 |
\frametitle{Negation} |
|
1698 |
||
1699 |
Regular languages are closed under negation:\bigskip |
|
1700 |
||
1701 |
\begin{center} |
|
1702 |
\begin{tikzpicture}[scale=2,>=stealth',very thick, |
|
1703 |
every state/.style={minimum size=0pt, |
|
1704 |
draw=blue!50,very thick,fill=blue!20}] |
|
1705 |
\only<1>{\node[state,initial] (q0) at ( 0,1) {$q_0$};} |
|
1706 |
\only<2>{\node[state,initial,accepting] (q0) at ( 0,1) {$q_0$};} |
|
1707 |
\only<1>{\node[state] (q1) at ( 1,1) {$q_1$};} |
|
1708 |
\only<2>{\node[state,accepting] (q1) at ( 1,1) {$q_1$};} |
|
1709 |
\only<1>{\node[state, accepting] (q2) at ( 2,1) {$q_2$};} |
|
1710 |
\only<2>{\node[state] (q2) at ( 2,1) {$q_2$};} |
|
1711 |
\path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1) |
|
1712 |
(q1) edge[bend left] node[above] {\alert{$b$}} (q0) |
|
1713 |
(q2) edge[bend left=50] node[below] {\alert{$b$}} (q0) |
|
1714 |
(q1) edge node[above] {\alert{$a$}} (q2) |
|
1715 |
(q2) edge [loop right] node {\alert{$a$}} () |
|
1716 |
(q0) edge [loop below] node {\alert{$b$}} (); |
|
1717 |
\end{tikzpicture} |
|
1718 |
\end{center}\bigskip\bigskip |
|
1719 |
||
1720 |
But requires that the automaton is \alert{completed}! |
|
1721 |
||
1722 |
\end{frame} |
|
1723 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1724 |
||
891 | 1725 |
{ |
1726 |
\setbeamercolor{background canvas}{bg=cream} |
|
1727 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1728 |
\begin{frame}[c] |
|
1729 |
\frametitle{\boldmath{}$(a^*)^* \cdot b$} |
|
1730 |
||
1731 |
\begin{center} |
|
1732 |
\begin{tikzpicture} |
|
1733 |
\begin{axis}[ |
|
1734 |
xlabel={\pcode{a}s}, |
|
1735 |
%%x label style={at={(1.05,0.0)}}, |
|
1736 |
ylabel={time in secs}, |
|
1737 |
enlargelimits=false, |
|
1738 |
xtick={0,15,...,30}, |
|
1739 |
xmax=33, |
|
1740 |
ymax=35, |
|
1741 |
ytick={0,5,...,30}, |
|
1742 |
scaled ticks=false, |
|
1743 |
axis lines=left, |
|
1744 |
width=9cm, |
|
1745 |
height=6cm, |
|
1746 |
legend entries={Java 8,Python,JavaScript,Swift,Dart}, |
|
1747 |
legend pos=outer north east, |
|
1748 |
legend cell align=left] |
|
1749 |
\addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data}; |
|
1750 |
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data}; |
|
1751 |
\addplot[red,mark=*, mark options={fill=white}] table {re-js.data}; |
|
1752 |
\addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data}; |
|
1753 |
\addplot[brown,mark=*, mark options={fill=white}] table {re-dart.data}; |
|
1754 |
||
1755 |
%\addplot[red,mark=triangle*, mark options={fill=red}] table {nfadepth2.data}; |
|
1756 |
\end{axis} |
|
1757 |
\end{tikzpicture} |
|
1758 |
\end{center} |
|
1759 |
||
1760 |
\end{frame}} |
|
1761 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1762 |
||
1763 |
\begin{frame}<1-3>[c] |
|
1764 |
\end{frame} |
|
1765 |
||
889 | 1766 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1767 |
{ |
|
1768 |
\setbeamercolor{background canvas}{bg=cream} |
|
1769 |
\begin{frame}[c] |
|
1770 |
||
1771 |
\begin{center} |
|
1772 |
\begin{tikzpicture}[scale=1.5,>=stealth',very thick, |
|
1773 |
every state/.style={minimum size=0pt, |
|
1774 |
draw=blue!50,very thick,fill=blue!20}] |
|
1775 |
\node[state,initial] (q0) at (0,2) {$q_0$}; |
|
1776 |
\node[state,accepting] (q1) at (2,2) {$q_1$}; |
|
1777 |
\node[state] (q2) at (0,0) {$q_2$}; |
|
1778 |
\node[state] (q3) at (2,0) {$q_3$}; |
|
1779 |
||
1780 |
\path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1) |
|
1781 |
(q1) edge[bend left] node[above] {\alert{$a$}} (q0) |
|
1782 |
(q2) edge[bend left] node[above] {\alert{$a$}} (q3) |
|
1783 |
(q3) edge[bend left] node[above] {\alert{$a$}} (q2) |
|
1784 |
(q0) edge[bend left] node[right] {\alert{$b$}} (q2) |
|
1785 |
(q2) edge[bend left] node[left] {\alert{$b$}} (q0) |
|
1786 |
(q1) edge[bend left] node[right] {\alert{$b$}} (q3) |
|
1787 |
(q3) edge[bend left] node[left] {\alert{$b$}} (q1); |
|
1788 |
\end{tikzpicture} |
|
1789 |
\end{center} |
|
1790 |
||
1791 |
\hfill{}Which language? |
|
1792 |
||
1793 |
\end{frame} |
|
1794 |
} |
|
1795 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1796 |
||
1797 |
||
781 | 1798 |
|
847 | 1799 |
\begin{frame}<1-15>[c] |
1800 |
||
781 | 1801 |
\end{frame} |
1802 |
||
782 | 1803 |
\begin{frame}[t] |
781 | 1804 |
\begin{mybox3}{} |
1805 |
I always thought dfa's needed a transition for each state for each |
|
1806 |
character, and if not it would be an nfa not a dfa. Is there an |
|
1807 |
example that disproves this? |
|
1808 |
\end{mybox3} |
|
1809 |
\end{frame} |
|
1810 |
||
1811 |
\begin{frame}<1-12>[c] |
|
1812 |
\end{frame} |
|
1813 |
||
782 | 1814 |
\begin{frame}[t] |
1815 |
\begin{mybox3}{} |
|
1816 |
Do the regular expression matchers in Python and Java 8 have more |
|
1817 |
features than the one implemented in this module? Or is there |
|
1818 |
another reason for their inefficiency? |
|
1819 |
\end{mybox3} |
|
1820 |
\end{frame} |
|
1821 |
||
891 | 1822 |
|
1823 |
\begin{frame}[c] |
|
1824 |
\begin{itemize} |
|
892 | 1825 |
\item CW / censored some msgs |
891 | 1826 |
\item power law / proof |
1827 |
\item CW feedback |
|
892 | 1828 |
\item too polished CW submissions |
1829 |
\item no open book |
|
891 | 1830 |
\end{itemize} |
1831 |
\end{frame} |
|
1832 |
||
1833 |
||
25 | 1834 |
\end{document} |
1835 |
||
1836 |
%%% Local Variables: |
|
1837 |
%%% mode: latex |
|
1838 |
%%% TeX-master: t |
|
1839 |
%%% End: |
|
1840 |