author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Sat, 24 Sep 2016 08:37:48 +0100 | |
changeset 429 | 7e71c947ec69 |
parent 398 | c8ce95067c1a |
child 431 | c7d4ee344451 |
permissions | -rw-r--r-- |
7 | 1 |
\documentclass[dvipsnames,14pt,t]{beamer} |
258
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
2 |
\usepackage{../slides} |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
3 |
\usepackage{../graphics} |
215
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
4 |
\usepackage{../langs} |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
133
diff
changeset
|
5 |
\usepackage{../data} |
7 | 6 |
|
258
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
7 |
\hfuzz=220pt |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
8 |
|
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
9 |
\lstset{language=Scala, |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
10 |
style=mystyle, |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
11 |
numbersep=0pt, |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
12 |
numbers=none, |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
13 |
xleftmargin=0mm} |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
14 |
|
398
c8ce95067c1a
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
345
diff
changeset
|
15 |
\pgfplotsset{compat=1.12} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
16 |
|
258
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
17 |
\newcommand{\bl}[1]{\textcolor{blue}{#1}} |
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
18 |
|
7 | 19 |
% beamer stuff |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
20 |
\renewcommand{\slidecaption}{CFL 02, King's College London} |
258
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
21 |
|
7 | 22 |
|
23 |
\begin{document} |
|
24 |
||
25 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
261
24531cfaa36a
updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
26 |
\begin{frame}[t] |
7 | 27 |
\frametitle{% |
28 |
\begin{tabular}{@ {}c@ {}} |
|
29 |
\\[-3mm] |
|
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
30 |
\LARGE Compilers and \\[-1mm] |
16 | 31 |
\LARGE Formal Languages (2)\\[3mm] |
7 | 32 |
\end{tabular}} |
33 |
||
261
24531cfaa36a
updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
34 |
\normalsize |
7 | 35 |
\begin{center} |
36 |
\begin{tabular}{ll} |
|
37 |
Email: & christian.urban at kcl.ac.uk\\ |
|
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
38 |
Office: & S1.27 (1st floor Strand Building)\\ |
16 | 39 |
Slides: & KEATS |
7 | 40 |
\end{tabular} |
41 |
\end{center} |
|
42 |
||
261
24531cfaa36a
updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
43 |
\end{frame} |
24531cfaa36a
updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
44 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
7 | 45 |
|
46 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
16 | 47 |
\begin{frame}[c] |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
48 |
\frametitle{\begin{tabular}{@ {}c@ {}} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
49 |
An Efficient Regular\\[-1mm] |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
50 |
Expression Matcher\end{tabular}} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
51 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
52 |
\footnotesize |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
53 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
54 |
\begin{tabular}{@{}cc@{}} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
55 |
\begin{tikzpicture} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
56 |
\begin{axis}[ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
57 |
xlabel={\pcode{a}s}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
58 |
ylabel={time in secs}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
59 |
enlargelimits=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
60 |
xtick={0,5,...,30}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
61 |
xmax=30, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
62 |
ymax=35, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
63 |
ytick={0,5,...,30}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
64 |
scaled ticks=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
65 |
axis lines=left, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
66 |
width=4.5cm, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
67 |
height=4.5cm, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
68 |
legend entries={Python,Ruby}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
69 |
legend pos=north west, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
70 |
legend cell align=left |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
71 |
] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
72 |
\addplot[blue,mark=*, mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
73 |
table {re-python.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
74 |
\addplot[brown,mark=pentagon*, mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
75 |
table {re-ruby.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
76 |
\end{axis} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
77 |
\end{tikzpicture} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
78 |
& |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
79 |
\begin{tikzpicture} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
80 |
\begin{axis}[ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
81 |
xlabel={\pcode{a}s}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
82 |
ylabel={time in secs}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
83 |
enlargelimits=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
84 |
xtick={0,3000,...,12000}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
85 |
xmax=12000, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
86 |
ymax=35, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
87 |
ytick={0,5,...,30}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
88 |
scaled ticks=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
89 |
axis lines=left, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
90 |
width=5.5cm, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
91 |
height=4.5cm |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
92 |
] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
93 |
\addplot[green,mark=square*,mark options={fill=white}] table {re2b.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
94 |
\addplot[black,mark=square*,mark options={fill=white}] table {re3.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
95 |
\end{axis} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
96 |
\end{tikzpicture} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
97 |
\end{tabular} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
98 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
99 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
100 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
101 |
\end{frame} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
102 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
103 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
104 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
105 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
106 |
\begin{frame}[c] |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
107 |
\frametitle{Languages} |
16 | 108 |
|
261
24531cfaa36a
updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
109 |
\begin{itemize} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
110 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
111 |
\item A \alert{\bf language} is a set of strings, for example\medskip |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
112 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
113 |
\bl{$\{[], hello, \textit{foobar}, a, abc\}$} |
261
24531cfaa36a
updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
114 |
\end{center}\bigskip |
16 | 115 |
|
332
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
116 |
\item \alert{\bf Concatenation} of strings and languages |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
117 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
118 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
119 |
\begin{tabular}{rcl} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
120 |
\bl{$\textit{foo}\;@\;bar$} & \bl{$=$} & \bl{$\textit{foobar}$}\medskip\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
121 |
\bl{$A\;@\;B$} & \bl{$\dn$} & \bl{$\{ s_1\,@\,s_2 \;\mid\; s_1 \in A \wedge s_2 \in B\}$} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
122 |
\end{tabular} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
123 |
\end{center} |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
124 |
\bigskip |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
125 |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
126 |
\small |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
127 |
\item [] For example \bl{$A = \{foo, bar\}$}, \bl{$B = \{a, b\}$} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
128 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
129 |
\[ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
130 |
\bl{A \,@\, B = \{fooa, foob, bara, barb\}} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
131 |
\] |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
132 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
133 |
\end{itemize} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
134 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
135 |
\end{frame} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
136 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
137 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
138 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
139 |
\begin{frame}[c] |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
140 |
\frametitle{The Power Operation} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
141 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
142 |
\begin{itemize} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
143 |
\item The \alert{\bf Power} of a language: |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
144 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
145 |
\begin{center} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
146 |
\begin{tabular}{lcl} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
147 |
\bl{$A^0$} & \bl{$\dn$} & \bl{$\{[]\}$}\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
148 |
\bl{$A^{n+1}$} & \bl{$\dn$} & \bl{$A \,@\, A^n$} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
149 |
\end{tabular} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
150 |
\end{center}\bigskip |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
151 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
152 |
\item[] For example |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
153 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
154 |
\begin{center} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
155 |
\begin{tabular}{l} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
156 |
\bl{$A^4 = A \,@\, A \,@\, A \,@\, A$}\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
157 |
\bl{$A^0 \dn \{[]\}$}\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
158 |
\end{tabular} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
159 |
\end{center} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
160 |
|
261
24531cfaa36a
updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
161 |
\end{itemize} |
24531cfaa36a
updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
162 |
|
24531cfaa36a
updated handouts
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
163 |
\end{frame} |
16 | 164 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
165 |
||
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
166 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
167 |
\begin{frame}[c] |
336
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
168 |
\frametitle{Homework Question} |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
169 |
|
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
170 |
\begin{itemize} |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
171 |
\item Say \bl{$A = \{[a],[b],[c],[d]\}$}.\bigskip |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
172 |
|
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
173 |
\begin{center} |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
174 |
How many strings are in \bl{$A^4$}? |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
175 |
\end{center}\bigskip\medskip\pause |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
176 |
|
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
177 |
|
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
178 |
\begin{center} |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
179 |
\begin{tabular}{l} |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
180 |
What if \bl{$A = \{[a],[b],[c],[]\}$};\\ |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
181 |
how many strings are then in \bl{$A^4$}? |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
182 |
\end{tabular} |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
183 |
\end{center} |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
184 |
\end{itemize} |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
185 |
|
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
186 |
\end{frame} |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
187 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
188 |
|
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
189 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
190 |
\begin{frame}[c] |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
191 |
\frametitle{The Star Operation} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
192 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
193 |
\begin{itemize} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
194 |
\item The \alert{\bf Star} of a \underline{language}: |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
195 |
\bigskip |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
196 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
197 |
\begin{center} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
198 |
\begin{tabular}{c} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
199 |
\bl{$A^* \dn \bigcup_{0\le n} A^n$} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
200 |
\end{tabular} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
201 |
\end{center}\bigskip |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
202 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
203 |
\item[] This expands to |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
204 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
205 |
\[ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
206 |
\bl{A^0 \cup A^1 \cup A^2 \cup A^3 \cup A^4 \cup \ldots} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
207 |
\] |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
208 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
209 |
\small |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
210 |
\[ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
211 |
\bl{\{[]\} \;\cup\; A \;\cup\; A\,@\,A \;\cup\; |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
212 |
A\,@\,A\,@\,A \;\cup\; A\,@\,A\,@\,A\,@\,A \cup \ldots} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
213 |
\] |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
214 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
215 |
\end{itemize} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
216 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
217 |
\end{frame} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
218 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
219 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
220 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
221 |
\begin{frame}[c] |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
222 |
\frametitle{Semantic Derivative} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
223 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
224 |
\begin{itemize} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
225 |
\item The \alert{\bf Semantic Derivative} of a |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
226 |
\underline{language}\\ wrt to a character \bl{$c$}: |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
227 |
\bigskip |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
228 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
229 |
\begin{center} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
230 |
\bl{$Der\,c\,A \dn \{ s \;|\; c\!::\!s \in A\}$ } |
345
0922b3e01289
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
342
diff
changeset
|
231 |
\end{center}\bigskip\bigskip\bigskip |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
232 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
233 |
For \bl{$A = \{\textit{foo}, \textit{bar}, \textit{frak}\}$} then |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
234 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
235 |
\begin{center} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
236 |
\bl{\begin{tabular}{l@{\hspace{2mm}}c@{\hspace{2mm}}l} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
237 |
$Der\,f\,A$ & $=$ & $\{\textit{oo}, \textit{rak}\}$\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
238 |
$Der\,b\,A$ & $=$ & $\{\textit{ar}\}$\\ |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
239 |
$Der\,a\,A$ & $=$ & $\{\}$\\\pause |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
240 |
\end{tabular}} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
241 |
\end{center} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
242 |
|
338
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
243 |
\small |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
244 |
We can extend this definition to strings |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
245 |
\[ |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
246 |
\bl{Ders\,s\,A = \{s'\;|\;s\,@\,s' \in A\}} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
247 |
\] |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
248 |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
249 |
\end{itemize} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
250 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
251 |
\end{frame} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
252 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
253 |
|
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
254 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
255 |
\begin{frame}[t] |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
256 |
\frametitle{Regular Expressions} |
7 | 257 |
|
15 | 258 |
Their inductive definition: |
259 |
||
260 |
||
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
261 |
\begin{textblock}{6}(2,7.5) |
7 | 262 |
\begin{tabular}{@ {}rrl@ {\hspace{13mm}}l} |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
263 |
\bl{$r$} & \bl{$::=$} & \bl{$\ZERO$} & null\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
264 |
& \bl{$\mid$} & \bl{$\ONE$} & empty string / \pcode{""} / $[]$\\ |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
265 |
& \bl{$\mid$} & \bl{$c$} & character\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
266 |
& \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
267 |
& \bl{$\mid$} & \bl{$r_1 + r_2$} & alternative / choice\\ |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
268 |
& \bl{$\mid$} & \bl{$r^*$} & star (zero or more)\\ |
7 | 269 |
\end{tabular} |
336
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
270 |
\end{textblock} |
7 | 271 |
|
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
272 |
\only<2->{\footnotesize |
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
273 |
\begin{textblock}{9}(2,0.5) |
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
274 |
\begin{bubble}[9.8cm] |
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
275 |
\lstinputlisting{../progs/app01.scala} |
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
276 |
\end{bubble} |
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
277 |
\end{textblock}} |
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
278 |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
279 |
\end{frame} |
16 | 280 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
281 |
||
282 |
||
283 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
7 | 284 |
\begin{frame}[c] |
285 |
\frametitle{\begin{tabular}{c}The Meaning of a\\[-2mm] Regular Expression\end{tabular}} |
|
286 |
||
287 |
\begin{textblock}{15}(1,4) |
|
288 |
\begin{tabular}{@ {}rcl} |
|
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
289 |
\bl{$L(\ZERO)$} & \bl{$\dn$} & \bl{$\{\}$}\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
290 |
\bl{$L(\ONE)$} & \bl{$\dn$} & \bl{$\{[]\}$}\\ |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
291 |
\bl{$L(c)$} & \bl{$\dn$} & \bl{$\{[c]\}$}\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
292 |
\bl{$L(r_1 + r_2)$} & \bl{$\dn$} & \bl{$L(r_1) \cup L(r_2)$}\\ |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
293 |
\bl{$L(r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$L(r_1) \,@\, L(r_2)$}\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
294 |
\bl{$L(r^*)$} & \bl{$\dn$} & \bl{$(L(r))^*$}\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
295 |
\end{tabular} |
11 | 296 |
\end{textblock} |
7 | 297 |
|
16 | 298 |
\begin{textblock}{6}(9,12)\small |
336
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
299 |
\bl{$L$} is a function from regular expressions to |
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
300 |
sets of strings\\ |
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
301 |
\bl{$L$ : Rexp $\Rightarrow$ Set$[$String$]$} |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
302 |
\end{textblock} |
16 | 303 |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
304 |
\end{frame} |
7 | 305 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
306 |
||
16 | 307 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
308 |
\begin{frame}[c] |
|
309 |
||
310 |
\large |
|
311 |
\begin{center} |
|
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
312 |
What is \bl{$L(a^*)$}? |
16 | 313 |
\end{center} |
314 |
||
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
315 |
\end{frame} |
16 | 316 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
317 |
||
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
318 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
332
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
319 |
\begin{frame}[c] |
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
320 |
\frametitle{\begin{tabular}{c} |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
321 |
When Are Two Regular\\[-1mm] |
332
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
322 |
Expressions Equivalent?\end{tabular}} |
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
323 |
\large |
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
324 |
\begin{center} |
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
325 |
\bl{$r_1 \equiv r_2 \;\;\dn\;\; L(r_1) = L(r_2)$} |
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
326 |
\end{center} |
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
327 |
|
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
328 |
\end{frame} |
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
329 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
330 |
|
4755ad4b457b
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
325
diff
changeset
|
331 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
332 |
\begin{frame}[t] |
336
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
333 |
\frametitle{Concrete Equivalences} |
16 | 334 |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
335 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
336 |
\bl{\begin{tabular}{rcl} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
337 |
$(a + b) + c$ & $\equiv$ & $a + (b + c)$\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
338 |
$a + a$ & $\equiv$ & $a$\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
339 |
$a + b$ & $\equiv$ & $b + a$\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
340 |
$(a \cdot b) \cdot c$ & $\equiv$ & $a \cdot (b \cdot c)$\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
341 |
$c \cdot (a + b)$ & $\equiv$ & $(c \cdot a) + (c \cdot b)$\bigskip\bigskip\\\pause |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
342 |
$a \cdot a$ & $\not\equiv$ & $a$\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
343 |
$a + (b \cdot c)$ & $\not\equiv$ & $(a + b) \cdot (a + c)$\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
344 |
\end{tabular}} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
345 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
346 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
347 |
\end{frame} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
348 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
349 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
350 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
351 |
\begin{frame}[t] |
336
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
352 |
\frametitle{Corner Cases} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
353 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
354 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
355 |
\bl{\begin{tabular}{rcl} |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
356 |
$a \cdot \ZERO$ & $\not\equiv$ & $a$\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
357 |
$a + \ONE$ & $\not\equiv$ & $a$\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
358 |
$\ONE$ & $\equiv$ & $\ZERO^*$\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
359 |
$\ONE^*$ & $\equiv$ & $\ONE$\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
360 |
$\ZERO^*$ & $\not\equiv$ & $\ZERO$\\ |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
361 |
\end{tabular}} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
362 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
363 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
364 |
\end{frame} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
365 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
366 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
367 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
368 |
\begin{frame}[t] |
336
7c80b9b6f713
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
335
diff
changeset
|
369 |
\frametitle{Simplification Rules} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
370 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
371 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
372 |
\bl{\begin{tabular}{rcl} |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
373 |
$r + \ZERO$ & $\equiv$ & $r$\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
374 |
$\ZERO + r$ & $\equiv$ & $r$\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
375 |
$r \cdot \ONE$ & $\equiv$ & $r$\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
376 |
$\ONE \cdot r$ & $\equiv$ & $r$\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
377 |
$r \cdot \ZERO$ & $\equiv$ & $\ZERO$\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
378 |
$\ZERO \cdot r$ & $\equiv$ & $\ZERO$\\ |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
379 |
$r + r$ & $\equiv$ & $r$ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
380 |
\end{tabular}} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
381 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
382 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
383 |
\end{frame} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
384 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
16 | 385 |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
386 |
%\newcommand{\YES}{\textcolor{gray}{yes}} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
387 |
%\newcommand{\NO}{\textcolor{gray}{no}} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
388 |
%\newcommand{\FORALLR}{\textcolor{gray}{$\forall$ r.}} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
389 |
|
7 | 390 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
391 |
\begin{frame}[c] |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
392 |
\frametitle{\begin{tabular}{c}The Specification\\[-1mm] for Matching\end{tabular}} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
393 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
394 |
\large |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
395 |
A regular expression \bl{$r$} matches a string \bl{$s$}\\ if and only if |
7 | 396 |
|
397 |
\begin{center} |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
398 |
\bl{$s \in L(r)$}\\ |
7 | 399 |
\end{center} |
400 |
||
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
401 |
\end{frame} |
7 | 402 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
403 |
||
404 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
405 |
\begin{frame}[c] |
|
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
406 |
\frametitle{\bl{$({a^?}^{\{n\}}) \cdot a^{\{n\}}$}} |
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
407 |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
408 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
409 |
\begin{tikzpicture} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
410 |
\begin{axis}[ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
411 |
xlabel={\pcode{a}s}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
412 |
ylabel={time in secs}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
413 |
enlargelimits=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
414 |
xtick={0,5,...,30}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
415 |
xmax=30, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
416 |
ymax=35, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
417 |
ytick={0,5,...,30}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
418 |
scaled ticks=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
419 |
axis lines=left, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
420 |
width=9cm, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
421 |
height=7cm, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
422 |
legend entries={Python,Ruby}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
423 |
legend pos=north west, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
424 |
legend cell align=left |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
425 |
] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
426 |
\addplot[blue,mark=*, mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
427 |
table {re-python.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
428 |
\addplot[brown,mark=pentagon*, mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
429 |
table {re-ruby.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
430 |
\end{axis} |
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
431 |
\end{tikzpicture} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
432 |
\end{center} |
11 | 433 |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
434 |
\end{frame} |
11 | 435 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
436 |
||
437 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
118
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
438 |
\begin{frame}[c] |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
439 |
\frametitle{Evil Regular Expressions} |
118
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
440 |
|
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
441 |
\begin{itemize} |
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
442 |
\item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\bigskip |
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
443 |
\item Evil regular expressions\medskip |
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
444 |
\begin{itemize} |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
445 |
\item \bl{$({a^?}^{\{n\}}) \cdot a^{\{n\}}$} |
118
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
446 |
\item \bl{$(a^+)^+$} |
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
447 |
\item \bl{$([a$\,-\,$z]^+)^*$} |
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
448 |
\item \bl{$(a + a \cdot a)^+$} |
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
449 |
\item \bl{$(a + a?)^+$} |
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
450 |
\end{itemize} |
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
451 |
\end{itemize} |
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
452 |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
453 |
\end{frame} |
118
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
454 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
455 |
|
6a5b59690f7d
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
117
diff
changeset
|
456 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
11 | 457 |
\begin{frame}[t] |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
458 |
\frametitle{A Matching Algorithm} |
11 | 459 |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
460 |
|
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
461 |
\ldots{}whether a regular expression can match the empty string: |
11 | 462 |
\begin{center} |
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
463 |
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
464 |
\bl{$nullable(\ZERO)$} & \bl{$\dn$} & \bl{\textit{false}}\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
465 |
\bl{$nullable(\ONE)$} & \bl{$\dn$} & \bl{\textit{true}}\\ |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
466 |
\bl{$nullable (c)$} & \bl{$\dn$} & \bl{\textit{false}}\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
467 |
\bl{$nullable (r_1 + r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \vee nullable(r_2)$} \\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
468 |
\bl{$nullable (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \wedge nullable(r_2)$} \\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
469 |
\bl{$nullable (r^*)$} & \bl{$\dn$} & \bl{\textit{true}}\\ |
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
470 |
\end{tabular} |
16 | 471 |
\end{center} |
472 |
||
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
473 |
\end{frame} |
11 | 474 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
475 |
||
476 |
||
477 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
478 |
\begin{frame}[c] |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
479 |
\frametitle{The Derivative of a Rexp} |
7 | 480 |
|
481 |
\large |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
482 |
If \bl{$r$} matches the string \bl{$c\!::\!s$}, what is a regular |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
483 |
expression that matches just \bl{$s$}?\bigskip\bigskip\bigskip\bigskip |
7 | 484 |
|
485 |
\small |
|
325
794c599cee53
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
263
diff
changeset
|
486 |
\bl{$der\,c\,r$} gives the answer, Brzozowski 1964 |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
487 |
\end{frame} |
7 | 488 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
489 |
||
490 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
491 |
\begin{frame}[c] |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
492 |
\frametitle{The Derivative of a Rexp} |
7 | 493 |
|
494 |
\begin{center} |
|
495 |
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}} |
|
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
496 |
\bl{$der\, c\, (\ZERO)$} & \bl{$\dn$} & \bl{$\ZERO$} & \\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
497 |
\bl{$der\, c\, (\ONE)$} & \bl{$\dn$} & \bl{$\ZERO$} & \\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
498 |
\bl{$der\, c\, (d)$} & \bl{$\dn$} & \bl{if $c = d$ then $\ONE$ else $\ZERO$} & \\ |
117
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
499 |
\bl{$der\, c\, (r_1 + r_2)$} & \bl{$\dn$} & \bl{$der\, c\, r_1 + der\, c\, r_2$} & \\ |
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
500 |
\bl{$der\, c\, (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{if $nullable (r_1)$}\\ |
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
501 |
& & \bl{then $(der\,c\,r_1) \cdot r_2 + der\, c\, r_2$}\\ |
25999de692b2
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
502 |
& & \bl{else $(der\, c\, r_1) \cdot r_2$}\\ |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
503 |
\bl{$der\, c\, (r^*)$} & \bl{$\dn$} & \bl{$(der\,c\,r) \cdot (r^*)$} &\bigskip\\\pause |
7 | 504 |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
505 |
\bl{$\textit{ders}\, []\, r$} & \bl{$\dn$} & \bl{$r$} & \\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
506 |
\bl{$\textit{ders}\, (c\!::\!s)\, r$} & \bl{$\dn$} & \bl{$\textit{ders}\,s\,(der\,c\,r)$} & \\ |
7 | 507 |
\end{tabular} |
508 |
\end{center} |
|
509 |
||
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
510 |
\end{frame} |
7 | 511 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
512 |
||
513 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
514 |
\begin{frame}[c] |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
515 |
\frametitle{Examples} |
7 | 516 |
|
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
517 |
Given \bl{$r \dn ((a \cdot b) + b)^*$} what is |
7 | 518 |
|
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
519 |
\begin{center} |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
520 |
\begin{tabular}{l} |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
521 |
\bl{$der\,a\,r =\;?$}\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
522 |
\bl{$der\,b\,r =\;?$}\\ |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
523 |
\bl{$der\,c\,r =\;?$} |
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
524 |
\end{tabular} |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
525 |
\end{center} |
7 | 526 |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
527 |
\end{frame} |
7 | 528 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
529 |
||
17 | 530 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
531 |
\begin{frame}[t] |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
532 |
\frametitle{The Algorithm} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
533 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
534 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
535 |
\begin{tabular}{@{}rll@{}} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
536 |
Input: & \bl{$r_1$}, \bl{$abc$}\medskip\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
537 |
Step 1: & build derivative of \bl{$a$} and \bl{$r_1$} & \bl{$(r_2 = der\,a\,r_1)$}\smallskip\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
538 |
Step 2: & build derivative of \bl{$b$} and \bl{$r_2$} & \bl{$(r_3 = der\,b\,r_2)$}\smallskip\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
539 |
Step 3: & build derivative of \bl{$c$} and \bl{$r_3$} & \bl{$(r_4 = der\,b\,r_3)$}\smallskip\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
540 |
Step 4: & the string is exhausted; test & (\bl{$nullable(r_4)$})\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
541 |
& whether \bl{$r_4$} can recognise\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
542 |
& the empty string\smallskip\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
543 |
Output: & result of the test\\ |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
544 |
& $\Rightarrow \bl{\textit{true}} \,\text{or}\, |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
545 |
\bl{\textit{false}}$\\ |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
546 |
\end{tabular} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
547 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
548 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
549 |
|
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
550 |
\end{frame} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
551 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
552 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
553 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
554 |
\begin{frame}[c] |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
555 |
\frametitle{The Idea of the Algorithm} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
556 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
557 |
If we want to recognise the string \bl{$abc$} with regular |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
558 |
expression \bl{$r_1$} then\medskip |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
559 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
560 |
\begin{enumerate} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
561 |
\item \bl{$Der\,a\,(L(r_1))$}\pause |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
562 |
\item \bl{$Der\,b\,(Der\,a\,(L(r_1)))$}\pause |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
563 |
\item \bl{$Der\,c\,(Der\,b\,(Der\,a\,(L(r_1))))$}\bigskip |
342
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
564 |
\item finally we test whether the empty string is in this |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
565 |
set; same for \bl{$Ders\,abc\,(L(r_1))$}.\medskip |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
566 |
\end{enumerate} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
567 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
568 |
The matching algorithm works similarly, just over regular expressions instead of sets. |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
569 |
\end{frame} |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
570 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
571 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
572 |
|
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
573 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
574 |
\begin{frame}[c] |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
575 |
\frametitle{\bl{$({a^?}^{\{n\}}) \cdot a^{\{n\}}$}} |
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
576 |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
577 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
578 |
\begin{tikzpicture} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
579 |
\begin{axis}[ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
580 |
xlabel={\pcode{a}s}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
581 |
ylabel={time in secs}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
582 |
enlargelimits=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
583 |
xtick={0,5,...,30}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
584 |
xmax=30, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
585 |
ytick={0,5,...,30}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
586 |
scaled ticks=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
587 |
axis lines=left, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
588 |
width=7cm, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
589 |
height=7cm, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
590 |
legend entries={Python,Ruby,Scala V1}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
591 |
legend pos=outer north east, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
592 |
legend cell align=left |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
593 |
] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
594 |
\addplot[blue,mark=*, mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
595 |
table {re-python.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
596 |
\addplot[brown,mark=pentagon*, mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
597 |
table {re-ruby.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
598 |
\addplot[red,mark=triangle*,mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
599 |
table {re1.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
600 |
\end{axis} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
601 |
\end{tikzpicture} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
602 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
603 |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
604 |
\end{frame} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
605 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
606 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
607 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
608 |
\begin{frame}[c] |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
609 |
\frametitle{A Problem} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
610 |
|
345
0922b3e01289
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
342
diff
changeset
|
611 |
We represented the ``n-times'' \bl{$a^{\{n\}}$} as a |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
612 |
sequence regular expression: |
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
613 |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
614 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
615 |
\begin{tabular}{rl} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
616 |
1: & \bl{$a$}\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
617 |
2: & \bl{$a\cdot a$}\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
618 |
3: & \bl{$a\cdot a\cdot a$}\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
619 |
& \ldots\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
620 |
13: & \bl{$a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a\cdot a$}\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
621 |
& \ldots\\ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
622 |
20: |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
623 |
\end{tabular} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
624 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
625 |
|
345
0922b3e01289
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
342
diff
changeset
|
626 |
This problem is aggravated with \bl{$a^?$} being represented |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
627 |
as \bl{$\ONE + a$}. |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
628 |
\end{frame} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
629 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
630 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
631 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
632 |
\begin{frame}[c] |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
633 |
\frametitle{Solving the Problem} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
634 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
635 |
What happens if we extend our regular expressions |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
636 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
637 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
638 |
\begin{tabular}{rcl} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
639 |
\bl{$r$} & \bl{$::=$} & \bl{\ldots}\\ |
342
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
640 |
& \bl{$\mid$} & \bl{$r^{\{n\}}$}\\ |
345
0922b3e01289
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
342
diff
changeset
|
641 |
& \bl{$\mid$} & \bl{$r^?$} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
642 |
\end{tabular} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
643 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
644 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
645 |
What is their meaning? What are the cases for \bl{$nullable$} and \bl{$der$}? |
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
646 |
\end{frame} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
647 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
648 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
649 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
650 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
651 |
\begin{frame}[t] |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
652 |
\frametitle{\bl{$({a^?}^{\{n\}}) \cdot a^{\{n\}}$}} |
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
653 |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
654 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
655 |
\begin{tikzpicture} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
656 |
\begin{axis}[ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
657 |
xlabel={\pcode{a}s}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
658 |
ylabel={time in secs}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
659 |
enlargelimits=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
660 |
xtick={0,200,...,1000}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
661 |
xmax=1000, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
662 |
ytick={0,5,...,30}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
663 |
scaled ticks=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
664 |
axis lines=left, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
665 |
width=9.5cm, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
666 |
height=7cm, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
667 |
legend entries={Python,Ruby,Scala V1,Scala V2}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
668 |
legend pos=north west, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
669 |
legend cell align=left |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
670 |
] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
671 |
\addplot[blue,mark=*, mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
672 |
table {re-python.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
673 |
\addplot[brown,mark=pentagon*, mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
674 |
table {re-ruby.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
675 |
\addplot[red,mark=triangle*,mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
676 |
table {re1.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
677 |
\addplot[green,mark=square*,mark options={fill=white}] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
678 |
table {re2b.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
679 |
\end{axis} |
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
680 |
\end{tikzpicture} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
681 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
682 |
|
335
2d112a7b29eb
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
332
diff
changeset
|
683 |
\end{frame} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
684 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
685 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
686 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
687 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
688 |
\begin{frame}[c] |
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
689 |
\frametitle{Examples} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
690 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
691 |
Recall the example of \bl{$r \dn ((a \cdot b) + b)^*$} with |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
692 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
693 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
694 |
\begin{tabular}{l} |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
695 |
\bl{$der\,a\,r = ((\ONE \cdot b) + \ZERO) \cdot r$}\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
696 |
\bl{$der\,b\,r = ((\ZERO \cdot b) + \ONE)\cdot r$}\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
697 |
\bl{$der\,c\,r = ((\ZERO \cdot b) + \ZERO)\cdot r$} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
698 |
\end{tabular} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
699 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
700 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
701 |
What are these regular expressions equivalent to? |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
702 |
|
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
703 |
\end{frame} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
704 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
705 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
706 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
707 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
708 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
709 |
\begin{frame}[t] |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
710 |
\frametitle{\bl{$({a^?}^{\{n\}}) \cdot a^{\{n\}}$}} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
711 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
712 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
713 |
\begin{tikzpicture} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
714 |
\begin{axis}[ |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
715 |
xlabel={\pcode{a}s}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
716 |
ylabel={time in secs}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
717 |
enlargelimits=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
718 |
xtick={0,3000,...,12000}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
719 |
xmax=12000, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
720 |
ymax=35, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
721 |
ytick={0,5,...,30}, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
722 |
scaled ticks=false, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
723 |
axis lines=left, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
724 |
width=9cm, |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
725 |
height=7cm |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
726 |
] |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
727 |
\addplot[green,mark=square*,mark options={fill=white}] table {re2b.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
728 |
\addplot[black,mark=square*,mark options={fill=white}] table {re3.data}; |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
729 |
\end{axis} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
730 |
\end{tikzpicture} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
731 |
\end{center} |
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
732 |
|
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
733 |
\end{frame} |
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
734 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
735 |
|
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
736 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
737 |
\begin{frame}[t] |
342
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
738 |
\frametitle{What is good about this Alg.} |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
739 |
|
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
740 |
\begin{itemize} |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
741 |
\item extends to most regular expressions, for example |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
742 |
\bl{$\sim r$} |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
743 |
|
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
744 |
\item is easy to implement in a functional language |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
745 |
|
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
746 |
\item the algorithm is already quite old; there is still |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
747 |
work to be done to use it as a tokenizer (that is brand new work) |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
748 |
|
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
749 |
\item we can prove its correctness\ldots |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
750 |
\end{itemize} |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
751 |
|
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
752 |
\end{frame} |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
753 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
754 |
|
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
755 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
c235e0aeb8df
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
338
diff
changeset
|
756 |
\begin{frame}[t] |
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
757 |
\frametitle{Proofs about Rexps} |
17 | 758 |
|
759 |
Remember their inductive definition:\\[5cm] |
|
760 |
||
761 |
\begin{textblock}{6}(5,5) |
|
762 |
\begin{tabular}{@ {}rrl} |
|
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
763 |
\bl{$r$} & \bl{$::=$} & \bl{$\ZERO$}\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
764 |
& \bl{$\mid$} & \bl{$\ONE$} \\ |
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
765 |
& \bl{$\mid$} & \bl{$c$} \\ |
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
766 |
& \bl{$\mid$} & \bl{$r_1 \cdot r_2$}\\ |
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
767 |
& \bl{$\mid$} & \bl{$r_1 + r_2$} \\ |
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
768 |
& \bl{$\mid$} & \bl{$r^*$} \\ |
17 | 769 |
\end{tabular} |
770 |
\end{textblock} |
|
771 |
||
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
772 |
If we want to prove something, say a property \bl{$P(r)$}, for all regular expressions \bl{$r$} then \ldots |
17 | 773 |
|
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
774 |
\end{frame} |
17 | 775 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
776 |
||
777 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
778 |
\begin{frame}[c] |
|
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
779 |
\frametitle{Proofs about Rexp (2)} |
17 | 780 |
|
781 |
\begin{itemize} |
|
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
782 |
\item \bl{$P$} holds for \bl{$\ZERO$}, \bl{$\ONE$} and \bl{c}\bigskip |
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
783 |
\item \bl{$P$} holds for \bl{$r_1 + r_2$} under the assumption that \bl{$P$} already |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
784 |
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
785 |
\item \bl{$P$} holds for \bl{$r_1 \cdot r_2$} under the assumption that \bl{$P$} already |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
786 |
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
787 |
\item \bl{$P$} holds for \bl{$r^*$} under the assumption that \bl{$P$} already |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
788 |
holds for \bl{$r$}. |
17 | 789 |
\end{itemize} |
790 |
||
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
791 |
\end{frame} |
17 | 792 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
793 |
||
794 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
795 |
\begin{frame}[c] |
|
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
796 |
\frametitle{Proofs about Rexp (3)} |
17 | 797 |
|
798 |
Assume \bl{$P(r)$} is the property: |
|
799 |
||
800 |
\begin{center} |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
801 |
\bl{$nullable(r)$} if and only if \bl{$[] \in L(r)$} |
17 | 802 |
\end{center} |
803 |
||
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
804 |
\end{frame} |
17 | 805 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
806 |
||
807 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
808 |
\begin{frame}[c] |
|
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
809 |
\frametitle{Proofs about Rexp (4)} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
810 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
811 |
\begin{center} |
338
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
812 |
\bl{\begin{tabular}{r@{\hspace{2mm}}c@{\hspace{2mm}}l} |
429
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
813 |
$rev(\ZERO)$ & $\dn$ & $\ZERO$\\ |
7e71c947ec69
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
398
diff
changeset
|
814 |
$rev(\ONE)$ & $\dn$ & $\ONE$\\ |
338
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
815 |
$rev(c)$ & $\dn$ & $c$\\ |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
816 |
$rev(r_1 + r_2)$ & $\dn$ & $rev(r_1) + rev(r_2)$\\ |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
817 |
$rev(r_1 \cdot r_2)$ & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\ |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
818 |
$rev(r^*)$ & $\dn$ & $rev(r)^*$\\ |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
819 |
\end{tabular}} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
820 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
821 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
822 |
We can prove |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
823 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
824 |
\begin{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
825 |
\bl{$L(rev(r)) = \{s^{-1} \;|\; s \in L(r)\}$} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
826 |
\end{center} |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
827 |
|
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
828 |
by induction on \bl{$r$}. |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
829 |
|
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
830 |
\end{frame} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
831 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
832 |
|
338
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
833 |
|
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
834 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
835 |
\begin{frame}[c] |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
836 |
\frametitle{\begin{tabular}{c} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
837 |
Correctness Proof\\[-1mm] for our Matcher\end{tabular}} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
838 |
|
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
839 |
\begin{itemize} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
840 |
\item We started from |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
841 |
|
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
842 |
\begin{center} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
843 |
\begin{tabular}{rp{4cm}} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
844 |
& \bl{$s \in L(r)$}\medskip\\ |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
845 |
\bl{$\Leftrightarrow$} & \bl{$[] \in Ders\,s\,(L(r))$}\pause |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
846 |
\end{tabular} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
847 |
\end{center} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
848 |
|
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
849 |
\item if we can show \bl{$Ders\, s\,(L(r)) = L(ders\,s\,r)$} we |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
850 |
have |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
851 |
|
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
852 |
\begin{center} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
853 |
\begin{tabular}{rp{4cm}} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
854 |
\bl{$\Leftrightarrow$} & \bl{$[] \in L(ders\,s\,r)$}\medskip\\ |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
855 |
\bl{$\Leftrightarrow$} & \bl{$nullable(ders\,s\,r)$}\medskip\\ |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
856 |
\bl{$\dn$} & \bl{$matches\,s\,r$} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
857 |
\end{tabular} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
858 |
\end{center} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
859 |
|
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
860 |
\end{itemize} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
861 |
|
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
862 |
\end{frame} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
863 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
864 |
|
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
865 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
866 |
\begin{frame}[c] |
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
867 |
\frametitle{Proofs about Rexp (5)} |
263
92e6985018ae
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
261
diff
changeset
|
868 |
|
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
869 |
Let \bl{$Der\,c\,A$} be the set defined as |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
870 |
|
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
871 |
\begin{center} |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
872 |
\bl{$Der\,c\,A \dn \{ s \;|\; c\!::\!s \in A\}$ } |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
873 |
\end{center} |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
874 |
|
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
875 |
We can prove |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
876 |
|
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
877 |
\begin{center} |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
878 |
\bl{$L(der\,c\,r) = Der\,c\,(L(r))$} |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
879 |
\end{center} |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
880 |
|
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
881 |
by induction on \bl{$r$}. |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
882 |
|
337
885ac2b6c27d
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
336
diff
changeset
|
883 |
\end{frame} |
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
884 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
885 |
|
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
886 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
887 |
\begin{frame}[c] |
338
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
888 |
\frametitle{Proofs about Strings} |
17 | 889 |
|
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
890 |
If we want to prove something, say a property \bl{$P(s)$}, for all strings \bl{$s$} then \ldots\bigskip |
17 | 891 |
|
892 |
\begin{itemize} |
|
893 |
\item \bl{$P$} holds for the empty string, and\medskip |
|
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
894 |
\item \bl{$P$} holds for the string \bl{$c\!::\!s$} under the assumption that \bl{$P$} |
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
895 |
already holds for \bl{$s$} |
17 | 896 |
\end{itemize} |
338
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
897 |
\end{frame} |
17 | 898 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
899 |
||
19 | 900 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
901 |
\begin{frame}[c] |
|
338
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
902 |
\frametitle{Proofs about Strings (2)} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
903 |
|
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
904 |
We can then prove |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
905 |
|
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
906 |
\begin{center} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
907 |
\bl{$Ders\,s\,(L(r)) = L(ders\,s\,r)$} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
908 |
\end{center} |
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
909 |
|
19 | 910 |
|
119
a6684e8961d0
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
118
diff
changeset
|
911 |
We can finally prove |
19 | 912 |
|
913 |
\begin{center} |
|
345
0922b3e01289
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
342
diff
changeset
|
914 |
\bl{$matches\,s\,r$} if and only if \bl{$s \in L(r)$} |
19 | 915 |
\end{center} |
916 |
||
917 |
||
338
f16120cb4e19
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
337
diff
changeset
|
918 |
\end{frame} |
19 | 919 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
17 | 920 |
|
7 | 921 |
\end{document} |
922 |
||
923 |
%%% Local Variables: |
|
924 |
%%% mode: latex |
|
925 |
%%% TeX-master: t |
|
926 |
%%% End: |
|
927 |