33
|
1 |
\documentclass[dvipsnames,14pt,t]{beamer}
|
|
2 |
\usepackage{beamerthemeplainculight}
|
|
3 |
\usepackage[T1]{fontenc}
|
|
4 |
\usepackage[latin1]{inputenc}
|
|
5 |
\usepackage{mathpartir}
|
|
6 |
\usepackage[absolute,overlay]{textpos}
|
|
7 |
\usepackage{ifthen}
|
|
8 |
\usepackage{tikz}
|
|
9 |
\usepackage{pgf}
|
|
10 |
\usepackage{calc}
|
|
11 |
\usepackage{ulem}
|
|
12 |
\usepackage{courier}
|
|
13 |
\usepackage{listings}
|
|
14 |
\renewcommand{\uline}[1]{#1}
|
|
15 |
\usetikzlibrary{arrows}
|
|
16 |
\usetikzlibrary{automata}
|
|
17 |
\usetikzlibrary{shapes}
|
|
18 |
\usetikzlibrary{shadows}
|
|
19 |
\usetikzlibrary{positioning}
|
|
20 |
\usetikzlibrary{calc}
|
|
21 |
\usepackage{graphicx}
|
|
22 |
|
|
23 |
\definecolor{javared}{rgb}{0.6,0,0} % for strings
|
|
24 |
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
|
|
25 |
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
|
|
26 |
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
|
|
27 |
|
|
28 |
\lstset{language=Java,
|
|
29 |
basicstyle=\ttfamily,
|
|
30 |
keywordstyle=\color{javapurple}\bfseries,
|
|
31 |
stringstyle=\color{javagreen},
|
|
32 |
commentstyle=\color{javagreen},
|
|
33 |
morecomment=[s][\color{javadocblue}]{/**}{*/},
|
|
34 |
numbers=left,
|
|
35 |
numberstyle=\tiny\color{black},
|
|
36 |
stepnumber=1,
|
|
37 |
numbersep=10pt,
|
|
38 |
tabsize=2,
|
|
39 |
showspaces=false,
|
|
40 |
showstringspaces=false}
|
|
41 |
|
|
42 |
\lstdefinelanguage{scala}{
|
|
43 |
morekeywords={abstract,case,catch,class,def,%
|
|
44 |
do,else,extends,false,final,finally,%
|
|
45 |
for,if,implicit,import,match,mixin,%
|
|
46 |
new,null,object,override,package,%
|
|
47 |
private,protected,requires,return,sealed,%
|
|
48 |
super,this,throw,trait,true,try,%
|
|
49 |
type,val,var,while,with,yield},
|
|
50 |
otherkeywords={=>,<-,<\%,<:,>:,\#,@},
|
|
51 |
sensitive=true,
|
|
52 |
morecomment=[l]{//},
|
|
53 |
morecomment=[n]{/*}{*/},
|
|
54 |
morestring=[b]",
|
|
55 |
morestring=[b]',
|
|
56 |
morestring=[b]"""
|
|
57 |
}
|
|
58 |
|
|
59 |
\lstset{language=Scala,
|
|
60 |
basicstyle=\ttfamily,
|
|
61 |
keywordstyle=\color{javapurple}\bfseries,
|
|
62 |
stringstyle=\color{javagreen},
|
|
63 |
commentstyle=\color{javagreen},
|
|
64 |
morecomment=[s][\color{javadocblue}]{/**}{*/},
|
|
65 |
numbers=left,
|
|
66 |
numberstyle=\tiny\color{black},
|
|
67 |
stepnumber=1,
|
|
68 |
numbersep=10pt,
|
|
69 |
tabsize=2,
|
|
70 |
showspaces=false,
|
|
71 |
showstringspaces=false}
|
|
72 |
|
|
73 |
% beamer stuff
|
|
74 |
\renewcommand{\slidecaption}{AFL 04, King's College London, 17.~October 2012}
|
|
75 |
\newcommand{\bl}[1]{\textcolor{blue}{#1}}
|
|
76 |
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
|
|
77 |
|
|
78 |
\begin{document}
|
|
79 |
|
|
80 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
81 |
\mode<presentation>{
|
|
82 |
\begin{frame}<1>[t]
|
|
83 |
\frametitle{%
|
|
84 |
\begin{tabular}{@ {}c@ {}}
|
|
85 |
\\[-3mm]
|
|
86 |
\LARGE Automata and \\[-2mm]
|
|
87 |
\LARGE Formal Languages (4)\\[3mm]
|
|
88 |
\end{tabular}}
|
|
89 |
|
|
90 |
\normalsize
|
|
91 |
\begin{center}
|
|
92 |
\begin{tabular}{ll}
|
|
93 |
Email: & christian.urban at kcl.ac.uk\\
|
|
94 |
Of$\!$fice: & S1.27 (1st floor Strand Building)\\
|
|
95 |
Slides: & KEATS (also home work is there)\\
|
|
96 |
\end{tabular}
|
|
97 |
\end{center}
|
|
98 |
|
|
99 |
|
|
100 |
\end{frame}}
|
|
101 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
102 |
|
|
103 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
104 |
\mode<presentation>{
|
|
105 |
\begin{frame}[c]
|
|
106 |
\frametitle{\begin{tabular}{c}Last Week\end{tabular}}
|
|
107 |
|
35
|
108 |
Last week I showed you\bigskip
|
33
|
109 |
|
|
110 |
\begin{itemize}
|
35
|
111 |
\item a tokenizer taking a list of regular expressions\bigskip
|
33
|
112 |
|
|
113 |
\item tokenization identifies lexeme in an input stream of characters (or string)
|
35
|
114 |
and cathegorizes them into tokens
|
|
115 |
|
|
116 |
\end{itemize}
|
|
117 |
|
|
118 |
\end{frame}}
|
|
119 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
33
|
120 |
|
35
|
121 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
122 |
\mode<presentation>{
|
|
123 |
\begin{frame}[c]
|
|
124 |
\frametitle{\begin{tabular}{c}Two Rules\end{tabular}}
|
|
125 |
|
|
126 |
\begin{itemize}
|
|
127 |
\item Longest match rule (maximal munch rule): The
|
34
|
128 |
longest initial substring matched by any regular expression is taken
|
35
|
129 |
as next token.\bigskip
|
34
|
130 |
|
|
131 |
\item Rule priority:
|
|
132 |
For a particular longest initial substring, the first regular
|
|
133 |
expression that can match determines the token.
|
|
134 |
|
33
|
135 |
\end{itemize}
|
|
136 |
|
35
|
137 |
%\url{http://www.technologyreview.com/tr10/?year=2011}
|
33
|
138 |
|
35
|
139 |
%finite deterministic automata/ nondeterministic automaton
|
34
|
140 |
|
35
|
141 |
%\item problem with infix operations, for example i-12
|
34
|
142 |
|
|
143 |
|
33
|
144 |
\end{frame}}
|
|
145 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
36
|
146 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
147 |
|
|
148 |
\mode<presentation>{
|
|
149 |
\begin{frame}[t]
|
|
150 |
|
|
151 |
\begin{center}
|
|
152 |
\texttt{"if true then then 42 else +"}
|
|
153 |
\end{center}
|
|
154 |
|
|
155 |
|
|
156 |
\begin{tabular}{@{}l}
|
|
157 |
KEYWORD: \\
|
|
158 |
\hspace{5mm}\texttt{"if"}, \texttt{"then"}, \texttt{"else"},\\
|
|
159 |
WHITESPACE:\\
|
|
160 |
\hspace{5mm}\texttt{" "}, \texttt{"$\backslash$n"},\\
|
|
161 |
IDENT:\\
|
|
162 |
\hspace{5mm}LETTER $\cdot$ (LETTER + DIGIT + \texttt{"\_"})$^*$\\
|
|
163 |
NUM:\\
|
|
164 |
\hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + \texttt{"0"}\\
|
|
165 |
OP:\\
|
|
166 |
\hspace{5mm}\texttt{"+"}\\
|
|
167 |
COMMENT:\\
|
|
168 |
\hspace{5mm}\texttt{"$\slash$*"} $\cdot$ (ALL$^*$ $\cdot$ \texttt{"*$\slash$"} $\cdot$ ALL$^*$) $\cdot$ \texttt{"*$\slash$"}
|
|
169 |
\end{tabular}
|
|
170 |
|
|
171 |
\end{frame}}
|
|
172 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
33
|
173 |
|
|
174 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
175 |
\mode<presentation>{
|
35
|
176 |
\begin{frame}[t]
|
33
|
177 |
|
|
178 |
\begin{center}
|
35
|
179 |
\texttt{"if true then then 42 else +"}
|
33
|
180 |
\end{center}
|
|
181 |
|
35
|
182 |
\only<1>{
|
|
183 |
\small\begin{tabular}{l}
|
|
184 |
KEYWORD(if),\\
|
|
185 |
WHITESPACE,\\
|
|
186 |
IDENT(true),\\
|
|
187 |
WHITESPACE,\\
|
|
188 |
KEYWORD(then),\\
|
|
189 |
WHITESPACE,\\
|
|
190 |
KEYWORD(then),\\
|
|
191 |
WHITESPACE,\\
|
|
192 |
NUM(42),\\
|
|
193 |
WHITESPACE,\\
|
|
194 |
KEYWORD(else),\\
|
|
195 |
WHITESPACE,\\
|
|
196 |
OP(+)
|
|
197 |
\end{tabular}}
|
|
198 |
|
|
199 |
\only<2>{
|
|
200 |
\small\begin{tabular}{l}
|
|
201 |
KEYWORD(if),\\
|
|
202 |
IDENT(true),\\
|
|
203 |
KEYWORD(then),\\
|
|
204 |
KEYWORD(then),\\
|
|
205 |
NUM(42),\\
|
|
206 |
KEYWORD(else),\\
|
|
207 |
OP(+)
|
|
208 |
\end{tabular}}
|
33
|
209 |
|
|
210 |
\end{frame}}
|
|
211 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
212 |
|
|
213 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
214 |
\mode<presentation>{
|
|
215 |
\begin{frame}[c]
|
|
216 |
|
|
217 |
|
35
|
218 |
There is one small problem with the tokenizer. How should we
|
|
219 |
tokenize:
|
33
|
220 |
|
|
221 |
\begin{center}
|
35
|
222 |
\texttt{"x - 3"}
|
33
|
223 |
\end{center}
|
|
224 |
|
36
|
225 |
\begin{tabular}{@{}l}
|
|
226 |
OP:\\
|
|
227 |
\hspace{5mm}\texttt{"+"}, \texttt{"-"}\\
|
|
228 |
NUM:\\
|
|
229 |
\hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + \texttt{"0"}\\
|
|
230 |
NUMBER:\\
|
|
231 |
\hspace{5mm}NUM + (\texttt{"-"} $\cdot$ NUM)\\
|
|
232 |
\end{tabular}
|
|
233 |
|
|
234 |
|
33
|
235 |
\end{frame}}
|
|
236 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
237 |
|
|
238 |
|
|
239 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
240 |
\mode<presentation>{
|
|
241 |
\begin{frame}[c]
|
36
|
242 |
\frametitle{\begin{tabular}{c}Deterministic Finite Automata\end{tabular}}
|
35
|
243 |
|
|
244 |
A deterministic finite automaton consists of:
|
|
245 |
|
|
246 |
\begin{itemize}
|
|
247 |
\item a finite set of states
|
|
248 |
\item one of these states is the start state
|
|
249 |
\item some states are accepting states, and
|
|
250 |
\item there is transition function\medskip
|
|
251 |
|
|
252 |
\small
|
|
253 |
which takes a state and a character as arguments and produces a new state\smallskip\\
|
|
254 |
this function might not always be defined everywhere
|
|
255 |
\end{itemize}
|
|
256 |
|
|
257 |
\begin{center}
|
|
258 |
\bl{$A(Q, q_0, F, \delta)$}
|
|
259 |
\end{center}
|
|
260 |
\end{frame}}
|
|
261 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
262 |
|
|
263 |
|
|
264 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
265 |
\mode<presentation>{
|
|
266 |
\begin{frame}[c]
|
|
267 |
|
|
268 |
\begin{center}
|
|
269 |
\includegraphics[scale=0.7]{pics/ch3.jpg}
|
36
|
270 |
\end{center}\pause
|
|
271 |
|
|
272 |
\begin{itemize}
|
|
273 |
\item start can be an accepting state
|
|
274 |
\item there is no accepting state
|
|
275 |
\item all states are accepting
|
|
276 |
\end{itemize}
|
|
277 |
|
|
278 |
\end{frame}}
|
|
279 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
280 |
|
|
281 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
282 |
\mode<presentation>{
|
|
283 |
\begin{frame}[c]
|
|
284 |
|
|
285 |
\begin{center}
|
|
286 |
\includegraphics[scale=0.7]{pics/ch3.jpg}
|
|
287 |
\end{center}
|
|
288 |
|
|
289 |
for this automaton \bl{$\delta$} is the function\\
|
|
290 |
|
|
291 |
\begin{center}
|
|
292 |
\begin{tabular}{lll}
|
|
293 |
\bl{(q$_0$, a) $\rightarrow$ q$_1$} & \bl{(q$_1$, a) $\rightarrow$ q$_4$} & \bl{(q$_4$, a) $\rightarrow$ q$_4$}\\
|
|
294 |
\bl{(q$_0$, b) $\rightarrow$ q$_2$} & \bl{(q$_1$, b) $\rightarrow$ q$_2$} & \bl{(q$_4$, b) $\rightarrow$ q$_4$}\\
|
|
295 |
\end{tabular}\ldots
|
|
296 |
\end{center}
|
|
297 |
|
|
298 |
\end{frame}}
|
|
299 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
300 |
|
|
301 |
|
|
302 |
|
|
303 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
304 |
\mode<presentation>{
|
|
305 |
\begin{frame}[t]
|
|
306 |
\frametitle{\begin{tabular}{c}Accepting a String\end{tabular}}
|
|
307 |
|
|
308 |
Given
|
|
309 |
|
|
310 |
\begin{center}
|
|
311 |
\bl{$A(Q, q_0, F, \delta)$}
|
|
312 |
\end{center}
|
|
313 |
|
|
314 |
you can define
|
|
315 |
|
|
316 |
\begin{center}
|
|
317 |
\begin{tabular}{l}
|
|
318 |
\bl{$\hat{\delta}(q, \texttt{""}) = q$}\\
|
|
319 |
\bl{$\hat{\delta}(q, c::s) = \hat{\delta}(\delta(q, c), s)$}\\
|
|
320 |
\end{tabular}
|
|
321 |
\end{center}\pause
|
|
322 |
|
|
323 |
Whether a string \bl{$s$} is accepted by \bl{$A$}?
|
|
324 |
|
|
325 |
\begin{center}
|
|
326 |
\hspace{5mm}\bl{$\hat{\delta}(q_0, s) \in F$}
|
|
327 |
\end{center}
|
|
328 |
\end{frame}}
|
|
329 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
330 |
|
|
331 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
332 |
\mode<presentation>{
|
|
333 |
\begin{frame}[c]
|
|
334 |
\frametitle{\begin{tabular}{c}Non-Deterministic\\[-1mm] Finite Automata\end{tabular}}
|
|
335 |
|
|
336 |
A non-deterministic finite automaton consists again of:
|
|
337 |
|
|
338 |
\begin{itemize}
|
|
339 |
\item a finite set of states
|
|
340 |
\item one of these states is the start state
|
|
341 |
\item some states are accepting states, and
|
|
342 |
\item there is transition \alert{relation}\medskip
|
|
343 |
\end{itemize}
|
|
344 |
|
|
345 |
|
|
346 |
\begin{center}
|
|
347 |
\begin{tabular}{c}
|
|
348 |
\bl{(q$_1$, a) $\rightarrow$ q$_2$}\\
|
|
349 |
\bl{(q$_1$, a) $\rightarrow$ q$_3$}\\
|
|
350 |
\end{tabular}
|
|
351 |
\hspace{10mm}
|
|
352 |
\begin{tabular}{c}
|
|
353 |
\bl{(q$_1$, $\epsilon$) $\rightarrow$ q$_2$}\\
|
|
354 |
\end{tabular}
|
35
|
355 |
\end{center}
|
|
356 |
|
|
357 |
\end{frame}}
|
|
358 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
33
|
359 |
|
35
|
360 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
361 |
\mode<presentation>{
|
36
|
362 |
\begin{frame}[c]
|
|
363 |
|
|
364 |
\begin{center}
|
|
365 |
\includegraphics[scale=0.7]{pics/ch5.jpg}
|
|
366 |
\end{center}
|
|
367 |
|
37
|
368 |
|
36
|
369 |
\end{frame}}
|
|
370 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
371 |
|
|
372 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
373 |
\mode<presentation>{
|
|
374 |
\begin{frame}[c]
|
35
|
375 |
|
|
376 |
\begin{center}
|
36
|
377 |
\begin{tabular}[b]{ll}
|
|
378 |
\bl{$\varnothing$} & \includegraphics[scale=0.7]{pics/NULL.jpg}\\\\
|
|
379 |
\bl{$\epsilon$} & \includegraphics[scale=0.7]{pics/epsilon.jpg}\\\\
|
|
380 |
\bl{c} & \includegraphics[scale=0.7]{pics/char.jpg}\\
|
|
381 |
\end{tabular}
|
|
382 |
\end{center}
|
|
383 |
|
|
384 |
\end{frame}}
|
|
385 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
386 |
|
|
387 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
388 |
\mode<presentation>{
|
|
389 |
\begin{frame}[c]
|
35
|
390 |
|
|
391 |
\begin{center}
|
36
|
392 |
\begin{tabular}[t]{ll}
|
|
393 |
\bl{r$_1$ $\cdot$ r$_2$} & \includegraphics[scale=0.6]{pics/seq.jpg}\\\\
|
35
|
394 |
\end{tabular}
|
36
|
395 |
\end{center}
|
|
396 |
|
|
397 |
\end{frame}}
|
|
398 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
399 |
|
|
400 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
401 |
\mode<presentation>{
|
|
402 |
\begin{frame}[c]
|
33
|
403 |
|
35
|
404 |
\begin{center}
|
36
|
405 |
\begin{tabular}[t]{ll}
|
|
406 |
\bl{r$_1$ + r$_2$} & \includegraphics[scale=0.7]{pics/alt.jpg}\\\\
|
|
407 |
\end{tabular}
|
35
|
408 |
\end{center}
|
36
|
409 |
|
35
|
410 |
\end{frame}}
|
|
411 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
412 |
|
|
413 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
414 |
\mode<presentation>{
|
|
415 |
\begin{frame}[c]
|
|
416 |
|
|
417 |
\begin{center}
|
36
|
418 |
\begin{tabular}[b]{ll}
|
|
419 |
\bl{r$^*$} & \includegraphics[scale=0.7]{pics/star.jpg}\\
|
|
420 |
\end{tabular}
|
|
421 |
\end{center}
|
|
422 |
|
|
423 |
\end{frame}}
|
|
424 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
425 |
|
|
426 |
|
|
427 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
428 |
\mode<presentation>{
|
|
429 |
\begin{frame}[c]
|
|
430 |
|
37
|
431 |
\begin{textblock}{5}(1,1)
|
36
|
432 |
\includegraphics[scale=0.5]{pics/ch5.jpg}
|
37
|
433 |
\end{textblock}
|
|
434 |
|
|
435 |
\begin{textblock}{11}(6.5,3)
|
|
436 |
\begin{tabular}{r|cl}
|
|
437 |
& a & b\\
|
|
438 |
\hline
|
|
439 |
$\varnothing$ \onslide<2>{\textcolor{white}{*}} & $\varnothing$ & $\varnothing$\\
|
|
440 |
$\{0\}$ \onslide<2>{\textcolor{white}{*}} & $\{0,1,2\}$ & $\{2\}$\\
|
|
441 |
$\{1\}$ \onslide<2>{\textcolor{white}{*}} &$\{1\}$ & $\varnothing$\\
|
|
442 |
$\{2\}$ \onslide<2>{*} & $\varnothing$ &$\{2\}$\\
|
|
443 |
$\{0,1\}$ \onslide<2>{\textcolor{white}{*}} &$\{0,1,2\}$ &$\{2\}$\\
|
|
444 |
$\{0,2\}$ \onslide<2>{*}&$\{0,1,2\}$ &$\{2\}$\\
|
|
445 |
$\{1,2\}$ \onslide<2>{*}& $\{1\}$ & $\{2\}$\\
|
|
446 |
\onslide<2>{s:} $\{0,1,2\}$ \onslide<2>{*}&$\{0,1,2\}$ &$\{2\}$\\
|
|
447 |
\end{tabular}
|
|
448 |
\end{textblock}
|
|
449 |
|
36
|
450 |
|
|
451 |
\end{frame}}
|
|
452 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
453 |
|
|
454 |
|
|
455 |
|
|
456 |
|
|
457 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
458 |
\mode<presentation>{
|
|
459 |
\begin{frame}[c]
|
|
460 |
|
|
461 |
\begin{center}
|
35
|
462 |
\includegraphics[scale=0.7]{pics/ch4.jpg}
|
|
463 |
\end{center}
|
|
464 |
|
|
465 |
\end{frame}}
|
|
466 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
467 |
|
|
468 |
|
|
469 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
470 |
\mode<presentation>{
|
|
471 |
\begin{frame}[c]
|
|
472 |
\frametitle{\begin{tabular}{c}Languages\end{tabular}}
|
33
|
473 |
|
|
474 |
A language is \alert{regular} iff there exists
|
|
475 |
a regular expression that recognises all its strings.\bigskip\bigskip\pause
|
|
476 |
|
|
477 |
\textcolor{gray}{not all languages are regular, e.g.~\bl{a$^n$b$^n$}.}
|
|
478 |
\end{frame}}
|
|
479 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
480 |
|
|
481 |
|
|
482 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
483 |
\mode<presentation>{
|
|
484 |
\begin{frame}[c]
|
|
485 |
|
|
486 |
\begin{itemize}
|
35
|
487 |
\item Assuming you have the alphabet \bl{\{a, b, c\}}\bigskip
|
|
488 |
\item Give a regular expression that can recognise all strings that have at least one \bl{b}.
|
33
|
489 |
\end{itemize}
|
|
490 |
|
|
491 |
\end{frame}}
|
|
492 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
493 |
|
|
494 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
495 |
\mode<presentation>{
|
|
496 |
\begin{frame}[c]
|
|
497 |
|
35
|
498 |
|
33
|
499 |
|
|
500 |
\begin{itemize}
|
35
|
501 |
\item The star-case in our proof needs the following lemma
|
|
502 |
\begin{center}
|
|
503 |
\bl{Der\,c\,A$^*$ $=$ (Der c A)\,@\, A$^*$}
|
|
504 |
\end{center}
|
|
505 |
\end{itemize}\bigskip\bigskip
|
33
|
506 |
|
35
|
507 |
|
|
508 |
|
|
509 |
\begin{itemize}
|
|
510 |
\item If \bl{\texttt{""} $\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B $\cup$ (Der\,c\,B)}\medskip
|
|
511 |
\item If \bl{\texttt{""} $\not\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B}
|
|
512 |
|
33
|
513 |
\end{itemize}
|
|
514 |
|
|
515 |
\end{frame}}
|
|
516 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
517 |
|
|
518 |
|
|
519 |
\end{document}
|
|
520 |
|
|
521 |
%%% Local Variables:
|
|
522 |
%%% mode: latex
|
|
523 |
%%% TeX-master: t
|
|
524 |
%%% End:
|
|
525 |
|