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