author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Sun, 01 Dec 2013 09:58:41 +0000 | |
changeset 215 | 828303e8e4af |
parent 143 | e3fd4c5995ef |
child 265 | 332fbe9c91ab |
permissions | -rw-r--r-- |
25 | 1 |
\documentclass[dvipsnames,14pt,t]{beamer} |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
2 |
\usepackage{beamerthemeplaincu} |
25 | 3 |
\usepackage[absolute,overlay]{textpos} |
4 |
\usepackage{ifthen} |
|
5 |
\usepackage{tikz} |
|
6 |
\usepackage{pgf} |
|
7 |
\usepackage{calc} |
|
8 |
\usepackage{ulem} |
|
9 |
\usepackage{courier} |
|
10 |
\usepackage{listings} |
|
11 |
\renewcommand{\uline}[1]{#1} |
|
12 |
\usetikzlibrary{arrows} |
|
13 |
\usetikzlibrary{automata} |
|
14 |
\usetikzlibrary{shapes} |
|
15 |
\usetikzlibrary{shadows} |
|
16 |
\usetikzlibrary{positioning} |
|
17 |
\usetikzlibrary{calc} |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
18 |
\usetikzlibrary{fit} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
19 |
\usetikzlibrary{backgrounds} |
25 | 20 |
\usepackage{graphicx} |
215
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
21 |
\usepackage{../langs} |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
22 |
\usepackage{../data} |
25 | 23 |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
24 |
\makeatletter |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
25 |
\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
26 |
\@empty\z@\@empty |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
27 |
\makeatother |
25 | 28 |
|
29 |
% beamer stuff |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
30 |
\renewcommand{\slidecaption}{AFL 03, King's College London, 9.~October 2013} |
25 | 31 |
\newcommand{\bl}[1]{\textcolor{blue}{#1}} |
32 |
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions |
|
33 |
||
34 |
\begin{document} |
|
35 |
||
36 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
37 |
\mode<presentation>{ |
|
38 |
\begin{frame}<1>[t] |
|
39 |
\frametitle{% |
|
40 |
\begin{tabular}{@ {}c@ {}} |
|
41 |
\\[-3mm] |
|
42 |
\LARGE Automata and \\[-2mm] |
|
43 |
\LARGE Formal Languages (3)\\[3mm] |
|
44 |
\end{tabular}} |
|
45 |
||
46 |
%\begin{center} |
|
47 |
%\includegraphics[scale=0.3]{pics/ante1.jpg}\hspace{5mm} |
|
48 |
%\includegraphics[scale=0.31]{pics/ante2.jpg}\\ |
|
49 |
%\footnotesize\textcolor{gray}{Antikythera automaton, 100 BC (Archimedes?)} |
|
50 |
%\end{center} |
|
51 |
||
52 |
\normalsize |
|
53 |
\begin{center} |
|
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
54 |
\begin{tabular}{lp{8cm}} |
25 | 55 |
Email: & christian.urban at kcl.ac.uk\\ |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
56 |
Office: & S1.27 (1st floor Strand Building)\\ |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
57 |
Slides: & KEATS (also home work and coursework is there)\\ |
25 | 58 |
\end{tabular} |
59 |
\end{center} |
|
60 |
||
61 |
||
62 |
\end{frame}} |
|
63 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
64 |
||
65 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
66 |
\mode<presentation>{ |
|
67 |
\begin{frame}[c] |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
68 |
\frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}} |
25 | 69 |
|
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
70 |
In programming languages they are often used to recognise:\medskip |
25 | 71 |
|
72 |
\begin{itemize} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
73 |
\item symbols, digits |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
74 |
\item identifiers |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
75 |
\item numbers (non-leading zeros) |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
76 |
\item keywords |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
77 |
\item comments |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
78 |
\end{itemize}\bigskip |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
79 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
80 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
81 |
\mbox{}\hfill\bl{\url{http://www.regexper.com}} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
82 |
\end{frame}} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
83 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
84 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
85 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
86 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
87 |
\mode<presentation>{ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
88 |
\begin{frame}[c] |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
89 |
\frametitle{\begin{tabular}{c}Last Week\end{tabular}} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
90 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
91 |
Last week I showed you a regular expression matcher |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
92 |
which works provably correctly in all cases. |
25 | 93 |
|
94 |
\begin{center} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
95 |
\bl{$matcher\,r\,s$} \;\;if and only if \;\; \bl{$s \in L(r)$} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
96 |
\end{center}\bigskip\bigskip |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
97 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
98 |
\small |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
99 |
\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
|
100 |
|
25 | 101 |
|
102 |
\end{frame}} |
|
103 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
104 |
||
105 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
106 |
\mode<presentation>{ |
|
107 |
\begin{frame}[c] |
|
108 |
\frametitle{\begin{tabular}{c}The Derivative of a Rexp\end{tabular}} |
|
109 |
||
110 |
\begin{center} |
|
111 |
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
112 |
\bl{$der\, c\, (\varnothing)$} & \bl{$\dn$} & \bl{$\varnothing$} & \\ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
113 |
\bl{$der\, c\, (\epsilon)$} & \bl{$\dn$} & \bl{$\varnothing$} & \\ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
114 |
\bl{$der\, c\, (d)$} & \bl{$\dn$} & \bl{if $c = d$ then $\epsilon$ else $\varnothing$} & \\ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
115 |
\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
|
116 |
\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
|
117 |
& & \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
|
118 |
& & \bl{else $(der\, c\, r_1) \cdot r_2$}\\ |
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
119 |
\bl{$der\, c\, (r^*)$} & \bl{$\dn$} & \bl{$(der\,c\,r) \cdot (r^*)$} &\smallskip\\ |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
120 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
121 |
\bl{$der\!s\, []\, r$} & \bl{$\dn$} & \bl{$r$} & \\ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
122 |
\bl{$der\!s\, (c\!::\!s)\, r$} & \bl{$\dn$} & \bl{$der\!s\,s\,(der\,c\,r)$} & \\ |
25 | 123 |
\end{tabular} |
124 |
\end{center} |
|
125 |
||
126 |
||
127 |
\end{frame}} |
|
128 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
129 |
||
130 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
131 |
\mode<presentation>{ |
|
132 |
\begin{frame}[c] |
|
133 |
||
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
134 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
135 |
To see what is going on, define |
25 | 136 |
|
137 |
\begin{center} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
138 |
\bl{$Der\,c\,A \dn \{ s \;|\; c\!::\!s \in A\}$ } |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
139 |
\end{center}\bigskip\bigskip |
25 | 140 |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
141 |
\small |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
142 |
For \bl{$A = \{"f\!oo", "bar", "f\!rak"\}$} then |
25 | 143 |
|
144 |
\begin{center} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
145 |
\bl{\begin{tabular}{l@{\hspace{2mm}}c@{\hspace{2mm}}l} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
146 |
$Der\,f\,A$ & $=$ & $\{"oo", "rak"\}$\\ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
147 |
$Der\,b\,A$ & $=$ & $\{"ar"\}$\\ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
148 |
$Der\,a\,A$ & $=$ & $\varnothing$\\ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
149 |
\end{tabular}} |
25 | 150 |
\end{center} |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
151 |
|
25 | 152 |
|
153 |
\end{frame}} |
|
154 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
155 |
||
156 |
||
157 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
158 |
\mode<presentation>{ |
|
159 |
\begin{frame}[c] |
|
160 |
\frametitle{\begin{tabular}{c}The Idea of the Algorithm\end{tabular}} |
|
161 |
||
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
162 |
If we want to recognise the string \bl{$"abc"$} with regular expression \bl{$r$} |
25 | 163 |
then\medskip |
164 |
||
165 |
\begin{enumerate} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
166 |
\item \bl{$Der\,a\,(L(r))$}\pause |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
167 |
\item \bl{$Der\,b\,(Der\,a\,(L(r)))$}\pause |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
168 |
\item \bl{$Der\,c\,(Der\,b\,(Der\,a\,(L(r))))$}\pause |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
169 |
\item finally we test whether the empty string is in this set\pause\medskip |
25 | 170 |
\end{enumerate} |
171 |
||
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
172 |
The matching algorithm works similarly, just over regular expression instead of sets. |
25 | 173 |
\end{frame}} |
174 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
175 |
||
176 |
||
177 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
178 |
\mode<presentation>{ |
|
179 |
\begin{frame}[c] |
|
180 |
||
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
181 |
Input: string \bl{$"abc"$} and regular expression \bl{$r$} |
25 | 182 |
|
183 |
\begin{enumerate} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
184 |
\item \bl{$der\,a\,r$} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
185 |
\item \bl{$der\,b\,(der\,a\,r)$} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
186 |
\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
|
187 |
\item finally check whether the last regular expression can match the empty string |
25 | 188 |
\end{enumerate} |
189 |
||
190 |
\end{frame}} |
|
191 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
192 |
||
193 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
194 |
\mode<presentation>{ |
|
195 |
\begin{frame}[c] |
|
196 |
||
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
197 |
We proved already |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
198 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
199 |
\begin{center} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
200 |
\bl{$nullable(r)$} \;if and only if\; \bl{$"" \in L(r)$} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
201 |
\end{center} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
202 |
|
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
203 |
by induction on the regular expression.\bigskip\pause |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
204 |
|
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
205 |
\begin{center} |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
206 |
\huge\bf \alert{Any Questions?} |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
207 |
\end{center} |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
208 |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
209 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
210 |
\end{frame}} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
211 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
212 |
|
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
213 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
214 |
\mode<presentation>{ |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
215 |
\begin{frame}[c] |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
216 |
|
25 | 217 |
We need to prove |
218 |
||
219 |
\begin{center} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
220 |
\bl{$L(der\,c\,r) = Der\,c\,(L(r))$} |
25 | 221 |
\end{center} |
222 |
||
223 |
by induction on the regular expression. |
|
224 |
\end{frame}} |
|
225 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
226 |
||
227 |
||
228 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
229 |
\mode<presentation>{ |
|
230 |
\begin{frame}[c] |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
231 |
\frametitle{\begin{tabular}{c}Proofs about Rexps\end{tabular}} |
25 | 232 |
|
233 |
\begin{itemize} |
|
234 |
\item \bl{$P$} holds for \bl{$\varnothing$}, \bl{$\epsilon$} and \bl{c}\bigskip |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
235 |
\item \bl{$P$} holds for \bl{$r_1 + r_2$} under the assumption that \bl{$P$} already |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
236 |
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
237 |
\item \bl{$P$} holds for \bl{$r_1 \cdot r_2$} under the assumption that \bl{$P$} already |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
238 |
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
239 |
\item \bl{$P$} holds for \bl{$r^*$} under the assumption that \bl{$P$} already |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
240 |
holds for \bl{$r$}. |
25 | 241 |
\end{itemize} |
242 |
||
243 |
\end{frame}} |
|
244 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
245 |
||
246 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
247 |
\mode<presentation>{ |
|
248 |
\begin{frame}[c] |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
249 |
\frametitle{\begin{tabular}{c}Proofs about Natural\\[-1mm] Numbers and Strings\end{tabular}} |
25 | 250 |
|
251 |
\begin{itemize} |
|
252 |
\item \bl{$P$} holds for \bl{$0$} and |
|
253 |
\item \bl{$P$} holds for \bl{$n + 1$} under the assumption that \bl{$P$} already |
|
254 |
holds for \bl{$n$} |
|
255 |
\end{itemize}\bigskip |
|
256 |
||
257 |
\begin{itemize} |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
258 |
\item \bl{$P$} holds for \bl{$""$} and |
25 | 259 |
\item \bl{$P$} holds for \bl{$c\!::\!s$} under the assumption that \bl{$P$} already |
260 |
holds for \bl{$s$} |
|
261 |
\end{itemize} |
|
262 |
||
263 |
\end{frame}} |
|
264 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
265 |
||
266 |
||
267 |
||
268 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
269 |
\mode<presentation>{ |
|
270 |
\begin{frame}[c] |
|
271 |
\frametitle{\begin{tabular}{c}Languages\end{tabular}} |
|
272 |
||
273 |
A \alert{language} is a set of strings.\bigskip |
|
274 |
||
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
275 |
A \alert{regular expression} specifies a language.\bigskip |
25 | 276 |
|
277 |
A language is \alert{regular} iff there exists |
|
278 |
a regular expression that recognises all its strings.\bigskip\bigskip\pause |
|
279 |
||
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
280 |
\textcolor{gray}{not all languages are regular, e.g.~\bl{$a^nb^n$}.} |
25 | 281 |
\end{frame}} |
282 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
283 |
||
284 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
285 |
\mode<presentation>{ |
|
286 |
\begin{frame}[t] |
|
287 |
\frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}} |
|
288 |
||
289 |
\begin{center} |
|
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
290 |
\begin{tabular}{@ {}rrl@ {\hspace{13mm}}l} |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
291 |
\bl{$r$} & \bl{$::=$} & \bl{$\varnothing$} & null\\ |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
292 |
& \bl{$\mid$} & \bl{$\epsilon$} & empty string / "" / $[]$\\ |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
293 |
& \bl{$\mid$} & \bl{$c$} & character\\ |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
294 |
& \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
|
295 |
& \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
|
296 |
& \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
|
297 |
\end{tabular} |
25 | 298 |
\end{center} |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
299 |
|
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
300 |
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
|
301 |
set of languages we can recognise? |
25 | 302 |
|
303 |
\end{frame}} |
|
304 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
305 |
||
306 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
307 |
\mode<presentation>{ |
|
308 |
\begin{frame}[c] |
|
309 |
\frametitle{\begin{tabular}{c}Negation of Regular Expr's\end{tabular}} |
|
310 |
||
311 |
\begin{itemize} |
|
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
312 |
\item \bl{$\sim{}r$} \hspace{6mm} (everything that \bl{r} cannot recognise)\medskip |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
313 |
\item \bl{$L(\sim{}r) \dn UNIV - L(r)$}\medskip |
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
314 |
\item \bl{$nullable (\sim{}r) \dn not\, (nullable(r))$}\medskip |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
315 |
\item \bl{$der\,c\,(\sim{}r) \dn \;\sim{}(der\,c\,r)$} |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
316 |
\end{itemize}\bigskip\pause |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
317 |
|
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
318 |
Used often for recognising comments: |
134
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
319 |
|
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
320 |
\[ |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
321 |
\bl{/ \cdot * \cdot (\sim{}([a\mbox{-}z]^* \cdot * \cdot / \cdot [a\mbox{-}z]^*)) \cdot * \cdot /} |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
322 |
\] |
e3a8cf96f570
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
323 |
|
25 | 324 |
|
325 |
\end{frame}} |
|
326 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
327 |
||
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
328 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
329 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
330 |
\begin{frame}[c] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
331 |
\frametitle{\begin{tabular}{c}Negation\end{tabular}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
332 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
333 |
Assume you have an alphabet consisting of the letters \bl{a}, \bl{b} and \bl{c} only. |
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
334 |
Find a regular expression that matches all strings \emph{except} \bl{ab} and \bl{ac}. |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
335 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
336 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
337 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
338 |
|
25 | 339 |
|
340 |
||
341 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
342 |
\mode<presentation>{ |
|
343 |
\begin{frame}[c] |
|
344 |
\frametitle{\begin{tabular}{c}Regular Exp's for Lexing\end{tabular}} |
|
345 |
||
346 |
Lexing separates strings into ``words'' / components. |
|
347 |
||
348 |
\begin{itemize} |
|
349 |
\item Identifiers (non-empty strings of letters or digits, starting with a letter) |
|
350 |
\item Numbers (non-empty sequences of digits omitting leading zeros) |
|
351 |
\item Keywords (else, if, while, \ldots) |
|
352 |
\item White space (a non-empty sequence of blanks, newlines and tabs) |
|
353 |
\item Comments |
|
354 |
\end{itemize} |
|
355 |
||
356 |
\end{frame}} |
|
357 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
358 |
||
359 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
360 |
\mode<presentation>{ |
|
361 |
\begin{frame}[c] |
|
362 |
\frametitle{\begin{tabular}{c}Automata\end{tabular}} |
|
363 |
||
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
364 |
A \alert{deterministic finite automaton} consists of: |
25 | 365 |
|
366 |
\begin{itemize} |
|
367 |
\item a set of states |
|
368 |
\item one of these states is the start state |
|
369 |
\item some states are accepting states, and |
|
370 |
\item there is transition function\medskip |
|
371 |
||
372 |
\small |
|
373 |
which takes a state as argument and a character and produces a new state\smallskip\\ |
|
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
374 |
this function might not be everywhere defined |
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
375 |
\end{itemize} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
376 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
377 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
378 |
\bl{$A(Q, q_0, F, \delta)$} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
379 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
380 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
381 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
382 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
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 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
385 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
386 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
387 |
\begin{frame}[c] |
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 |
\begin{center} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
390 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
391 |
every state/.style={minimum size=0pt,inner sep=2pt,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
|
392 |
\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
|
393 |
\node[state] (q_1) [right=of q_0] {$q_1$}; |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
394 |
\node[state] (q_2) [below right=of q_0] {$q_2$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
395 |
\node[state] (q_3) [right=of q_2] {$q_3$}; |
215
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
396 |
\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
397 |
\path[->] (q_0) edge node [above] {\alert{$a$}} (q_1); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
398 |
\path[->] (q_1) edge node [above] {\alert{$a$}} (q_4); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
399 |
\path[->] (q_4) edge [loop right] node {\alert{$a, b$}} (); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
400 |
\path[->] (q_3) edge node [right] {\alert{$a$}} (q_4); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
401 |
\path[->] (q_2) edge node [above] {\alert{$a$}} (q_3); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
402 |
\path[->] (q_1) edge node [right] {\alert{$b$}} (q_2); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
403 |
\path[->] (q_0) edge node [above] {\alert{$b$}} (q_2); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
404 |
\path[->] (q_2) edge [loop left] node {\alert{$b$}} (); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
405 |
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (q_0); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
406 |
\end{tikzpicture} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
407 |
\end{center}\pause |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
408 |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
409 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
410 |
\begin{itemize} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
411 |
\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
|
412 |
\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
|
413 |
\item all states might be accepting (but this does not necessarily mean all strings are accepted) |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
414 |
\end{itemize} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
415 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
416 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
417 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
418 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
419 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
420 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
421 |
\begin{frame}[c] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
422 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
423 |
\begin{center} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
424 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
425 |
every state/.style={minimum size=0pt,inner sep=2pt,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
|
426 |
\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
|
427 |
\node[state] (q_1) [right=of q_0] {$q_1$}; |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
428 |
\node[state] (q_2) [below right=of q_0] {$q_2$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
429 |
\node[state] (q_3) [right=of q_2] {$q_3$}; |
215
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
430 |
\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
431 |
\path[->] (q_0) edge node [above] {\alert{$a$}} (q_1); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
432 |
\path[->] (q_1) edge node [above] {\alert{$a$}} (q_4); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
433 |
\path[->] (q_4) edge [loop right] node {\alert{$a, b$}} (); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
434 |
\path[->] (q_3) edge node [right] {\alert{$a$}} (q_4); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
435 |
\path[->] (q_2) edge node [above] {\alert{$a$}} (q_3); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
436 |
\path[->] (q_1) edge node [right] {\alert{$b$}} (q_2); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
437 |
\path[->] (q_0) edge node [above] {\alert{$b$}} (q_2); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
438 |
\path[->] (q_2) edge [loop left] node {\alert{$b$}} (); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
439 |
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (q_0); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
440 |
\end{tikzpicture} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
441 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
442 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
443 |
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
|
444 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
445 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
446 |
\begin{tabular}{lll} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
447 |
\bl{$(q_0, a) \rightarrow q_1$} & \bl{$(q_1, a) \rightarrow q_4$} & \bl{$(q_4, a) \rightarrow q_4$}\\ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
448 |
\bl{$(q_0, b) \rightarrow q_2$} & \bl{$(q_1, b) \rightarrow q_2$} & \bl{$(q_4, b) \rightarrow q_4$}\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
449 |
\end{tabular}\ldots |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
450 |
\end{center} |
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 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
453 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
454 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
455 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
456 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
457 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
458 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
459 |
\begin{frame}[t] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
460 |
\frametitle{\begin{tabular}{c}Accepting a String\end{tabular}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
461 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
462 |
Given |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
463 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
464 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
465 |
\bl{$A(Q, q_0, F, \delta)$} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
466 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
467 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
468 |
you can define |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
469 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
470 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
471 |
\begin{tabular}{l} |
143
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
472 |
\bl{$\hat{\delta}(q, \texttt{""}) \dn q$}\\ |
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
473 |
\bl{$\hat{\delta}(q, c::s) \dn \hat{\delta}(\delta(q, c), s)$}\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
474 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
475 |
\end{center}\pause |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
476 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
477 |
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
|
478 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
479 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
480 |
\hspace{5mm}\bl{$\hat{\delta}(q_0, s) \in F$} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
481 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
482 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
483 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
484 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
485 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
486 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
487 |
\begin{frame}[c] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
488 |
\frametitle{\begin{tabular}{c}Non-Deterministic\\[-1mm] Finite Automata\end{tabular}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
489 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
490 |
A non-deterministic finite automaton consists again of: |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
491 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
492 |
\begin{itemize} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
493 |
\item a finite set of states |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
494 |
\item one of these states is the start state |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
495 |
\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
|
496 |
\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
|
497 |
\end{itemize} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
498 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
499 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
500 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
501 |
\begin{tabular}{c} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
502 |
\bl{$(q_1, a) \rightarrow q_2$}\\ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
503 |
\bl{$(q_1, a) \rightarrow q_3$}\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
504 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
505 |
\hspace{10mm} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
506 |
\begin{tabular}{c} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
507 |
\bl{$(q_1, \epsilon) \rightarrow q_2$}\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
508 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
509 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
510 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
511 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
512 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
513 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
514 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
515 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
516 |
\begin{frame}[c] |
143
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
517 |
\frametitle{Two NFA Examples} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
518 |
|
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 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
547 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
548 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
549 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
550 |
|
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 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
553 |
\begin{frame}[c] |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
554 |
\frametitle{Rexp to NFA} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
555 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
556 |
\begin{center} |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
557 |
\begin{tabular}[t]{l@{\hspace{10mm}}l} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
558 |
\raisebox{1mm}{\bl{$\varnothing$}} & |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
559 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,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
|
560 |
\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
|
561 |
\end{tikzpicture}\\\\ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
562 |
\raisebox{1mm}{\bl{$\epsilon$}} & |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
563 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,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
|
564 |
\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
|
565 |
\end{tikzpicture}\\\\ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
566 |
\raisebox{2mm}{\bl{$c$}} & |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
567 |
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,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
|
568 |
\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
|
569 |
\node[state, accepting] (q_1) [right=of q_0] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
570 |
\path[->] (q_0) edge node [below] {\alert{$c$}} (q_1); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
571 |
\end{tikzpicture}\\\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
572 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
573 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
574 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
575 |
\end{frame}} |
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 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
578 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
579 |
\mode<presentation>{ |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
580 |
\begin{frame}[t] |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
581 |
\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
|
582 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
583 |
\mbox{}\bigskip |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
584 |
\onslide<1>{By recursion we are given two automata:\bigskip} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
585 |
|
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
586 |
{\centering\begin{tikzpicture}[node distance=3mm, |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
587 |
>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
588 |
\node[state, initial] (q_0) {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
589 |
\node (r_1) [right=of q_0] {$\ldots$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
590 |
\only<1>{ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
591 |
\node[state, accepting] (t_1) [right=of r_1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
592 |
\node[state, accepting] (t_2) [above=of t_1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
593 |
\node[state, accepting] (t_3) [below=of t_1] {$\mbox{}$};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
594 |
\only<2>{ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
595 |
\node[state] (t_1) [right=of r_1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
596 |
\node[state] (t_2) [above=of t_1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
597 |
\node[state] (t_3) [below=of t_1] {$\mbox{}$};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
598 |
\only<1>{\node[state, initial] (a_0) [right=2.5cm of t_1] {$\mbox{}$};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
599 |
\only<2>{\node[state] (a_0) [right=2.5cm of t_1] {$\mbox{}$};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
600 |
\node (b_1) [right=of a_0] {$\ldots$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
601 |
\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
|
602 |
\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
|
603 |
\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
|
604 |
\only<2>{ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
605 |
\path[->] (t_1) edge node [above, pos=0.3] {\alert{$\epsilon$}} (a_0); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
606 |
\path[->] (t_2) edge node [above] {\alert{$\epsilon$}} (a_0); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
607 |
\path[->] (t_3) edge node [below] {\alert{$\epsilon$}} (a_0); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
608 |
} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
609 |
\begin{pgfonlayer}{background} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
610 |
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (q_0) (r_1) (t_1) (t_2) (t_3)] {};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
611 |
\only<1>{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (a_0) (b_1) (c_1) (c_2) (c_3)] {};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
612 |
\only<2>{\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (q_0) (c_1) (c_2) (c_3)] {};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
613 |
\only<1>{\node [yshift=2mm] at (1.north) {\bl{$r_1$}};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
614 |
\only<1>{\node [yshift=2mm] at (2.north) {\bl{$r_2$}};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
615 |
\only<2>{\node [yshift=2mm] at (3.north) {\bl{$r_1\cdot r_2$}};} |
143
e3fd4c5995ef
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
139
diff
changeset
|
616 |
\end{pgfonlayer} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
617 |
\end{tikzpicture}}\bigskip\bigskip |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
618 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
619 |
\small |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
620 |
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
|
621 |
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
|
622 |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
623 |
\end{frame}} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
624 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
625 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
626 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
627 |
\mode<presentation>{ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
628 |
\begin{frame}[t] |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
629 |
\frametitle{Case $r_1+ r_2$} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
630 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
631 |
\onslide<1>{By recursion we are given two automata:\smallskip} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
632 |
|
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
633 |
\hspace{2cm}\begin{tikzpicture}[node distance=3mm, |
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
634 |
>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
635 |
\onslide<1>{\node at (0,0) (1) {$\mbox{}$};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
636 |
\onslide<2>{\node at (0,0) [state, initial] (1) {$\mbox{}$};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
637 |
\only<1>{ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
638 |
\node[state, initial] (2) [above right=16mm of 1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
639 |
\node[state, initial] (3) [below right=16mm of 1] {$\mbox{}$};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
640 |
\only<2>{ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
641 |
\node[state] (2) [above right=16mm of 1] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
642 |
\node[state] (3) [below right=16mm of 1] {$\mbox{}$};} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
643 |
|
137
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
644 |
\node (a) [right=of 2] {$\ldots$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
645 |
\node[state, accepting] (a1) [right=of a] {$\mbox{}$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
646 |
\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
|
647 |
\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
|
648 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
649 |
\node (b) [right=of 3] {$\ldots$}; |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
650 |
\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
|
651 |
\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
|
652 |
\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
|
653 |
\only<2>{ |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
654 |
\path[->] (1) edge node [above] {\alert{$\epsilon$}} (2); |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
655 |
\path[->] (1) edge node [below] {\alert{$\epsilon$}} (3); |
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 |
\begin{pgfonlayer}{background} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
658 |
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
659 |
\only<1>{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (3) (b1) (b2) (b3)] {};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
660 |
\only<2>{\node (3) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3) (b2) (b3)] {};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
661 |
\only<1>{\node [yshift=3mm] at (1.north) {\bl{$r_1$}};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
662 |
\only<1>{\node [yshift=3mm] at (2.north) {\bl{$r_2$}};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
663 |
\only<2>{\node [yshift=3mm] at (3.north) {\bl{$r_1+ r_2$}};} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
664 |
\end{pgfonlayer} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
665 |
\end{tikzpicture} |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
666 |
|
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
667 |
\small |
69cec773736b
added pictures
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
136
diff
changeset
|
668 |
We (1) need to introduce a new starting state and (2) connect it to the original two starting states. |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
669 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
670 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
671 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
672 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
673 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
674 |
\begin{frame}[c] |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
675 |
\frametitle{Case $r^*$} |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
676 |
|
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
677 |
\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
|
678 |
|
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
679 |
\hspace{2cm}\begin{tikzpicture}[node distance=3mm, |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
680 |
>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
681 |
\onslide<1>{\node at (0,0) (1) {$\mbox{}$};} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
682 |
\onslide<2->{\node at (0,0) [state, initial,accepting] (1) {$\mbox{}$};} |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
683 |
\only<1>{\node[state, initial] (2) [right=16mm of 1] {$\mbox{}$};} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
684 |
\only<2->{\node[state] (2) [right=16mm of 1] {$\mbox{}$};} |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
685 |
\node (a) [right=of 2] {$\ldots$}; |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
686 |
\only<1>{ |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
687 |
\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
|
688 |
\node[state, accepting] (a2) [above=of a1] {$\mbox{}$}; |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
689 |
\node[state, accepting] (a3) [below=of a1] {$\mbox{}$};} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
690 |
\only<2->{ |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
691 |
\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
|
692 |
\node[state] (a2) [above=of a1] {$\mbox{}$}; |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
693 |
\node[state] (a3) [below=of a1] {$\mbox{}$};} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
694 |
\only<2->{ |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
695 |
\path[->] (1) edge node [above] {\alert{$\epsilon$}} (2); |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
696 |
\path[->] (a1) edge [bend left=45] node [above] {\alert{$\epsilon$}} (1); |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
697 |
\path[->] (a2) edge [bend right] node [below] {\alert{$\epsilon$}} (1); |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
698 |
\path[->] (a3) edge [bend left=45] node [below] {\alert{$\epsilon$}} (1); |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
699 |
|
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
700 |
} |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
701 |
\begin{pgfonlayer}{background} |
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
702 |
\only<1>{\node (1) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (2) (a1) (a2) (a3)] {};} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
703 |
\only<2->{\node (2) [rounded corners, inner sep=1mm, thick, draw=black!60, fill=black!20, fit= (1) (a2) (a3)] {};} |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
704 |
\only<1>{\node [yshift=3mm] at (1.north) {\bl{$r$}};} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
705 |
\only<2->{\node [yshift=3mm] at (2.north) {\bl{$r^*$}};} |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
706 |
\end{pgfonlayer} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
707 |
\end{tikzpicture}\bigskip |
138
b98a0a49c432
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
137
diff
changeset
|
708 |
|
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
709 |
\onslide<3->{ |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
710 |
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
|
711 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
712 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
713 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
714 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
715 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
716 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
717 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
718 |
\begin{frame}[c] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
719 |
\frametitle{\begin{tabular}{c}Subset Construction\end{tabular}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
720 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
721 |
|
136
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
722 |
\begin{textblock}{5}(1,1) |
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
723 |
\begin{center} |
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
724 |
\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
|
725 |
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
|
726 |
\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
|
727 |
\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
|
728 |
\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
|
729 |
\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
|
730 |
\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
|
731 |
\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
|
732 |
\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
|
733 |
\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
|
734 |
\end{tikzpicture} |
cc19e6cbcb68
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
135
diff
changeset
|
735 |
\end{center} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
736 |
\end{textblock} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
737 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
738 |
\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
|
739 |
\begin{tabular}{r|cl} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
740 |
nodes \textcolor{white}{*} & $a$ & $b$\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
741 |
\hline |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
742 |
$\varnothing$ \textcolor{white}{*} & \onslide<2->{$\varnothing$} & \onslide<2->{$\varnothing$}\\ |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
743 |
$\{0\}$ \textcolor{white}{*} & \onslide<3->{$\{0,1,2\}$} & \onslide<3->{$\{2\}$}\\ |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
744 |
$\{1\}$ \textcolor{white}{*} & \onslide<3->{$\{1\}$} & \onslide<3->{$\varnothing$}\\ |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
745 |
$\{2\}$ \onslide<5->{*} & \onslide<3->{$\varnothing$} & \onslide<3->{$\{2\}$}\\ |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
746 |
$\{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
|
747 |
$\{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
|
748 |
$\{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
|
749 |
\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
|
750 |
\end{tabular} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
751 |
\end{textblock} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
752 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
753 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
754 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
755 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
756 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
757 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
758 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
759 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
760 |
\begin{frame}[c] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
761 |
\frametitle{\begin{tabular}{c}Regular Languages\end{tabular}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
762 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
763 |
A language is \alert{regular} iff there exists |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
764 |
a regular expression that recognises all its strings.\bigskip\medskip |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
765 |
|
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
766 |
or {\bf equivalently}\bigskip\medskip |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
767 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
768 |
A language is \alert{regular} iff there exists |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
769 |
a deterministic finite automaton that recognises all its strings.\bigskip\medskip\pause |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
770 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
771 |
Why is every finite set of strings a regular language? |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
772 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
773 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
774 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
775 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
776 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
777 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
778 |
\mode<presentation>{ |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
779 |
\begin{frame}<1-2>[c] |
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 |
\begin{center} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
782 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
783 |
every state/.style={minimum size=0pt,inner sep=2pt,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
|
784 |
\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
|
785 |
\node[state] (q_1) [right=of q_0] {$q_1$}; |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
786 |
\node[state] (q_2) [below right=of q_0] {$q_2$}; |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
787 |
\node[state] (q_3) [right=of q_2] {$q_3$}; |
215
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
788 |
\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
789 |
\path[->] (q_0) edge node [above] {\alert{$a$}} (q_1); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
790 |
\path[->] (q_1) edge node [above] {\alert{$a$}} (q_4); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
791 |
\path[->] (q_4) edge [loop right] node {\alert{$a, b$}} (); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
792 |
\path[->] (q_3) edge node [right] {\alert{$a$}} (q_4); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
793 |
\path[->] (q_2) edge node [above] {\alert{$a$}} (q_3); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
794 |
\path[->] (q_1) edge node [right] {\alert{$b$}} (q_2); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
795 |
\path[->] (q_0) edge node [above] {\alert{$b$}} (q_2); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
796 |
\path[->] (q_2) edge [loop left] node {\alert{$b$}} (); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
797 |
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (q_0); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
798 |
\end{tikzpicture} |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
799 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
800 |
|
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
801 |
\mbox{}\\[-20mm]\mbox{} |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
802 |
|
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
803 |
\begin{center} |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
804 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
805 |
every state/.style={minimum size=0pt,inner sep=2pt,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
|
806 |
\node[state,initial] (q_02) {$q_{0, 2}$}; |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
807 |
\node[state] (q_13) [right=of q_02] {$q_{1, 3}$}; |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
143
diff
changeset
|
808 |
\node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$}; |
139
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
809 |
\path[->] (q_02) edge [bend left] node [above] {\alert{$a$}} (q_13); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
810 |
\path[->] (q_13) edge [bend left] node [below] {\alert{$b$}} (q_02); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
811 |
\path[->] (q_02) edge [loop below] node {\alert{$b$}} (); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
812 |
\path[->] (q_13) edge node [above] {\alert{$a$}} (q_4); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
813 |
\path[->] (q_4) edge [loop above] node {\alert{$a, b$}} (); |
6e7c3db9023d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
138
diff
changeset
|
814 |
\end{tikzpicture}\\ |
135
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
815 |
minimal automaton |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
816 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
817 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
818 |
\end{frame}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
819 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
820 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
821 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
822 |
\mode<presentation>{ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
823 |
\begin{frame}[c] |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
824 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
825 |
Given the function |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
826 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
827 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
828 |
\bl{\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
829 |
$rev(\varnothing)$ & $\dn$ & $\varnothing$\\ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
830 |
$rev(\epsilon)$ & $\dn$ & $\epsilon$\\ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
831 |
$rev(c)$ & $\dn$ & $c$\\ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
832 |
$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
|
833 |
$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
|
834 |
$rev(r^*)$ & $\dn$ & $rev(r)^*$\\ |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
835 |
\end{tabular}} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
836 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
837 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
838 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
839 |
and the set |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
840 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
841 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
842 |
\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
|
843 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
844 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
845 |
prove whether |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
846 |
|
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
847 |
\begin{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
848 |
\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
|
849 |
\end{center} |
72b686e1c974
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
134
diff
changeset
|
850 |
|
133
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
851 |
\end{frame}} |
09efdf5cf07c
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
852 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
25 | 853 |
|
854 |
||
855 |
\end{document} |
|
856 |
||
857 |
%%% Local Variables: |
|
858 |
%%% mode: latex |
|
859 |
%%% TeX-master: t |
|
860 |
%%% End: |
|
861 |