|
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 02, King's College London, 3.~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 (2)\\[3mm] |
|
88 \end{tabular}} |
|
89 |
|
90 %\begin{center} |
|
91 %\includegraphics[scale=0.3]{pics/ante1.jpg}\hspace{5mm} |
|
92 %\includegraphics[scale=0.31]{pics/ante2.jpg}\\ |
|
93 %\footnotesize\textcolor{gray}{Antikythera automaton, 100 BC (Archimedes?)} |
|
94 %\end{center} |
|
95 |
|
96 \normalsize |
|
97 \begin{center} |
|
98 \begin{tabular}{ll} |
|
99 Email: & christian.urban at kcl.ac.uk\\ |
|
100 Of$\!$fice: & S1.27 (1st floor Strand Building)\\ |
|
101 Slides: & KEATS |
|
102 \end{tabular} |
|
103 \end{center} |
|
104 |
|
105 |
|
106 \end{frame}} |
|
107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
108 |
|
109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
110 \mode<presentation>{ |
|
111 \begin{frame}[c] |
|
112 \frametitle{\begin{tabular}{c}Languages\end{tabular}} |
|
113 |
|
114 A \alert{language} is a set of strings.\bigskip |
|
115 |
|
116 A \alert{regular expression} specifies a set of strings or language. |
|
117 |
|
118 \end{frame}} |
|
119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
120 |
|
121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
122 \mode<presentation>{ |
|
123 \begin{frame}[t] |
|
124 \frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}} |
|
125 |
|
126 Their inductive definition: |
|
127 |
|
128 |
|
129 \begin{textblock}{6}(2,5) |
|
130 \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l} |
|
131 \bl{r} & \bl{$::=$} & \bl{$\varnothing$} & null\\ |
|
132 & \bl{$\mid$} & \bl{$\epsilon$} & empty string / "" / []\\ |
|
133 & \bl{$\mid$} & \bl{c} & character\\ |
|
134 & \bl{$\mid$} & \bl{r$_1$ $\cdot$ r$_2$} & sequence\\ |
|
135 & \bl{$\mid$} & \bl{r$_1$ + r$_2$} & alternative / choice\\ |
|
136 & \bl{$\mid$} & \bl{r$^*$} & star (zero or more)\\ |
|
137 \end{tabular} |
|
138 \end{textblock} |
|
139 |
|
140 \end{frame}} |
|
141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
142 |
|
143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
144 \mode<presentation>{ |
|
145 \begin{frame}[t] |
|
146 \frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}} |
|
147 |
|
148 Their implementation in Scala: |
|
149 |
|
150 {\lstset{language=Scala}\fontsize{8}{10}\selectfont |
|
151 \texttt{\lstinputlisting{app51.scala}}} |
|
152 |
|
153 |
|
154 \end{frame}} |
|
155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
156 |
|
157 |
|
158 |
|
159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
160 \mode<presentation>{ |
|
161 \begin{frame}[c] |
|
162 \frametitle{\begin{tabular}{c}The Meaning of a\\[-2mm] Regular Expression\end{tabular}} |
|
163 |
|
164 \begin{textblock}{15}(1,4) |
|
165 \begin{tabular}{@ {}rcl} |
|
166 \bl{$L$($\varnothing$)} & \bl{$\dn$} & \bl{$\varnothing$}\\ |
|
167 \bl{$L$($\epsilon$)} & \bl{$\dn$} & \bl{$\{$""$\}$}\\ |
|
168 \bl{$L$(c)} & \bl{$\dn$} & \bl{$\{$"c"$\}$}\\ |
|
169 \bl{$L$(r$_1$ + r$_2$)} & \bl{$\dn$} & \bl{$L$(r$_1$) $\cup$ $L$(r$_2$)}\\ |
|
170 \bl{$L$(r$_1$ $\cdot$ r$_2$)} & \bl{$\dn$} & \bl{$L$(r$_1$) @ $L$(r$_2$)}\\ |
|
171 \bl{$L$(r$^*$)} & \bl{$\dn$} & \bl{$\bigcup_{n \ge 0}$ $L$(r)$^n$}\\ |
|
172 \end{tabular}\bigskip |
|
173 |
|
174 \hspace{5mm}\textcolor{gray}{$L$(r)$^0$ $\;\dn\;$ $\{$""$\}$}\\ |
|
175 \textcolor{gray}{$L$(r)$^{n+1}$ $\;\dn\;$ $L$(r) @ $L$(r)$^n$} |
|
176 \end{textblock} |
|
177 |
|
178 \only<2->{ |
|
179 \begin{textblock}{5}(11,5) |
|
180 \textcolor{gray}{\small |
|
181 A @ B\\ |
|
182 \ldots you take out every string from A and |
|
183 concatenate it with every string in B |
|
184 } |
|
185 \end{textblock}} |
|
186 |
|
187 \only<3->{ |
|
188 \begin{textblock}{6}(9,12)\small |
|
189 \bl{$L$} is a function from regular expressions to sets of strings\\ |
|
190 \bl{$L$ : Rexp $\Rightarrow$ Set[String]} |
|
191 \end{textblock}} |
|
192 |
|
193 |
|
194 \end{frame}} |
|
195 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
196 |
|
197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
198 \mode<presentation>{ |
|
199 \begin{frame}[c] |
|
200 |
|
201 \large |
|
202 \begin{center} |
|
203 What is \bl{$L$(a$^*$)}? |
|
204 \end{center} |
|
205 |
|
206 \end{frame}} |
|
207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
208 |
|
209 |
|
210 |
|
211 \newcommand{\YES}{\textcolor{gray}{yes}} |
|
212 \newcommand{\NO}{\textcolor{gray}{no}} |
|
213 \newcommand{\FORALLR}{\textcolor{gray}{$\forall$ r.}} |
|
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
215 \mode<presentation>{ |
|
216 \begin{frame}[c] |
|
217 \frametitle{\begin{tabular}{c}Reg Exp Equivalences\end{tabular}} |
|
218 |
|
219 \begin{center} |
|
220 \begin{tabular}{l@ {\hspace{7mm}}rcl@ {\hspace{7mm}}l} |
|
221 &\bl{(a + b) + c} & \bl{$\equiv^?$} & \bl{a + (b + c)} & \onslide<2->{\YES}\\ |
|
222 &\bl{a + a} & \bl{$\equiv^?$} & \bl{a} & \onslide<3->{\YES}\\ |
|
223 &\bl{(a $\cdot$ b) $\cdot$ c} & \bl{$\equiv^?$} & \bl{a $\cdot$ (b $\cdot$ c)} & \onslide<4->{\YES}\\ |
|
224 &\bl{a $\cdot$ a} & \bl{$\equiv^?$} & \bl{a} & \onslide<5->{\NO}\\ |
|
225 &\bl{$\epsilon^*$} & \bl{$\equiv^?$} & \bl{$\epsilon$} & \onslide<6->{\YES}\\ |
|
226 &\bl{$\varnothing^*$} & \bl{$\equiv^?$} & \bl{$\varnothing$} & \onslide<7->{\NO}\\ |
|
227 \FORALLR &\bl{r $\cdot$ $\epsilon$} & \bl{$\equiv^?$} & \bl{r} & \onslide<8->{\YES}\\ |
|
228 \FORALLR &\bl{r + $\epsilon$} & \bl{$\equiv^?$} & \bl{r} & \onslide<9->{\NO}\\ |
|
229 \FORALLR &\bl{r + $\varnothing$} & \bl{$\equiv^?$} & \bl{r} & \onslide<10->{\YES}\\ |
|
230 \FORALLR &\bl{r $\cdot$ $\varnothing$} & \bl{$\equiv^?$} & \bl{r} & \onslide<11->{\NO}\\ |
|
231 &\bl{c $\cdot$ (a + b)} & \bl{$\equiv^?$} & \bl{(c $\cdot$ a) + (c $\cdot$ b)} & \onslide<12->{\YES}\\ |
|
232 &\bl{a$^*$} & \bl{$\equiv^?$} & \bl{$\epsilon$ + (a $\cdot$ a$^*$)} & \onslide<13->{\YES} |
|
233 \end{tabular} |
|
234 \end{center} |
|
235 |
|
236 \end{frame}} |
|
237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
238 |
|
239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
240 \mode<presentation>{ |
|
241 \begin{frame}[c] |
|
242 \frametitle{\begin{tabular}{c}The Meaning of Matching\end{tabular}} |
|
243 |
|
244 \large |
|
245 a regular expression \bl{r} matches a string \bl{s} is defined as |
|
246 |
|
247 \begin{center} |
|
248 \bl{s $\in$ $L$(r)}\\ |
|
249 \end{center}\bigskip\bigskip\pause |
|
250 |
|
251 \small |
|
252 if \bl{r$_1$ $\equiv$ r$_2$}, then \bl{$s$ $\in$ $L$(r$_1$)} iff \bl{$s$ $\in$ $L$(r$_2$)} |
|
253 |
|
254 \end{frame}} |
|
255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
256 |
|
257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
258 \mode<presentation>{ |
|
259 \begin{frame}[t] |
|
260 \frametitle{\begin{tabular}{c}A Matching Algorithm\end{tabular}} |
|
261 |
|
262 \begin{itemize} |
|
263 \item given a regular expression \bl{r} and a string \bl{s}, say yes or no for whether |
|
264 \begin{center} |
|
265 \bl{s $\in$ $L$(r)} |
|
266 \end{center} |
|
267 or not.\bigskip\bigskip\pause |
|
268 \end{itemize}\pause |
|
269 |
|
270 \small |
|
271 \begin{itemize} |
|
272 \item Identifiers (strings of letters or digits, starting with a letter) |
|
273 \item Integers (a non-empty sequence of digits) |
|
274 \item Keywords (else, if, while, \ldots) |
|
275 \item White space (a non-empty sequence of blanks, newlines and tabs) |
|
276 \end{itemize} |
|
277 \end{frame}} |
|
278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
279 |
|
280 |
|
281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
282 \mode<presentation>{ |
|
283 \begin{frame}[c] |
|
284 \frametitle{\begin{tabular}{c}A Matching Algorithm\end{tabular}} |
|
285 |
|
286 \small |
|
287 whether a regular expression matches the empty string:\medskip |
|
288 |
|
289 |
|
290 {\lstset{language=Scala}\fontsize{8}{10}\selectfont |
|
291 \texttt{\lstinputlisting{app5.scala}}} |
|
292 |
|
293 |
|
294 |
|
295 \end{frame}} |
|
296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
297 |
|
298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
299 \mode<presentation>{ |
|
300 \begin{frame}[c] |
|
301 \frametitle{\begin{tabular}{c}The Derivative of a Rexp\end{tabular}} |
|
302 |
|
303 \large |
|
304 If \bl{r} matches the string \bl{c::s}, what is a regular expression that matches \bl{s}?\bigskip\bigskip\bigskip\bigskip |
|
305 |
|
306 \small |
|
307 \bl{der c r} gives the answer |
|
308 \end{frame}} |
|
309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
310 |
|
311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
312 \mode<presentation>{ |
|
313 \begin{frame}[c] |
|
314 \frametitle{\begin{tabular}{c}The Derivative of a Rexp (2)\end{tabular}} |
|
315 |
|
316 \begin{center} |
|
317 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}} |
|
318 \bl{der c ($\varnothing$)} & \bl{$\dn$} & \bl{$\varnothing$} & \\ |
|
319 \bl{der c ($\epsilon$)} & \bl{$\dn$} & \bl{$\varnothing$} & \\ |
|
320 \bl{der c (d)} & \bl{$\dn$} & \bl{if c $=$ d then $\epsilon$ else $\varnothing$} & \\ |
|
321 \bl{der c (r$_1$ + r$_2$)} & \bl{$\dn$} & \bl{(der c r$_1$) + (der c r$_2$)} & \\ |
|
322 \bl{der c (r$_1$ $\cdot$ r$_2$)} & \bl{$\dn$} & \bl{if nullable r$_1$}\\ |
|
323 & & \bl{then ((der c r$_1$) $\cdot$ r$_2$) + (der c r$_2$)}\\ |
|
324 & & \bl{else (der c r$_1$) $\cdot$ r$_2$}\\ |
|
325 \bl{der c (r$^*$)} & \bl{$\dn$} & \bl{(der c r) $\cdot$ (r$^*$)} &\smallskip\\\pause |
|
326 |
|
327 \bl{ders [] r} & \bl{$\dn$} & \bl{r} & \\ |
|
328 \bl{ders (c::s) r} & \bl{$\dn$} & \bl{ders s (der c r)} & \\ |
|
329 \end{tabular} |
|
330 \end{center} |
|
331 |
|
332 \end{frame}} |
|
333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
334 |
|
335 |
|
336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
337 \mode<presentation>{ |
|
338 \begin{frame}[c] |
|
339 \frametitle{\begin{tabular}{c}The Derivative\end{tabular}} |
|
340 |
|
341 |
|
342 {\lstset{language=Scala}\fontsize{8}{10}\selectfont |
|
343 \texttt{\lstinputlisting{app6.scala}}} |
|
344 |
|
345 |
|
346 |
|
347 \end{frame}} |
|
348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
349 |
|
350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
351 \mode<presentation>{ |
|
352 \begin{frame}[c] |
|
353 \frametitle{\begin{tabular}{c}The Rexp Matcher\end{tabular}} |
|
354 |
|
355 |
|
356 {\lstset{language=Scala}\fontsize{8}{10}\selectfont |
|
357 \texttt{\lstinputlisting{app7.scala}}} |
|
358 |
|
359 |
|
360 |
|
361 \end{frame}} |
|
362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
363 |
|
364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
365 \mode<presentation>{ |
|
366 \begin{frame}[t] |
|
367 \frametitle{\begin{tabular}{c}Proofs about Rexp\end{tabular}} |
|
368 |
|
369 Remember their inductive definition:\\[5cm] |
|
370 |
|
371 \begin{textblock}{6}(5,5) |
|
372 \begin{tabular}{@ {}rrl} |
|
373 \bl{r} & \bl{$::=$} & \bl{$\varnothing$}\\ |
|
374 & \bl{$\mid$} & \bl{$\epsilon$} \\ |
|
375 & \bl{$\mid$} & \bl{c} \\ |
|
376 & \bl{$\mid$} & \bl{r$_1$ $\cdot$ r$_2$}\\ |
|
377 & \bl{$\mid$} & \bl{r$_1$ + r$_2$} \\ |
|
378 & \bl{$\mid$} & \bl{r$^*$} \\ |
|
379 \end{tabular} |
|
380 \end{textblock} |
|
381 |
|
382 If we want to prove something, say a property \bl{$P$(r)}, for all regular expressions \bl{r} then \ldots |
|
383 |
|
384 \end{frame}} |
|
385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
386 |
|
387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
388 \mode<presentation>{ |
|
389 \begin{frame}[c] |
|
390 \frametitle{\begin{tabular}{c}Proofs about Rexp (2)\end{tabular}} |
|
391 |
|
392 \begin{itemize} |
|
393 \item \bl{$P$} holds for \bl{$\varnothing$}, \bl{$\epsilon$} and \bl{c}\bigskip |
|
394 \item \bl{$P$} holds for \bl{r$_1$ + r$_2$} under the assumption that \bl{$P$} already |
|
395 holds for \bl{r$_1$} and \bl{r$_2$}.\bigskip |
|
396 \item \bl{$P$} holds for \bl{r$_1$ $\cdot$ r$_2$} under the assumption that \bl{$P$} already |
|
397 holds for \bl{r$_1$} and \bl{r$_2$}. |
|
398 \item \bl{$P$} holds for \bl{r$^*$} under the assumption that \bl{$P$} already |
|
399 holds for \bl{r}. |
|
400 \end{itemize} |
|
401 |
|
402 \end{frame}} |
|
403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
404 |
|
405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
406 \mode<presentation>{ |
|
407 \begin{frame}[c] |
|
408 \frametitle{\begin{tabular}{c}Proofs about Rexp (3)\end{tabular}} |
|
409 |
|
410 Assume \bl{$P(r)$} is the property: |
|
411 |
|
412 \begin{center} |
|
413 \bl{nullable(r)} if and only if \bl{"" $\in$ $L$(r)} |
|
414 \end{center} |
|
415 |
|
416 \end{frame}} |
|
417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
418 |
|
419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
420 \mode<presentation>{ |
|
421 \begin{frame}[c] |
|
422 \frametitle{\begin{tabular}{c}Proofs about Strings\end{tabular}} |
|
423 |
|
424 If we want to prove something, say a property \bl{$P$(s)}, for all strings \bl{s} then \ldots\bigskip |
|
425 |
|
426 \begin{itemize} |
|
427 \item \bl{$P$} holds for the empty string, and\medskip |
|
428 \item \bl{$P$} holds for the string \bl{c::s} under the assumption that \bl{$P$} |
|
429 already holds for \bl{s} |
|
430 \end{itemize} |
|
431 \end{frame}} |
|
432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
433 |
|
434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
435 \mode<presentation>{ |
|
436 \begin{frame}[c] |
|
437 \frametitle{\begin{tabular}{c}Proofs about Strings (2)\end{tabular}} |
|
438 |
|
439 Let \bl{Der c A} be the set defined as |
|
440 |
|
441 \begin{center} |
|
442 \bl{Der c A $\dn$ $\{$ s $|$ c::s $\in$ A$\}$ } |
|
443 \end{center} |
|
444 |
|
445 Assume that \bl{$L$(der c r) = Der c ($L$(r))}. Prove that |
|
446 |
|
447 \begin{center} |
|
448 \bl{matcher(r, s) if and only if s $\in$ $L$(r)} |
|
449 \end{center} |
|
450 |
|
451 |
|
452 \end{frame}} |
|
453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
454 |
|
455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
456 \mode<presentation>{ |
|
457 \begin{frame}[c] |
|
458 \frametitle{\begin{tabular}{c}Regular Languages\end{tabular}} |
|
459 |
|
460 A language (set of strings) is \alert{regular} iff there exists |
|
461 a regular expression that recognises all its strings. |
|
462 |
|
463 \end{frame}} |
|
464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
465 |
|
466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
467 \mode<presentation>{ |
|
468 \begin{frame}[c] |
|
469 \frametitle{\begin{tabular}{c}Automata\end{tabular}} |
|
470 |
|
471 A deterministic finite automaton consists of: |
|
472 |
|
473 \begin{itemize} |
|
474 \item a set of states |
|
475 \item one of these states is the start state |
|
476 \item some states are accepting states, and |
|
477 \item there is transition function\medskip |
|
478 |
|
479 \small |
|
480 which takes a state as argument and a character and produces a new state\smallskip\\ |
|
481 this function might not always be defined |
|
482 \end{itemize} |
|
483 |
|
484 \end{frame}} |
|
485 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
486 |
|
487 |
|
488 \end{document} |
|
489 |
|
490 %%% Local Variables: |
|
491 %%% mode: latex |
|
492 %%% TeX-master: t |
|
493 %%% End: |
|
494 |