1 \documentclass[dvipsnames,14pt,t, xelatex]{beamer} |
1 \documentclass[dvipsnames,14pt,t]{beamer} |
2 \usepackage{slides} |
2 \usepackage{slides} |
|
3 \usepackage{langs} |
3 \usepackage{graph} |
4 \usepackage{graph} |
4 |
5 %\usepackage{grammar} |
|
6 \usepackage{soul} |
|
7 \usepackage{data} |
|
8 \usepackage{proof} |
5 |
9 |
6 % beamer stuff |
10 % beamer stuff |
7 \renewcommand{\slidecaption}{SEN 09, King's College London} |
11 \renewcommand{\slidecaption}{Canterbury, 22.2.2016} |
8 \newcommand{\bl}[1]{\textcolor{blue}{#1}} |
12 \newcommand{\bl}[1]{\textcolor{blue}{#1}} |
9 |
13 |
|
14 \newcommand\grid[1]{% |
|
15 \begin{tikzpicture}[baseline=(char.base)] |
|
16 \path[use as bounding box] |
|
17 (0,0) rectangle (1em,1em); |
|
18 \draw[red!50, fill=red!20] |
|
19 (0,0) rectangle (1em,1em); |
|
20 \node[inner sep=1pt,anchor=base west] |
|
21 (char) at (0em,\gridraiseamount) {#1}; |
|
22 \end{tikzpicture}} |
|
23 \newcommand\gridraiseamount{0.12em} |
|
24 |
|
25 \makeatletter |
|
26 \newcommand\Grid[1]{% |
|
27 \@tfor\z:=#1\do{\grid{\z}}} |
|
28 \makeatother |
|
29 |
|
30 \newcommand\Vspace[1][.3em]{% |
|
31 \mbox{\kern.06em\vrule height.3ex}% |
|
32 \vbox{\hrule width#1}% |
|
33 \hbox{\vrule height.3ex}} |
|
34 |
|
35 \def\VS{\Vspace[0.6em]} |
|
36 |
|
37 |
|
38 |
10 \begin{document} |
39 \begin{document} |
11 |
|
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
13 \begin{frame}[t] |
41 \begin{frame}[t] |
14 \frametitle{% |
42 \frametitle{% |
15 \begin{tabular}{@ {}c@ {}} |
43 \begin{tabular}{@ {}c@ {}} |
16 \\ |
44 \\ |
17 \LARGE Security Engineering (9)\\[-3mm] |
45 \Large POSIX Lexing with Derivatives\\[-1.5mm] |
|
46 \Large of Regular Expressions\\[-1mm] |
|
47 %\normalsize Or, How to Find Bugs with the\\[-5mm] |
|
48 %\normalsize Isabelle Theorem Prover |
18 \end{tabular}}\bigskip\bigskip\bigskip |
49 \end{tabular}}\bigskip\bigskip\bigskip |
19 |
50 |
20 \normalsize |
51 \normalsize |
21 \begin{center} |
52 \begin{center} |
22 \begin{tabular}{ll} |
53 \begin{tabular}{c} |
23 Email: & christian.urban at kcl.ac.uk\\ |
54 \small Christian Urban\\ |
24 Office: & S1.27 (1st floor Strand Building)\\ |
55 \small King's College London\\ |
25 Slides: & KEATS (also homework is there)\\ |
56 \\ |
|
57 \\ |
|
58 Joint work with Fahad Ausaf and Roy Dyckhoff |
26 \end{tabular} |
59 \end{tabular} |
27 \end{center} |
60 \end{center} |
28 |
61 |
29 \end{frame} |
62 \end{frame} |
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
31 |
64 |
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
33 \begin{frame}[c] |
66 \begin{frame}[c] |
34 |
67 |
35 \begin{center} |
68 \begin{center} |
36 \includegraphics[scale=0.6]{pics/bridge-limits.png} |
69 \includegraphics[scale=0.2]{isabelle.png} |
37 \end{center} |
70 \end{center} |
|
71 \mbox{}\\[-20mm]\mbox{} |
|
72 |
|
73 \begin{itemize} |
|
74 \item Isabelle interactive theorem prover; |
|
75 some proofs are automatic -- most however need help |
|
76 \item the learning curve is steep; you often have to fight the |
|
77 theorem prover\ldots no different in other ITPs |
|
78 \end{itemize} |
38 |
79 |
39 \end{frame} |
80 \end{frame} |
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
41 |
82 |
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
43 \begin{frame}[c] |
84 \begin{frame}[c] |
44 \frametitle{Old-Fashioned Eng.~vs.~CS} |
85 \frametitle{Why Bother?} |
45 |
86 |
46 \begin{center} |
87 Surely regular expressions must have been implemented and |
47 \begin{tabular}{@{}cc@{}} |
88 studied to death, no? |
48 \begin{tabular}{@{}p{5.2cm}} |
89 |
49 \includegraphics[scale=0.058]{pics/towerbridge.jpg}\\ |
90 \begin{center} |
50 {\bf bridges}: \\ |
91 \begin{tikzpicture} |
51 \raggedright\small |
92 \begin{axis}[ |
52 engineers can ``look'' at a bridge and have a pretty good |
93 xlabel={{\tt a}s}, |
53 intuition about whether it will hold up or not\\ |
94 ylabel={time in secs}, |
54 (redundancy; predictive theory) |
95 enlargelimits=false, |
55 \end{tabular} & |
96 xtick={0,5,...,30}, |
56 \begin{tabular}{p{5cm}} |
97 xmax=30, |
57 \includegraphics[scale=0.265]{pics/code.jpg}\\ |
98 ymax=35, |
58 \raggedright |
99 ytick={0,5,...,30}, |
59 {\bf code}: \\ |
100 scaled ticks=false, |
60 \raggedright\small |
101 axis lines=left, |
61 programmers have very little intuition about their code; |
102 width=8cm, |
62 often it is too expensive to have redundancy; |
103 height=6cm, |
63 not ``continuous'' |
104 legend entries={Python,Ruby}, |
|
105 legend pos=north west, |
|
106 legend cell align=left |
|
107 ] |
|
108 \addplot[blue,mark=*, mark options={fill=white}] |
|
109 table {re-python.data}; |
|
110 \addplot[brown,mark=pentagon*, mark options={fill=white}] |
|
111 table {re-ruby.data}; |
|
112 \end{axis} |
|
113 \end{tikzpicture} |
|
114 \end{center} |
|
115 |
|
116 evil regular expressions: \bl{$({\tt a}?)^n \cdot {\tt a}^n$} |
|
117 |
|
118 \end{frame} |
|
119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
120 |
|
121 |
|
122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
123 \begin{frame}[c] |
|
124 \frametitle{\Large Isabelle Theorem Prover} |
|
125 |
|
126 \begin{itemize} |
|
127 \item started to use Isabelle after my PhD (in 2000) |
|
128 |
|
129 \item the thesis included a rather complicated |
|
130 ``pencil-and-paper'' proof for a |
|
131 termination argument (sort of $\lambda$-calculus)\medskip |
|
132 |
|
133 \item me, my supervisor, the examiners did not find any problems\medskip |
|
134 \begin{center} |
|
135 \begin{tabular}{@ {}c@ {}} |
|
136 \includegraphics[scale=0.38]{barendregt.jpg}\\[-2mm] |
|
137 \footnotesize Henk Barendregt |
64 \end{tabular} |
138 \end{tabular} |
|
139 \hspace{2mm} |
|
140 \begin{tabular}{@ {}c@ {}} |
|
141 \includegraphics[scale=0.20]{andrewpitts.jpg}\\[-2mm] |
|
142 \footnotesize Andrew Pitts |
65 \end{tabular} |
143 \end{tabular} |
66 \end{center} |
144 \end{center} |
|
145 |
|
146 \item people were building their work on my result |
|
147 |
|
148 \end{itemize} |
|
149 |
|
150 \end{frame} |
|
151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
152 |
|
153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
154 \begin{frame}[t] |
|
155 \frametitle{\Large Nominal Isabelle} |
|
156 |
|
157 \begin{itemize} |
|
158 \item implemented a package for the Isabelle prover |
|
159 in order to reason conveniently about binders |
|
160 |
|
161 \begin{center} |
|
162 \large\bl{$\lambda \alert{x}.\,M$} \hspace{10mm} |
|
163 \bl{$\forall \alert{x}.\,P\,x$} |
|
164 \end{center}\bigskip\bigskip\bigskip\bigskip |
|
165 \bigskip\bigskip\bigskip\pause\pause |
|
166 |
|
167 |
|
168 \item when finally being able to formalise the proof from my PhD, I found that the main result |
|
169 (termination) is correct, but a central lemma needed to |
|
170 be generalised |
|
171 \end{itemize} |
|
172 |
|
173 \only<2->{ |
|
174 \begin{textblock}{3}(13,5) |
|
175 \includegraphics[scale=0.33]{skeleton.jpg} |
|
176 \end{textblock}} |
|
177 |
|
178 \begin{textblock}{3}(5.3,7) |
|
179 \onslide<1->{ |
|
180 \begin{tikzpicture} |
|
181 \node at (0,0) [single arrow, shape border rotate=90, fill=red,text=red]{\mbox{a}}; |
|
182 \end{tikzpicture}} |
|
183 \end{textblock} |
|
184 |
|
185 \begin{textblock}{3}(8.7,7) |
|
186 \onslide<1->{ |
|
187 \begin{tikzpicture} |
|
188 \node at (0,0) [single arrow, shape border rotate=90, fill=red,text=red]{\mbox{a}}; |
|
189 \end{tikzpicture}} |
|
190 \end{textblock} |
|
191 |
|
192 \end{frame} |
|
193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
194 |
|
195 |
|
196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
197 \begin{frame}[c] |
|
198 \frametitle{\Large Variable Convention} |
|
199 |
|
200 |
|
201 \begin{center} |
|
202 \begin{bubble}[10cm] |
|
203 \color{gray} |
|
204 \small |
|
205 {\bf\mbox{}Variable Convention:}\\[1mm] |
|
206 If $M_1,\ldots,M_n$ occur in a certain mathematical context |
|
207 (e.g. definition, proof), then in these terms all bound variables |
|
208 are chosen to be different from the free variables.\\[2mm] |
|
209 |
|
210 \footnotesize\hfill Barendregt in ``The Lambda-Calculus: Its Syntax and Semantics'' |
|
211 \end{bubble} |
|
212 \end{center} |
|
213 |
|
214 \mbox{}\\[-8mm] |
|
215 \begin{itemize} |
|
216 |
|
217 |
|
218 \item instead of proving a property for \alert{\bf all} bound |
|
219 variables, you prove it only for \alert{\bf some}\ldots? |
|
220 |
|
221 \item feels like it is used in 90\% of papers in PT and FP |
|
222 (9.9\% use de-Bruijn indices) |
|
223 |
|
224 \item this is mostly OK, but in some corner-cases you can use it |
|
225 to prove \alert{\bf false}\ldots we fixed this! |
|
226 \end{itemize} |
|
227 |
|
228 \end{frame} |
|
229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
230 |
|
231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
232 \begin{frame}[c] |
|
233 \frametitle{} |
|
234 |
|
235 \begin{tabular}{c@ {\hspace{2mm}}c} |
|
236 \\[6mm] |
|
237 \begin{tabular}{c} |
|
238 \includegraphics[scale=0.11]{harper.jpg}\\[-2mm] |
|
239 {\footnotesize Bob Harper}\\[-2mm] |
|
240 {\footnotesize} |
|
241 \end{tabular} |
|
242 \begin{tabular}{c} |
|
243 \includegraphics[scale=0.37]{pfenning.jpg}\\[-2mm] |
|
244 {\footnotesize Frank Pfenning}\\[-2mm] |
|
245 {\footnotesize} |
|
246 \end{tabular} & |
|
247 |
|
248 \begin{tabular}{p{6cm}} |
|
249 \raggedright |
|
250 {published a proof in\\ {\bf ACM Transactions on Computational Logic}, 2005, |
|
251 $\sim$31pp} |
|
252 \end{tabular}\\ |
|
253 |
|
254 \\[0mm] |
|
255 |
|
256 \begin{tabular}{c} |
|
257 \includegraphics[scale=0.36]{appel.jpg}\\[-2mm] |
|
258 {\footnotesize Andrew Appel}\\[-2.5mm] |
|
259 {\footnotesize} |
|
260 \end{tabular} & |
|
261 |
|
262 \begin{tabular}{p{6cm}} |
|
263 \raggedright |
|
264 {relied on their proof in a\\ {\bf security} critical application} |
|
265 \end{tabular} |
|
266 \end{tabular} |
|
267 |
|
268 \end{frame} |
|
269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
270 |
|
271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
272 \begin{frame} |
|
273 \frametitle{Proof-Carrying Code} |
|
274 |
|
275 \begin{textblock}{10}(2.5,2.2) |
|
276 \begin{block}{Idea:} |
|
277 \begin{center} |
|
278 \begin{tikzpicture} |
|
279 \draw[help lines,cream] (0,0.2) grid (8,4); |
|
280 |
|
281 \draw[line width=1mm, red] (5.5,0.6) rectangle (7.5,4); |
|
282 \node[anchor=base] at (6.5,2.8) |
|
283 {\small\begin{tabular}{@ {}p{1.9cm}@ {}}\centering user: untrusted code\end{tabular}}; |
|
284 |
|
285 \draw[line width=1mm, red] (0.1,0.6) rectangle (2.1,4); |
|
286 \node[anchor=base] at (1.1,2.3) |
|
287 {\small\begin{tabular}{@ {}p{1.9cm}@ {}}\centering developer ---\\ web server\end{tabular}}; |
|
288 |
|
289 \onslide<3->{ |
|
290 \draw[line width=1mm, red, fill=red] (5.5,0.6) rectangle (7.5,1.8); |
|
291 \node[anchor=base,white] at (6.5,1.1) |
|
292 {\small\begin{tabular}{@ {}p{1.9cm}@ {}}\bf\centering proof- checker\end{tabular}};} |
|
293 |
|
294 \node at (3.6,3.0) [single arrow, fill=red,text=white, |
|
295 minimum height=3.4cm]{\bf code}; |
|
296 \onslide<2->{ |
|
297 \node at (3.6,1.3) [single arrow, fill=red,text=white, |
|
298 minimum height=3.4cm]{\bf certificate}; |
|
299 \node at (3.6,1.9) {\small\color{gray}{\mbox{}\hspace{-1mm}a proof in LF}}; |
|
300 } |
|
301 |
|
302 |
|
303 \end{tikzpicture} |
|
304 \end{center} |
|
305 \end{block} |
|
306 \end{textblock} |
|
307 |
|
308 \begin{textblock}{15}(2,12) |
|
309 \small |
|
310 \begin{itemize} |
|
311 \item<3-> Appel's checker is $\sim$2700 lines of code (1865 loc of\\ LF definitions; |
|
312 803 loc in C including 2 library functions)\\[-3mm] |
|
313 \item<3-> 167 loc in C implement a type-checker |
|
314 \end{itemize} |
|
315 \end{textblock} |
|
316 |
|
317 \end{frame} |
|
318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
319 |
|
320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
321 \begin{frame}<2->[squeeze] |
|
322 \frametitle{} |
|
323 |
|
324 \begin{columns} |
|
325 \tikzstyle{every node}=[node distance=25mm,text height=1.5ex, text depth=.25ex] |
|
326 \tikzstyle{node1}=[rectangle, minimum size=10mm, rounded corners=3mm, very thick, |
|
327 draw=black!50, top color=white, bottom color=black!20] |
|
328 \tikzstyle{node2}=[rectangle, minimum size=12mm, rounded corners=3mm, very thick, |
|
329 draw=red!70, top color=white, bottom color=red!50!black!20] |
|
330 |
|
331 \begin{column}{0.8\textwidth} |
|
332 \begin{textblock}{0}(1,2) |
|
333 |
|
334 \begin{tikzpicture} |
|
335 \matrix[ampersand replacement=\&,column sep=7mm, row sep=5mm] |
|
336 { \&[-10mm] |
|
337 \node (def1) [node1] {\large\hspace{1mm}Spec\hspace{1mm}\mbox{}}; \& |
|
338 \node (proof1) [node1] {\large Proof}; \& |
|
339 \node (alg1) [node1] {\large\hspace{1mm}Alg\hspace{1mm}\mbox{}}; \\ |
|
340 |
|
341 \onslide<4->{\node {\begin{tabular}{c}\small 1st\\[-2.5mm] \footnotesize solution\end{tabular}};} \& |
|
342 \onslide<4->{\node (def2) [node2] {\large Spec$^\text{+ex}$};} \& |
|
343 \onslide<4->{\node (proof2) [node1] {\large Proof};} \& |
|
344 \onslide<4->{\node (alg2) [node1] {\large\hspace{1mm}Alg\hspace{1mm}\mbox{}};} \\ |
|
345 |
|
346 \onslide<5->{\node {\begin{tabular}{c}\small 2nd\\[-2.5mm] \footnotesize solution\end{tabular}};} \& |
|
347 \onslide<5->{\node (def3) [node1] {\large\hspace{1mm}Spec\hspace{1mm}\mbox{}};} \& |
|
348 \onslide<5->{\node (proof3) [node1] {\large Proof};} \& |
|
349 \onslide<5->{\node (alg3) [node2] {\large Alg$^\text{-ex}$};} \\ |
|
350 |
|
351 \onslide<6->{\node {\begin{tabular}{c}\small 3rd\\[-2.5mm] \footnotesize solution\end{tabular}};} \& |
|
352 \onslide<6->{\node (def4) [node1] {\large\hspace{1mm}Spec\hspace{1mm}\mbox{}};} \& |
|
353 \onslide<6->{\node (proof4) [node2] {\large\hspace{1mm}Proof\hspace{1mm}};} \& |
|
354 \onslide<6->{\node (alg4) [node1] {\large\hspace{1mm}Alg\hspace{1mm}\mbox{}};} \\ |
|
355 }; |
|
356 |
|
357 \draw[->,black!50,line width=2mm] (proof1) -- (def1); |
|
358 \draw[->,black!50,line width=2mm] (proof1) -- (alg1); |
|
359 |
|
360 \onslide<4->{\draw[->,black!50,line width=2mm] (proof2) -- (def2);} |
|
361 \onslide<4->{\draw[->,black!50,line width=2mm] (proof2) -- (alg2);} |
|
362 |
|
363 \onslide<5->{\draw[->,black!50,line width=2mm] (proof3) -- (def3);} |
|
364 \onslide<5->{\draw[->,black!50,line width=2mm] (proof3) -- (alg3);} |
|
365 |
|
366 \onslide<6->{\draw[->,black!50,line width=2mm] (proof4) -- (def4);} |
|
367 \onslide<6->{\draw[->,black!50,line width=2mm] (proof4) -- (alg4);} |
|
368 |
|
369 \onslide<3->{\draw[white,line width=1mm] (1.1,3.2) -- (0.9,2.85) -- (1.1,2.35) -- (0.9,2.0);} |
|
370 \end{tikzpicture} |
|
371 |
|
372 \end{textblock} |
|
373 \end{column} |
|
374 \end{columns} |
|
375 |
|
376 |
|
377 \begin{textblock}{3}(12,3.6) |
|
378 \onslide<4->{ |
|
379 \begin{tikzpicture} |
|
380 \node at (0,0) [single arrow, shape border rotate=270, fill=red,text=white]{2h}; |
|
381 \end{tikzpicture}} |
|
382 \end{textblock} |
|
383 |
|
384 \begin{textblock}{0}(0.4,12.8) |
|
385 \onslide<6->{ |
|
386 \begin{bubble}[11cm] |
|
387 \small Each time one needs to check $\sim$31pp~of |
|
388 informal paper proofs. |
|
389 You have to be able to keep definitions |
|
390 and proofs consistent. |
|
391 \end{bubble}} |
|
392 \end{textblock} |
67 |
393 |
68 \end{frame} |
394 \end{frame} |
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
70 |
396 |
71 |
397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
398 % \begin{frame}[c] |
73 \begin{frame}[c] |
399 % \frametitle{\Large Lessons Learned} |
74 \frametitle{Trusting Computing Base} |
400 % |
75 |
401 % \begin{itemize} |
76 When considering whether a system meets some security |
402 % \item using a theorem prover we were able to keep a large |
77 objectives, it is important to consider which parts of that |
403 % proof consistent with changes in the definitions\bigskip |
78 system are trusted in order to meet that objective (TCB). |
404 % \item it took us some 10 days to get to the error\ldots |
79 \bigskip\pause |
405 % probably the same time Harper and Pfenning needed to \LaTeX{} |
80 |
406 % their paper\bigskip |
81 The smaller the TCB, the less effort it takes to get |
407 % \item once there, we ran circles around them |
82 some confidence that it is trustworthy, by doing a code |
408 % \end{itemize} |
83 review or by performing some (penetration) testing. |
409 % |
84 \bigskip |
410 % \end{frame} |
85 |
411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
86 \footnotesize |
412 |
87 CPU, compiler, libraries, OS, NP $\not=$ P, |
413 |
88 random number generator, \ldots |
414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
89 \end{frame} |
|
90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
91 |
|
92 |
|
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
94 \begin{frame}[c] |
415 \begin{frame}[c] |
95 \frametitle{Dijkstra on Testing} |
416 \frametitle{Real-Time Scheduling} |
96 |
|
97 \begin{bubble}[10cm] |
|
98 ``Program testing can be a very effective way to show the |
|
99 presence of bugs, but it is hopelessly inadequate for showing |
|
100 their absence.'' |
|
101 \end{bubble}\bigskip |
|
102 |
|
103 unfortunately attackers exploit bugs (Satan's computer vs |
|
104 Murphy's) |
|
105 |
|
106 \end{frame} |
|
107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
108 |
|
109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
110 \begin{frame}[c] |
|
111 \frametitle{\Large Proving Programs to be Correct} |
|
112 |
|
113 \begin{bubble}[10cm] |
|
114 \small |
|
115 {\bf Theorem:} There are infinitely many prime |
|
116 numbers.\medskip\\ |
|
117 |
|
118 {\bf Proof} \ldots\\ |
|
119 \end{bubble}\bigskip |
|
120 |
|
121 |
|
122 similarly\bigskip |
|
123 |
|
124 \begin{bubble}[10cm] |
|
125 \small |
|
126 {\bf Theorem:} The program is doing what |
|
127 it is supposed to be doing.\medskip |
|
128 |
|
129 {\bf Long, long proof} \ldots\\ |
|
130 \end{bubble}\bigskip\medskip |
|
131 |
|
132 \small This can be a gigantic proof. The only hope is to have |
|
133 help from the computer. `Program' is here to be understood to be |
|
134 quite general (protocols, OS, \ldots). |
|
135 |
|
136 \end{frame} |
|
137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
138 |
|
139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
140 \begin{frame}[c] |
|
141 \frametitle{\Large{}Mars Pathfinder Mission 1997} |
|
142 |
|
143 \begin{center} |
|
144 %\includegraphics[scale=0.15]{../pics/marspath1.png} |
|
145 %\includegraphics[scale=0.16]{../pics/marspath3.png} |
|
146 %\includegraphics[scale=0.3]{../pics/marsrover.png} |
|
147 \end{center} |
|
148 |
|
149 \begin{itemize} |
|
150 \item despite NASA's famous testing procedures, the lander crashed frequently on Mars |
|
151 \item a scheduling algorithm was not used in the OS |
|
152 \end{itemize} |
|
153 |
|
154 \end{frame} |
|
155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
156 |
|
157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
158 \begin{frame}[c] |
|
159 |
|
160 |
417 |
161 \begin{textblock}{11}(1,3) |
418 \begin{textblock}{11}(1,3) |
162 \begin{tabular}{@{\hspace{-10mm}}l} |
419 \begin{tabular}{@{\hspace{-10mm}}l} |
163 \begin{tikzpicture}[scale=1.1] |
420 \begin{tikzpicture}[scale=1.1] |
164 \node at (-2.5,-1.5) {\textcolor{white}{a}}; |
421 \node at (-2.5,-1.5) {\textcolor{white}{a}}; |
165 \node at (8,4) {\textcolor{white}{a}}; |
422 \node at (8,4) {\textcolor{white}{a}}; |
166 |
423 |
167 |
424 |
168 |
|
169 \only<1>{ |
425 \only<1>{ |
170 \draw[fill, blue!50] (1,0) rectangle (3,0.6); |
426 \draw[fill, blue!50] (1,0) rectangle (3,0.6); |
171 } |
427 } |
172 \only<2>{ |
428 \only<2>{ |
173 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
429 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
180 \draw[fill, blue!50] (5.5,0) rectangle (6,0.6); |
436 \draw[fill, blue!50] (5.5,0) rectangle (6,0.6); |
181 \draw[fill, blue!100] (2,3) rectangle (3,3.6); |
437 \draw[fill, blue!100] (2,3) rectangle (3,3.6); |
182 \draw[fill, blue!100] (4.5,3) rectangle (5.5,3.6); |
438 \draw[fill, blue!100] (4.5,3) rectangle (5.5,3.6); |
183 } |
439 } |
184 \only<4>{ |
440 \only<4>{ |
185 \node at (2.5,0.9) {\small locked a resource}; |
441 \node at (2.5,0.9) {\small locks a resource}; |
186 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
442 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
187 \draw[blue!50, very thick] (2,0) rectangle (4,0.6); |
443 \draw[blue!50, very thick] (2,0) rectangle (4,0.6); |
188 \draw[blue!100, very thick] (2,3) rectangle (3, 3.6); |
444 \draw[blue!100, very thick] (2,3) rectangle (3, 3.6); |
189 \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1); |
445 \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1); |
190 } |
446 } |
191 \only<5>{ |
447 \only<5>{ |
192 \node at (2.5,0.9) {\small locked a resource}; |
448 \node at (2.5,0.9) {\small locks a resource}; |
193 \draw[fill, blue!50] (1,0) rectangle (4,0.6); |
449 \draw[fill, blue!50] (1,0) rectangle (4,0.6); |
194 \draw[blue!100, fill] (4,3) rectangle (5, 3.6); |
450 \draw[blue!100, fill] (4,3) rectangle (5, 3.6); |
195 } |
451 } |
196 \only<6>{ |
452 \only<6>{ |
197 \node at (2.5,0.9) {\small locked a resource}; |
453 \node at (2.5,0.9) {\small locks a resource}; |
198 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
454 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
199 \draw[blue!50, very thick] (2,0) rectangle (4,0.6); |
455 \draw[blue!50, very thick] (2,0) rectangle (4,0.6); |
200 \draw[blue!100, very thick] (2,3) rectangle (3, 3.6); |
456 \draw[blue!100, very thick] (2,3) rectangle (3, 3.6); |
201 \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1); |
457 \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1); |
202 } |
458 } |
203 \only<7>{ |
459 \only<7>{ |
204 \node at (2.5,0.9) {\small locked a resource}; |
460 \node at (2.5,0.9) {\small locks a resource}; |
205 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
461 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
206 \draw[blue!50, very thick] (2.5,0) rectangle (4,0.6); |
462 \draw[blue!50, very thick] (2.5,0) rectangle (4,0.6); |
207 \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6); |
463 \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6); |
208 \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1); |
464 \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1); |
209 } |
465 } |
210 \only<8>{ |
466 \only<8>{ |
211 \node at (2.5,0.9) {\small locked a resource}; |
467 \node at (2.5,0.9) {\small locks a resource}; |
212 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
468 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
213 \draw[blue!50, very thick] (2.5,0) rectangle (4,0.6); |
469 \draw[blue!50, very thick] (2.5,0) rectangle (4,0.6); |
214 \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6); |
470 \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6); |
215 \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6); |
471 \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6); |
216 \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1); |
472 \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1); |
217 \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1); |
473 \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1); |
218 } |
474 } |
219 \only<9>{ |
475 \only<9>{ |
220 \node at (2.5,0.9) {\small locked a resource}; |
476 \node at (2.5,0.9) {\small locks a resource}; |
221 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
477 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
222 \draw[blue!50, very thick] (3.5,0) rectangle (5,0.6); |
478 \draw[blue!50, very thick] (3.5,0) rectangle (5,0.6); |
223 \draw[blue!100, very thick] (3.5,3) rectangle (4.5, 3.6); |
479 \draw[blue!100, very thick] (3.5,3) rectangle (4.5, 3.6); |
224 \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1); |
480 \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1); |
225 \draw[red, <-, line width = 2mm] (3.5,-0.1) -- (3.5, -1); |
481 \draw[red, <-, line width = 2mm] (3.5,-0.1) -- (3.5, -1); |
226 } |
482 } |
227 \only<10>{ |
483 \only<10>{ |
228 \node at (2.5,0.9) {\small locked a resource}; |
484 \node at (2.5,0.9) {\small locks a resource}; |
229 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
485 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
230 \draw[blue!50, very thick] (3.5,0) rectangle (5,0.6); |
486 \draw[blue!50, very thick] (3.5,0) rectangle (5,0.6); |
231 \draw[blue!100, very thick] (3.5,3) rectangle (4.5, 3.6); |
487 \draw[blue!100, very thick] (3.5,3) rectangle (4.5, 3.6); |
232 \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1); |
488 \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1); |
233 \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1); |
489 \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1); |
234 \draw[red, <-, line width = 2mm] (3.5,-0.1) -- (3.5, -1); |
490 \draw[red, <-, line width = 2mm] (3.5,-0.1) -- (3.5, -1); |
235 } |
491 } |
236 \only<11>{ |
492 \only<11>{ |
237 \node at (2.5,0.9) {\small locked a resource}; |
493 \node at (2.5,0.9) {\small locks a resource}; |
238 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
494 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
239 \draw[blue!50, very thick] (4.5,0) rectangle (6,0.6); |
495 \draw[blue!50, very thick] (4.5,0) rectangle (6,0.6); |
240 \draw[blue!100, very thick] (4.5,3) rectangle (5.5, 3.6); |
496 \draw[blue!100, very thick] (4.5,3) rectangle (5.5, 3.6); |
241 \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1); |
497 \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1); |
242 \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1); |
498 \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1); |
243 \draw[red, <-, line width = 2mm] (4.5,-0.1) -- (4.5, -1); |
499 \draw[red, <-, line width = 2mm] (4.5,-0.1) -- (4.5, -1); |
244 } |
500 } |
245 \only<12>{ |
501 \only<12>{ |
246 \node at (2.5,0.9) {\small locked a resource}; |
502 \node at (2.5,0.9) {\small locks a resource}; |
247 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
503 \draw[fill, blue!50] (1,0) rectangle (2.5,0.6); |
248 \draw[blue!50, very thick] (5.5,0) rectangle (7,0.6); |
504 \draw[blue!50, very thick] (5.5,0) rectangle (7,0.6); |
249 \draw[blue!100, very thick] (5.5,3) rectangle (6.5, 3.6); |
505 \draw[blue!100, very thick] (5.5,3) rectangle (6.5, 3.6); |
250 \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1); |
506 \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1); |
251 \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1); |
507 \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1); |
252 \draw[red, fill] (4.55,1.5) rectangle (5.5,2.1); |
508 \draw[red, fill] (4.55,1.5) rectangle (5.5,2.1); |
253 \draw[red, <-, line width = 2mm] (5.5,-0.1) -- (5.5, -1); |
509 \draw[red, <-, line width = 2mm] (5.5,-0.1) -- (5.5, -1); |
254 \node [anchor=base] at (6.3, 1.8) {\Large\ldots}; |
510 \node [anchor=base] at (6.3, 1.8) {\Large\ldots}; |
255 } |
511 } |
256 \only<13>{ |
512 \only<13>{ |
257 \node at (2.5,0.9) {\small locked a resource}; |
513 \node at (2.5,0.9) {\small locks a resource}; |
258 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
514 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
259 \draw[blue!50, very thick] (2,0) rectangle (4,0.6); |
515 \draw[blue!50, very thick] (2,0) rectangle (4,0.6); |
260 \draw[blue!100, very thick] (2,3) rectangle (3, 3.6); |
516 \draw[blue!100, very thick] (2,3) rectangle (3, 3.6); |
261 \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1); |
517 \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1); |
262 } |
518 } |
263 \only<14>{ |
519 \only<14>{ |
264 \node at (2.5,3.9) {\small locked a resource}; |
520 \node at (2.5,3.9) {\small locks a resource}; |
265 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
521 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
266 \draw[blue!50, fill] (2,3) rectangle (4,3.6); |
522 \draw[blue!50, fill] (2,3) rectangle (4,3.6); |
267 \draw[blue!100, very thick] (4,3) rectangle (5, 3.6); |
523 \draw[blue!100, very thick] (4,3) rectangle (5, 3.6); |
268 \draw[blue!50, ->, line width = 2mm] (2,1) -- (2, 2.5); |
524 \draw[blue!50, ->, line width = 2mm] (2,1) -- (2, 2.5); |
269 \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1); |
525 \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1); |
270 } |
526 } |
271 \only<15>{ |
527 \only<15>{ |
272 \node at (2.5,3.9) {\small locked a resource}; |
528 \node at (2.5,3.9) {\small locks a resource}; |
273 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
529 \draw[fill, blue!50] (1,0) rectangle (2,0.6); |
274 \draw[blue!50, fill] (2,3) rectangle (4,3.6); |
530 \draw[blue!50, fill] (2,3) rectangle (4,3.6); |
275 \draw[blue!100, very thick] (4,3) rectangle (5, 3.6); |
531 \draw[blue!100, very thick] (4,3) rectangle (5, 3.6); |
276 \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1); |
532 \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1); |
277 \draw[red, very thick] (2.5,1.5) rectangle (3.5,2.1); |
533 \draw[red, very thick] (2.5,1.5) rectangle (3.5,2.1); |
608 |
873 |
609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
610 \begin{frame}[c] |
875 \begin{frame}[c] |
611 |
876 |
612 \begin{center} |
877 \begin{center} |
613 \includegraphics[scale=0.25]{pics/p4.jpg} |
878 \includegraphics[scale=0.22]{p5.jpg} |
614 \end{center} |
879 \end{center} |
615 |
880 |
616 \begin{itemize} |
881 \begin{itemize} |
617 \item by Silberschatz, Galvin, and Gagne, 2013 (OS-bible) |
882 \item by Silberschatz, Galvin and Gagne (9th edition, 2013) |
618 \item \it ``Upon releasing the lock, the |
883 \item \it ``Upon releasing the |
619 $[$low-priority$]$ thread will revert to |
884 lock, the $[$low-priority$]$ thread will revert to its original |
620 its original priority.'' |
885 priority.'' |
|
886 \end{itemize} |
|
887 |
|
888 \end{frame} |
|
889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
890 |
|
891 |
|
892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
893 \begin{frame}[c] |
|
894 \frametitle{Priority Scheduling} |
|
895 |
|
896 \begin{itemize} |
|
897 \item a scheduling algorithm that is widely used in real-time operating systems |
|
898 \item has been ``proved'' correct by hand in a paper in 1990 |
|
899 \item but this algorithm turned out to be incorrect, despite its ``proof''\bigskip\pause |
|
900 |
|
901 \item we (generalised) the algorithm and then {\bf really} proved that it is correct |
|
902 \item we implemented this algorithm in a small OS called PINTOS (used for teaching at Stanford) |
|
903 \item our implementation was faster than their reference implementation |
621 \end{itemize} |
904 \end{itemize} |
622 |
905 |
623 \end{frame} |
906 \end{frame} |
624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
625 |
908 |
626 |
909 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
910 % \begin{frame}[c] |
|
911 % \frametitle{\Large{}Mars Pathfinder Mission 1997} |
|
912 % |
|
913 % \begin{center} |
|
914 % \includegraphics[scale=0.15]{marspath1.png} |
|
915 % \includegraphics[scale=0.16]{marspath3.png} |
|
916 % \includegraphics[scale=0.3]{marsrover.png} |
|
917 % \end{center} |
|
918 % |
|
919 % \begin{itemize} |
|
920 % \item despite NASA's famous testing procedures, the lander crashed frequently on Mars |
|
921 % \item a scheduling algorithm was not used in the OS at the |
|
922 % beginning; PIP was enabled after the cause was identified |
|
923 % \end{itemize} |
|
924 % |
|
925 % \end{frame} |
|
926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
927 |
627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
628 \begin{frame}[c] |
929 \begin{frame}[c] |
629 \frametitle{Priority Scheduling} |
930 \frametitle{Lessons Learned} |
630 |
931 |
631 \begin{itemize} |
932 \begin{itemize} |
632 \item a scheduling algorithm that is widely used in real-time operating systems |
933 \item our proof-technique is adapted from security |
633 \item has been ``proved'' correct by hand in a paper in 1983 |
934 protocols\bigskip |
634 \item but this algorithm turned out to be incorrect, despite its ``proof''\bigskip\pause |
935 |
635 |
936 \item do not venture outside your field of expertise |
636 \item we corrected the algorithm and then {\bf really} proved that it is correct |
937 \includegraphics[scale=0.03]{smiley.jpg} |
637 \item we implemented this algorithm in a small OS called PINTOS (used for teaching at Stanford) |
938 \bigskip |
638 \item our implementation was much more efficient than their reference implementation |
939 |
|
940 \item we solved the single-processor case; the multi-processor |
|
941 case: no idea! |
639 \end{itemize} |
942 \end{itemize} |
640 |
943 |
641 \end{frame} |
944 \end{frame} |
642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
643 |
946 |
644 |
947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
948 \begin{frame}[c] |
|
949 \frametitle{Regular Expressions} |
|
950 |
|
951 |
|
952 \begin{textblock}{6}(2,5) |
|
953 \begin{tabular}{rrl@ {\hspace{13mm}}l} |
|
954 \bl{$r$} & \bl{$::=$} & \bl{$\varnothing$} & null\\ |
|
955 & \bl{$\mid$} & \bl{$\epsilon$} & empty string\\ |
|
956 & \bl{$\mid$} & \bl{$c$} & character\\ |
|
957 & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\ |
|
958 & \bl{$\mid$} & \bl{$r_1 + r_2$} & alternative / choice\\ |
|
959 & \bl{$\mid$} & \bl{$r^*$} & star (zero or more)\\ |
|
960 \end{tabular} |
|
961 \end{textblock} |
|
962 |
|
963 \end{frame} |
|
964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
965 |
|
966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
967 \begin{frame}[c] |
|
968 \frametitle{\begin{tabular}{c}The Derivative of a Rexp\end{tabular}} |
|
969 |
|
970 \large |
|
971 If \bl{$r$} matches the string \bl{$c\!::\!s$}, what is a regular |
|
972 expression that matches just \bl{$s$}?\bigskip\bigskip\bigskip\bigskip |
|
973 |
|
974 \small |
|
975 \bl{$der\,c\,r$} gives the answer, Brzozowski (1964), Owens (2005) |
|
976 ``\ldots have been lost in the sands of time\ldots'' |
|
977 \end{frame} |
|
978 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
979 |
|
980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
981 \begin{frame}[c] |
|
982 \frametitle{} |
|
983 |
|
984 |
|
985 \ldots{}whether a regular expression can match the empty string: |
|
986 \begin{center} |
|
987 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
|
988 \bl{$nullable(\varnothing)$} & \bl{$\dn$} & \bl{$false$}\\ |
|
989 \bl{$nullable(\epsilon)$} & \bl{$\dn$} & \bl{$true$}\\ |
|
990 \bl{$nullable (c)$} & \bl{$\dn$} & \bl{$false$}\\ |
|
991 \bl{$nullable (r_1 + r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \vee nullable(r_2)$} \\ |
|
992 \bl{$nullable (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \wedge nullable(r_2)$} \\ |
|
993 \bl{$nullable (r^*)$} & \bl{$\dn$} & \bl{$true$} \\ |
|
994 \end{tabular} |
|
995 \end{center} |
|
996 |
|
997 \end{frame} |
|
998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
999 |
|
1000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1001 \begin{frame}[c] |
|
1002 \frametitle{\begin{tabular}{c}The Derivative of a Rexp\end{tabular}} |
|
1003 |
|
1004 \begin{center} |
|
1005 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}} |
|
1006 \bl{$der\, c\, (\varnothing)$} & \bl{$\dn$} & \bl{$\varnothing$} & \\ |
|
1007 \bl{$der\, c\, (\epsilon)$} & \bl{$\dn$} & \bl{$\varnothing$} & \\ |
|
1008 \bl{$der\, c\, (d)$} & \bl{$\dn$} & \bl{if $c = d$ then $\epsilon$ else $\varnothing$} & \\ |
|
1009 \bl{$der\, c\, (r_1 + r_2)$} & \bl{$\dn$} & \bl{$der\, c\, r_1 + der\, c\, r_2$} & \\ |
|
1010 \bl{$der\, c\, (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{if $nullable (r_1)$}\\ |
|
1011 & & \bl{then $(der\,c\,r_1) \cdot r_2 + der\, c\, r_2$}\\ |
|
1012 & & \bl{else $(der\, c\, r_1) \cdot r_2$}\\ |
|
1013 \bl{$der\, c\, (r^*)$} & \bl{$\dn$} & \bl{$(der\,c\,r) \cdot (r^*)$} &\medskip\\\pause |
|
1014 |
|
1015 \bl{$\textit{ders}\, []\, r$} & \bl{$\dn$} & \bl{$r$} & \\ |
|
1016 \bl{$\textit{ders}\, (c\!::\!s)\, r$} & \bl{$\dn$} & \bl{$\textit{ders}\,s\,(der\,c\,r)$} & \\ |
|
1017 \end{tabular} |
|
1018 \end{center} |
|
1019 |
|
1020 \end{frame} |
|
1021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1022 |
|
1023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1024 \begin{frame}[c] |
|
1025 \frametitle{\begin{tabular}{c}\bl{$({\tt a}?)^n \cdot {\tt a}^n$}\end{tabular}} |
|
1026 |
|
1027 \begin{center} |
|
1028 \begin{tikzpicture} |
|
1029 \begin{axis}[ |
|
1030 xlabel={\pcode{a}s}, |
|
1031 ylabel={time in secs}, |
|
1032 enlargelimits=false, |
|
1033 xtick={0,200,...,1000}, |
|
1034 xmax=1000, |
|
1035 ytick={0,5,...,30}, |
|
1036 scaled ticks=false, |
|
1037 axis lines=left, |
|
1038 width=9.5cm, |
|
1039 height=7cm, |
|
1040 legend entries={Python,Ruby,Scala V1,Scala V2}, |
|
1041 legend pos=north west, |
|
1042 legend cell align=left |
|
1043 ] |
|
1044 \addplot[blue,mark=*, mark options={fill=white}] |
|
1045 table {re-python.data}; |
|
1046 \addplot[brown,mark=pentagon*, mark options={fill=white}] |
|
1047 table {re-ruby.data}; |
|
1048 \addplot[red,mark=triangle*,mark options={fill=white}] |
|
1049 table {re1.data}; |
|
1050 \addplot[green,mark=square*,mark options={fill=white}] |
|
1051 table {re2b.data}; |
|
1052 \end{axis} |
|
1053 \end{tikzpicture} |
|
1054 \end{center} |
|
1055 |
|
1056 \end{frame} |
|
1057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1058 |
|
1059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1060 \begin{frame}[t] |
|
1061 \frametitle{\begin{tabular}{c}\bl{$({\tt a}?)^n \cdot {\tt a}^n$}\end{tabular}} |
|
1062 |
|
1063 \begin{center} |
|
1064 \begin{tikzpicture} |
|
1065 \begin{axis}[ |
|
1066 xlabel={\pcode{a}s}, |
|
1067 ylabel={time in secs}, |
|
1068 enlargelimits=false, |
|
1069 xtick={0,3000,...,12000}, |
|
1070 xmax=12000, |
|
1071 ymax=35, |
|
1072 ytick={0,5,...,30}, |
|
1073 scaled ticks=false, |
|
1074 axis lines=left, |
|
1075 width=9cm, |
|
1076 height=7cm |
|
1077 ] |
|
1078 \addplot[green,mark=square*,mark options={fill=white}] table {re2b.data}; |
|
1079 \addplot[black,mark=square*,mark options={fill=white}] table {re3.data}; |
|
1080 \end{axis} |
|
1081 \end{tikzpicture} |
|
1082 \end{center} |
|
1083 |
|
1084 \end{frame} |
|
1085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1086 |
|
1087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1088 \begin{frame}[c] |
|
1089 \frametitle{Correctness} |
|
1090 |
|
1091 It is a relative easy exercise in a theorem prover: |
|
1092 |
|
1093 \begin{center} |
|
1094 \bl{$matches(r, s)$} if and only if \bl{$s \in L(r)$} |
|
1095 \end{center}\bigskip |
|
1096 |
|
1097 \small |
|
1098 \bl{$matches(r, s) \dn nullable(ders(r, s))$} |
|
1099 |
|
1100 \end{frame} |
|
1101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1102 |
|
1103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1104 \begin{frame}[c] |
|
1105 \frametitle{POSIX Regex Matching} |
|
1106 |
|
1107 Two rules: |
|
1108 |
|
1109 \begin{itemize} |
|
1110 \item Longest match rule (``maximal munch rule''): The |
|
1111 longest initial substring matched by any regular expression |
|
1112 is taken as the next token. |
|
1113 |
|
1114 \begin{center} |
|
1115 \bl{$\texttt{\Grid{iffoo\VS bla}}$} |
|
1116 \end{center}\medskip |
|
1117 |
|
1118 \item Rule priority: |
|
1119 For a particular longest initial substring, the first regular |
|
1120 expression that can match determines the token. |
|
1121 |
|
1122 \begin{center} |
|
1123 \bl{$\texttt{\Grid{if\VS bla}}$} |
|
1124 \end{center} |
|
1125 \end{itemize}\bigskip\pause |
|
1126 |
|
1127 \small |
|
1128 \hfill Kuklewicz: most POSIX matchers are buggy\\ |
|
1129 \footnotesize |
|
1130 \hfill \url{http://www.haskell.org/haskellwiki/Regex_Posix} |
|
1131 |
|
1132 \end{frame} |
|
1133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1134 |
|
1135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1136 \begin{frame}[c] |
|
1137 \frametitle{POSIX Regex Matching} |
|
1138 |
|
1139 \begin{itemize} |
|
1140 |
|
1141 \item Sulzmann \& Lu came up with a beautiful |
|
1142 idea for how to extend the simple regular expression |
|
1143 matcher to POSIX matching/lexing (FLOPS 2014)\bigskip\bigskip\bigskip |
|
1144 |
|
1145 \begin{tabular}{@{\hspace{4cm}}c@{}} |
|
1146 \includegraphics[scale=0.14]{sulzmann.jpg}\\[-2mm] |
|
1147 \hspace{0cm}\footnotesize Martin Sulzmann |
|
1148 \end{tabular}\bigskip\bigskip |
|
1149 |
|
1150 \item the idea: define an inverse operation to the derivatives |
|
1151 \end{itemize} |
|
1152 |
|
1153 |
|
1154 |
|
1155 \end{frame} |
|
1156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1157 |
|
1158 |
|
1159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1160 \begin{frame}[c] |
|
1161 \frametitle{Regexes and Values} |
|
1162 |
|
1163 Regular expressions and their corresponding values: |
|
1164 |
|
1165 \begin{center} |
|
1166 \begin{columns} |
|
1167 \begin{column}{3cm} |
|
1168 \begin{tabular}{@{}rrl@{}} |
|
1169 \bl{$r$} & \bl{$::=$} & \bl{$\varnothing$}\\ |
|
1170 & \bl{$\mid$} & \bl{$\epsilon$} \\ |
|
1171 & \bl{$\mid$} & \bl{$c$} \\ |
|
1172 & \bl{$\mid$} & \bl{$r_1 \cdot r_2$}\\ |
|
1173 & \bl{$\mid$} & \bl{$r_1 + r_2$} \\ |
|
1174 \\ |
|
1175 & \bl{$\mid$} & \bl{$r^*$} \\ |
|
1176 \\ |
|
1177 \end{tabular} |
|
1178 \end{column} |
|
1179 \begin{column}{3cm} |
|
1180 \begin{tabular}{@{\hspace{-7mm}}rrl@{}} |
|
1181 \bl{$v$} & \bl{$::=$} & \\ |
|
1182 & & \bl{$Empty$} \\ |
|
1183 & \bl{$\mid$} & \bl{$Char(c)$} \\ |
|
1184 & \bl{$\mid$} & \bl{$Seq(v_1,v_2)$}\\ |
|
1185 & \bl{$\mid$} & \bl{$Left(v)$} \\ |
|
1186 & \bl{$\mid$} & \bl{$Right(v)$} \\ |
|
1187 & \bl{$\mid$} & \bl{$[]$} \\ |
|
1188 & \bl{$\mid$} & \bl{$[v_1,\ldots\,v_n]$} \\ |
|
1189 \end{tabular} |
|
1190 \end{column} |
|
1191 \end{columns} |
|
1192 \end{center}\pause |
|
1193 |
|
1194 There is also a notion of a string behind a value: \bl{$|v|$} |
|
1195 |
|
1196 \end{frame} |
|
1197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1198 |
|
1199 |
|
1200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1201 \begin{frame}[c] |
|
1202 \frametitle{Sulzmann \& Lu Matcher} |
|
1203 |
|
1204 We want to match the string \bl{$abc$} using \bl{$r_1$}: |
|
1205 |
|
1206 \begin{center} |
|
1207 \begin{tikzpicture}[scale=2,node distance=1.3cm,every node/.style={minimum size=8mm}] |
|
1208 \node (r1) {\bl{$r_1$}}; |
|
1209 \node (r2) [right=of r1] {\bl{$r_2$}}; |
|
1210 \draw[->,line width=1mm] (r1) -- (r2) node[above,midway] {\bl{$der\,a$}};\pause |
|
1211 \node (r3) [right=of r2] {\bl{$r_3$}}; |
|
1212 \draw[->,line width=1mm] (r2) -- (r3) node[above,midway] {\bl{$der\,b$}};\pause |
|
1213 \node (r4) [right=of r3] {\bl{$r_4$}}; |
|
1214 \draw[->,line width=1mm] (r3) -- (r4) node[above,midway] {\bl{$der\,c$}};\pause |
|
1215 \draw (r4) node[anchor=west] {\;\raisebox{3mm}{\bl{$\;\;nullable?$}}};\pause |
|
1216 \node (v4) [below=of r4] {\bl{$v_4$}}; |
|
1217 \draw[->,line width=1mm] (r4) -- (v4);\pause |
|
1218 \node (v3) [left=of v4] {\bl{$v_3$}}; |
|
1219 \draw[->,line width=1mm] (v4) -- (v3) node[below,midway] {\bl{$inj\,c$}};\pause |
|
1220 \node (v2) [left=of v3] {\bl{$v_2$}}; |
|
1221 \draw[->,line width=1mm] (v3) -- (v2) node[below,midway] {\bl{$inj\,b$}};\pause |
|
1222 \node (v1) [left=of v2] {\bl{$v_1$}}; |
|
1223 \draw[->,line width=1mm] (v2) -- (v1) node[below,midway] {\bl{$inj\,a$}};\pause |
|
1224 \draw[->,line width=0.5mm] (r3) -- (v3); |
|
1225 \draw[->,line width=0.5mm] (r2) -- (v2); |
|
1226 \draw[->,line width=0.5mm] (r1) -- (v1); |
|
1227 \draw (r4) node[anchor=north west] {\;\raisebox{-8mm}{\bl{$mkeps$}}}; |
|
1228 \end{tikzpicture} |
|
1229 \end{center} |
|
1230 |
|
1231 \end{frame} |
|
1232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1233 |
|
1234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1235 \begin{frame}[t,squeeze] |
|
1236 \frametitle{Sulzmann \& Lu Paper} |
|
1237 |
|
1238 \begin{itemize} |
|
1239 \item I have no doubt the algorithm is correct --- |
|
1240 the problem, I do not believe their proof. |
|
1241 |
|
1242 \begin{center} |
|
1243 \begin{bubble}[10cm]\small |
|
1244 ``How could I miss this? Well, I was rather careless when |
|
1245 stating this Lemma :)\smallskip |
|
1246 |
|
1247 Great example how formal machine checked proofs (and |
|
1248 proof assistants) can help to spot flawed reasoning steps.'' |
|
1249 \end{bubble} |
|
1250 \end{center}\pause |
|
1251 |
|
1252 \begin{center} |
|
1253 \begin{bubble}[10cm]\small |
|
1254 ``Well, I don't think there's any flaw. The issue is how to |
|
1255 come up with a mechanical proof. In my world mathematical |
|
1256 proof $=$ mechanical proof doesn't necessarily hold.'' |
|
1257 \end{bubble} |
|
1258 \end{center}\pause |
|
1259 |
|
1260 \end{itemize} |
|
1261 |
|
1262 \only<3>{% |
|
1263 \begin{textblock}{11}(1,4.4) |
|
1264 \begin{center} |
|
1265 \begin{bubble}[10.9cm]\small\centering |
|
1266 \includegraphics[scale=0.37]{msbug.png} |
|
1267 \end{bubble} |
|
1268 \end{center} |
|
1269 \end{textblock}} |
|
1270 |
|
1271 |
|
1272 \end{frame} |
|
1273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1274 |
|
1275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1276 \begin{frame}[c] |
|
1277 \frametitle{\begin{tabular}{c}The Proof Idea\\[-1mm] by Sulzmann \& Lu |
|
1278 \end{tabular}} |
|
1279 |
|
1280 \begin{itemize} |
|
1281 \item introduce an inductively defined ordering relation |
|
1282 \bl{$v \succ_r v'$} which captures the idea of POSIX matching |
|
1283 |
|
1284 \item the algorithm returns the maximum of all possible |
|
1285 values that are possible for a regular expression.\pause |
|
1286 \bigskip\small |
|
1287 |
|
1288 \item the idea is from a paper by Cardelli \& Frisch about |
|
1289 greedy matching (greedy $=$ preferring instant gratification to delayed |
|
1290 repletion): |
|
1291 |
|
1292 \item e.g.~given \bl{$(a + (b + ab))^*$} and string \bl{$ab$} |
|
1293 |
|
1294 \begin{center} |
|
1295 \begin{tabular}{ll} |
|
1296 greedy: & \bl{$[Left(a), Right(Left(b)]$}\\ |
|
1297 POSIX: & \bl{$[Right(Right(a, b)))]$} |
|
1298 \end{tabular} |
|
1299 \end{center} |
|
1300 \end{itemize} |
|
1301 |
|
1302 \end{frame} |
|
1303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1304 |
|
1305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1306 \begin{frame}[c] |
|
1307 \frametitle{} |
|
1308 \centering |
|
1309 |
|
1310 |
|
1311 \bl{\infer{\vdash Empty : \epsilon}{}}\hspace{15mm} |
|
1312 \bl{\infer{\vdash Char(c): c}{}}\bigskip |
|
1313 |
|
1314 \bl{\infer{\vdash Seq(v_1, v_2) : r_1\cdot r_2}{\vdash v_1 : r_1 \quad \vdash v_2 : r_2}} |
|
1315 \bigskip |
|
1316 |
|
1317 \bl{\infer{\vdash Left(v) : r_1 + r_2}{\vdash v : r_1}}\hspace{15mm} |
|
1318 \bl{\infer{\vdash Right(v): r_1 + r_2}{\vdash v : r_2}}\bigskip |
|
1319 |
|
1320 \bl{\infer{\vdash [] : r^*}{}}\hspace{15mm} |
|
1321 \bl{\infer{\vdash [v_1,\ldots, v_n] : r^*} |
|
1322 {\vdash v_1 : r \quad\ldots\quad \vdash v_n : r}} |
|
1323 |
|
1324 \end{frame} |
|
1325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1326 |
|
1327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1328 \begin{frame}<1>[c] |
|
1329 \frametitle{} |
|
1330 \small |
|
1331 |
|
1332 \begin{tabular}{@{}lll@{}} |
|
1333 \bl{$POSIX(v, r)$} & \bl{$\dn$} & \bl{$\vdash v : r$}\\ |
|
1334 & & \bl{$\wedge \;\;(\forall v'.\;\; \vdash v' : r \,\wedge\, |v'| = |v| |
|
1335 \Rightarrow v \succ_{\alert<2>{r}} v')$} |
|
1336 \end{tabular}\bigskip\bigskip\bigskip |
|
1337 |
|
1338 |
|
1339 \centering |
|
1340 |
|
1341 \bl{\infer{Seq(v_1, v_2) \succ_{\alert<2>{r_1\cdot r_2}} Seq(v'_1, v'_2)} |
|
1342 {v_1 = v'_1 \quad v_2 \succ_{\alert<2>{r_2}} v'_2}}\hspace{3mm} |
|
1343 \bl{\infer{Seq(v_1, v_2) \succ_{\alert<2>{r_1\cdot r_2}} Seq(v'_1, v'_2)} |
|
1344 {v_1 \not= v'_1 \quad v_1 \succ_{\alert<2>{r_1}} v'_1}} |
|
1345 \bigskip |
|
1346 |
|
1347 \bl{\infer{Left(v) \succ_{\alert<2>{r_1 + r_2}} Left(v')} |
|
1348 {v \succ_{\alert<2>{r_1}} v'}}\hspace{15mm} |
|
1349 \bl{\infer{Right(v) \succ_{\alert<2>{r_1 + r_2}} Right(v')} |
|
1350 {v \succ_{\alert<2>{r_2}} v'}}\bigskip\medskip |
|
1351 |
|
1352 \bl{\infer{Left(v) \succ_{\alert<2>{r_1 + r_2}} Right(v')} |
|
1353 {length |v| \ge length |v'|}}\hspace{15mm} |
|
1354 \bl{\infer{Right(v) \succ_{\alert<2>{r_1 + r_2}} Left(v')} |
|
1355 {length |v| > length |v'|}}\bigskip |
|
1356 |
|
1357 \bl{$\big\ldots$} |
|
1358 |
|
1359 \end{frame} |
|
1360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1361 |
|
1362 |
|
1363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1364 \begin{frame}[c] |
|
1365 \frametitle{Problems} |
|
1366 |
|
1367 \begin{itemize} |
|
1368 \item Sulzmann: \ldots Let's assume \bl{$v$} is not |
|
1369 a $POSIX$ value, then there must be another one |
|
1370 \ldots contradiction.\bigskip\pause |
|
1371 |
|
1372 \item Exists? |
|
1373 |
|
1374 \begin{center} |
|
1375 \bl{$L(r) \not= \varnothing \;\Rightarrow\; POSIX(v, r)$} |
|
1376 \end{center}\bigskip\bigskip\pause |
|
1377 |
|
1378 \item in the sequence case, the induction hypotheses require |
|
1379 \bl{$|v_1| = |v'_1|$} and \bl{$|v_2| = |v'_2|$}, |
|
1380 but you only know |
|
1381 |
|
1382 \begin{center} |
|
1383 \bl{$|v_1| \;@\; |v_2| = |v'_1| \;@\; |v'_2|$} |
|
1384 \end{center}\pause\small |
|
1385 |
|
1386 \item although one begins with the assumption that the two |
|
1387 values have the same flattening, this cannot be maintained |
|
1388 as one descends into the induction (alternative, sequence) |
|
1389 \end{itemize} |
|
1390 |
|
1391 \end{frame} |
|
1392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1393 |
|
1394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1395 \begin{frame}[c] |
|
1396 \frametitle{Our Solution} |
|
1397 |
|
1398 \begin{itemize} |
|
1399 \item direct definition of what a POSIX value is, using |
|
1400 \bl{$s \in r \to v$}: |
|
1401 |
|
1402 \begin{center} |
|
1403 \bl{\infer{[] \in \epsilon \to Empty}{}}\hspace{15mm} |
|
1404 \bl{\infer{c \in c \to Char(c)}{}}\bigskip\medskip |
|
1405 |
|
1406 \bl{\infer{s \in r_1 + r_2 \to Left(v)} |
|
1407 {s \in r_1 \to v}}\hspace{10mm} |
|
1408 \bl{\infer{s \in r_1 + r_2 \to Right(v)} |
|
1409 {s \in r_2 \to v & s \not\in L(r_1)}}\bigskip\medskip |
|
1410 |
|
1411 \bl{\infer{s_1 @ s_2 \in r_1 \cdot r_2 \to Seq(v_1, v_2)} |
|
1412 {\small\begin{array}{l} |
|
1413 s_1 \in r_1 \to v_1 \\ |
|
1414 s_2 \in r_2 \to v_2 \\ |
|
1415 \neg(\exists s_3\,s_4.\; s_3 \not= [] |
|
1416 \wedge s_3 @ s_4 = s_2 \wedge |
|
1417 s_1 @ s_3 \in L(r_1) \wedge |
|
1418 s_4 \in L(r_2)) |
|
1419 \end{array}}} |
|
1420 |
|
1421 \bl{\ldots} |
|
1422 \end{center} |
|
1423 \end{itemize} |
|
1424 |
|
1425 \end{frame} |
|
1426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1427 \begin{frame}[t] |
|
1428 \frametitle{\Large\begin{tabular}{@{}c@{}}Pencil-and-Paper Proofs\\[-1mm] |
|
1429 in CS are normally incorrect\end{tabular}} |
|
1430 |
|
1431 \begin{itemize} |
|
1432 \item case in point, in one of Roy's proofs he made the |
|
1433 incorrect inference |
|
1434 |
|
1435 \begin{center} |
|
1436 if \bl{$\forall s.\; |v_2| \alert{\not}\in L(der\,c\,r_1) \cdot s$} |
|
1437 then \bl{$\forall s.\; c\,|v_2| \alert{\not}\in L(r_1) \cdot s$} |
|
1438 \end{center}\bigskip |
|
1439 |
|
1440 while |
|
1441 |
|
1442 \begin{center} |
|
1443 if \bl{$\forall s.\; |v_2| \in L(der\,c\,r_1) \cdot s$} |
|
1444 then \bl{$\forall s.\; c\,|v_2| \in L(r_1) \cdot s$} |
|
1445 \end{center} |
|
1446 |
|
1447 is correct |
|
1448 |
|
1449 \end{itemize} |
|
1450 |
|
1451 |
|
1452 \begin{textblock}{11}(12,11) |
|
1453 \includegraphics[scale=0.15]{roy.jpg} |
|
1454 \end{textblock} |
|
1455 \end{frame} |
|
1456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
646 \begin{frame}[c] |
1457 \begin{frame}[c] |
647 \frametitle{Design of AC-Policies} |
1458 \frametitle{Proofs in Math~vs.~in CS} |
648 |
1459 |
649 Imagine you set up an access policy (root, lpd, users, staff, etc) |
1460 \alert{\bf My theory on why CS-proofs are often buggy} |
650 \bigskip\pause |
1461 \\[-10mm]\mbox{} |
651 |
1462 |
652 \Large |
1463 \begin{center} |
653 \begin{quote} |
1464 \begin{tabular}{@{}cc@{}} |
654 ``what you specify is what you get but not necessarily what you want\ldots'' |
1465 \begin{tabular}{@{}p{5.6cm}} |
655 \end{quote}\bigskip\bigskip\bigskip |
1466 \includegraphics[scale=0.43]{icosahedron.png}\\[2mm] |
656 |
1467 {\bf Math}: \\ |
657 \normalsize main work by Chunhan Wu (a PhD-student in Nanjing) |
1468 \raggedright\small |
|
1469 in math, ``objects'' can be ``looked'' at from all |
|
1470 ``angles'';\\\smallskip |
|
1471 non-trivial proofs, but it seems |
|
1472 difficult to make mistakes |
|
1473 \end{tabular} & |
|
1474 \begin{tabular}{p{5cm}} |
|
1475 \includegraphics[scale=0.2]{sel4callgraph.jpg}\\[3mm] |
|
1476 \raggedright |
|
1477 {\bf Code in CS}: \\ |
|
1478 \raggedright\small |
|
1479 the call-graph of the seL4 microkernel OS;\\\smallskip |
|
1480 easy to make mistakes\\ \mbox{}\\ |
|
1481 \end{tabular} |
|
1482 \end{tabular} |
|
1483 \end{center} |
|
1484 |
|
1485 \end{frame} |
|
1486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1487 |
|
1488 |
|
1489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1490 \begin{frame}[c] |
|
1491 \frametitle{Conclusion} |
|
1492 |
|
1493 \begin{itemize} |
|
1494 \item we strengthened the POSIX definition of Sulzmann \& Lu |
|
1495 in order to get the inductions through, his proof |
|
1496 contained small gaps but had also fundamental flaws\bigskip |
|
1497 |
|
1498 \item its a nice exercise for theorem proving |
|
1499 \item some optimisations need to be aplied to the |
|
1500 algorithm in order to become fast enough |
|
1501 \item can be used for lexing, small little functional |
|
1502 program |
|
1503 \end{itemize} |
|
1504 |
|
1505 \end{frame} |
|
1506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1507 |
|
1508 |
|
1509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1510 \begin{frame}[b] |
|
1511 \frametitle{ |
|
1512 \begin{tabular}{c} |
|
1513 \mbox{}\\[13mm] |
|
1514 \alert{\Large Thank you very much again}\\ |
|
1515 \alert{\Large for the invitation!}\\ |
|
1516 \alert{\Large Questions?} |
|
1517 \end{tabular}} |
658 |
1518 |
659 \end{frame} |
1519 \end{frame} |
660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
661 |
|
662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
663 \begin{frame}[c] |
|
664 \frametitle{Testing Policies} |
|
665 |
|
666 \begin{center} |
|
667 \begin{tikzpicture}[scale=1] |
|
668 %\draw[black!10,step=2mm] (-5,-3) grid (5,4); |
|
669 %\draw[black!10,thick,step=10mm] (-5,-3) grid (5,4); |
|
670 \draw[white,thick,step=10mm] (-5,-3) grid (5,4); |
|
671 |
|
672 \draw [black!20, line width=1mm] (0,0) circle (1cm); |
|
673 \draw [line width=1mm] (0,0) circle (3cm); |
|
674 \node [black!20] at (0,0) {\begin{tabular}{c}core\\[-1mm] system\end{tabular}}; |
|
675 |
|
676 \draw [red, line width=2mm, <-] (-2.1,2.1) -- (-3.5,3.2); |
|
677 \node at (-3.5,3.6) {your system}; |
|
678 \node at (-4.8,0) {\Large policy $+$}; |
|
679 |
|
680 |
|
681 \only<2>{ |
|
682 \draw [black, fill=red, line width=0.5mm] (2,1) circle (3mm); |
|
683 \draw [red, line width=2mm, <-] (2.3,1.2) -- (3.5,2); |
|
684 \node at (3.8,2.6) {\begin{tabular}{l}a seed\\[-1mm] \footnotesize virus, Trojan\end{tabular}};} |
|
685 |
|
686 \only<3>{ |
|
687 \draw [black, fill=red, line width=0.5mm] (2,1) circle (7mm); |
|
688 \node[white] at (2,1) {\small tainted};} |
|
689 |
|
690 \only<4>{ |
|
691 \begin{scope} |
|
692 \draw [clip] (0,0) circle (2.955cm); |
|
693 \draw [black, fill=red, line width=0.5mm] (2,1) circle (9mm); |
|
694 \node[white] at (2,1) {\small tainted}; |
|
695 \end{scope}} |
|
696 |
|
697 \only<5->{ |
|
698 \begin{scope} |
|
699 \draw [clip] (0,0) circle (2.955cm); |
|
700 \draw [black, fill=red, line width=0.5mm] (2,1) circle (13mm); |
|
701 \node[white] at (2,1) {\small tainted}; |
|
702 \end{scope}} |
|
703 |
|
704 \only<6->{ |
|
705 \draw[fill=white, line width=1mm] (1.265,2.665) arc (-35:183:5mm); |
|
706 \draw[fill=white, line width=1mm] (1.25,3.25) arc (-35:183:3mm); |
|
707 \node[black, rotate=10] at (1.9,3.6) {\LARGE\ldots}; |
|
708 } |
|
709 |
|
710 \end{tikzpicture} |
|
711 \end{center} |
|
712 |
|
713 \only<7->{ |
|
714 \begin{textblock}{4}(1,12) |
|
715 \small |
|
716 reduced the problem to a finite problem; gave a proof |
|
717 \end{textblock}} |
|
718 |
|
719 \end{frame} |
|
720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
721 |
|
722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
723 \begin{frame}[c] |
|
724 \frametitle{Fuzzy Testing C-Compilers} |
|
725 |
|
726 \begin{itemize} |
|
727 \item tested GCC, LLVM and others by randomly generating |
|
728 C-programs |
|
729 \item found more than 300 bugs in GCC and also |
|
730 many in LLVM (some of them highest-level critical)\bigskip |
|
731 \item about CompCert: |
|
732 |
|
733 \begin{bubble}[10cm]\small ``The striking thing about our CompCert |
|
734 results is that the middle-end bugs we found in all other |
|
735 compilers are absent. As of early 2011, the under-development |
|
736 version of CompCert is the only compiler we have tested for |
|
737 which Csmith cannot find wrong-code errors. This is not for |
|
738 lack of trying: we have devoted about six CPU-years to the |
|
739 task.'' |
|
740 \end{bubble} |
|
741 \end{itemize} |
|
742 |
|
743 \end{frame} |
|
744 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
745 |
|
746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
747 \begin{frame}[c] |
|
748 \frametitle{Big Proofs in CS (2)} |
|
749 |
|
750 \begin{itemize} |
|
751 \item in 2010, verification of a micro-kernel operating system (approximately 8700 loc) |
|
752 \begin{itemize} |
|
753 \item used in helicopters and mobile phones |
|
754 \item 200k loc of proof |
|
755 \item 25 - 30 person years |
|
756 \item found 160 bugs in the C code (144 by the proof) |
|
757 \end{itemize} |
|
758 \end{itemize} |
|
759 |
|
760 \begin{bubble}[10cm]\small |
|
761 ``Real-world operating-system kernel with an end-to-end proof |
|
762 of implementation correctness and security enforcement'' |
|
763 \end{bubble}\bigskip\pause |
|
764 |
|
765 unhackable kernel (New Scientists, September 2015) |
|
766 \end{frame} |
|
767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
768 |
|
769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
770 \begin{frame}[c] |
|
771 \frametitle{Big Proofs in CS (3)} |
|
772 |
|
773 \begin{itemize} |
|
774 \item verified TLS implementation\medskip |
|
775 \item verified compilers (CompCert, CakeML)\medskip |
|
776 \item verified distributed systems (Verdi)\medskip |
|
777 \item verified OSes or OS components\\ |
|
778 (seL4, CertiKOS, Ironclad Apps, \ldots)\medskip |
|
779 \item verified cryptography |
|
780 \end{itemize} |
|
781 |
|
782 \end{frame} |
|
783 |
|
784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
785 \begin{frame}[c] |
|
786 \frametitle{How Did This Happen?} |
|
787 |
|
788 Lots of ways! |
|
789 |
|
790 \begin{itemize} |
|
791 \item better programming languages |
|
792 \begin{itemize} |
|
793 \item basic safety guarantees built in |
|
794 \item powerful mechanisms for abstraction and modularity |
|
795 \end{itemize} |
|
796 \item better software development methodology |
|
797 \item stable platforms and frameworks |
|
798 \item better use of specifications\medskip\\ |
|
799 \small If you want to build software that works or is secure, |
|
800 it is helpful to know what you mean by ``works'' and by ``is secure''! |
|
801 \end{itemize} |
|
802 |
|
803 \end{frame} |
|
804 |
|
805 |
|
806 |
|
807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
808 \begin{frame}[c] |
|
809 \frametitle{Goal} |
|
810 |
|
811 Remember the Bridges example? |
|
812 |
|
813 \begin{itemize} |
|
814 \item Can we look at our programs and somehow ensure |
|
815 they are secure/bug free/correct?\pause\bigskip |
|
816 |
|
817 \item Very hard: Anything interesting about programs is equivalent |
|
818 to halting problem, which is undecidable.\pause\bigskip |
|
819 |
|
820 \item \alert{Solution:} We avoid this ``minor'' obstacle by |
|
821 being as close as possible of deciding the halting |
|
822 problem, without actually deciding the halting problem. |
|
823 \small$\quad\Rightarrow$ yes, no, don't know (static analysis) |
|
824 \end{itemize} |
|
825 |
|
826 \end{frame} |
|
827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
828 |
|
829 |
1521 |
830 \end{document} |
1522 \end{document} |
831 |
1523 |
832 |
1524 |
833 %%% Local Variables: |
1525 %%% Local Variables: |