author | Christian Urban <christian.urban@kcl.ac.uk> |
Sat, 16 May 2020 17:18:43 +0100 | |
changeset 724 | 61a936be50c4 |
parent 662 | 8da26d4c2ca8 |
child 743 | 6acabeecdf75 |
permissions | -rw-r--r-- |
651 | 1 |
% !TEX program = xelatex |
25 | 2 |
\documentclass[dvipsnames,14pt,t]{beamer} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
3 |
\usepackage{../slides} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
4 |
\usepackage{../graphics} |
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 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
8 |
\hfuzz=220pt |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
9 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
10 |
\pgfplotsset{compat=1.11} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
11 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
12 |
\newcommand{\bl}[1]{\textcolor{blue}{#1}} |
25 | 13 |
|
14 |
% beamer stuff |
|
445 | 15 |
\renewcommand{\slidecaption}{CFL 03, King's College London} |
25 | 16 |
|
17 |
\begin{document} |
|
18 |
||
19 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
20 |
\begin{frame}[t] |
25 | 21 |
\frametitle{% |
22 |
\begin{tabular}{@ {}c@ {}} |
|
23 |
\\[-3mm] |
|
445 | 24 |
\LARGE Compilers and \\[-2mm] |
25 | 25 |
\LARGE Formal Languages (3)\\[3mm] |
26 |
\end{tabular}} |
|
27 |
||
651 | 28 |
\normalsize |
25 | 29 |
\begin{center} |
651 | 30 |
\begin{tabular}{ll} |
31 |
Email: & christian.urban at kcl.ac.uk\\ |
|
32 |
Office Hours: & Thursdays 12 -- 14\\ |
|
33 |
Location: & N7.07 (North Wing, Bush House)\\ |
|
34 |
Slides \& Progs: & KEATS (also homework is there)\\ |
|
25 | 35 |
\end{tabular} |
36 |
\end{center} |
|
37 |
||
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
38 |
\end{frame} |
445 | 39 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
40 |
||
41 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
42 |
\begin{frame}[c] |
|
43 |
\frametitle{Scala Book, Exams} |
|
44 |
||
45 |
\begin{itemize} |
|
515 | 46 |
\item \small https://nms.kcl.ac.uk/christian.urban/ProgInScala2ed.pdf\normalsize |
572 | 47 |
\item homework (written exam 80\%) |
515 | 48 |
\item coursework (20\%)\bigskip |
49 |
\item short survey at KEATS; to be answered until Sunday |
|
445 | 50 |
\end{itemize} |
51 |
||
52 |
\end{frame} |
|
53 |
%%%%%%%%%%% |
|
25 | 54 |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
55 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
56 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
57 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
58 |
\begin{frame}[c] |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
59 |
\frametitle{Last Week} |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
60 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
61 |
Last week I showed you a regular expression matcher |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
62 |
that works provably correct in all cases (we only |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
63 |
started with the proving part though) |
25 | 64 |
|
65 |
\begin{center} |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
66 |
\bl{$matches\,s\,r$} \;\;if and only if \;\; \bl{$s \in L(r)$} |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
67 |
\end{center}\bigskip\bigskip |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
68 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
69 |
\small |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
70 |
\textcolor{gray}{\mbox{}\hfill{}by Janusz Brzozowski (1964)} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
71 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
72 |
\end{frame} |
25 | 73 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
74 |
||
75 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
76 |
\begin{frame}[c] |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
77 |
\frametitle{The Derivative of a Rexp} |
25 | 78 |
|
79 |
\begin{center} |
|
80 |
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}} |
|
445 | 81 |
\bl{$der\, c\, (\ZERO)$} & \bl{$\dn$} & \bl{$\ZERO$} & \\ |
82 |
\bl{$der\, c\, (\ONE)$} & \bl{$\dn$} & \bl{$\ZERO$} & \\ |
|
83 |
\bl{$der\, c\, (d)$} & \bl{$\dn$} & \bl{if $c = d$ then $\ONE$ else $\ZERO$} & \\ |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
84 |
\bl{$der\, c\, (r_1 + r_2)$} & \bl{$\dn$} & \bl{$der\, c\, r_1 + der\, c\, r_2$} & \\ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
85 |
\bl{$der\, c\, (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{if $nullable (r_1)$}\\ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
86 |
& & \bl{then $(der\,c\,r_1) \cdot r_2 + der\, c\, r_2$}\\ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
87 |
& & \bl{else $(der\, c\, r_1) \cdot r_2$}\\ |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
88 |
\bl{$der\, c\, (r^*)$} & \bl{$\dn$} & \bl{$(der\,c\,r) \cdot (r^*)$} &\medskip\\ |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
89 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
90 |
\bl{$\textit{ders}\, []\, r$} & \bl{$\dn$} & \bl{$r$} & \\ |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
91 |
\bl{$\textit{ders}\, (c\!::\!s)\, r$} & \bl{$\dn$} & \bl{$\textit{ders}\,s\,(der\,c\,r)$} & \\ |
25 | 92 |
\end{tabular} |
93 |
\end{center} |
|
94 |
||
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
95 |
\end{frame} |
25 | 96 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
97 |
||
98 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
99 |
\begin{frame}[c] |
|
515 | 100 |
\frametitle{Example} |
101 |
||
102 |
Given \bl{$r \dn ((a \cdot b) + b)^*$} what is |
|
103 |
||
104 |
\begin{center} |
|
105 |
\def\arraystretch{1.5} |
|
106 |
\begin{tabular}{@{}lcl} |
|
107 |
\bl{$\der\,a\,((a \cdot b) + b)^*$} |
|
108 |
& \bl{$\Rightarrow$}& \bl{$\der\,a\, \underline{((a \cdot b) + b)^*}$}\\ |
|
109 |
& \bl{$=$} & \bl{$(der\,a\,(\underline{(a \cdot b) + b})) \cdot r$}\\ |
|
110 |
& \bl{$=$} & \bl{$((der\,a\,(\underline{a \cdot b})) + (der\,a\,b)) \cdot r$}\\ |
|
111 |
& \bl{$=$} & \bl{$(((der\,a\,\underline{a}) \cdot b) + (der\,a\,b)) \cdot r$}\\ |
|
112 |
& \bl{$=$} & \bl{$((\ONE \cdot b) + (der\,a\,\underline{b})) \cdot r$}\\ |
|
113 |
& \bl{$=$} & \bl{$((\ONE \cdot b) + \ZERO) \cdot r$}\\ |
|
114 |
\end{tabular} |
|
115 |
\end{center} |
|
116 |
||
117 |
\end{frame} |
|
118 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
119 |
||
120 |
||
121 |
||
122 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
123 |
\begin{frame}[c] |
|
25 | 124 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
125 |
Input: string \bl{$abc$} and regular expression \bl{$r$} |
25 | 126 |
|
127 |
\begin{enumerate} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
128 |
\item \bl{$der\,a\,r$} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
129 |
\item \bl{$der\,b\,(der\,a\,r)$} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
130 |
\item \bl{$der\,c\,(der\,b\,(der\,a\,r))$}\bigskip\pause |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
131 |
\item finally check whether the last regular expression can match the empty string |
25 | 132 |
\end{enumerate} |
133 |
||
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
134 |
\end{frame} |
515 | 135 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
136 |
||
137 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
574 | 138 |
\begin{frame}[t] |
515 | 139 |
\frametitle{Simplification} |
140 |
||
574 | 141 |
Given \bl{$r \dn ((a \cdot b) + b)^*$}, you can simplify as follows |
515 | 142 |
|
143 |
\begin{center} |
|
144 |
\def\arraystretch{2} |
|
145 |
\begin{tabular}{@{}lcl} |
|
146 |
\bl{$((\ONE \cdot b) + \ZERO) \cdot r$} |
|
147 |
& \bl{$\Rightarrow$} & \bl{$((\underline{\ONE \cdot b}) + \ZERO) \cdot r$}\\ |
|
148 |
& \bl{$=$} & \bl{$(\underline{b + \ZERO}) \cdot r$}\\ |
|
149 |
& \bl{$=$} & \bl{$b \cdot r$}\\ |
|
150 |
\end{tabular} |
|
151 |
\end{center} |
|
152 |
||
153 |
\end{frame} |
|
25 | 154 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
155 |
||
651 | 156 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
157 |
\begin{frame}[c] |
|
158 |
\frametitle{Proofs about Rexp} |
|
159 |
||
160 |
\begin{itemize} |
|
161 |
\item \bl{$P$} holds for \bl{$\ZERO$}, \bl{$\ONE$} and \bl{c}\bigskip |
|
162 |
\item \bl{$P$} holds for \bl{$r_1 + r_2$} under the assumption that \bl{$P$} already |
|
163 |
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip |
|
164 |
\item \bl{$P$} holds for \bl{$r_1 \cdot r_2$} under the assumption that \bl{$P$} already |
|
165 |
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip |
|
166 |
\item \bl{$P$} holds for \bl{$r^*$} under the assumption that \bl{$P$} already |
|
167 |
holds for \bl{$r$}. |
|
168 |
\end{itemize} |
|
169 |
||
170 |
\end{frame} |
|
171 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
172 |
||
515 | 173 |
|
25 | 174 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
175 |
\begin{frame}[c] |
|
176 |
||
572 | 177 |
We proved |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
178 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
179 |
\begin{center} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
180 |
\bl{$nullable(r)$} \;if and only if\; \bl{$[] \in L(r)$} |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
181 |
\end{center} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
182 |
|
445 | 183 |
by induction on the regular expression \bl{$r$}.\bigskip\pause |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
184 |
|
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
185 |
\begin{center} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
186 |
{\huge\bf\alert{Any Questions?}} |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
187 |
\end{center} |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
188 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
189 |
\end{frame} |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
190 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
191 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
192 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
193 |
\begin{frame}[c] |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
194 |
\frametitle{\begin{tabular}{c}Proofs about Natural\\[-1mm] Numbers and Strings\end{tabular}} |
25 | 195 |
|
196 |
\begin{itemize} |
|
197 |
\item \bl{$P$} holds for \bl{$0$} and |
|
198 |
\item \bl{$P$} holds for \bl{$n + 1$} under the assumption that \bl{$P$} already |
|
199 |
holds for \bl{$n$} |
|
200 |
\end{itemize}\bigskip |
|
201 |
||
202 |
\begin{itemize} |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
203 |
\item \bl{$P$} holds for \bl{$[]$} and |
25 | 204 |
\item \bl{$P$} holds for \bl{$c\!::\!s$} under the assumption that \bl{$P$} already |
205 |
holds for \bl{$s$} |
|
206 |
\end{itemize} |
|
207 |
||
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
208 |
\end{frame} |
25 | 209 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
210 |
||
651 | 211 |
|
212 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
213 |
\begin{frame}[c] |
|
214 |
\frametitle{Correctness Proof \\[-1mm] |
|
215 |
for our Matcher} |
|
216 |
||
217 |
\begin{itemize} |
|
218 |
\item We started from |
|
219 |
||
220 |
\begin{center} |
|
221 |
\begin{tabular}{rp{4cm}} |
|
222 |
& \bl{$s \in L(r)$}\medskip\\ |
|
223 |
\bl{$\Leftrightarrow$} & \bl{$[] \in \Ders\,s\,(L(r))$}\pause |
|
224 |
\end{tabular} |
|
225 |
\end{center}\bigskip |
|
226 |
||
227 |
\item \textbf{\alert{if}} we can show \bl{$\Ders\, s\,(L(r)) = L(\ders\,s\,r)$} we |
|
228 |
have\bigskip |
|
229 |
||
230 |
\begin{center} |
|
231 |
\begin{tabular}{rp{4cm}} |
|
232 |
\bl{$\Leftrightarrow$} & \bl{$[] \in L(\ders\,s\,r)$}\medskip\\ |
|
233 |
\bl{$\Leftrightarrow$} & \bl{$nullable(\ders\,s\,r)$}\medskip\\ |
|
234 |
\bl{$\dn$} & \bl{$matches\,s\,r$} |
|
235 |
\end{tabular} |
|
236 |
\end{center} |
|
237 |
||
238 |
\end{itemize} |
|
239 |
||
240 |
\end{frame} |
|
241 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
242 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
243 |
\begin{frame}[c] |
|
244 |
||
245 |
We need to prove |
|
246 |
||
247 |
\begin{center} |
|
248 |
\bl{$L(der\,c\,r) = Der\,c\,(L(r))$} |
|
249 |
\end{center} |
|
250 |
||
251 |
also by induction on the regular expression \bl{$r$}. |
|
252 |
\end{frame} |
|
253 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
254 |
||
255 |
||
256 |
||
25 | 257 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
258 |
\begin{frame}[t] |
|
651 | 259 |
\frametitle{(Basic) Regular Expressions} |
25 | 260 |
|
261 |
\begin{center} |
|
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
262 |
\begin{tabular}{@ {}rrl@ {\hspace{13mm}}l} |
515 | 263 |
\bl{$r$} & \bl{$::=$} & \bl{$\ZERO$} & nothing\\ |
445 | 264 |
& \bl{$\mid$} & \bl{$\ONE$} & empty string / "" / $[]$\\ |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
265 |
& \bl{$\mid$} & \bl{$c$} & character\\ |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
266 |
& \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
|
267 |
& \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
|
268 |
& \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
|
269 |
\end{tabular} |
25 | 270 |
\end{center} |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
271 |
|
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
272 |
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
|
273 |
set of languages we can recognise? |
25 | 274 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
275 |
\end{frame} |
25 | 276 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
277 |
||
278 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
279 |
\begin{frame}[c] |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
280 |
\frametitle{Negation} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
281 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
282 |
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
|
283 |
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
|
284 |
\bl{$ab$} and \bl{$ac$}! |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
285 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
286 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
287 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
288 |
|
25 | 289 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
573 | 290 |
\begin{frame}[t] |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
291 |
\frametitle{Automata} |
25 | 292 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
293 |
A \alert{\bf deterministic finite automaton}, DFA, consists of: |
25 | 294 |
|
295 |
\begin{itemize} |
|
515 | 296 |
\item an alphabet \bl{$\varSigma$} |
574 | 297 |
\item a set of states \bl{$\mbox{Qs}$} |
515 | 298 |
\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
|
299 |
\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
|
300 |
\item there is transition function \bl{$\delta$}\bigskip |
25 | 301 |
|
302 |
\small |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
303 |
which takes a state as argument and a character and produces a |
515 | 304 |
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
|
305 |
\end{itemize} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
306 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
307 |
\begin{center} |
574 | 308 |
\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
|
309 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
310 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
311 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
312 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
313 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
314 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
315 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
316 |
\begin{frame}[c] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
317 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
318 |
\begin{center} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
319 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
573 | 320 |
every state/.style={minimum size=0pt,inner sep=2pt, |
321 |
draw=blue!50,very thick,fill=blue!20},] |
|
515 | 322 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
323 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$}; |
|
324 |
\node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$}; |
|
325 |
\node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$}; |
|
326 |
\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$}; |
|
327 |
\path[->] (Q_0) edge node [above] {\alert{$a$}} (Q_1); |
|
328 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_4); |
|
329 |
\path[->] (Q_4) edge [loop right] node {\alert{$a, b$}} (); |
|
330 |
\path[->] (Q_3) edge node [right] {\alert{$a$}} (Q_4); |
|
331 |
\path[->] (Q_2) edge node [above] {\alert{$a$}} (Q_3); |
|
332 |
\path[->] (Q_1) edge node [right] {\alert{$b$}} (Q_2); |
|
333 |
\path[->] (Q_0) edge node [above] {\alert{$b$}} (Q_2); |
|
334 |
\path[->] (Q_2) edge [loop left] node {\alert{$b$}} (); |
|
335 |
\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
|
336 |
\end{tikzpicture} |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
337 |
\end{center} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
338 |
|
573 | 339 |
\mbox{}\\[-14mm] |
340 |
\only<1>{ |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
341 |
\begin{itemize} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
342 |
\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
|
343 |
\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
|
344 |
\item all states might be accepting (but this does not necessarily mean all strings are accepted) |
573 | 345 |
\end{itemize}} |
346 |
\only<2>{ |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
347 |
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
|
348 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
349 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
350 |
\begin{tabular}{lll} |
515 | 351 |
\bl{$(\mbox{Q}_0, a) \rightarrow \mbox{Q}_1$} & \bl{$(\mbox{Q}_1, a) \rightarrow \mbox{Q}_4$} |
352 |
& \bl{$(\mbox{Q}_4, a) \rightarrow \mbox{Q}_4$}\\ |
|
353 |
\bl{$(\mbox{Q}_0, b) \rightarrow \mbox{Q}_2$} & \bl{$(\mbox{Q}_1, b) \rightarrow \mbox{Q}_2$} & |
|
354 |
\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
|
355 |
\end{tabular}\ldots |
573 | 356 |
\end{center} |
357 |
} |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
358 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
359 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
360 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
361 |
|
573 | 362 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
363 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
364 |
\begin{frame}[t] |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
365 |
\frametitle{Accepting a String} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
366 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
367 |
Given |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
368 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
369 |
\begin{center} |
574 | 370 |
\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
|
371 |
\end{center} |
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 |
you can define |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
374 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
375 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
376 |
\begin{tabular}{l} |
515 | 377 |
\bl{$\widehat{\delta}(q, []) \dn q$}\\ |
378 |
\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
|
379 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
380 |
\end{center}\pause |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
381 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
382 |
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
|
383 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
384 |
\begin{center} |
517 | 385 |
\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
|
386 |
\end{center} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
387 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
388 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
389 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
390 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
391 |
\begin{frame}[c] |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
392 |
\frametitle{Regular Languages} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
393 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
394 |
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
|
395 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
396 |
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
|
397 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
398 |
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
|
399 |
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
|
400 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
401 |
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
|
402 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
403 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
404 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
405 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
406 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
407 |
\frametitle{Regular Languages (2)} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
408 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
409 |
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
|
410 |
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
|
411 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
412 |
or {\bf equivalently}\bigskip\medskip |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
413 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
414 |
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
|
415 |
deterministic finite automaton that recognises all its |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
416 |
strings. |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
417 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
418 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
419 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
420 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
421 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
422 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
423 |
\begin{frame}[c] |
348
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
424 |
\frametitle{\begin{tabular}{c} |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
425 |
Non-Deterministic\\[-1mm] |
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
426 |
Finite Automata\end{tabular}} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
427 |
|
515 | 428 |
A non-deterministic finite automaton (NFA) consists again of: |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
429 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
430 |
\begin{itemize} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
431 |
\item a finite set of states |
515 | 432 |
\item \underline{some} these states are the start states |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
433 |
\item some states are accepting states, and |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
434 |
\item there is transition \alert{relation}\medskip |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
435 |
\end{itemize} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
436 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
437 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
438 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
439 |
\begin{tabular}{c} |
515 | 440 |
\bl{$(\mbox{Q}_1, a) \rightarrow \mbox{Q}_2$}\\ |
441 |
\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
|
442 |
\end{tabular} |
515 | 443 |
\bl{\ldots} |
444 |
\hspace{10mm}\pause |
|
445 |
\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
|
446 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
447 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
448 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
449 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
450 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
451 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
452 |
\begin{frame}[c] |
515 | 453 |
\frametitle{An NFA Example} |
454 |
||
455 |
% A NFA for (ab* + b)*a |
|
456 |
\begin{center} |
|
457 |
\begin{tikzpicture}[>=stealth',very thick, auto, |
|
458 |
every state/.style={minimum size=0pt,inner sep=3pt, |
|
459 |
draw=blue!50,very thick,fill=blue!20},scale=2] |
|
460 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
|
461 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$}; |
|
462 |
\node[state, accepting] (Q_2) [right=of Q_1] {$\mbox{Q}_2$}; |
|
463 |
\path[->] (Q_0) edge [loop above] node {\alert{$b$}} (); |
|
464 |
\path[<-] (Q_0) edge node [below] {\alert{$b$}} (Q_1); |
|
465 |
\path[->] (Q_0) edge [bend left] node [above] {\alert{$a$}} (Q_1); |
|
466 |
\path[->] (Q_0) edge [bend right] node [below] {\alert{$a$}} (Q_2); |
|
467 |
\path[->] (Q_1) edge [loop above] node {\alert{$a,b$}} (); |
|
468 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_2); |
|
469 |
\end{tikzpicture} |
|
470 |
\end{center} |
|
471 |
||
472 |
\end{frame} |
|
473 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
474 |
||
475 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
476 |
\begin{frame}[c] |
|
574 | 477 |
\frametitle{Another Example} |
478 |
||
479 |
For the regular expression \bl{$(.^*)a\,(.^{\{n\}})bc$}\bigskip\bigskip |
|
480 |
||
481 |
% \begin{center} |
|
650 | 482 |
\mbox{}\hspace{-11.5mm} |
574 | 483 |
\begin{tikzpicture}[>=stealth',very thick, auto, |
484 |
every state/.style={minimum size=5pt,inner sep=1pt, |
|
485 |
draw=blue!50,very thick,fill=blue!20},scale=1, node distance=5mm, |
|
486 |
decoration={brace,mirror,amplitude=7}] |
|
487 |
\node[state,initial] (Q_0) {$\;0\;$}; |
|
488 |
\node[state] (Q_1) [right=of Q_0] {$\;1\;$}; |
|
489 |
\node[state] (Q_2) [right=of Q_1] {$\;2\;$}; |
|
490 |
\node (Q_3) [right=of Q_2] {$\hspace{-1mm}\ldots\hspace{-3mm}$}; |
|
491 |
\node[state] (Q_4) [right=of Q_3] {$\;\phantom{1}\;$}; |
|
492 |
\node (Q_5) [right=of Q_4] {$\hspace{-1mm}\ldots\hspace{-3mm}$}; |
|
493 |
\node[state] (Q_6) [right=of Q_5] {\tiny$n+1$}; |
|
494 |
\node[state] (Q_7) [right=of Q_6] {\tiny$n+2$}; |
|
495 |
\node[state,accepting] (Q_8) [right=of Q_7] {\tiny$n+3$}; |
|
496 |
||
497 |
\path[->] (Q_0) edge [loop above] node {$*$} (); |
|
498 |
\path[->] (Q_0) edge node [above] {$a$} (Q_1); |
|
499 |
\path[->] (Q_1) edge node [above] {$*$} (Q_2); |
|
500 |
\path[->] (Q_2) edge node [above] {$*$} (Q_3); |
|
501 |
\path[->] (Q_4) edge node [above] {$*$} (Q_5); |
|
502 |
\path[->] (Q_5) edge node [above] {$*$} (Q_6); |
|
503 |
\path[->] (Q_6) edge node [above] {$b$} (Q_7); |
|
504 |
\path[->] (Q_7) edge node [above] {$c$} (Q_8); |
|
505 |
||
506 |
\draw [decorate] ([yshift=-5mm]Q_1.east) --node[below=3mm]{$n$} ([yshift=-5mm]Q_6.west); |
|
507 |
\end{tikzpicture}\bigskip |
|
508 |
||
509 |
||
510 |
{\small Note the star-transitions: accept any character.} |
|
511 |
||
512 |
\end{frame} |
|
513 |
||
514 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
515 |
\begin{frame}[c] |
|
515 | 516 |
\frametitle{Two Epsilon NFA Examples} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
517 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
518 |
\small |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
519 |
\begin{center} |
143
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
520 |
\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
|
521 |
\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
|
522 |
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
|
523 |
\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
|
524 |
\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
|
525 |
\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
|
526 |
\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
|
527 |
\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
|
528 |
\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
|
529 |
\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
|
530 |
\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
|
531 |
\end{tikzpicture} & |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
532 |
|
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
533 |
\raisebox{20mm}{ |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
534 |
\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
|
535 |
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
|
536 |
\node[state,initial] (r_1) {$r_1$}; |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
537 |
\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
|
538 |
\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
|
539 |
\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
|
540 |
\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
|
541 |
\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
|
542 |
\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
|
543 |
\end{tikzpicture}} |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
544 |
\end{tabular} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
545 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
546 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
547 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
548 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
549 |
|
515 | 550 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
551 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
552 |
\begin{frame}[c] |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
553 |
\frametitle{Rexp to NFA} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
554 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
555 |
\begin{center} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
556 |
\begin{tabular}[t]{l@{\hspace{10mm}}l} |
445 | 557 |
\raisebox{1mm}{\bl{$\ZERO$}} & |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
558 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 559 |
\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
|
560 |
\end{tikzpicture}\\\\ |
445 | 561 |
\raisebox{1mm}{\bl{$\ONE$}} & |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
562 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 563 |
\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
|
564 |
\end{tikzpicture}\\\\ |
651 | 565 |
\raisebox{5mm}{\bl{$c$}} & |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
566 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 567 |
\node[state, initial] (Q_0) {$\mbox{}$}; |
568 |
\node[state, accepting] (Q_1) [right=of Q_0] {$\mbox{}$}; |
|
569 |
\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
|
570 |
\end{tikzpicture}\\\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
571 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
572 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
573 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
574 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
575 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
576 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
577 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
578 |
\begin{frame}[t] |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
579 |
\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
|
580 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
581 |
\mbox{}\bigskip |
515 | 582 |
\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
|
583 |
|
515 | 584 |
{\centering% |
585 |
\only<1>{% |
|
586 |
\begin{tikzpicture}[node distance=3mm, |
|
587 |
>=stealth',very thick, |
|
588 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}] |
|
589 |
\node[state, initial] (Q_0) {$\mbox{}$}; |
|
590 |
\node[state, initial] (Q_01) [below=1mm of Q_0] {$\mbox{}$}; |
|
591 |
\node[state, initial] (Q_02) [above=1mm of Q_0] {$\mbox{}$}; |
|
592 |
\node (R_1) [right=of Q_0] {$\ldots$}; |
|
593 |
\node[state, accepting] (T_1) [right=of R_1] {$\mbox{}$}; |
|
594 |
\node[state, accepting] (T_2) [above=of T_1] {$\mbox{}$}; |
|
595 |
\node[state, accepting] (T_3) [below=of T_1] {$\mbox{}$}; |
|
596 |
||
597 |
\node (A_0) [right=2.5cm of T_1] {$\mbox{}$}; |
|
598 |
\node[state, initial] (A_01) [above=1mm of A_0] {$\mbox{}$}; |
|
599 |
\node[state, initial] (A_02) [below=1mm of A_0] {$\mbox{}$}; |
|
600 |
||
601 |
\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
|
602 |
\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
|
603 |
\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
|
604 |
\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
|
605 |
\begin{pgfonlayer}{background} |
515 | 606 |
\node (1) [rounded corners, inner sep=1mm, thick, |
607 |
draw=black!60, fill=black!20, fit= (Q_0) (R_1) (T_1) (T_2) (T_3)] {}; |
|
608 |
\node (2) [rounded corners, inner sep=1mm, thick, |
|
609 |
draw=black!60, fill=black!20, fit= (A_0) (b_1) (c_1) (c_2) (c_3)] {}; |
|
610 |
\node [yshift=2mm] at (1.north) {$r_1$}; |
|
611 |
\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
|
612 |
\end{pgfonlayer} |
515 | 613 |
\end{tikzpicture}} |
614 |
\only<2>{% |
|
615 |
\begin{tikzpicture}[node distance=3mm, |
|
616 |
>=stealth',very thick, |
|
617 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
|
618 |
\node[state, initial] (Q_0) {$\mbox{}$}; |
|
619 |
\node[state, initial] (Q_01) [below=1mm of Q_0] {$\mbox{}$}; |
|
620 |
\node[state, initial] (Q_02) [above=1mm of Q_0] {$\mbox{}$}; |
|
621 |
\node (r_1) [right=of Q_0] {$\ldots$}; |
|
622 |
\node[state] (t_1) [right=of r_1] {$\mbox{}$}; |
|
623 |
\node[state] (t_2) [above=of t_1] {$\mbox{}$}; |
|
624 |
\node[state] (t_3) [below=of t_1] {$\mbox{}$}; |
|
625 |
||
626 |
\node (A_0) [right=2.5cm of t_1] {$\mbox{}$}; |
|
627 |
\node[state] (A_01) [above=1mm of A_0] {$\mbox{}$}; |
|
628 |
\node[state] (A_02) [below=1mm of A_0] {$\mbox{}$}; |
|
629 |
||
630 |
\node (b_1) [right=of A_0] {$\ldots$}; |
|
631 |
\node[state, accepting] (c_1) [right=of b_1] {$\mbox{}$}; |
|
632 |
\node[state, accepting] (c_2) [above=of c_1] {$\mbox{}$}; |
|
633 |
\node[state, accepting] (c_3) [below=of c_1] {$\mbox{}$}; |
|
634 |
\path[->] (t_1) edge (A_01); |
|
635 |
\path[->] (t_2) edge node [above] {$\epsilon$s} (A_01); |
|
636 |
\path[->] (t_3) edge (A_01); |
|
637 |
\path[->] (t_1) edge (A_02); |
|
638 |
\path[->] (t_2) edge (A_02); |
|
639 |
\path[->] (t_3) edge node [below] {$\epsilon$s} (A_02); |
|
640 |
||
641 |
\begin{pgfonlayer}{background} |
|
642 |
\node (3) [rounded corners, inner sep=1mm, thick, |
|
643 |
draw=black!60, fill=black!20, fit= (Q_0) (c_1) (c_2) (c_3)] {}; |
|
644 |
\node [yshift=2mm] at (3.north) {$r_1\cdot r_2$}; |
|
645 |
\end{pgfonlayer} |
|
646 |
\end{tikzpicture}} |
|
647 |
% |
|
648 |
}\bigskip\bigskip |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
649 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
650 |
\small |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
651 |
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
|
652 |
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
|
653 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
654 |
\end{frame} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
655 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
656 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
657 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
658 |
\begin{frame}[t] |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
659 |
\frametitle{Case $r_1+ r_2$} |
515 | 660 |
\mbox{}\\[-8mm] |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
661 |
|
515 | 662 |
\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
|
663 |
|
515 | 664 |
\hspace{2cm} |
665 |
\only<1>{% |
|
666 |
\begin{tikzpicture}[node distance=3mm, |
|
667 |
>=stealth',very thick, |
|
668 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
|
669 |
baseline=(current bounding box.center)] |
|
670 |
\node at (0,0) (1) {$\mbox{}$}; |
|
671 |
\node (2) [above=14mm of 1] {}; |
|
672 |
\node[state, initial] (4) [above=1mm of 2] {$\mbox{}$}; |
|
673 |
\node[state, initial] (5) [below=1mm of 2] {$\mbox{}$}; |
|
674 |
\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
|
675 |
|
515 | 676 |
\node (a) [right=of 2] {$\ldots\,$}; |
677 |
\node (a1) [right=of a] {$$}; |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
678 |
\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
|
679 |
\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
|
680 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
681 |
\node (b) [right=of 3] {$\ldots$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
682 |
\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
|
683 |
\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
|
684 |
\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
|
685 |
\begin{pgfonlayer}{background} |
515 | 686 |
\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {}; |
687 |
\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (3) (b1) (b2) (b3)] {}; |
|
688 |
\node [yshift=3mm] at (1.north) {$r_1$}; |
|
689 |
\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
|
690 |
\end{pgfonlayer} |
515 | 691 |
\end{tikzpicture}} |
692 |
\only<2>{% |
|
693 |
\begin{tikzpicture}[node distance=3mm, |
|
694 |
>=stealth',very thick, |
|
695 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
|
696 |
baseline=(current bounding box.center)] |
|
697 |
\node at (0,0) (1) {$\mbox{}$}; |
|
698 |
\node (2) [above=14mm of 1] {$$}; |
|
699 |
\node[state, initial] (4) [above=1mm of 2] {$\mbox{}$}; |
|
700 |
\node[state, initial] (5) [below=1mm of 2] {$\mbox{}$}; |
|
701 |
\node[state, initial] (3) [below=10mm of 1] {$\mbox{}$}; |
|
702 |
||
703 |
\node (a) [right=of 2] {$\ldots\,$}; |
|
704 |
\node (a1) [right=of a] {$$}; |
|
705 |
\node[state, accepting] (a2) [above=of a1] {$\mbox{}$}; |
|
706 |
\node[state, accepting] (a3) [below=of a1] {$\mbox{}$}; |
|
707 |
||
708 |
\node (b) [right=of 3] {$\ldots$}; |
|
709 |
\node[state, accepting] (b1) [right=of b] {$\mbox{}$}; |
|
710 |
\node[state, accepting] (b2) [above=of b1] {$\mbox{}$}; |
|
711 |
\node[state, accepting] (b3) [below=of b1] {$\mbox{}$}; |
|
712 |
||
713 |
%\path[->] (1) edge node [above] {$\epsilon$} (2); |
|
714 |
%\path[->] (1) edge node [below] {$\epsilon$} (3); |
|
715 |
||
716 |
\begin{pgfonlayer}{background} |
|
717 |
\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3) (b2) (b3)] {}; |
|
718 |
\node [yshift=3mm] at (3.north) {$r_1+ r_2$}; |
|
719 |
\end{pgfonlayer} |
|
720 |
\end{tikzpicture}} |
|
721 |
% |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
722 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
723 |
\small |
515 | 724 |
\mbox{}\\\medskip |
517 | 725 |
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
|
726 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
727 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
728 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
729 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
730 |
\begin{frame}[c] |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
731 |
\frametitle{Case $r^*$} |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
732 |
|
515 | 733 |
\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
|
734 |
|
515 | 735 |
\hspace{2cm} |
736 |
\only<1>{\begin{tikzpicture}[node distance=3mm, |
|
737 |
>=stealth',very thick, |
|
738 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
|
739 |
baseline=(current bounding box.north)] |
|
740 |
\node (2) {$\mbox{}$}; |
|
741 |
\node[state, initial] (4) [above=1mm of 2] {$\mbox{}$}; |
|
742 |
\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
|
743 |
\node (a) [right=of 2] {$\ldots$}; |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
744 |
\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
|
745 |
\node[state, accepting] (a2) [above=of a1] {$\mbox{}$}; |
515 | 746 |
\node[state, accepting] (a3) [below=of a1] {$\mbox{}$}; |
747 |
\begin{pgfonlayer}{background} |
|
748 |
\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {}; |
|
749 |
\node [yshift=3mm] at (1.north) {$r$}; |
|
750 |
\end{pgfonlayer} |
|
751 |
\end{tikzpicture}} |
|
752 |
\only<2->{\begin{tikzpicture}[node distance=3mm, |
|
753 |
>=stealth',very thick, |
|
754 |
every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
|
755 |
baseline=(current bounding box.north)] |
|
756 |
\node at (0,0) [state, initial,accepting] (1) {$\mbox{}$}; |
|
757 |
\node (2) [right=16mm of 1] {$\mbox{}$}; |
|
758 |
\node[state] (4) [above=1mm of 2] {$\mbox{}$}; |
|
759 |
\node[state] (5) [below=1mm of 2] {$\mbox{}$}; |
|
760 |
\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
|
761 |
\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
|
762 |
\node[state] (a2) [above=of a1] {$\mbox{}$}; |
515 | 763 |
\node[state] (a3) [below=of a1] {$\mbox{}$}; |
764 |
\path[->] (1) edge node [below] {$\epsilon$} (4); |
|
765 |
\path[->] (1) edge node [below] {$\epsilon$} (5); |
|
766 |
\path[->] (a1) edge [bend left=45] node [below] {$\epsilon$} (1); |
|
767 |
\path[->] (a2) edge [bend right] node [below] {$\epsilon$} (1); |
|
768 |
\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
|
769 |
\begin{pgfonlayer}{background} |
515 | 770 |
\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3)] {}; |
771 |
\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
|
772 |
\end{pgfonlayer} |
515 | 773 |
\end{tikzpicture}} |
774 |
\bigskip |
|
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
775 |
|
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
776 |
\onslide<3->{ |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
777 |
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
|
778 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
779 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
780 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
781 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
782 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
783 |
\begin{frame}[c] |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
784 |
\frametitle{Subset Construction} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
785 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
786 |
|
662 | 787 |
\begin{textblock}{5}(1,1.5) |
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
788 |
\begin{center} |
515 | 789 |
\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
|
790 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 791 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
792 |
\node[state] (Q_1) [above=of Q_0] {$\mbox{Q}_1$}; |
|
793 |
\node[state, accepting] (Q_2) [below=of Q_0] {$\mbox{Q}_2$}; |
|
794 |
\path[->] (Q_0) edge node [left] {\alert{$\epsilon$}} (Q_1); |
|
795 |
\path[->] (Q_0) edge node [left] {\alert{$\epsilon$}} (Q_2); |
|
796 |
\path[->] (Q_0) edge [loop right] node {\alert{$a$}} (); |
|
797 |
\path[->] (Q_1) edge [loop above] node {\alert{$a$}} (); |
|
798 |
\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
|
799 |
\end{tikzpicture} |
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
800 |
\end{center} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
801 |
\end{textblock} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
802 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
803 |
\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
|
804 |
\begin{tabular}{r|cl} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
805 |
nodes \textcolor{white}{*} & $a$ & $b$\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
806 |
\hline |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
807 |
$\{\}$ \textcolor{white}{*} & \onslide<2->{$\{\}$} & \onslide<2->{$\{\}$}\\ |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
808 |
$\{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
|
809 |
$\{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
|
810 |
$\{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
|
811 |
$\{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
|
812 |
$\{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
|
813 |
$\{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
|
814 |
\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
|
815 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
816 |
\end{textblock} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
817 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
818 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
819 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
820 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
821 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
822 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
823 |
\frametitle{The Result} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
824 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
825 |
\footnotesize |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
826 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
827 |
\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
|
828 |
every state/.style={minimum size=0pt, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
829 |
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
|
830 |
baseline=0mm] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
831 |
\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
|
832 |
\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
|
833 |
\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
|
834 |
\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
|
835 |
\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
|
836 |
\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
|
837 |
\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
|
838 |
\node[state] (qn) [right=of q1] {$\{\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
839 |
|
348
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
840 |
\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
|
841 |
\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
|
842 |
\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
|
843 |
\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
|
844 |
\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
|
845 |
\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
|
846 |
\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
|
847 |
\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
|
848 |
\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
|
849 |
\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
|
850 |
\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
|
851 |
\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
|
852 |
\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
|
853 |
\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
|
854 |
\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
|
855 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
856 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
857 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
858 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
859 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
860 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
861 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
862 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
863 |
\begin{frame}[c] |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
864 |
\frametitle{Removing Dead States} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
865 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
866 |
\footnotesize |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
867 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
868 |
\begin{tabular}{ll} |
445 | 869 |
DFA: & (original) NFA:\\ |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
870 |
\raisebox{10mm}{% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
871 |
\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
|
872 |
every state/.style={minimum size=0pt, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
873 |
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
|
874 |
\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
|
875 |
\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
|
876 |
\node[state] (qn) [right=of q2] {$\{\}$}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
877 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
878 |
\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
|
879 |
\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
|
880 |
\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
|
881 |
\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
|
882 |
\path[->] (qn) edge [loop above] node |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
883 |
{$\alert{a},\alert{b}$} (); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
884 |
\end{tikzpicture}} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
885 |
& |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
886 |
\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
|
887 |
every state/.style={minimum size=0pt, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
888 |
draw=blue!50,very thick,fill=blue!20},] |
515 | 889 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
890 |
\node[state] (Q_1) [above=of Q_0] {$\mbox{Q}_1$}; |
|
891 |
\node[state, accepting] (Q_2) [below=of Q_0] {$\mbox{Q}_2$}; |
|
892 |
\path[->] (Q_0) edge node [left] {\alert{$\epsilon$}} (Q_1); |
|
893 |
\path[->] (Q_0) edge node [left] {\alert{$\epsilon$}} (Q_2); |
|
894 |
\path[->] (Q_0) edge [loop right] node {\alert{$a$}} (); |
|
895 |
\path[->] (Q_1) edge [loop above] node {\alert{$a$}} (); |
|
896 |
\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
|
897 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
898 |
\end{tabular} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
899 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
900 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
901 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
902 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
903 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
904 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
905 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
906 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
907 |
\begin{frame}[c] |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
908 |
\frametitle{Regexps and Automata} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
909 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
910 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
911 |
\begin{tikzpicture} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
912 |
\node (rexp) {\bl{\bf Regexps}}; |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
913 |
\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
|
914 |
\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
|
915 |
\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
|
916 |
\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
|
917 |
\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
|
918 |
\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
|
919 |
\end{tikzpicture}\\ |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
920 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
921 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
922 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
923 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
924 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
925 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
926 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
927 |
\frametitle{DFA Minimisation} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
928 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
929 |
\begin{enumerate} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
930 |
\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
|
931 |
\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
|
932 |
\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
|
933 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
934 |
\bl{$(\delta(q, c), \delta(p,c))$} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
935 |
\end{center} |
348
31e89128ccd2
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
346
diff
changeset
|
936 |
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
|
937 |
\item Repeat last step until no change. |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
938 |
\item All unmarked pairs can be merged. |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
939 |
\end{enumerate} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
940 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
941 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
942 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
943 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
944 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
945 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
946 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
947 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
948 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
949 |
every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 950 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
951 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$}; |
|
952 |
\node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$}; |
|
953 |
\node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$}; |
|
954 |
\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$}; |
|
955 |
\path[->] (Q_0) edge node [above] {\alert{$a$}} (Q_1); |
|
956 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_4); |
|
957 |
\path[->] (Q_4) edge [loop right] node {\alert{$a, b$}} (); |
|
958 |
\path[->] (Q_3) edge node [right] {\alert{$a$}} (Q_4); |
|
959 |
\path[->] (Q_2) edge node [above] {\alert{$a$}} (Q_3); |
|
960 |
\path[->] (Q_1) edge node [right] {\alert{$b$}} (Q_2); |
|
961 |
\path[->] (Q_0) edge node [above] {\alert{$b$}} (Q_2); |
|
962 |
\path[->] (Q_2) edge [loop left] node {\alert{$b$}} (); |
|
963 |
\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
|
964 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
965 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
966 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
967 |
\mbox{}\\[-20mm]\mbox{} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
968 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
969 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
970 |
\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
|
971 |
\draw (0,0) -- (4,0); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
972 |
\draw (0,1) -- (4,1); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
973 |
\draw (0,2) -- (3,2); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
974 |
\draw (0,3) -- (2,3); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
975 |
\draw (0,4) -- (1,4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
976 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
977 |
\draw (0,0) -- (0, 4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
978 |
\draw (1,0) -- (1, 4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
979 |
\draw (2,0) -- (2, 3); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
980 |
\draw (3,0) -- (3, 2); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
981 |
\draw (4,0) -- (4, 1); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
982 |
|
515 | 983 |
\draw (0.5,-0.5) node {$\mbox{Q}_0$}; |
984 |
\draw (1.5,-0.5) node {$\mbox{Q}_1$}; |
|
985 |
\draw (2.5,-0.5) node {$\mbox{Q}_2$}; |
|
986 |
\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
|
987 |
|
515 | 988 |
\draw (-0.5, 3.5) node {$\mbox{Q}_1$}; |
989 |
\draw (-0.5, 2.5) node {$\mbox{Q}_2$}; |
|
990 |
\draw (-0.5, 1.5) node {$\mbox{Q}_3$}; |
|
991 |
\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
|
992 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
993 |
\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
|
994 |
\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
|
995 |
\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
|
996 |
\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
|
997 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
998 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
999 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1000 |
\end{frame} |
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 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1003 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1004 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1005 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1006 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1007 |
\begin{tabular}{@{\hspace{-8mm}}cc@{}} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1008 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1009 |
every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 1010 |
\node[state,initial] (Q_0) {$\mbox{Q}_0$}; |
1011 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$}; |
|
1012 |
\node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$}; |
|
1013 |
\node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$}; |
|
1014 |
\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$}; |
|
1015 |
\path[->] (Q_0) edge node [above] {\alert{$a$}} (Q_1); |
|
1016 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_4); |
|
1017 |
\path[->] (Q_4) edge [loop right] node {\alert{$a, b$}} (); |
|
1018 |
\path[->] (Q_3) edge node [right] {\alert{$a$}} (Q_4); |
|
1019 |
\path[->] (Q_2) edge node [above] {\alert{$a$}} (Q_3); |
|
1020 |
\path[->] (Q_1) edge node [right] {\alert{$b$}} (Q_2); |
|
1021 |
\path[->] (Q_0) edge node [above] {\alert{$b$}} (Q_2); |
|
1022 |
\path[->] (Q_2) edge [loop left] node {\alert{$b$}} (); |
|
1023 |
\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
|
1024 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1025 |
& |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1026 |
\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
|
1027 |
\draw (0,0) -- (4,0); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1028 |
\draw (0,1) -- (4,1); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1029 |
\draw (0,2) -- (3,2); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1030 |
\draw (0,3) -- (2,3); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1031 |
\draw (0,4) -- (1,4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1032 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1033 |
\draw (0,0) -- (0, 4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1034 |
\draw (1,0) -- (1, 4); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1035 |
\draw (2,0) -- (2, 3); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1036 |
\draw (3,0) -- (3, 2); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1037 |
\draw (4,0) -- (4, 1); |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1038 |
|
515 | 1039 |
\draw (0.5,-0.5) node {$\mbox{Q}_0$}; |
1040 |
\draw (1.5,-0.5) node {$\mbox{Q}_1$}; |
|
1041 |
\draw (2.5,-0.5) node {$\mbox{Q}_2$}; |
|
1042 |
\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
|
1043 |
|
515 | 1044 |
\draw (-0.5, 3.5) node {$\mbox{Q}_1$}; |
1045 |
\draw (-0.5, 2.5) node {$\mbox{Q}_2$}; |
|
1046 |
\draw (-0.5, 1.5) node {$\mbox{Q}_3$}; |
|
1047 |
\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
|
1048 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1049 |
\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
|
1050 |
\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
|
1051 |
\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
|
1052 |
\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
|
1053 |
\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
|
1054 |
\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
|
1055 |
\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
|
1056 |
\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
|
1057 |
\end{tikzpicture}} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1058 |
\end{tabular} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1059 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1060 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1061 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1062 |
\mbox{}\\[-20mm]\mbox{} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1063 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1064 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1065 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1066 |
every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 1067 |
\node[state,initial] (Q_02) {$\mbox{Q}_{0, 2}$}; |
1068 |
\node[state] (Q_13) [right=of Q_02] {$\mbox{Q}_{1, 3}$}; |
|
1069 |
\node[state, accepting] (Q_4) [right=of Q_13] {$\mbox{Q}_{4\phantom{,0}}$}; |
|
1070 |
\path[->] (Q_02) edge [bend left] node [above] {\alert{$a$}} (Q_13); |
|
1071 |
\path[->] (Q_13) edge [bend left] node [below] {\alert{$b$}} (Q_02); |
|
1072 |
\path[->] (Q_02) edge [loop below] node {\alert{$b$}} (); |
|
1073 |
\path[->] (Q_13) edge node [above] {\alert{$a$}} (Q_4); |
|
1074 |
\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
|
1075 |
\end{tikzpicture}\\ |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1076 |
minimal automaton |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1077 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1078 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1079 |
\end{frame} |
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] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1085 |
\frametitle{Alternatives} |
573 | 1086 |
\mbox{}\\[-14mm]\mbox{} |
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1087 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1088 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1089 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1090 |
every state/.style={minimum size=0pt, |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1091 |
inner sep=2pt,draw=blue!50,very thick,fill=blue!20}] |
515 | 1092 |
\only<1>{\node[state,initial] (Q_0) {$\mbox{Q}_0$};} |
1093 |
\only<2->{\node[state,accepting] (Q_0) {$\mbox{Q}_0$};} |
|
1094 |
\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$}; |
|
1095 |
\node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$}; |
|
1096 |
\node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$}; |
|
1097 |
\only<1>{\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};} |
|
1098 |
\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
|
1099 |
\only<1-2>{ |
515 | 1100 |
\path[->] (Q_0) edge node [above] {\alert{$a$}} (Q_1); |
1101 |
\path[->] (Q_1) edge node [above] {\alert{$a$}} (Q_4); |
|
1102 |
\path[->] (Q_4) edge [loop above] node {\alert{$a, b$}} (); |
|
1103 |
\path[->] (Q_3) edge node [right] {\alert{$a$}} (Q_4); |
|
1104 |
\path[->] (Q_2) edge node [above] {\alert{$a$}} (Q_3); |
|
1105 |
\path[->] (Q_1) edge node [right] {\alert{$b$}} (Q_2); |
|
1106 |
\path[->] (Q_0) edge node [above] {\alert{$b$}} (Q_2); |
|
1107 |
\path[->] (Q_2) edge [loop left] node {\alert{$b$}} (); |
|
1108 |
\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
|
1109 |
\only<3->{ |
515 | 1110 |
\path[<-] (Q_0) edge node [above] {\alert{$a$}} (Q_1); |
1111 |
\path[<-] (Q_1) edge node [above] {\alert{$a$}} (Q_4); |
|
1112 |
\path[<-] (Q_4) edge [loop above] node {\alert{$a, b$}} (); |
|
1113 |
\path[<-] (Q_3) edge node [right] {\alert{$a$}} (Q_4); |
|
1114 |
\path[<-] (Q_2) edge node [above] {\alert{$a$}} (Q_3); |
|
1115 |
\path[<-] (Q_1) edge node [right] {\alert{$b$}} (Q_2); |
|
1116 |
\path[<-] (Q_0) edge node [above] {\alert{$b$}} (Q_2); |
|
1117 |
\path[<-] (Q_2) edge [loop left] node {\alert{$b$}} (); |
|
1118 |
\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
|
1119 |
\end{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1120 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1121 |
\mbox{}\\[-18mm] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1122 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1123 |
\small |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1124 |
\begin{itemize} |
573 | 1125 |
\item<1-> exchange initial / accepting states\\[-2mm] |
1126 |
\item<2-> reverse all edges\\[-2mm] |
|
1127 |
\item<3-> subset construction $\Rightarrow$ DFA\\[-2mm] |
|
1128 |
\item<4-> remove dead states\\[-2mm] |
|
1129 |
\item<5-> repeat once more |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1130 |
\onslide<6->{$\Rightarrow$ minimal DFA} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1131 |
\end{itemize} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1132 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1133 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1134 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1135 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1136 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1137 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1138 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1139 |
\frametitle{Regexps and Automata} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1140 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1141 |
\begin{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1142 |
\begin{tikzpicture} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1143 |
\node (rexp) {\bl{\bf Regexps}}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1144 |
\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
|
1145 |
\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
|
1146 |
\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
|
1147 |
\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
|
1148 |
\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
|
1149 |
\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
|
1150 |
\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
|
1151 |
\end{tikzpicture}\\ |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1152 |
\end{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1153 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1154 |
\end{frame} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1155 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1156 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1157 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1158 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1159 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1160 |
\begin{frame}<2>[c] |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1161 |
\frametitle{DFA to Rexp} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1162 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1163 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1164 |
\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
|
1165 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 1166 |
\only<1>{\node[state, initial] (q0) at ( 0,1) {$\mbox{Q}_0$};} |
1167 |
\only<2->{\node[state, initial,accepting] (q0) at ( 0,1) {$\mbox{Q}_0$};} |
|
1168 |
\only<1>{\node[state] (q1) at ( 1,1) {$\mbox{Q}_1$};} |
|
1169 |
\only<2->{\node[state,accepting] (q1) at ( 1,1) {$\mbox{Q}_1$};} |
|
1170 |
\only<1>{\node[state, accepting] (q2) at ( 2,1) {$\mbox{Q}_2$};} |
|
1171 |
\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
|
1172 |
\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
|
1173 |
(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
|
1174 |
(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
|
1175 |
(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
|
1176 |
(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
|
1177 |
(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
|
1178 |
; |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1179 |
\end{tikzpicture} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1180 |
\end{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1181 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1182 |
\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
|
1183 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1184 |
\end{frame} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1185 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1186 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1187 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1188 |
\begin{frame}[c] |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1189 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1190 |
\begin{center} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1191 |
\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
|
1192 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 1193 |
\only<1->{\node[state, initial] (q0) at ( 0,1) {$\mbox{Q}_0$};} |
1194 |
\only<1->{\node[state] (q1) at ( 1,1) {$\mbox{Q}_1$};} |
|
1195 |
\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
|
1196 |
\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
|
1197 |
(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
|
1198 |
(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
|
1199 |
(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
|
1200 |
(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
|
1201 |
(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
|
1202 |
; |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
1203 |
\end{tikzpicture} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1204 |
\end{center}\pause\bigskip |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1205 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1206 |
\onslide<2->{ |
445 | 1207 |
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
|
1208 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1209 |
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
515 | 1210 |
\bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$2\, \mbox{Q}_0 + 3 \,\mbox{Q}_1 + 4\, \mbox{Q}_2$}\\ |
1211 |
\bl{$\mbox{Q}_1$} & \bl{$=$} & \bl{$2 \,\mbox{Q}_0 + 3\, \mbox{Q}_1 + 1\, \mbox{Q}_2$}\\ |
|
1212 |
\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
|
1213 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1214 |
\end{tabular} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1215 |
\end{center} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1216 |
} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1217 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1218 |
\end{frame} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1219 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1220 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1221 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1222 |
\begin{frame}[c] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1223 |
|
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1224 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1225 |
\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
|
1226 |
every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] |
515 | 1227 |
\only<1->{\node[state, initial] (q0) at ( 0,1) {$\mbox{Q}_0$};} |
1228 |
\only<1->{\node[state] (q1) at ( 1,1) {$\mbox{Q}_1$};} |
|
1229 |
\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
|
1230 |
\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
|
1231 |
(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
|
1232 |
(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
|
1233 |
(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
|
1234 |
(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
|
1235 |
(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
|
1236 |
; |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1237 |
\end{tikzpicture} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1238 |
\end{center}\bigskip |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1239 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1240 |
\onslide<2->{ |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1241 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1242 |
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
650 | 1243 |
\bl{$\mbox{Q}_0$} & \bl{$=$} & \bl{$\mbox{Q}_0\,b + \mbox{Q}_1\,b + \mbox{Q}_2\,b + \ONE$}\\ |
515 | 1244 |
\bl{$\mbox{Q}_1$} & \bl{$=$} & \bl{$\mbox{Q}_0\,a$}\\ |
1245 |
\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
|
1246 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1247 |
\end{tabular} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1248 |
\end{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1249 |
} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1250 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1251 |
\onslide<3->{ |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1252 |
Arden's Lemma: |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1253 |
\begin{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1254 |
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
|
1255 |
\end{center} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1256 |
} |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1257 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1258 |
\end{frame} |
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 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1262 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1263 |
\frametitle{Regexps and Automata} |
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} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1267 |
\node (rexp) {\bl{\bf Regexps}}; |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1268 |
\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
|
1269 |
\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
|
1270 |
\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
|
1271 |
\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
|
1272 |
\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
|
1273 |
\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
|
1274 |
\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
|
1275 |
\end{tikzpicture}\\ |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1276 |
\end{center} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1277 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1278 |
\end{frame} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1279 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1280 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1281 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1282 |
\begin{frame}[c] |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1283 |
\frametitle{Regular Languages (3)} |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1284 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1285 |
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
|
1286 |
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
|
1287 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1288 |
or {\bf equivalently}\bigskip\medskip |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1289 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1290 |
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
|
1291 |
deterministic finite automaton that recognises all its |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1292 |
strings.\bigskip\medskip\pause |
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1293 |
|
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1294 |
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
|
1295 |
\end{frame} |
265
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1296 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1297 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1298 |
|
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1299 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1300 |
\begin{frame}[c] |
332fbe9c91ab
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
1301 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1302 |
Given the function |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1303 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1304 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1305 |
\bl{\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l} |
445 | 1306 |
$rev(\ZERO)$ & $\dn$ & $\ZERO$\\ |
1307 |
$rev(\ONE)$ & $\dn$ & $\ONE$\\ |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1308 |
$rev(c)$ & $\dn$ & $c$\\ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1309 |
$rev(r_1 + r_2)$ & $\dn$ & $rev(r_1) + rev(r_2)$\\ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1310 |
$rev(r_1 \cdot r_2)$ & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1311 |
$rev(r^*)$ & $\dn$ & $rev(r)^*$\\ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1312 |
\end{tabular}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1313 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1314 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1315 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1316 |
and the set |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1317 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1318 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1319 |
\bl{$Rev\,A \dn \{s^{-1} \;|\; s \in A\}$} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1320 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1321 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1322 |
prove whether |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1323 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1324 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1325 |
\bl{$L(rev(r)) = Rev (L(r))$} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1326 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
1327 |
|
346
a98794b11ac4
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
265
diff
changeset
|
1328 |
\end{frame} |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
1329 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
25 | 1330 |
|
1331 |
||
1332 |
\end{document} |
|
1333 |
||
1334 |
%%% Local Variables: |
|
1335 |
%%% mode: latex |
|
1336 |
%%% TeX-master: t |
|
1337 |
%%% End: |
|
1338 |