11 \newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black} |
11 \newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black} |
12 \newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1} |
12 \newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1} |
13 \newtcolorbox{mybox3}[1]{colback=Cyan!5!white,colframe=Cyan!75!black,fonttitle=\bfseries,title=#1} |
13 \newtcolorbox{mybox3}[1]{colback=Cyan!5!white,colframe=Cyan!75!black,fonttitle=\bfseries,title=#1} |
14 |
14 |
15 |
15 |
16 |
16 \setbeamersize{text margin left=2mm} % <- like this |
17 \hfuzz=220pt |
17 \hfuzz=220pt |
18 |
18 |
19 \lstset{language=Scala, |
19 \lstset{language=Scala, |
20 style=mystyle, |
20 style=mystyle, |
21 numbersep=0pt, |
21 numbersep=0pt, |
22 numbers=none, |
22 numbers=none, |
23 xleftmargin=0mm} |
23 xleftmargin=0mm} |
24 |
24 |
25 \pgfplotsset{compat=1.17} |
25 \pgfplotsset{compat=1.17} |
26 |
26 |
27 \newcommand{\bl}[1]{\textcolor{blue}{#1}} |
27 \newcommand{\bl}[1]{\textcolor{blue}{#1}} |
28 |
28 |
29 % beamer stuff |
29 % beamer stuff |
30 \renewcommand{\slidecaption}{SSY, King's College London} |
30 \renewcommand{\slidecaption}{Christian Urban, SSY, King's College London} |
31 |
31 |
32 |
32 |
33 |
33 |
34 \begin{document} |
34 \begin{document} |
35 |
35 |
|
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
37 \begin{frame}[t] |
|
38 \frametitle{\begin{tabular}{@ {\hspace{8mm}}c@ {}}Fast Regular Expression Matching\end{tabular}} |
|
39 \mbox{}\\[1mm] |
|
40 |
|
41 \begin{columns}[t,onlytextwidth] |
|
42 \begin{column}{.2\textwidth} |
|
43 \raisebox{-10mm}{ |
|
44 \begin{tikzpicture} |
|
45 \begin{axis}[ |
|
46 xlabel={size of strings}, |
|
47 x label style={at={(0.45,-0.16)}}, |
|
48 ylabel={time in secs}, |
|
49 enlargelimits=false, |
|
50 xtick={0,10,...,30}, |
|
51 xmax=35, |
|
52 ymax=35, |
|
53 ytick={0,10,...,30}, |
|
54 scaled ticks=false, |
|
55 axis lines=left, |
|
56 width=5cm, |
|
57 height=4.5cm, |
|
58 legend entries={Python,JavaScript,Swift,Dart}, |
|
59 legend style={font=\footnotesize,at={(0.45,-0.48)},anchor=north}, |
|
60 legend cell align=left] |
|
61 \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data}; |
|
62 \addplot[red,mark=*, mark options={fill=white}] table {re-js.data}; |
|
63 \addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data}; |
|
64 \addplot[brown,mark=*, mark options={fill=white}] table {re-dart.data}; |
|
65 \end{axis} |
|
66 \end{tikzpicture}} |
|
67 \end{column} |
|
68 |
|
69 \end{columns} |
|
70 |
|
71 \begin{textblock}{4}(3.5,3.2) |
|
72 {\bl{\texttt{(a*)*$\cdot$b}}} |
|
73 \end{textblock} |
|
74 |
|
75 \begin{textblock}{7.5}(8,3) |
|
76 \begin{itemize} |
|
77 \item use \textbf{Brzozowski derivatives} for regex matching rather\\ than NFAs/DFAs% and lexing |
|
78 \item based on work by \textbf{Christian Urban} and \textbf{Roy Dyckhoff}\bigskip |
|
79 \item applications in network security (traffic filtering) |
|
80 \item formal verification of correctness and speed (\textbf{Isabelle} theorem prover) |
|
81 \end{itemize} |
|
82 \end{textblock} |
|
83 |
|
84 \end{frame} |
|
85 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
86 |
|
87 |
|
88 \end{document} |
|
89 |
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
37 \begin{frame}[t] |
91 \begin{frame}[t] |
38 \frametitle{% |
92 \frametitle{% |
39 \begin{tabular}{@ {}c@ {}} |
93 \begin{tabular}{@ {}c@ {}} |
40 \\[8mm] |
94 \\[8mm] |
41 \LARGE Derivative-Based\\ |
95 \LARGE Derivative-Based\\ |
42 \LARGE Regular Expression Matching\\[5mm] |
96 \LARGE Regular Expression Matching\\[5mm] |
43 \normalsize\textcolor{gray}{Christian Urban, SSY Group} |
97 \normalsize\textcolor{gray}{Christian Urban, SSY Group} |
44 \end{tabular}} |
98 \end{tabular}} |
45 |
99 |
46 \end{frame} |
100 \end{frame} |
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
48 |
102 |
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
50 \begin{frame}[c] |
104 \begin{frame}[c] |
51 \frametitle{A Bit of Background} |
105 \frametitle{A Bit of Background} |
52 |
106 |
53 \begin{textblock}{10}(2,2.5) |
107 \begin{textblock}{10}(2,2.5) |
54 \includegraphics[scale=0.4]{../pics/phd-1.jpg} |
108 \includegraphics[scale=0.4]{../pics/phd-1.jpg} |
55 \end{textblock} |
109 \end{textblock} |
56 |
110 |
57 \begin{textblock}{11}(1.7,10) |
111 \begin{textblock}{11}(1.7,10) |
58 \begin{bubble}[9.6cm] |
112 \begin{bubble}[9.6cm] |
59 PhD thesis on a particular term-rewriting system:\medskip\\ |
113 PhD thesis on a particular term-rewriting system:\medskip\\ |
60 Proved that all rewriting sequences are strongly normalising (terminate). |
114 Proved that all rewriting sequences are strongly normalising (terminate). |
61 \end{bubble} |
115 \end{bubble} |
62 \end{textblock} |
116 \end{textblock} |
63 |
117 |
64 \only<2->{% |
118 \only<2->{% |
65 \begin{textblock}{3}(10,2.5) |
119 \begin{textblock}{3}(10,2.5) |
67 \begin{tabular}{rcl} |
121 \begin{tabular}{rcl} |
68 \bl{$t$} & \bl{::=} & \bl{$x$}\\ |
122 \bl{$t$} & \bl{::=} & \bl{$x$}\\ |
69 & \bl{|} & \bl{$\lambda x.\,t$}\\ |
123 & \bl{|} & \bl{$\lambda x.\,t$}\\ |
70 & \bl{|} & \bl{$t_1\;t_2$}\\ |
124 & \bl{|} & \bl{$t_1\;t_2$}\\ |
71 & \bl{|} & \bl{...} |
125 & \bl{|} & \bl{...} |
72 \end{tabular} |
126 \end{tabular} |
73 \end{bubble} |
127 \end{bubble} |
74 \end{textblock}} |
128 \end{textblock}} |
75 |
129 |
76 \end{frame} |
130 \end{frame} |
77 |
131 |
78 |
132 |
79 |
133 |
80 |
134 |
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
82 |
136 |
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
84 \begin{frame}[t] |
138 \begin{frame}[t] |
85 \frametitle{Quiz 1} |
139 \frametitle{Quiz 1} |
86 \begin{bubble}[10cm]\it |
140 \begin{bubble}[10cm]\it |
87 There are many, many regular expression libraries.\bigskip\\ |
141 There are many, many regular expression libraries.\bigskip\\ |
88 |
142 |
89 \textbf{Given a regular expression \bl{r} and a string \bl{s}, what is the |
143 \textbf{Given a regular expression \bl{r} and a string \bl{s}, what is the |
90 difficulty / complexity of the problem deciding whether \bl{r} matches \bl{s}?} |
144 difficulty / complexity of the problem deciding whether \bl{r} matches \bl{s}?} |
91 \end{bubble} |
145 \end{bubble} |
92 |
146 |
93 \begin{textblock}{12}(2,9) |
147 \begin{textblock}{12}(2,9) |
100 \draw(7,-1) node[rotate=0]{\bl{$O(2^n)$}}; |
154 \draw(7,-1) node[rotate=0]{\bl{$O(2^n)$}}; |
101 \end{tikzpicture} |
155 \end{tikzpicture} |
102 \end{textblock} |
156 \end{textblock} |
103 |
157 |
104 \end{frame} |
158 \end{frame} |
105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
106 |
160 |
107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
108 \begin{frame}[t] |
162 \begin{frame}[t] |
109 \frametitle{Quiz 2} |
163 \frametitle{Quiz 2} |
110 |
164 |
111 \begin{textblock}{12}(2,2.5) |
165 \begin{textblock}{12}(2,2.5) |
112 A regular expression for (some) email addresses: |
166 A regular expression for (some) email addresses: |
113 \begin{center} |
167 \begin{center} |
114 ($\underbrace{\bl{[a\mbox{-}z0\mbox{-}9\_\!\!\_\,.-]^+}}_{\textrm{name}}$)\bl{$\,@\,$} |
168 ($\underbrace{\bl{[a\mbox{-}z0\mbox{-}9\_\!\!\_\,.-]^+}}_{\textrm{name}}$)\bl{$\,@\,$} |
115 ($\underbrace{\bl{[a\mbox{-}z0\mbox{-}9\,-]^+}}_{\textrm{domain}}$) \bl{$\,.\,$} |
169 ($\underbrace{\bl{[a\mbox{-}z0\mbox{-}9\,-]^+}}_{\textrm{domain}}$) \bl{$\,.\,$} |
116 ($\underbrace{\bl{[a\mbox{-}z\,.]^{\{2..5\}}}}_{\textrm{top-level domain}}$) |
170 ($\underbrace{\bl{[a\mbox{-}z\,.]^{\{2..5\}}}}_{\textrm{top-level domain}}$) |
117 \end{center} |
171 \end{center} |
118 \end{textblock} |
172 \end{textblock} |
119 |
173 |
120 \only<2>{ |
174 \only<2>{ |
121 \begin{textblock}{10}(4,8) |
175 \begin{textblock}{10}(4,8) |
122 bounded regular expressions:\medskip\\ |
176 bounded regular expressions:\medskip\\ |
123 \begin{tabular}{ll} |
177 \begin{tabular}{ll} |
124 \bl{$r^{\{n\}}$} & exactly n-times \bl{$r$}\\ |
178 \bl{$r^{\{n\}}$} & exactly n-times \bl{$r$}\\ |
125 \bl{$r^{\{n..m\}}$} & between n and m-times\\ |
179 \bl{$r^{\{n..m\}}$} & between n and m-times\\ |
126 \bl{$r^{\{n..\}}$} & from n-times\\ |
180 \bl{$r^{\{n..\}}$} & from n-times\\ |
127 \bl{$r^{\{..m\}}$} & upto m-times\\ |
181 \bl{$r^{\{..m\}}$} & upto m-times\\ |
128 \end{tabular}\smallskip\\ |
182 \end{tabular}\smallskip\\ |
129 \footnotesize\hfill ${}^*$ in some applications the counters can be in the millions |
183 \footnotesize\hfill ${}^*$ in some applications the counters can be in the millions |
130 \end{textblock}} |
184 \end{textblock}} |
131 |
185 |
132 \end{frame} |
186 \end{frame} |
133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
134 |
188 |
135 |
189 |
136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
137 \begin{frame}[t] |
191 \begin{frame}[t] |
138 \frametitle{Quiz 2} |
192 \frametitle{Quiz 2} |
139 |
193 |
140 |
194 |
141 \begin{textblock}{12}(2,2.5) |
195 \begin{textblock}{12}(2,2.5) |
147 \onslide<1>{ |
201 \onslide<1>{ |
148 \begin{tikzpicture}[node distance=3mm, |
202 \begin{tikzpicture}[node distance=3mm, |
149 >=stealth',very thick, |
203 >=stealth',very thick, |
150 every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}] |
204 every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}] |
151 \node[state, initial] (Q_0) {$\mbox{}$}; |
205 \node[state, initial] (Q_0) {$\mbox{}$}; |
152 \node[state, initial] (Q_01) [below=1mm of Q_0] {$\mbox{}$}; |
206 \node[state, initial] (Q_01) [below=1mm of Q_0] {$\mbox{}$}; |
153 \node[state, initial] (Q_02) [above=1mm of Q_0] {$\mbox{}$}; |
207 \node[state, initial] (Q_02) [above=1mm of Q_0] {$\mbox{}$}; |
154 \node (R_1) [right=of Q_0] {$\ldots$}; |
208 \node (R_1) [right=of Q_0] {$\ldots$}; |
155 \node[state, accepting] (T_1) [right=of R_1] {$\mbox{}$}; |
209 \node[state, accepting] (T_1) [right=of R_1] {$\mbox{}$}; |
156 \node[state, accepting] (T_2) [above=of T_1] {$\mbox{}$}; |
210 \node[state, accepting] (T_2) [above=of T_1] {$\mbox{}$}; |
157 \node[state, accepting] (T_3) [below=of T_1] {$\mbox{}$}; |
211 \node[state, accepting] (T_3) [below=of T_1] {$\mbox{}$}; |
158 |
212 |
179 \onslide<2>{ |
233 \onslide<2>{ |
180 \begin{tikzpicture}[node distance=3mm, |
234 \begin{tikzpicture}[node distance=3mm, |
181 >=stealth',very thick, |
235 >=stealth',very thick, |
182 every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
236 every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] |
183 \node[state, initial] (Q_0) {$\mbox{}$}; |
237 \node[state, initial] (Q_0) {$\mbox{}$}; |
184 \node[state, initial] (Q_01) [below=1mm of Q_0] {$\mbox{}$}; |
238 \node[state, initial] (Q_01) [below=1mm of Q_0] {$\mbox{}$}; |
185 \node[state, initial] (Q_02) [above=1mm of Q_0] {$\mbox{}$}; |
239 \node[state, initial] (Q_02) [above=1mm of Q_0] {$\mbox{}$}; |
186 \node (r_1) [right=of Q_0] {$\ldots$}; |
240 \node (r_1) [right=of Q_0] {$\ldots$}; |
187 \node[state] (t_1) [right=of r_1] {$\mbox{}$}; |
241 \node[state] (t_1) [right=of r_1] {$\mbox{}$}; |
188 \node[state] (t_2) [above=of t_1] {$\mbox{}$}; |
242 \node[state] (t_2) [above=of t_1] {$\mbox{}$}; |
189 \node[state] (t_3) [below=of t_1] {$\mbox{}$}; |
243 \node[state] (t_3) [below=of t_1] {$\mbox{}$}; |
190 |
244 |
200 \path[->] (t_2) edge node [above] {$\varepsilon$\footnotesize{}s} (A_01); |
254 \path[->] (t_2) edge node [above] {$\varepsilon$\footnotesize{}s} (A_01); |
201 \path[->] (t_3) edge (A_01); |
255 \path[->] (t_3) edge (A_01); |
202 \path[->] (t_1) edge (A_02); |
256 \path[->] (t_1) edge (A_02); |
203 \path[->] (t_2) edge (A_02); |
257 \path[->] (t_2) edge (A_02); |
204 \path[->] (t_3) edge node [below] {$\varepsilon$\footnotesize{}s} (A_02); |
258 \path[->] (t_3) edge node [below] {$\varepsilon$\footnotesize{}s} (A_02); |
205 |
259 |
206 \begin{pgfonlayer}{background} |
260 \begin{pgfonlayer}{background} |
207 \node (3) [rounded corners, inner sep=1mm, thick, |
261 \node (3) [rounded corners, inner sep=1mm, thick, |
208 draw=black!60, fill=black!20, fit= (Q_0) (c_1) (c_2) (c_3)] {}; |
262 draw=black!60, fill=black!20, fit= (Q_0) (c_1) (c_2) (c_3)] {}; |
209 \node [yshift=2mm] at (3.north) {$r_1\cdot r_2$}; |
263 \node [yshift=2mm] at (3.north) {$r_1\cdot r_2$}; |
210 \end{pgfonlayer} |
264 \end{pgfonlayer} |
211 \end{tikzpicture}} |
265 \end{tikzpicture}} |
212 \end{textblock} |
266 \end{textblock} |
213 |
267 |
214 |
268 |
215 \end{frame} |
269 \end{frame} |
216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
217 |
271 |
218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
219 \begin{frame}[t] |
273 \begin{frame}[t] |
220 \frametitle{Quiz 2} |
274 \frametitle{Quiz 2} |
221 |
275 |
222 \begin{textblock}{12}(2,2.5) |
276 \begin{textblock}{12}(2,2.5) |
223 \onslide<1->{Thompson construction: By recursion we have a NFA for $r$.\medskip\\ |
277 \onslide<1->{Thompson construction: By recursion we have a NFA for $r$.\medskip\\ |
224 \onslide<2->{For $r^*$:\bigskip}} |
278 \onslide<2->{For $r^*$:\bigskip}} |
225 \end{textblock} |
279 \end{textblock} |
226 |
280 |
227 \begin{textblock}{12}(4,6) |
281 \begin{textblock}{12}(4,6) |
228 \onslide<1>{ |
282 \onslide<1>{ |
229 \begin{tikzpicture}[node distance=3mm, |
283 \begin{tikzpicture}[node distance=3mm, |
230 >=stealth',very thick, |
284 >=stealth',very thick, |
231 every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
285 every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
232 baseline=(current bounding box.north)] |
286 baseline=(current bounding box.north)] |
233 \node (2) {$\mbox{}$}; |
287 \node (2) {$\mbox{}$}; |
234 \node[state, initial] (4) [above=1mm of 2] {$\mbox{}$}; |
288 \node[state, initial] (4) [above=1mm of 2] {$\mbox{}$}; |
235 \node[state, initial] (5) [below=1mm of 2] {$\mbox{}$}; |
289 \node[state, initial] (5) [below=1mm of 2] {$\mbox{}$}; |
236 \node (a) [right=of 2] {$\ldots$}; |
290 \node (a) [right=of 2] {$\ldots$}; |
237 \node[state, accepting] (a1) [right=of a] {$\mbox{}$}; |
291 \node[state, accepting] (a1) [right=of a] {$\mbox{}$}; |
238 \node[state, accepting] (a2) [above=of a1] {$\mbox{}$}; |
292 \node[state, accepting] (a2) [above=of a1] {$\mbox{}$}; |
239 \node[state, accepting] (a3) [below=of a1] {$\mbox{}$}; |
293 \node[state, accepting] (a3) [below=of a1] {$\mbox{}$}; |
240 \begin{pgfonlayer}{background} |
294 \begin{pgfonlayer}{background} |
243 \end{pgfonlayer} |
297 \end{pgfonlayer} |
244 \end{tikzpicture}} |
298 \end{tikzpicture}} |
245 \end{textblock} |
299 \end{textblock} |
246 |
300 |
247 \begin{textblock}{12}(2,6) |
301 \begin{textblock}{12}(2,6) |
248 \onslide<2->{ |
302 \onslide<2->{ |
249 \begin{tikzpicture}[node distance=3mm, |
303 \begin{tikzpicture}[node distance=3mm, |
250 >=stealth',very thick, |
304 >=stealth',very thick, |
251 every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
305 every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20}, |
252 baseline=(current bounding box.north)] |
306 baseline=(current bounding box.north)] |
253 \node at (0,0) [state, initial,accepting] (1) {$\mbox{}$}; |
307 \node at (0,0) [state, initial,accepting] (1) {$\mbox{}$}; |
254 \node (2) [right=16mm of 1] {$\mbox{}$}; |
308 \node (2) [right=16mm of 1] {$\mbox{}$}; |
255 \node[state] (4) [above=1mm of 2] {$\mbox{}$}; |
309 \node[state] (4) [above=1mm of 2] {$\mbox{}$}; |
256 \node[state] (5) [below=1mm of 2] {$\mbox{}$}; |
310 \node[state] (5) [below=1mm of 2] {$\mbox{}$}; |
257 \node (a) [right=of 2] {$\ldots$}; |
311 \node (a) [right=of 2] {$\ldots$}; |
258 \node[state] (a1) [right=of a] {$\mbox{}$}; |
312 \node[state] (a1) [right=of a] {$\mbox{}$}; |
259 \node[state] (a2) [above=of a1] {$\mbox{}$}; |
313 \node[state] (a2) [above=of a1] {$\mbox{}$}; |
260 \node[state] (a3) [below=of a1] {$\mbox{}$}; |
314 \node[state] (a3) [below=of a1] {$\mbox{}$}; |
261 \path[->] (1) edge node [below] {$\varepsilon$} (4); |
315 \path[->] (1) edge node [below] {$\varepsilon$} (4); |
269 \end{pgfonlayer} |
323 \end{pgfonlayer} |
270 \end{tikzpicture}} |
324 \end{tikzpicture}} |
271 \end{textblock} |
325 \end{textblock} |
272 |
326 |
273 \begin{textblock}{12}(2,12) |
327 \begin{textblock}{12}(2,12) |
274 \onslide<3->{ |
328 \onslide<3->{ |
275 \begin{bubble}[9.5cm]\it |
329 \begin{bubble}[9.5cm]\it |
276 Quiz:\smallskip\\ |
330 Quiz:\smallskip\\ |
277 \textbf{What is the Thompson Construction for \bl{$r^{\{n\}}$} ?} |
331 \textbf{What is the Thompson Construction for \bl{$r^{\{n\}}$} ?} |
278 \end{bubble}} |
332 \end{bubble}} |
279 \end{textblock} |
333 \end{textblock} |
280 |
334 |
281 \end{frame} |
335 \end{frame} |
282 |
336 |
283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
284 |
338 |
285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
286 \begin{frame}[t] |
340 \begin{frame}[t] |
287 \frametitle{Quiz 3} |
341 \frametitle{Quiz 3} |
288 |
342 |
289 Hierarchy of Languages: |
343 Hierarchy of Languages: |
290 |
344 |
291 \begin{center} |
345 \begin{center} |
292 \begin{tikzpicture} |
346 \begin{tikzpicture} |
293 [rect/.style={draw=black!50, |
347 [rect/.style={draw=black!50, |
294 top color=white, |
348 top color=white, |
295 bottom color=black!20, |
349 bottom color=black!20, |
296 rectangle, |
350 rectangle, |
297 very thick, |
351 very thick, |
298 rounded corners}, scale=1.2] |
352 rounded corners}, scale=1.2] |
299 |
353 |
300 \draw (0,0) node [rect, text depth=39mm, text width=68mm] {all languages}; |
354 \draw (0,0) node [rect, text depth=39mm, text width=68mm] {all languages}; |
301 \draw (0,-0.4) node [rect, text depth=28.5mm, text width=64mm] {decidable languages}; |
355 \draw (0,-0.4) node [rect, text depth=28.5mm, text width=64mm] {decidable languages}; |
302 \draw (0,-0.85) node [rect, text depth=17mm] {\;\;context sensitive languages\;\;}; |
356 \draw (0,-0.85) node [rect, text depth=17mm] {\;\;context sensitive languages\;\;}; |
303 \draw (0,-1.14) node [rect, text depth=9mm, text width=50mm] {context-free languages}; |
357 \draw (0,-1.14) node [rect, text depth=9mm, text width=50mm] {context-free languages}; |
304 \draw (0,-1.4) node [rect] {regular languages}; |
358 \draw (0,-1.4) node [rect] {regular languages}; |
305 \end{tikzpicture} |
359 \end{tikzpicture} |
306 \end{center} |
360 \end{center} |
307 |
361 |
308 \begin{textblock}{12}(2,11.5) |
362 \begin{textblock}{12}(2,11.5) |
309 \onslide<2->{ |
363 \onslide<2->{ |
310 \begin{bubble}[9.5cm]\it |
364 \begin{bubble}[9.5cm]\it |
311 Quiz:\smallskip\\ |
365 Quiz:\smallskip\\ |
312 |
366 |
313 \textbf{Can we use standard parsing algorithms for matching / lexing\,?} |
367 \textbf{Can we use standard parsing algorithms for matching / lexing\,?} |
314 Say CYK, LL, LR(k), PEG, \ldots |
368 Say CYK, LL, LR(k), PEG, \ldots |
315 \end{bubble}} |
369 \end{bubble}} |
316 \end{textblock} |
370 \end{textblock} |
317 |
371 |
318 \end{frame} |
372 \end{frame} |
319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
320 |
374 |
321 \defverbatim{\foo}{\footnotesize% |
375 \defverbatim{\foo}{\footnotesize% |
322 \begin{verbatim} |
376 \begin{verbatim} |
323 (?:(?:\"|'|\]|\}|\\|\d|(?:nan|infinity|true|false| |
377 (?:(?:\"|'|\]|\}|\\|\d|(?:nan|infinity|true|false| |
324 null|undefined|symbol|math)|\`|\-|\+)+[)]*;?((?:\s |
378 null|undefined|symbol|math)|\`|\-|\+)+[)]*;?((?:\s |
325 | -|~|!|{}|\|\||\+)*.*(?:.*=.*))) |
379 | -|~|!|{}|\|\||\+)*.*(?:.*=.*))) |
326 \end{verbatim} |
380 \end{verbatim} |
327 } |
381 } |
328 |
382 |
329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
383 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
330 \begin{frame}[t,fragile] |
384 \begin{frame}[t,fragile] |
331 \frametitle{Quiz 4} |
385 \frametitle{Quiz 4} |
332 |
386 |
333 \begin{textblock}{12}(2,2.5) |
387 \begin{textblock}{12}(2,2.5) |
334 \begin{bubble}[9.5cm]\it |
388 \begin{bubble}[9.5cm]\it |
335 Quiz:\smallskip\\ |
389 Quiz:\smallskip\\ |
336 Do regular expressions have any security relevance\,? |
390 Do regular expressions have any security relevance\,? |
337 \end{bubble} |
391 \end{bubble} |
338 \end{textblock} |
392 \end{textblock} |
339 |
393 |
340 \only<2->{ |
394 \only<2->{ |
359 \hspace{1.5cm}a global outage on 2 July 2019 (first one for six years) |
413 \hspace{1.5cm}a global outage on 2 July 2019 (first one for six years) |
360 \color{blue}\foo\color{black} |
414 \color{blue}\foo\color{black} |
361 \end{textblock} |
415 \end{textblock} |
362 } |
416 } |
363 |
417 |
364 |
418 |
365 \end{frame} |
419 \end{frame} |
366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
367 |
421 |
368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
369 \begin{frame}[t] |
423 \begin{frame}[t] |
370 \frametitle{Quiz 3} |
424 \frametitle{Quiz 3} |
371 |
425 |
372 \begin{textblock}{12}(2,2) |
426 \begin{textblock}{12}(2,2) |
373 \begin{bubble}[9.5cm]\it |
427 \begin{bubble}[9.5cm]\it |
374 Quiz:\smallskip\\ |
428 Quiz:\smallskip\\ |
375 |
429 |
376 \textbf{Can we use standard parsing algorithms for matching / lexing\,?} |
430 \textbf{Can we use standard parsing algorithms for matching / lexing\,?} |
377 Say CYK, LL, LR(k), PEG, \ldots |
431 Say CYK, LL, LR(k), PEG, \ldots |
378 \end{bubble} |
432 \end{bubble} |
379 \end{textblock} |
433 \end{textblock} |
380 |
434 |
388 |
442 |
389 Lexing a string with & \bl{$(r_{key} + r_{id})^*$}\medskip\\ |
443 Lexing a string with & \bl{$(r_{key} + r_{id})^*$}\medskip\\ |
390 |
444 |
391 What should be & \\ |
445 What should be & \\ |
392 the result for: & \bl{\texttt{"iffoo"}} \;\;\; \bl{\texttt{"if"}}\\ |
446 the result for: & \bl{\texttt{"iffoo"}} \;\;\; \bl{\texttt{"if"}}\\ |
393 \end{tabular} |
447 \end{tabular} |
394 \end{textblock} |
448 \end{textblock} |
395 |
449 |
396 \only<2->{ |
450 \only<2->{ |
397 \begin{textblock}{13.5}(1.5,4) |
451 \begin{textblock}{13.5}(1.5,4) |
398 \begin{mybox3}{POSIX rules} |
452 \begin{mybox3}{POSIX rules} |
399 \begin{itemize} |
453 \begin{itemize} |
400 \item \textbf{The Longest Match Rule:} The longest initial |
454 \item \textbf{The Longest Match Rule:} The longest initial |
401 substring matched by any regular expression is taken as next token. |
455 substring matched by any regular expression is taken as next token. |
402 \item \textbf{Priority Rule:} For a particular longest initial |
456 \item \textbf{Priority Rule:} For a particular longest initial |
403 substring, the first (leftmost) regular expression that can match |
457 substring, the first (leftmost) regular expression that can match |
404 determines the token. |
458 determines the token. |
405 \item \ldots |
459 \item \ldots |
406 \end{itemize} |
460 \end{itemize} |
407 \begin{center} |
461 \begin{center} |
408 \bl{$(a + ab) \cdot (bc + c)$} \;\;and\;\; \bl{\texttt{"}$abc$\texttt{"}} |
462 \bl{$(a + ab) \cdot (bc + c)$} \;\;and\;\; \bl{\texttt{"}$abc$\texttt{"}} |
409 \end{center} |
463 \end{center} |
410 \end{mybox3} |
464 \end{mybox3} |
411 \end{textblock}} |
465 \end{textblock}} |
412 |
466 |
413 \end{frame} |
467 \end{frame} |
414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
415 |
469 |
416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
417 \begin{frame}[t] |
471 \begin{frame}[t] |
418 \frametitle{Quiz 1} |
472 \frametitle{Quiz 1} |
419 \begin{bubble}[10cm]\it |
473 \begin{bubble}[10cm]\it |
420 There are many, many regular expression libraries.\bigskip\\ |
474 There are many, many regular expression libraries.\bigskip\\ |
421 |
475 |
422 \textbf{Given a regular expression \bl{r} and a string \bl{s}, what is the |
476 \textbf{Given a regular expression \bl{r} and a string \bl{s}, what is the |
423 difficulty / complexity of the problem deciding whether \bl{r} matches \bl{s}?} |
477 difficulty / complexity of the problem deciding whether \bl{r} matches \bl{s}?} |
424 \end{bubble} |
478 \end{bubble} |
425 |
479 |
426 \begin{textblock}{12}(1,9) |
480 \begin{textblock}{12}(1,9) |
429 Python, Ruby, Swift, Dart, JavaScript & Rust, Go, RE2 & \textcolor{gray}{Snort, .Net7}\\ |
483 Python, Ruby, Swift, Dart, JavaScript & Rust, Go, RE2 & \textcolor{gray}{Snort, .Net7}\\ |
430 \end{tabular} |
484 \end{tabular} |
431 \end{textblock} |
485 \end{textblock} |
432 |
486 |
433 \end{frame} |
487 \end{frame} |
434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
435 |
489 |
436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
437 \begin{frame}[t] |
491 \begin{frame}[t] |
438 |
492 |
439 \mbox{}\\[10mm] |
493 \mbox{}\\[10mm] |
440 |
494 |
441 \begin{columns}[t,onlytextwidth] |
495 \begin{columns}[t,onlytextwidth] |
442 \begin{column}{.2\textwidth} |
496 \begin{column}{.2\textwidth} |
443 \raisebox{-10mm}{ |
497 \raisebox{-10mm}{ |
444 \begin{tikzpicture} |
498 \begin{tikzpicture} |
445 \begin{axis}[ |
499 \begin{axis}[ |
446 xlabel={\bl{$n$} \pcode{a}s}, |
500 xlabel={\bl{$n$} \pcode{a}s}, |
447 %%x label style={at={(1.05,0.0)}}, |
501 %%x label style={at={(1.05,0.0)}}, |
448 ylabel={time in secs}, |
502 ylabel={time in secs}, |
452 ymax=35, |
506 ymax=35, |
453 ytick={0,5,...,30}, |
507 ytick={0,5,...,30}, |
454 scaled ticks=false, |
508 scaled ticks=false, |
455 axis lines=left, |
509 axis lines=left, |
456 width=5cm, |
510 width=5cm, |
457 height=5cm, |
511 height=5cm, |
458 legend entries={Python,JavaScript,Swift,Dart}, |
512 legend entries={Python,JavaScript,Swift,Dart}, |
459 legend style={font=\small,at={(0.5,-0.39)},anchor=north}, |
513 legend style={font=\small,at={(0.5,-0.39)},anchor=north}, |
460 legend cell align=left] |
514 legend cell align=left] |
461 \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data}; |
515 \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data}; |
462 \addplot[red,mark=*, mark options={fill=white}] table {re-js.data}; |
516 \addplot[red,mark=*, mark options={fill=white}] table {re-js.data}; |
477 ymax=35, |
531 ymax=35, |
478 ytick={0,5,...,30}, |
532 ytick={0,5,...,30}, |
479 scaled ticks=false, |
533 scaled ticks=false, |
480 axis lines=left, |
534 axis lines=left, |
481 width=5cm, |
535 width=5cm, |
482 height=5cm, |
536 height=5cm, |
483 legend entries={Python,Ruby}, |
537 legend entries={Python,Ruby}, |
484 legend style={font=\small,at={(0.5,-0.39)},anchor=north}, |
538 legend style={font=\small,at={(0.5,-0.39)},anchor=north}, |
485 legend cell align=left] |
539 legend cell align=left] |
486 \addplot[blue,mark=*, mark options={fill=white}] table {re-python.data}; |
540 \addplot[blue,mark=*, mark options={fill=white}] table {re-python.data}; |
487 \addplot[brown,mark=pentagon*, mark options={fill=white}] table {re-ruby.data}; |
541 \addplot[brown,mark=pentagon*, mark options={fill=white}] table {re-ruby.data}; |
488 \end{axis} |
542 \end{axis} |
489 \end{tikzpicture} |
543 \end{tikzpicture} |
490 \end{column} |
544 \end{column} |
491 \end{columns} |
545 \end{columns} |
492 |
546 |
493 \begin{textblock}{4}(9,1.7) |
547 \begin{textblock}{4}(9,1.7) |
494 \textbf{\bl{\texttt{(a?)\boldmath$^{\{n\}}\cdot$(a)\boldmath$^{\{n\}}$}}} |
548 \textbf{\bl{\texttt{(a?)\boldmath$^{\{n\}}\cdot$(a)\boldmath$^{\{n\}}$}}} |
495 \end{textblock} |
549 \end{textblock} |
496 |
550 |
497 \begin{textblock}{4}(4,1.7) |
551 \begin{textblock}{4}(4,1.7) |
498 \textbf{\bl{\texttt{(a*)*$\cdot$b}}} |
552 \textbf{\bl{\texttt{(a*)*$\cdot$b}}} |
499 \end{textblock} |
553 \end{textblock} |
500 |
554 |
501 \begin{textblock}{3.4}(0.3,10) |
555 \begin{textblock}{3.4}(0.3,10) |
502 \small{}\textbf{matching with strings} |
556 \small{}\textbf{matching with strings} |
503 \textbf{\bl{$\underbrace{\texttt{a}...\texttt{a}}_n$}} |
557 \textbf{\bl{$\underbrace{\texttt{a}...\texttt{a}}_n$}} |
504 \end{textblock} |
558 \end{textblock} |
505 |
559 |
506 \end{frame} |
560 \end{frame} |
507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
508 |
562 |
509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
510 \begin{frame}[t] |
564 \begin{frame}[t] |
511 \frametitle{Quiz 1} |
565 \frametitle{Quiz 1} |
512 \begin{bubble}[10cm]\it |
566 \begin{bubble}[10cm]\it |
513 \textbf{Given a regular expression \bl{r} and a string \bl{s}, what is the |
567 \textbf{Given a regular expression \bl{r} and a string \bl{s}, what is the |
514 difficulty / complexity of the problem deciding whether \bl{r} matches \bl{s}?} |
568 difficulty / complexity of the problem deciding whether \bl{r} matches \bl{s}?} |
517 \begin{textblock}{12}(1.7,7) |
571 \begin{textblock}{12}(1.7,7) |
518 For \textbf{Perl-style} regular expression matchers (say Python, JavaScript, etc), the |
572 For \textbf{Perl-style} regular expression matchers (say Python, JavaScript, etc), the |
519 answer is: |
573 answer is: |
520 \only<2->{\begin{center} |
574 \only<2->{\begin{center} |
521 \fontspec{Hoefler Text Black}\textcolor{ProcessBlue}{\huge{}NP} |
575 \fontspec{Hoefler Text Black}\textcolor{ProcessBlue}{\huge{}NP} |
522 \end{center}} |
576 \end{center}} |
523 \end{textblock} |
577 \end{textblock} |
524 |
578 |
525 \begin{textblock}{12}(1.7,12) |
579 \begin{textblock}{12}(1.7,12) |
526 \only<3->{Backreferences: \bl{(\ldots)$\,\ldots{}\backslash{}n$}} |
580 \only<3->{Backreferences: \bl{(\ldots)$\,\ldots{}\backslash{}n$}} |
527 \end{textblock} |
581 \end{textblock} |
528 \end{frame} |
582 \end{frame} |
529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
530 |
584 |
531 |
585 |
532 |
586 |
533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
534 \begin{frame} |
588 \begin{frame} |
535 \frametitle{Quiz 2} |
589 \frametitle{Quiz 2} |
536 |
590 |
537 \begin{textblock}{12}(2,2) |
591 \begin{textblock}{12}(2,2) |
538 \onslide<1->{ |
592 \onslide<1->{ |
539 \begin{bubble}[9.5cm]\it |
593 \begin{bubble}[9.5cm]\it |
540 Quiz:\smallskip\\ |
594 Quiz:\smallskip\\ |
541 \textbf{What is the Thompson Construction for \bl{$r^{\{n\}}$} ?} |
595 \textbf{What is the Thompson Construction for \bl{$r^{\{n\}}$} ?} |
542 \end{bubble}} |
596 \end{bubble}} |
543 \end{textblock} |
597 \end{textblock} |
544 |
598 |
545 \only<2->{ |
599 \only<2->{ |
550 & \onslide<6->{$\Rightarrow$ \bl{$a^{\{0\}\{4294967295\}}$} ?} |
604 & \onslide<6->{$\Rightarrow$ \bl{$a^{\{0\}\{4294967295\}}$} ?} |
551 \end{tabular} |
605 \end{tabular} |
552 \end{textblock}} |
606 \end{textblock}} |
553 |
607 |
554 \only<4>{ |
608 \only<4>{ |
555 \begin{textblock}{13.5}(1.5,4) |
609 \begin{textblock}{13.5}(1.5,4) |
556 \begin{mybox3}{From Rust's Regex Description}\it |
610 \begin{mybox3}{From Rust's Regex Description}\it |
557 ``\ldots [the] syntax is similar to Perl-style regular expressions, but lacks a few features like look |
611 ``\ldots [the] syntax is similar to Perl-style regular expressions, but lacks a few features like look |
558 around and backreferences. In exchange, all searches execute in linear time with respect |
612 around and backreferences. In exchange, all searches execute in linear time with respect |
559 to the size of the regular expression and search text. \ldots'' |
613 to the size of the regular expression and search text. \ldots'' |
560 \end{mybox3} |
614 \end{mybox3} |
561 \end{textblock}} |
615 \end{textblock}} |
562 |
616 |
563 |
617 |
564 \end{frame} |
618 \end{frame} |
565 |
619 |
566 |
620 |
567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
568 \begin{frame}[t] |
622 \begin{frame}[t] |
569 \frametitle{Regular Expressions} |
623 \frametitle{Regular Expressions} |
576 & \bl{$\mid$} & \bl{$r_1 + r_2$} & alternative / choice\\ |
630 & \bl{$\mid$} & \bl{$r_1 + r_2$} & alternative / choice\\ |
577 & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\ |
631 & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\ |
578 & \bl{$\mid$} & \bl{$r^*$} & star (zero or more)\\ |
632 & \bl{$\mid$} & \bl{$r^*$} & star (zero or more)\\ |
579 \end{tabular} |
633 \end{tabular} |
580 \end{textblock} |
634 \end{textblock} |
581 |
635 |
582 \end{frame} |
636 \end{frame} |
583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
584 |
638 |
585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
586 \begin{frame}[c] |
640 \begin{frame}[c] |
587 \frametitle{\begin{tabular}{l}The Derivative of a Rexp\end{tabular}} |
641 \frametitle{\begin{tabular}{l}The Derivative of a Rexp\end{tabular}} |
588 |
642 |
589 \large |
643 \large |
590 If \bl{$r$} matches the string \bl{$c\!::\!s$}, what is a regular |
644 If \bl{$r$} matches the string \bl{$c\!::\!s$}, what is a regular |
591 expression that matches just \bl{$s$}?\bigskip\bigskip\bigskip\bigskip |
645 expression that matches just \bl{$s$}?\bigskip\bigskip\bigskip\bigskip |
592 |
646 |
593 \small |
647 \small |
594 \bl{$\der\,c\,r$} gives the answer, Brzozowski 1964\medskip\\ |
648 \bl{$\der\,c\,r$} gives the answer, Brzozowski 1964\medskip\\ |
595 (lost in the sands of time, re-appeared in 2009) |
649 (lost in the sands of time, re-appeared in 2009) |
605 \bl{$\der\, c\, (\ZERO)$} & \bl{$\dn$} & \bl{$\ZERO$} & \\ |
659 \bl{$\der\, c\, (\ZERO)$} & \bl{$\dn$} & \bl{$\ZERO$} & \\ |
606 \bl{$\der\, c\, (\ONE)$} & \bl{$\dn$} & \bl{$\ZERO$} & \\ |
660 \bl{$\der\, c\, (\ONE)$} & \bl{$\dn$} & \bl{$\ZERO$} & \\ |
607 \bl{$\der\, c\, (d)$} & \bl{$\dn$} & \bl{if $c = d$ then $\ONE$ else $\ZERO$} & \\ |
661 \bl{$\der\, c\, (d)$} & \bl{$\dn$} & \bl{if $c = d$ then $\ONE$ else $\ZERO$} & \\ |
608 \bl{$\der\, c\, (r_1 + r_2)$} & \bl{$\dn$} & \bl{$\der\, c\, r_1 + \der\, c\, r_2$} & \\ |
662 \bl{$\der\, c\, (r_1 + r_2)$} & \bl{$\dn$} & \bl{$\der\, c\, r_1 + \der\, c\, r_2$} & \\ |
609 \bl{$\der\, c\, (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{if $nullable (r_1)$}\\ |
663 \bl{$\der\, c\, (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{if $nullable (r_1)$}\\ |
610 & & \bl{then $(\der\,c\,r_1) \cdot r_2 + \der\, c\, r_2$}\\ |
664 & & \bl{then $(\der\,c\,r_1) \cdot r_2 + \der\, c\, r_2$}\\ |
611 & & \bl{else $(\der\, c\, r_1) \cdot r_2$}\\ |
665 & & \bl{else $(\der\, c\, r_1) \cdot r_2$}\\ |
612 \bl{$\der\, c\, (r^*)$} & \bl{$\dn$} & \bl{$(\der\,c\,r) \cdot (r^*)$} &\medskip\bigskip\\ |
666 \bl{$\der\, c\, (r^*)$} & \bl{$\dn$} & \bl{$(\der\,c\,r) \cdot (r^*)$} &\medskip\bigskip\\ |
613 \end{tabular} |
667 \end{tabular} |
614 \end{center} |
668 \end{center} |
615 |
669 |
616 \end{frame} |
670 \end{frame} |
617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
618 |
672 |
619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
620 \begin{frame}[t] |
674 \begin{frame}[t] |
621 \frametitle{\begin{tabular}{l}Brzozowski matcher\end{tabular}} |
675 \frametitle{\begin{tabular}{l}Brzozowski matcher\end{tabular}} |
622 |
676 |
628 Step 3: & build derivative of \bl{$c$} and \bl{$r_3$} & \bl{$(r_4 = \der\,c\,r_3)$}\smallskip\\ |
682 Step 3: & build derivative of \bl{$c$} and \bl{$r_3$} & \bl{$(r_4 = \der\,c\,r_3)$}\smallskip\\ |
629 Step 4: & the string is exhausted: & \bl{($nullable(r_4))$}\\ |
683 Step 4: & the string is exhausted: & \bl{($nullable(r_4))$}\\ |
630 & test whether \bl{$r_4$} can recognise\\ |
684 & test whether \bl{$r_4$} can recognise\\ |
631 & the empty string\medskip\\ |
685 & the empty string\medskip\\ |
632 Output: & result of the test\\ |
686 Output: & result of the test\\ |
633 & $\Rightarrow \bl{\textit{true}} \,\text{or}\, |
687 & $\Rightarrow \bl{\textit{true}} \,\text{or}\, |
634 \bl{\textit{false}}$\\ |
688 \bl{\textit{false}}$\\ |
635 \end{tabular} |
689 \end{tabular} |
636 \end{center} |
690 \end{center} |
637 |
691 |
638 |
692 |
639 \end{frame} |
693 \end{frame} |
640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
641 |
695 |
642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
643 \begin{frame}[c] |
697 \begin{frame}[c] |
644 \frametitle{\mbox{Nullable}} |
698 \frametitle{\mbox{Nullable}} |
645 |
699 |
648 \begin{center} |
702 \begin{center} |
649 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
703 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
650 \bl{$nullable(\ZERO)$} & \bl{$\dn$} & \bl{\textit{false}}\\ |
704 \bl{$nullable(\ZERO)$} & \bl{$\dn$} & \bl{\textit{false}}\\ |
651 \bl{$nullable(\ONE)$} & \bl{$\dn$} & \bl{\textit{true}}\\ |
705 \bl{$nullable(\ONE)$} & \bl{$\dn$} & \bl{\textit{true}}\\ |
652 \bl{$nullable (c)$} & \bl{$\dn$} & \bl{\textit{false}}\\ |
706 \bl{$nullable (c)$} & \bl{$\dn$} & \bl{\textit{false}}\\ |
653 \bl{$nullable (r_1 + r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \vee nullable(r_2)$} \\ |
707 \bl{$nullable (r_1 + r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \vee nullable(r_2)$} \\ |
654 \bl{$nullable (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \wedge nullable(r_2)$} \\ |
708 \bl{$nullable (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \wedge nullable(r_2)$} \\ |
655 \bl{$nullable (r^*)$} & \bl{$\dn$} & \bl{\textit{true}}\\ |
709 \bl{$nullable (r^*)$} & \bl{$\dn$} & \bl{\textit{true}}\\ |
656 \end{tabular} |
710 \end{tabular} |
657 \end{center} |
711 \end{center} |
658 |
712 |
659 \end{frame} |
713 \end{frame} |
660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
661 |
715 |
662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
663 \begin{frame}[t] |
717 \begin{frame}[t] |
664 \frametitle{\begin{tabular}{l}Extensions\end{tabular}} |
718 \frametitle{\begin{tabular}{l}Extensions\end{tabular}} |
665 |
719 |
703 & & $\qquad(\ZERO + \ZERO{}a + \ONE) \cdot (a + aa)^* + (\ONE + \ONE{}a) \cdot (a + aa)^*$\\ |
757 & & $\qquad(\ZERO + \ZERO{}a + \ONE) \cdot (a + aa)^* + (\ONE + \ONE{}a) \cdot (a + aa)^*$\\ |
704 & $\ll$ & \ldots\\ \hspace{15mm} |
758 & $\ll$ & \ldots\\ \hspace{15mm} |
705 \end{tabular} |
759 \end{tabular} |
706 \end{center}} |
760 \end{center}} |
707 |
761 |
708 \begin{textblock}{13.5}(1.5,12) |
762 \begin{textblock}{13.5}(1.5,12) |
709 (regular expressions of sizes 98, 169, 283, 468, 767, \ldots) |
763 (regular expressions of sizes 98, 169, 283, 468, 767, \ldots) |
710 \end{textblock} |
764 \end{textblock} |
711 |
765 |
712 \end{frame} |
766 \end{frame} |
713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
714 |
768 |
715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
716 \begin{frame}[c] |
770 \begin{frame}[c] |
717 \frametitle{\mbox{Conclusion}} |
771 \frametitle{\mbox{Conclusion}} |
718 |
772 |
719 \begin{itemize} |
773 \begin{itemize} |
720 \item The beauty is that this only involves functional programs that can be conveniently reasoned about in theorem provers |
774 \item The beauty is that this only involves functional programs that can be conveniently reasoned about in theorem provers |
721 \item POSIX lexing can be done via an extension by Sulzmann and Lu, 2014 (our current work)\medskip\pause |
775 \item POSIX lexing can be done via an extension by Sulzmann and Lu, 2014 (our current work)\medskip\pause |
722 \item How surprising that one can still do new work on regular expressions. |
776 \item How surprising that one can still do new work on regular expressions. |
723 \end{itemize} |
777 \end{itemize} |
724 |
778 |
725 \end{frame} |
779 \end{frame} |
726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
727 |
781 |
728 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
729 |
783 |
730 \begin{frame}<1-10> |
784 \begin{frame}<1-10> |
731 \end{frame} |
785 \end{frame} |
732 |
786 |
733 |
787 |
734 |
788 |
735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
736 \end{document} |
790 \end{document} |
737 |
791 |
738 %%% Local Variables: |
792 %%% Local Variables: |
739 %%% mode: latex |
793 %%% mode: latex |
740 %%% TeX-master: t |
794 %%% TeX-master: t |
741 %%% End: |
795 %%% End: |
742 |
|