Slides/slides02.tex
changeset 197 a35041d5707c
child 198 1f961c9e4dd6
equal deleted inserted replaced
196:5fa8344a5176 197:a35041d5707c
       
     1 \documentclass[dvipsnames,14pt,t]{beamer}
       
     2 \usepackage{slides}
       
     3 \usepackage{langs}
       
     4 \usepackage{graph}
       
     5 %\usepackage{grammar}
       
     6 \usepackage{soul}
       
     7 \usepackage{data}
       
     8 \usepackage{proof}
       
     9 
       
    10 % beamer stuff 
       
    11 \renewcommand{\slidecaption}{SMAL, 23.3.2016}
       
    12 \newcommand{\bl}[1]{\textcolor{blue}{#1}}
       
    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 
       
    39 \begin{document}
       
    40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    41 \begin{frame}[t]
       
    42 \frametitle{%
       
    43   \begin{tabular}{@ {}c@ {}}
       
    44   \\
       
    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
       
    49   \end{tabular}}\bigskip\bigskip\bigskip
       
    50 
       
    51   \normalsize
       
    52   \begin{center}
       
    53   \begin{tabular}{c}
       
    54   \small Christian Urban\\
       
    55   %\small King's College London\\
       
    56   \\
       
    57   \small joint work with Fahad Ausaf and Roy Dyckhoff
       
    58   \end{tabular}
       
    59   \end{center}
       
    60 
       
    61 \end{frame}
       
    62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
    63 
       
    64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    65 \begin{frame}[c]
       
    66 \frametitle{Why Bother?}
       
    67 
       
    68 \begin{itemize}
       
    69 \item Surely regular expressions must have been studied and
       
    70       implemented to death by now, no?\medskip\pause
       
    71 
       
    72 \item \ldots{}well, take for example the ``evil'' regular
       
    73       expression \bl{$({\tt a}^?)^n \cdot {\tt a}^n$} to match
       
    74       strings \bl{$\underbrace{{\tt a}\ldots{\tt a}}_n$}
       
    75 \end{itemize}\smallskip
       
    76 
       
    77 \begin{center}
       
    78 \begin{tikzpicture}
       
    79 \begin{axis}[
       
    80     xlabel={strings of {\tt a}s},
       
    81     ylabel={time in secs},
       
    82     enlargelimits=false,
       
    83     xtick={0,5,...,30},
       
    84     xmax=30,
       
    85     ymax=35,
       
    86     ytick={0,5,...,30},
       
    87     scaled ticks=false,
       
    88     axis lines=left,
       
    89     width=7cm,
       
    90     height=5cm, 
       
    91     legend entries={Python,Ruby},  
       
    92     legend pos=north west,
       
    93     legend cell align=left  
       
    94 ]
       
    95 \addplot[blue,mark=*, mark options={fill=white}] 
       
    96   table {re-python.data};
       
    97 \addplot[brown,mark=pentagon*, mark options={fill=white}] 
       
    98   table {re-ruby.data};  
       
    99 \end{axis}
       
   100 \end{tikzpicture}
       
   101 \end{center}
       
   102 
       
   103 \end{frame}
       
   104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   105 
       
   106 
       
   107 
       
   108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   109   \begin{frame}[c]
       
   110 
       
   111   \begin{center}
       
   112   \includegraphics[scale=0.2]{pics/isabelle.png}
       
   113   \end{center}
       
   114   \mbox{}\\[-20mm]\mbox{}
       
   115 
       
   116   \begin{itemize}
       
   117   \item Isabelle interactive theorem prover; 
       
   118   some proofs are automatic -- most however need help
       
   119   \item the learning curve is steep; you often have to fight the 
       
   120   theorem prover\ldots no different in other ITPs
       
   121   \end{itemize}
       
   122 
       
   123   \end{frame}
       
   124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   125 
       
   126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   127 \begin{frame}[c]
       
   128 \frametitle{\Large Isabelle Theorem Prover}
       
   129 
       
   130 \begin{itemize}
       
   131 \item started to use Isabelle after my PhD (in 2000)
       
   132 
       
   133 \item the thesis included a rather complicated
       
   134       ``pencil-and-paper'' proof for a termination argument
       
   135       (SN for a sort of $\lambda$-calculus)\medskip
       
   136  
       
   137 \item me, my supervisor, the examiners did not find any problems\medskip 
       
   138  \begin{center}
       
   139   \begin{tabular}{@ {}c@ {}}
       
   140   \includegraphics[scale=0.38]{pics/barendregt.jpg}\\[-2mm]
       
   141   \footnotesize Henk Barendregt
       
   142   \end{tabular}
       
   143   \hspace{2mm}
       
   144   \begin{tabular}{@ {}c@ {}}
       
   145   \includegraphics[scale=0.20]{pics/andrewpitts.jpg}\\[-2mm]
       
   146   \footnotesize Andrew Pitts
       
   147   \end{tabular}
       
   148   \end{center}
       
   149   
       
   150 \item people were building their work on my result      
       
   151   
       
   152 \end{itemize}
       
   153 
       
   154 \end{frame}
       
   155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   156 
       
   157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   158 \begin{frame}[t]
       
   159 \frametitle{\Large Nominal Isabelle}
       
   160 
       
   161 \begin{itemize}
       
   162 \item implemented a package for the Isabelle prover 
       
   163 in order to reason conveniently about binders 
       
   164  
       
   165 \begin{center}
       
   166 \large\bl{$\lambda \alert{x}.\,M$} \hspace{10mm}
       
   167 \bl{$\forall \alert{x}.\,P\,x$}
       
   168 \end{center}\bigskip\bigskip\bigskip\bigskip
       
   169 \bigskip\bigskip\bigskip\pause\pause
       
   170   
       
   171   
       
   172 \item when finally being able to formalise the proof from my PhD, I found that the main result
       
   173       (termination) is correct, but a central lemma needed to
       
   174       be generalised
       
   175 \end{itemize}
       
   176 
       
   177 \only<2->{
       
   178 \begin{textblock}{3}(13,5)
       
   179 \includegraphics[scale=0.33]{pics/skeleton.jpg}
       
   180 \end{textblock}}
       
   181 
       
   182 \begin{textblock}{3}(5.3,7)
       
   183 \begin{tikzpicture}
       
   184 \node at (0,0) [single arrow, shape border rotate=90, fill=red,text=red]{\mbox{a}};
       
   185 \end{tikzpicture}
       
   186 \end{textblock}
       
   187 
       
   188 \begin{textblock}{3}(8.7,7)
       
   189 \begin{tikzpicture}
       
   190 \node at (0,0) [single arrow, shape border rotate=90, fill=red,text=red]{\mbox{a}};
       
   191 \end{tikzpicture}
       
   192 \end{textblock}
       
   193 
       
   194 \end{frame}
       
   195 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   196 
       
   197 
       
   198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   199 \begin{frame}[c]
       
   200 \frametitle{\Large Variable Convention}
       
   201 
       
   202 \begin{center}
       
   203 \begin{bubble}[10cm]
       
   204   \color{gray}  
       
   205   \small
       
   206   {\bf\mbox{}Variable Convention:}\\[1mm] 
       
   207   If $M_1,\ldots,M_n$ occur in a certain mathematical context
       
   208   (e.g. definition, proof), then in these terms all bound variables 
       
   209   are chosen to be different from the free variables.\\[2mm]
       
   210   
       
   211   \footnotesize\hfill Barendregt in ``The Lambda-Calculus: Its Syntax and Semantics''
       
   212 \end{bubble}
       
   213 \end{center}
       
   214 
       
   215 \mbox{}\\[-8mm]
       
   216 \begin{itemize}
       
   217 
       
   218 
       
   219 \item instead of proving a property for \alert{\bf all} bound
       
   220 variables, you prove it only for \alert{\bf some}\ldots?
       
   221 
       
   222 \item this is mostly OK, but in some corner-cases you can use it
       
   223 to prove \alert{\bf false}\ldots we fixed this!
       
   224 \end{itemize}
       
   225 
       
   226 \end{frame}
       
   227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   228 
       
   229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   230 \begin{frame}[c]
       
   231 \frametitle{}
       
   232 
       
   233 \begin{tabular}{c@ {\hspace{2mm}}c}
       
   234 \\[6mm]
       
   235 \begin{tabular}{c}
       
   236 \includegraphics[scale=0.11]{pics/harper.jpg}\\[-2mm]
       
   237 {\footnotesize Bob Harper}\\[-2mm]
       
   238 {\footnotesize}
       
   239 \end{tabular}
       
   240 \begin{tabular}{c}
       
   241 \includegraphics[scale=0.37]{pics/pfenning.jpg}\\[-2mm]
       
   242 {\footnotesize Frank Pfenning}\\[-2mm]
       
   243 {\footnotesize}
       
   244 \end{tabular} &
       
   245 
       
   246 \begin{tabular}{p{6cm}}
       
   247 \raggedright
       
   248 {published a proof on LF in\\ {\bf ACM Transactions on 
       
   249  Computational Logic}, 2005,
       
   250 $\sim$31pp}
       
   251 \end{tabular}\\
       
   252 
       
   253 \\[0mm]
       
   254   
       
   255 \begin{tabular}{c}
       
   256 \includegraphics[scale=0.36]{pics/appel.jpg}\\[-2mm] 
       
   257 {\footnotesize Andrew Appel}\\[-2.5mm]
       
   258 {\footnotesize}
       
   259 \end{tabular} &
       
   260 
       
   261 \begin{tabular}{p{6cm}}
       
   262 \raggedright
       
   263 {relied on their proof in a\\ {\bf security} critical application}
       
   264 \end{tabular}
       
   265 \end{tabular}
       
   266 
       
   267 \end{frame}
       
   268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   269 
       
   270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   271 \begin{frame}
       
   272 \frametitle{Proof-Carrying Code}
       
   273 
       
   274 \begin{textblock}{10}(2.5,2.2)
       
   275 \begin{block}{Idea:}
       
   276 \begin{center}
       
   277 \begin{tikzpicture}
       
   278 \draw[help lines,cream] (0,0.2) grid (8,4);
       
   279   
       
   280 \draw[line width=1mm, red] (5.5,0.6) rectangle (7.5,4);
       
   281 \node[anchor=base] at (6.5,2.8) 
       
   282      {\small\begin{tabular}{@ {}p{1.9cm}@ {}}\centering  user: untrusted code\end{tabular}};
       
   283 
       
   284 \draw[line width=1mm, red] (0.1,0.6) rectangle (2.1,4);
       
   285   \node[anchor=base] at (1.1,2.3) 
       
   286      {\small\begin{tabular}{@ {}p{1.9cm}@ {}}\centering  developer ---\\ web server\end{tabular}};
       
   287   
       
   288 \onslide<2->{
       
   289   \draw[line width=1mm, red, fill=red] (5.5,0.6) rectangle (7.5,1.8);
       
   290   \node[anchor=base,white] at (6.5,1.1) 
       
   291      {\small\begin{tabular}{@ {}p{1.9cm}@ {}}\bf\centering proof- checker\end{tabular}};}
       
   292 
       
   293   \node at (3.6,3.0) [single arrow, fill=red,text=white, 
       
   294                       minimum height=3.4cm]{\bf code};
       
   295   
       
   296 \node at (3.6,1.3) [single arrow, fill=red,text=white, 
       
   297                       minimum height=3.4cm]{\bf certificate};
       
   298 \node at (3.6,1.9) {\small\color{gray}{\mbox{}\hspace{-1mm}a proof in LF}};
       
   299 
       
   300 \end{tikzpicture}
       
   301 \end{center}
       
   302 \end{block}
       
   303 \end{textblock}
       
   304 
       
   305 \begin{textblock}{14}(2,11)
       
   306 \small
       
   307 \begin{itemize}
       
   308 \item<2-> Appel's checker is $\sim$2700 lines of code (1865 loc of\\ LF definitions; 
       
   309 803 loc in C including 2 library functions)\\[-3mm]
       
   310 \item<2-> 167 loc in C implement a type-checker\\ (proved correct by Harper and Pfenning)
       
   311 \end{itemize}
       
   312 \end{textblock}
       
   313 
       
   314 \end{frame}
       
   315 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   316 
       
   317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   318   \begin{frame}<2->[squeeze]
       
   319   \frametitle{} 
       
   320   
       
   321   \begin{columns}
       
   322   \tikzstyle{every node}=[node distance=25mm,text height=1.5ex, text depth=.25ex]
       
   323   \tikzstyle{node1}=[rectangle, minimum size=10mm, rounded corners=3mm, very thick, 
       
   324                      draw=black!50, top color=white, bottom color=black!20]
       
   325   \tikzstyle{node2}=[rectangle, minimum size=12mm, rounded corners=3mm, very thick, 
       
   326                      draw=red!70, top color=white, bottom color=red!50!black!20]
       
   327   
       
   328   \begin{column}{0.8\textwidth}
       
   329   \begin{textblock}{0}(1,2)
       
   330 
       
   331   \begin{tikzpicture}
       
   332   \matrix[ampersand replacement=\&,column sep=7mm, row sep=5mm]
       
   333   { \&[-10mm] 
       
   334     \node (def1)   [node1] {\large\hspace{1mm}Spec\hspace{1mm}\mbox{}}; \&
       
   335     \node (proof1) [node1] {\large Proof}; \&
       
   336     \node (alg1)   [node1] {\large\hspace{1mm}Alg\hspace{1mm}\mbox{}}; \\
       
   337     
       
   338     \onslide<4->{\node {\begin{tabular}{c}\small 1st\\[-2.5mm] \footnotesize solution\end{tabular}};} \&
       
   339     \onslide<4->{\node (def2)   [node2] {\large Spec$^\text{+ex}$};} \&
       
   340     \onslide<4->{\node (proof2) [node1] {\large Proof};} \&
       
   341     \onslide<4->{\node (alg2)   [node1] {\large\hspace{1mm}Alg\hspace{1mm}\mbox{}};} \\
       
   342      
       
   343     \onslide<5->{\node {\begin{tabular}{c}\small 2nd\\[-2.5mm] \footnotesize solution\end{tabular}};} \&
       
   344     \onslide<5->{\node (def3)   [node1] {\large\hspace{1mm}Spec\hspace{1mm}\mbox{}};} \&
       
   345     \onslide<5->{\node (proof3) [node1] {\large Proof};} \&
       
   346     \onslide<5->{\node (alg3)   [node2] {\large Alg$^\text{-ex}$};} \\
       
   347 
       
   348     \onslide<6->{\node {\begin{tabular}{c}\small 3rd\\[-2.5mm] \footnotesize solution\end{tabular}};} \&
       
   349     \onslide<6->{\node (def4)   [node1] {\large\hspace{1mm}Spec\hspace{1mm}\mbox{}};} \&
       
   350     \onslide<6->{\node (proof4) [node2] {\large\hspace{1mm}Proof\hspace{1mm}};} \&
       
   351     \onslide<6->{\node (alg4)   [node1] {\large\hspace{1mm}Alg\hspace{1mm}\mbox{}};} \\
       
   352   };
       
   353 
       
   354   \draw[->,black!50,line width=2mm] (proof1) -- (def1);
       
   355   \draw[->,black!50,line width=2mm] (proof1) -- (alg1);
       
   356   
       
   357   \onslide<4->{\draw[->,black!50,line width=2mm] (proof2) -- (def2);}
       
   358   \onslide<4->{\draw[->,black!50,line width=2mm] (proof2) -- (alg2);}
       
   359 
       
   360   \onslide<5->{\draw[->,black!50,line width=2mm] (proof3) -- (def3);}
       
   361   \onslide<5->{\draw[->,black!50,line width=2mm] (proof3) -- (alg3);}
       
   362   
       
   363   \onslide<6->{\draw[->,black!50,line width=2mm] (proof4) -- (def4);}
       
   364   \onslide<6->{\draw[->,black!50,line width=2mm] (proof4) -- (alg4);}
       
   365 
       
   366   \onslide<3->{\draw[white,line width=1mm] (1.1,3.2) -- (0.9,2.85) -- (1.1,2.35) -- (0.9,2.0);} 
       
   367   \end{tikzpicture}
       
   368 
       
   369   \end{textblock}
       
   370   \end{column}
       
   371   \end{columns}
       
   372 
       
   373 
       
   374   \begin{textblock}{3}(12,3.6)
       
   375   \onslide<4->{
       
   376   \begin{tikzpicture}
       
   377   \node at (0,0) [single arrow, shape border rotate=270, fill=red,text=white]{2h};
       
   378   \end{tikzpicture}}
       
   379   \end{textblock}
       
   380   
       
   381   \begin{textblock}{0}(0.4,12.8)
       
   382   \onslide<6->{
       
   383   \begin{bubble}[11cm]
       
   384   \small Each time one needs to check $\sim$31pp~of 
       
   385   informal paper proofs---impossible without tool support.
       
   386   You have to be able to keep definitions 
       
   387   and proofs consistent.
       
   388   \end{bubble}}
       
   389   \end{textblock}
       
   390 
       
   391   \end{frame}
       
   392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
   393 
       
   394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   395   \begin{frame}[c]
       
   396   \frametitle{\LARGE Lessons Learned}
       
   397 
       
   398   \begin{itemize}
       
   399   \item by using a theorem prover we were able to keep a large 
       
   400   proof consistent with changes in the first definitions\bigskip
       
   401   \item it took us appr.~10 days to get to the error\ldots
       
   402   probably the same time Harper and Pfenning needed to \LaTeX{}
       
   403   their paper\bigskip 
       
   404   \item once there, we ran circles around them
       
   405   \end{itemize}
       
   406 
       
   407   \end{frame}
       
   408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   409   
       
   410 
       
   411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   412   \begin{frame}[c]
       
   413   \frametitle{Real-Time Scheduling} 
       
   414 
       
   415   \begin{textblock}{11}(1,3)
       
   416   \begin{tabular}{@{\hspace{-10mm}}l}
       
   417   \begin{tikzpicture}[scale=1.1]
       
   418   \node at (-2.5,-1.5) {\textcolor{white}{a}};
       
   419   \node at (8,4) {\textcolor{white}{a}};
       
   420   
       
   421     
       
   422   \only<1>{
       
   423    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   424   }
       
   425   \only<2>{
       
   426    \draw[fill, blue!50] (1,0) rectangle (2,0.6);
       
   427    \draw[fill, blue!50] (3,0) rectangle (5,0.6);
       
   428    \draw[fill, blue!100] (2,3) rectangle (3,3.6);
       
   429   }
       
   430   \only<3>{
       
   431    \draw[fill, blue!50] (1,0) rectangle (2,0.6);
       
   432    \draw[fill, blue!50] (3,0) rectangle (4.5,0.6);
       
   433    \draw[fill, blue!50] (5.5,0) rectangle (6,0.6);
       
   434    \draw[fill, blue!100] (2,3) rectangle (3,3.6);
       
   435    \draw[fill, blue!100] (4.5,3) rectangle (5.5,3.6);
       
   436   }
       
   437   \only<4>{
       
   438    \node at (2.5,0.9) {\small locks a resource};
       
   439    \draw[fill, blue!50] (1,0) rectangle (2,0.6);
       
   440    \draw[blue!50, very thick] (2,0) rectangle (4,0.6);
       
   441    \draw[blue!100, very thick] (2,3) rectangle (3, 3.6);
       
   442    %\draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
       
   443   }
       
   444   \only<5>{
       
   445    \node at (2.5,0.9) {\small locks a resource};
       
   446    \draw[fill, blue!50] (1,0) rectangle (4,0.6);
       
   447    \draw[blue!100, fill] (4,3) rectangle (5, 3.6);
       
   448   }
       
   449   \only<6>{
       
   450    \node at (2.5,0.9) {\small locks a resource};
       
   451    \draw[fill, blue!50] (1,0) rectangle (2,0.6);
       
   452    \draw[blue!50, very thick] (2,0) rectangle (4,0.6);
       
   453    \draw[blue!100, very thick] (2,3) rectangle (3, 3.6);
       
   454    \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
       
   455   }
       
   456   \only<7>{
       
   457    \node at (2.5,0.9) {\small locks a resource};
       
   458    \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
       
   459    \draw[blue!50, very thick] (2.5,0) rectangle (4,0.6);
       
   460    \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6);
       
   461    \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1);
       
   462   }
       
   463   \only<8>{
       
   464    \node at (2.5,0.9) {\small locks a resource}; 
       
   465    \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
       
   466    \draw[blue!50, very thick] (2.5,0) rectangle (4,0.6);
       
   467    \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6);
       
   468    \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6);
       
   469    \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
       
   470    \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1);
       
   471   }
       
   472   \only<9>{
       
   473    \node at (2.5,0.9) {\small locks a resource}; 
       
   474    \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
       
   475    \draw[blue!50, very thick] (3.5,0) rectangle (5,0.6);
       
   476    \draw[blue!100, very thick] (3.5,3) rectangle (4.5, 3.6);
       
   477    \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
       
   478    \draw[red, <-, line width = 2mm] (3.5,-0.1) -- (3.5, -1);
       
   479   }
       
   480   \only<10>{
       
   481    \node at (2.5,0.9) {\small locks a resource}; 
       
   482    \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
       
   483    \draw[blue!50, very thick] (3.5,0) rectangle (5,0.6);
       
   484    \draw[blue!100, very thick] (3.5,3) rectangle (4.5, 3.6);
       
   485    \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
       
   486    \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1);
       
   487    \draw[red, <-, line width = 2mm] (3.5,-0.1) -- (3.5, -1);
       
   488   }
       
   489   \only<11>{
       
   490    \node at (2.5,0.9) {\small locks a resource};
       
   491    \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
       
   492    \draw[blue!50, very thick] (4.5,0) rectangle (6,0.6);
       
   493    \draw[blue!100, very thick] (4.5,3) rectangle (5.5, 3.6);
       
   494    \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
       
   495    \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1);
       
   496    \draw[red, <-, line width = 2mm] (4.5,-0.1) -- (4.5, -1);
       
   497   }
       
   498   \only<12>{
       
   499    \node at (2.5,0.9) {\small locks a resource}; 
       
   500    \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
       
   501    \draw[blue!50, very thick] (5.5,0) rectangle (7,0.6);
       
   502    \draw[blue!100, very thick] (5.5,3) rectangle (6.5, 3.6);
       
   503    \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
       
   504    \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1);
       
   505    \draw[red, fill] (4.55,1.5) rectangle (5.5,2.1);
       
   506    \draw[red, <-, line width = 2mm] (5.5,-0.1) -- (5.5, -1);
       
   507    \node [anchor=base] at (6.3, 1.8) {\Large\ldots};
       
   508   }
       
   509   \only<13>{
       
   510    \node at (2.5,0.9) {\small locks a resource}; 
       
   511    \draw[fill, blue!50] (1,0) rectangle (2,0.6);
       
   512    \draw[blue!50, very thick] (2,0) rectangle (4,0.6);
       
   513    \draw[blue!100, very thick] (2,3) rectangle (3, 3.6);
       
   514    \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
       
   515   }
       
   516   \only<14>{
       
   517    \node at (2.5,3.9) {\small locks a resource}; 
       
   518    \draw[fill, blue!50] (1,0) rectangle (2,0.6);
       
   519    \draw[blue!50, fill] (2,3) rectangle (4,3.6);
       
   520    \draw[blue!100, very thick] (4,3) rectangle (5, 3.6);
       
   521    \draw[blue!50, ->, line width = 2mm] (2,1) -- (2, 2.5);
       
   522    \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
       
   523   }
       
   524   \only<15>{
       
   525    \node at (2.5,3.9) {\small locks a resource};  
       
   526    \draw[fill, blue!50] (1,0) rectangle (2,0.6);
       
   527    \draw[blue!50, fill] (2,3) rectangle (4,3.6);
       
   528    \draw[blue!100, very thick] (4,3) rectangle (5, 3.6);
       
   529    \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1);
       
   530    \draw[red, very thick] (2.5,1.5) rectangle (3.5,2.1); 
       
   531   }
       
   532 
       
   533 
       
   534   \draw[very thick,->](0,0) -- (8,0);
       
   535   \node [anchor=base] at (8, -0.3) {\scriptsize time};
       
   536   \node [anchor=base] at (0, -0.3) {\scriptsize 0};
       
   537   \node [anchor=base] at (-1.2, 0.2) {\small low priority};
       
   538   \only<2->{\node [anchor=base] at (-1.2, 3.2) {\small high priority};}
       
   539   \only<8->{\node [anchor=base] at (-1.5, 1.7) {\small medium pr.};}
       
   540 
       
   541   \end{tikzpicture}
       
   542   \end{tabular}
       
   543   \end{textblock}
       
   544 
       
   545   \begin{textblock}{0}(1.5,13)%
       
   546   \small
       
   547   \onslide<5->{
       
   548   \begin{bubble}[10.3cm]%
       
   549   RT-Scheduling: You want to avoid that a 
       
   550   high-priority process is starved indefinitely by lower priority
       
   551   processes.
       
   552   \end{bubble}}
       
   553   \end{textblock}
       
   554 
       
   555   \end{frame}
       
   556 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   557   
       
   558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   559   \begin{frame}[c]
       
   560   \frametitle{\Large Priority Inheritance Scheduling}
       
   561 
       
   562   \begin{itemize}
       
   563   \item Idea: Let a low priority process \bl{$L$} temporarily inherit 
       
   564     the high priority of \bl{$H$} until \bl{$L$} leaves the critical 
       
   565     section unlocking the resource.\bigskip
       
   566   \item Once the resource is unlocked, \bl{$L$} ``returns to its original 
       
   567     priority level.''\\
       
   568     \mbox{}\hfill\footnotesize
       
   569     \begin{tabular}{p{6cm}@{}}
       
   570     L.~Sha, R.~Rajkumar, and J.~P.~Lehoczky. 
       
   571     {\it Priority Inheritance Protocols: An Approach to 
       
   572     Real-Time Synchronization}. IEEE Transactions on 
       
   573     Computers, 39(9):1175–1185, 1990
       
   574     \end{tabular}\bigskip\normalsize\pause
       
   575   
       
   576   \item classic, proved correct, reviewed in a respectable journal....what 
       
   577         could possibly be wrong?
       
   578     
       
   579   \end{itemize}
       
   580 
       
   581   \end{frame}
       
   582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   583   
       
   584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   585   \begin{frame}[c]
       
   586 
       
   587   \begin{textblock}{11}(1,3)
       
   588   \begin{tabular}{@{\hspace{-10mm}}l}
       
   589   \begin{tikzpicture}[scale=1.1]
       
   590   \node at (-2.5,-1.5) {\textcolor{white}{a}};
       
   591   \node at (8,4) {\textcolor{white}{a}};
       
   592   
       
   593   \only<1>{
       
   594     \draw[fill, blue!50] (1,0) rectangle (6,0.6);
       
   595     \node at (1.5,0.9) {\small $A_L$};
       
   596     \node at (2.0,0.9) {\small $B_L$};
       
   597     \node at (3.5,0.9) {\small $A_R$};
       
   598     \node at (5.7,0.9) {\small $B_R$};
       
   599     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   600     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   601     \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
       
   602     \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
       
   603   }
       
   604   \only<2>{
       
   605     \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   606     \draw[very thick, blue!50] (3,0) rectangle (6,0.6);
       
   607     \node at (1.5,0.9) {\small $A_L$};
       
   608     \node at (2.0,0.9) {\small $B_L$};
       
   609     \node at (3.5,0.9) {\small $A_R$};
       
   610     \node at (5.7,0.9) {\small $B_R$};
       
   611     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   612     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   613     \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
       
   614     \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
       
   615   }
       
   616   \only<3>{
       
   617     \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   618     \draw[very thick, blue!50] (3,0) rectangle (6,0.6);
       
   619     \node at (1.5,0.9) {\small $A_L$};
       
   620     \node at (2.0,0.9) {\small $B_L$};
       
   621     \node at (3.5,0.9) {\small $A_R$};
       
   622     \node at (5.7,0.9) {\small $B_R$};
       
   623     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   624     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   625     \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
       
   626     \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
       
   627     \draw[very thick,blue!100] (3,3) rectangle (4,3.6);
       
   628     \node at (3.5,3.3) {\small $A$};
       
   629   }
       
   630   \only<4>{
       
   631     \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   632     \draw[very thick, blue!50] (3,0) rectangle (6,0.6);
       
   633     \node at (1.5,0.9) {\small $A_L$};
       
   634     \node at (2.0,0.9) {\small $B_L$};
       
   635     \node at (3.5,0.9) {\small $A_R$};
       
   636     \node at (5.7,0.9) {\small $B_R$};
       
   637     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   638     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   639     \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
       
   640     \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
       
   641     \draw[very thick,blue!100] (3,3) rectangle (4,3.6);
       
   642     \node at (3.5,3.3) {\small $A$};
       
   643     \draw[very thick,blue!100] (4,3) rectangle (5,3.6);
       
   644     \node at (4.5,3.3) {\small $B$};
       
   645   }
       
   646   \only<5>{
       
   647     \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   648     \draw[very thick, blue!50] (3,3) rectangle (6,3.6);
       
   649     \node at (1.5,0.9) {\small $A_L$};
       
   650     \node at (2.0,0.9) {\small $B_L$};
       
   651     \node at (3.5,3.9) {\small $A_R$};
       
   652     \node at (5.7,3.9) {\small $B_R$};
       
   653     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   654     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   655     \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
       
   656     \draw[very thick,blue!100] (5.7,3) -- (5.7,3.6);
       
   657     \draw[very thick,blue!100] (6,3) rectangle (7,3.6);
       
   658     \node at (6.5,3.3) {\small $A$};
       
   659     \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
       
   660     \node at (7.5,3.3) {\small $B$};
       
   661     \draw[blue!50, ->, line width = 2mm] (3,1) -- (3, 2.5);
       
   662   }
       
   663   \only<6>{
       
   664     \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   665     \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
       
   666     \draw[very thick, blue!50] (3.5,3) rectangle (6,3.6);
       
   667     \node at (1.5,0.9) {\small $A_L$};
       
   668     \node at (2.0,0.9) {\small $B_L$};
       
   669     \node at (3.5,3.9) {\small $A_R$};
       
   670     \node at (5.7,3.9) {\small $B_R$};
       
   671     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   672     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   673     \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
       
   674     \draw[very thick,blue!100] (5.7,3) -- (5.7,3.6);
       
   675     \draw[very thick,blue!100] (6,3) rectangle (7,3.6);
       
   676     \node at (6.5,3.3) {\small $A$};
       
   677     \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
       
   678     \node at (7.5,3.3) {\small $B$}; 
       
   679   }
       
   680   \only<7>{
       
   681    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   682     \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
       
   683     \draw[very thick, blue!50] (3.5,0) rectangle (6,0.6);
       
   684     \node at (1.5,0.9) {\small $A_L$};
       
   685     \node at (2.0,0.9) {\small $B_L$};
       
   686     \node at (3.5,3.9) {\small $A_R$};
       
   687     \node at (5.7,0.9) {\small $B_R$};
       
   688     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   689     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   690     \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
       
   691     \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
       
   692     \draw[very thick,blue!100] (6,3) rectangle (7,3.6);
       
   693     \node at (6.5,3.3) {\small $A$};
       
   694     \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
       
   695     \node at (7.5,3.3) {\small $B$};  
       
   696     \draw[blue!50, <-, line width = 2mm] (3.5,1) -- (3.5, 2.5);
       
   697     \draw[blue!50, <-, line width = 2mm] (4,3.3) -- (5.5,3.3);
       
   698   }
       
   699   \only<8>{
       
   700     \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   701     \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
       
   702     \draw[very thick, blue!50] (4.5,0) rectangle (7,0.6);
       
   703     \node at (1.5,0.9) {\small $A_L$};
       
   704     \node at (2.0,0.9) {\small $B_L$};
       
   705     \node at (3.5,3.9) {\small $A_R$};
       
   706     \node at (6.7,0.9) {\small $B_R$};
       
   707     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   708     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   709     \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
       
   710     \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
       
   711     \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
       
   712     \node at (4,3.3) {\small $A$};
       
   713     \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
       
   714     \node at (7.5,3.3) {\small $B$};  
       
   715   }
       
   716   \only<9>{
       
   717     \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   718     \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
       
   719     \draw[fill, blue!50] (4.5,0) rectangle (5,0.6);
       
   720     \draw[very thick, blue!50] (5,0) rectangle (7,0.6);
       
   721     \node at (1.5,0.9) {\small $A_L$};
       
   722     \node at (2.0,0.9) {\small $B_L$};
       
   723     \node at (3.5,3.9) {\small $A_R$};
       
   724     \node at (6.7,0.9) {\small $B_R$};
       
   725     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   726     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   727     \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
       
   728     \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
       
   729     \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
       
   730     \node at (4,3.3) {\small $A$};
       
   731     \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
       
   732     \node at (7.5,3.3) {\small $B$};  
       
   733   }
       
   734   \only<10>{
       
   735     \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   736     \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
       
   737     \draw[fill, blue!50] (4.5,0) rectangle (5,0.6);
       
   738     \draw[very thick, blue!50] (5,0) rectangle (7,0.6);
       
   739     \node at (1.5,0.9) {\small $A_L$};
       
   740     \node at (2.0,0.9) {\small $B_L$};
       
   741     \node at (3.5,3.9) {\small $A_R$};
       
   742     \node at (6.7,0.9) {\small $B_R$};
       
   743     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   744     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   745     \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
       
   746     \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
       
   747     \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
       
   748     \node at (4,3.3) {\small $A$};
       
   749     \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
       
   750     \node at (7.5,3.3) {\small $B$};  
       
   751     \draw[red, fill] (5,1.5) rectangle (6,2.1);
       
   752     \draw[red, fill] (6.05,1.5) rectangle (7,2.1);
       
   753   }
       
   754   \only<11>{
       
   755    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
       
   756     \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
       
   757     \draw[fill, blue!50] (4.5,0) rectangle (5,0.6);
       
   758     \draw[very thick, blue!50] (5,0) rectangle (7,0.6);
       
   759     \node at (1.5,0.9) {\small $A_L$};
       
   760     \node at (2.0,0.9) {\small $B_L$};
       
   761     \node at (3.5,3.9) {\small $A_R$};
       
   762     \node at (6.7,0.9) {\small $B_R$};
       
   763     \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
       
   764     \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
       
   765     \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
       
   766     \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
       
   767     \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
       
   768     \node at (4,3.3) {\small $A$};
       
   769     \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
       
   770     \node at (7.5,3.3) {\small $B$};  
       
   771     \draw[red, fill] (5,1.5) rectangle (6,2.1);
       
   772     \draw[red, fill] (6.05,1.5) rectangle (7,2.1);
       
   773     \draw[blue!50, ->, line width = 2mm] (7.1,0.4) -- (8, 0.4);
       
   774     \draw[blue!50, ->, line width = 2mm] (7.1,4) -- (8,4);
       
   775   }
       
   776 
       
   777   \draw[very thick,->](0,0) -- (8,0);
       
   778   \node [anchor=base] at (8, -0.3) {\scriptsize time};
       
   779   \node [anchor=base] at (0, -0.3) {\scriptsize 0};
       
   780   \node [anchor=base] at (-1.2, 0.2) {\small low priority};
       
   781   \only<2->{\node [anchor=base] at (-1.2, 3.2) {\small high priority};}
       
   782   \only<10->{\node [anchor=base] at (-1.5, 1.7) {\small medium pr.};}
       
   783 
       
   784   \end{tikzpicture}
       
   785   \end{tabular}
       
   786   \end{textblock}
       
   787   
       
   788   \begin{textblock}{0}(1.5,13)%
       
   789   \small
       
   790   \begin{bubble}[10.3cm]%
       
   791   RT-Scheduling: You want to avoid that a 
       
   792   high-priority process is starved indefinitely by lower priority
       
   793   processes.
       
   794   \end{bubble}
       
   795   \end{textblock}
       
   796 
       
   797   \end{frame}
       
   798 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   799   
       
   800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   801   \begin{frame}[c]
       
   802   \frametitle{\Large Priority Inheritance Scheduling}
       
   803 
       
   804   \begin{itemize}
       
   805   \item Idea: Let a low priority process \bl{$L$} temporarily inherit 
       
   806     the high priority of \bl{$H$} until \bl{$L$} leaves the critical 
       
   807     section unlocking the resource.\bigskip
       
   808   \item Once the resource is unlocked, \bl{$L$} returns to its original 
       
   809     priority level. \alert{\bf BOGUS}\pause\bigskip
       
   810   \item \ldots \bl{$L$} needs to switch to the highest 
       
   811     \alert{\bf remaining} priority of the threads that it blocks.
       
   812   \end{itemize}\bigskip
       
   813 
       
   814   \small this error is already known since around 1999
       
   815 
       
   816   \end{frame}
       
   817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   818 
       
   819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   820   \begin{frame}[c]
       
   821 
       
   822   \begin{textblock}{11}(2,1)
       
   823   \alt<1>{\includegraphics[scale=0.25]{pics/p3.jpg}}
       
   824          {\includegraphics[scale=0.125]{pics/p3.jpg}}
       
   825   \alt<2>{\includegraphics[scale=0.25]{pics/p2.jpg}}
       
   826          {\includegraphics[scale=0.125]{pics/p2.jpg}}
       
   827   \alt<3>{\includegraphics[scale=0.153]{pics/p1.jpg}}
       
   828          {\includegraphics[scale=0.076]{pics/p1.jpg}} 
       
   829   \alt<4>{\includegraphics[scale=0.25]{pics/p4.jpg}}
       
   830          {\includegraphics[scale=0.125]{pics/p4.jpg}}
       
   831   \alt<5>{\includegraphics[scale=0.088]{pics/p5.jpg}}
       
   832          {\includegraphics[scale=0.044]{pics/p5.jpg}}
       
   833   \end{textblock}
       
   834 
       
   835   \begin{textblock}{13}(1,9)
       
   836   \only<1>{
       
   837   \begin{itemize}
       
   838   \item by Rajkumar, 1991
       
   839   \item \it ``it resumes the priority it had at the point of entry into the critical 
       
   840   section''
       
   841   \end{itemize}}
       
   842   \only<2>{
       
   843   \begin{itemize}
       
   844   \item by Jane Liu, 2000
       
   845   \item {\it ``The job $J_l$ executes at its inherited 
       
   846     priority until it releases $R$; at that time, the 
       
   847     priority of $J_l$ returns to its priority 
       
   848     at the time when it acquires the resource $R$.''}\medskip
       
   849   \item \small gives pseudo code and uses pretty bogus data structures  
       
   850   \item \small the interesting part is ``{\it left as an exercise}''
       
   851   \end{itemize}}
       
   852   \only<3>{
       
   853   \begin{itemize}
       
   854   \item by Laplante and Ovaska, 2011 (\$113.76)
       
   855   \item \it ``when $[$the task$]$ exits the critical section that
       
   856         caused the block, it reverts to the priority it had
       
   857         when it entered that section'' 
       
   858   \end{itemize}}
       
   859   \only<4>{
       
   860   \begin{itemize}
       
   861   \item by Silberschatz, Galvin and Gagne (9th edition, 2013)
       
   862   \item \it ``Upon releasing the
       
   863   lock, the $[$low-priority$]$ thread will revert to its original
       
   864   priority.''
       
   865   \end{itemize}}
       
   866   \only<5>{
       
   867   \begin{itemize}
       
   868   \item by Stallings (8th edition, 2014)
       
   869   \item \it ``This priority change takes place as soon as the 
       
   870   higher-priority task blocks on the resource; it should end when 
       
   871   the resource is released by the lower-priority task.''
       
   872   \end{itemize}}
       
   873   \end{textblock} 
       
   874   \end{frame}
       
   875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   876      
       
   877 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   878   \begin{frame}[c]
       
   879   \frametitle{Priority Scheduling}
       
   880 
       
   881   \begin{itemize}
       
   882   \item a scheduling algorithm that is widely used in real-time operating systems
       
   883   \item has been ``proved'' correct by hand in a paper in 1990
       
   884   \item but this algorithm turned out to be incorrect, despite its ``proof''\bigskip\pause
       
   885   
       
   886   \item we (generalised) the algorithm and then {\bf really} proved that it is correct	
       
   887   \item we implemented this algorithm in a small OS called PINTOS (used for teaching at Stanford)
       
   888   \item our implementation was faster than their reference implementation
       
   889   \end{itemize}
       
   890 
       
   891   \end{frame}
       
   892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   893    
       
   894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   895   \begin{frame}[c]
       
   896   \frametitle{Lessons Learned}
       
   897 
       
   898   \begin{itemize}
       
   899   \item our proof-technique is adapted from security 
       
   900   protocols\bigskip
       
   901  
       
   902   %\item do not venture outside your field of expertise 
       
   903   %\includegraphics[scale=0.03]{smiley.jpg}
       
   904   %\bigskip
       
   905 
       
   906   \item we solved the single-processor case; the multi-processor 
       
   907   case: no idea!
       
   908   \end{itemize}
       
   909 
       
   910   \end{frame}
       
   911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   912 
       
   913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   914 \begin{frame}[c]
       
   915 \frametitle{Regular Expressions}
       
   916 
       
   917 
       
   918 \begin{textblock}{6}(2,5)
       
   919   \begin{tabular}{rrl@ {\hspace{13mm}}l}
       
   920   \bl{$r$} & \bl{$::=$}  & \bl{$\varnothing$}   & null\\
       
   921            & \bl{$\mid$} & \bl{$\epsilon$}      & empty string\\
       
   922            & \bl{$\mid$} & \bl{$c$}             & character\\
       
   923            & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
       
   924            & \bl{$\mid$} & \bl{$r_1 + r_2$}     & alternative / choice\\
       
   925            & \bl{$\mid$} & \bl{$r^*$}           & star (zero or more)\\
       
   926   \end{tabular}
       
   927   \end{textblock}
       
   928   
       
   929 \end{frame}
       
   930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   931 
       
   932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   933 \begin{frame}[c]
       
   934 \frametitle{The Derivative of a Rexp}
       
   935 
       
   936 \large
       
   937 If \bl{$r$} matches the string \bl{$c\!::\!s$}, what is a regular 
       
   938 expression that matches just \bl{$s$}?\bigskip\bigskip\bigskip\bigskip
       
   939 
       
   940 \small
       
   941 \bl{$der\,c\,r$} gives the answer, Brzozowski (1964), Owens (2005)
       
   942 ``\ldots have been lost in the sands of time\ldots''
       
   943 \end{frame}
       
   944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   945 
       
   946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   947 \begin{frame}[c]
       
   948 \frametitle{}
       
   949 
       
   950 
       
   951 \ldots{}whether a regular expression can match the empty string:
       
   952 \begin{center}
       
   953 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
       
   954 \bl{$nullable(\varnothing)$}      & \bl{$\dn$} & \bl{$false$}\\
       
   955 \bl{$nullable(\epsilon)$}           & \bl{$\dn$} &  \bl{$true$}\\
       
   956 \bl{$nullable (c)$}                    & \bl{$\dn$} &  \bl{$false$}\\
       
   957 \bl{$nullable (r_1 + r_2)$}       & \bl{$\dn$} &  \bl{$nullable(r_1) \vee nullable(r_2)$} \\ 
       
   958 \bl{$nullable (r_1 \cdot r_2)$} & \bl{$\dn$} &  \bl{$nullable(r_1) \wedge nullable(r_2)$} \\
       
   959 \bl{$nullable (r^*)$}                 & \bl{$\dn$} & \bl{$true$} \\
       
   960 \end{tabular}
       
   961 \end{center}
       
   962 
       
   963 \end{frame}
       
   964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   965 
       
   966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   967 \begin{frame}[c]
       
   968 \frametitle{The Derivative of a Rexp}
       
   969 
       
   970 \begin{center}
       
   971 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}}
       
   972   \bl{$der\, c\, (\varnothing)$}      & \bl{$\dn$} & \bl{$\varnothing$} & \\
       
   973   \bl{$der\, c\, (\epsilon)$}           & \bl{$\dn$} & \bl{$\varnothing$} & \\
       
   974   \bl{$der\, c\, (d)$}                     & \bl{$\dn$} & \bl{if $c = d$ then $\epsilon$ else $\varnothing$} & \\
       
   975   \bl{$der\, c\, (r_1 + r_2)$}        & \bl{$\dn$} & \bl{$der\, c\, r_1 + der\, c\, r_2$} & \\
       
   976   \bl{$der\, c\, (r_1 \cdot r_2)$}  & \bl{$\dn$}  & \bl{if $nullable (r_1)$}\\
       
   977   & & \bl{then $(der\,c\,r_1) \cdot r_2 + der\, c\, r_2$}\\ 
       
   978   & & \bl{else $(der\, c\, r_1) \cdot r_2$}\\
       
   979   \bl{$der\, c\, (r^*)$}          & \bl{$\dn$} & \bl{$(der\,c\,r) \cdot (r^*)$} &\medskip\\\pause
       
   980 
       
   981   \bl{$\textit{ders}\, []\, r$}     & \bl{$\dn$} & \bl{$r$} & \\
       
   982   \bl{$\textit{ders}\, (c\!::\!s)\, r$} & \bl{$\dn$} & \bl{$\textit{ders}\,s\,(der\,c\,r)$} & \\
       
   983   \end{tabular}
       
   984 \end{center}
       
   985 
       
   986 \end{frame}
       
   987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   988 
       
   989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   990 \begin{frame}[c]
       
   991 \frametitle{Correctness}
       
   992 
       
   993 It is a relative easy exercise in a theorem prover:
       
   994 
       
   995 \begin{center}
       
   996 \bl{$matches(r, s)$}  if and only if  \bl{$s \in L(r)$} 
       
   997 \end{center}\bigskip
       
   998 
       
   999 \small
       
  1000 where \bl{$matches(r, s) \dn nullable(ders(r, s))$}
       
  1001 
       
  1002 \end{frame}
       
  1003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
  1004 
       
  1005 
       
  1006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1007 \begin{frame}[c]
       
  1008 \frametitle{\bl{$({\tt a}^?)^n \cdot {\tt a}^n$}}
       
  1009 
       
  1010 \begin{center}
       
  1011 \begin{tikzpicture}
       
  1012 \begin{axis}[
       
  1013     xlabel={strings of \pcode{a}s},
       
  1014     ylabel={time in secs},
       
  1015     enlargelimits=false,
       
  1016     xtick={0,200,...,1000},
       
  1017     xmax=1000,
       
  1018     ytick={0,5,...,30},
       
  1019     scaled ticks=false,
       
  1020     axis lines=left,
       
  1021     width=9.5cm,
       
  1022     height=7cm, 
       
  1023     legend entries={Python,Ruby,Scala V1,Scala V2},  
       
  1024     legend pos=north west,
       
  1025     legend cell align=left  
       
  1026 ]
       
  1027 \addplot[blue,mark=*, mark options={fill=white}] 
       
  1028   table {re-python.data};
       
  1029 \addplot[brown,mark=pentagon*, mark options={fill=white}] 
       
  1030   table {re-ruby.data};  
       
  1031 \addplot[red,mark=triangle*,mark options={fill=white}] 
       
  1032   table {re1.data};  
       
  1033 \addplot[green,mark=square*,mark options={fill=white}] 
       
  1034   table {re2b.data};
       
  1035 \end{axis}
       
  1036 \end{tikzpicture}
       
  1037 \end{center}
       
  1038 
       
  1039 \end{frame}
       
  1040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
  1041 
       
  1042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1043 \begin{frame}[t]
       
  1044 \frametitle{\bl{$({\tt a}^?)^n \cdot {\tt a}^n$}}
       
  1045 
       
  1046 \begin{center}
       
  1047 \begin{tikzpicture}
       
  1048 \begin{axis}[
       
  1049     xlabel={strings of \pcode{a}s},
       
  1050     ylabel={time in secs},
       
  1051     enlargelimits=false,
       
  1052     xtick={0,3000,...,12000},
       
  1053     xmax=12000,
       
  1054     ymax=35,
       
  1055     ytick={0,5,...,30},
       
  1056     scaled ticks=false,
       
  1057     axis lines=left,
       
  1058     width=9cm,
       
  1059     height=7cm
       
  1060 ]
       
  1061 \addplot[green,mark=square*,mark options={fill=white}] table {re2b.data};
       
  1062 \addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
       
  1063 \end{axis}
       
  1064 \end{tikzpicture}
       
  1065 \end{center}
       
  1066 
       
  1067 \end{frame}
       
  1068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
  1069 
       
  1070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1071 \begin{frame}[c]
       
  1072 \frametitle{POSIX Regex Matching}
       
  1073 
       
  1074 Two rules:
       
  1075 
       
  1076 \begin{itemize}
       
  1077 \item Longest match rule (``maximal munch rule''): The 
       
  1078 longest initial substring matched by any regular expression 
       
  1079 is taken as the next token.
       
  1080 
       
  1081 \begin{center}
       
  1082 \bl{$\texttt{\Grid{iffoo\VS bla}}$}
       
  1083 \end{center}\medskip
       
  1084 
       
  1085 \item Rule priority:
       
  1086 For a particular longest initial substring, the first regular
       
  1087 expression that can match determines the token.
       
  1088 
       
  1089 \begin{center}
       
  1090 \bl{$\texttt{\Grid{if\VS bla}}$}
       
  1091 \end{center}
       
  1092 \end{itemize}\bigskip\pause
       
  1093 
       
  1094 \small
       
  1095 \hfill Kuklewicz: most POSIX matchers are buggy\\
       
  1096 \footnotesize
       
  1097 \hfill \url{http://www.haskell.org/haskellwiki/Regex_Posix}
       
  1098 
       
  1099 \end{frame}
       
  1100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       
  1101 
       
  1102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1103 \begin{frame}[c]
       
  1104 \frametitle{POSIX Regex Matching}
       
  1105 
       
  1106 \begin{itemize}
       
  1107 
       
  1108 \item Sulzmann \& Lu came up with a beautiful
       
  1109 idea for how to extend the simple regular expression 
       
  1110 matcher to POSIX matching/lexing (FLOPS 2014)\bigskip\bigskip
       
  1111 
       
  1112 \begin{tabular}{@{\hspace{4cm}}c@{}}
       
  1113   \includegraphics[scale=0.20]{pics/sulzmann.jpg}\\[-2mm]
       
  1114   \hspace{0cm}\footnotesize Martin Sulzmann
       
  1115 \end{tabular}\bigskip\bigskip
       
  1116 
       
  1117 \item the idea: define an inverse operation to the derivatives
       
  1118 \end{itemize}
       
  1119 
       
  1120 
       
  1121 
       
  1122 \end{frame}
       
  1123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       
  1124 
       
  1125 
       
  1126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1127 \begin{frame}[c]
       
  1128 \frametitle{Regexes and Values}
       
  1129 
       
  1130 Regular expressions and their corresponding values
       
  1131 (for \emph{how} a regular expression matched a string):
       
  1132 
       
  1133 \begin{center}
       
  1134 \begin{columns}
       
  1135 \begin{column}{3cm}
       
  1136 \begin{tabular}{@{}rrl@{}}
       
  1137   \bl{$r$} & \bl{$::=$}  & \bl{$\varnothing$}\\
       
  1138            & \bl{$\mid$} & \bl{$\epsilon$}   \\
       
  1139            & \bl{$\mid$} & \bl{$c$}          \\
       
  1140            & \bl{$\mid$} & \bl{$r_1 \cdot r_2$}\\
       
  1141            & \bl{$\mid$} & \bl{$r_1 + r_2$}   \\
       
  1142   \\
       
  1143            & \bl{$\mid$} & \bl{$r^*$}         \\
       
  1144   \\
       
  1145   \end{tabular}
       
  1146 \end{column}
       
  1147 \begin{column}{3cm}
       
  1148 \begin{tabular}{@{\hspace{-7mm}}rrl@{}}
       
  1149   \bl{$v$} & \bl{$::=$}  & \\
       
  1150            &             & \bl{$Empty$}   \\
       
  1151            & \bl{$\mid$} & \bl{$Char(c)$}          \\
       
  1152            & \bl{$\mid$} & \bl{$Seq(v_1,v_2)$}\\
       
  1153            & \bl{$\mid$} & \bl{$Left(v)$}   \\
       
  1154            & \bl{$\mid$} & \bl{$Right(v)$}  \\
       
  1155            & \bl{$\mid$} & \bl{$[]$}      \\
       
  1156            & \bl{$\mid$} & \bl{$[v_1,\ldots\,v_n]$} \\
       
  1157   \end{tabular}
       
  1158 \end{column}
       
  1159 \end{columns}
       
  1160 \end{center}\pause
       
  1161 
       
  1162 There is also a notion of a string behind a value: \bl{$|v|$}
       
  1163 
       
  1164 \end{frame}
       
  1165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
  1166 
       
  1167 
       
  1168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1169 \begin{frame}[c]
       
  1170 \frametitle{Sulzmann \& Lu Matcher}
       
  1171 
       
  1172 We want to match the string \bl{$abc$} using \bl{$r_1$}:
       
  1173 
       
  1174 \begin{center}
       
  1175 \begin{tikzpicture}[scale=2,node distance=1.3cm,every node/.style={minimum size=8mm}]
       
  1176 \node (r1)  {\bl{$r_1$}};
       
  1177 \node (r2) [right=of r1] {\bl{$r_2$}};
       
  1178 \draw[->,line width=1mm]  (r1) -- (r2) node[above,midway] {\bl{$der\,a$}};\pause
       
  1179 \node (r3) [right=of r2] {\bl{$r_3$}};
       
  1180 \draw[->,line width=1mm]  (r2) -- (r3) node[above,midway] {\bl{$der\,b$}};\pause
       
  1181 \node (r4) [right=of r3] {\bl{$r_4$}};
       
  1182 \draw[->,line width=1mm]  (r3) -- (r4) node[above,midway] {\bl{$der\,c$}};\pause
       
  1183 \draw (r4) node[anchor=west] {\;\raisebox{3mm}{\bl{$\;\;nullable?$}}};\pause
       
  1184 \node (v4) [below=of r4] {\bl{$v_4$}};
       
  1185 \draw[->,line width=1mm]  (r4) -- (v4);\pause
       
  1186 \node (v3) [left=of v4] {\bl{$v_3$}};
       
  1187 \draw[->,line width=1mm]  (v4) -- (v3) node[below,midway] {\bl{$inj\,c$}};\pause
       
  1188 \node (v2) [left=of v3] {\bl{$v_2$}};
       
  1189 \draw[->,line width=1mm]  (v3) -- (v2) node[below,midway] {\bl{$inj\,b$}};\pause
       
  1190 \node (v1) [left=of v2] {\bl{$v_1$}};
       
  1191 \draw[->,line width=1mm]  (v2) -- (v1) node[below,midway] {\bl{$inj\,a$}};\pause
       
  1192 \draw[->,line width=0.5mm]  (r3) -- (v3);
       
  1193 \draw[->,line width=0.5mm]  (r2) -- (v2);
       
  1194 \draw[->,line width=0.5mm]  (r1) -- (v1);
       
  1195 \draw (r4) node[anchor=north west] {\;\raisebox{-8mm}{\bl{$mkeps$}}};
       
  1196 \end{tikzpicture}
       
  1197 \end{center}
       
  1198 
       
  1199 \only<10>{
       
  1200 The original ideas of Sulzmann and Lu are the \bl{\textit{mkeps}} 
       
  1201 and \bl{\textit{inj}} functions (ommitted here).}
       
  1202 \end{frame}
       
  1203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
  1204 
       
  1205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1206 \begin{frame}[t,squeeze]
       
  1207 \frametitle{Sulzmann \& Lu Paper}
       
  1208 
       
  1209 \begin{itemize}
       
  1210 \item I have no doubt the algorithm is correct --- 
       
  1211   the problem is I do not believe their proof.
       
  1212 
       
  1213   \begin{center}
       
  1214   \begin{bubble}[10cm]\small
       
  1215   ``How could I miss this? Well, I was rather careless when 
       
  1216   stating this Lemma :)\smallskip
       
  1217  
       
  1218   Great example how formal machine checked proofs (and 
       
  1219   proof assistants) can help to spot flawed reasoning steps.''
       
  1220   \end{bubble}
       
  1221   \end{center}\pause
       
  1222   
       
  1223   \begin{center}
       
  1224   \begin{bubble}[10cm]\small
       
  1225   ``Well, I don't think there's any flaw. The issue is how to 
       
  1226   come up with a mechanical proof. In my world mathematical 
       
  1227   proof $=$ mechanical proof doesn't necessarily hold.''
       
  1228   \end{bubble}
       
  1229   \end{center}\pause
       
  1230   
       
  1231 \end{itemize}
       
  1232 
       
  1233   \only<3>{%
       
  1234   \begin{textblock}{11}(1,4.4)
       
  1235   \begin{center}
       
  1236   \begin{bubble}[10.9cm]\small\centering
       
  1237   \includegraphics[scale=0.37]{pics/msbug.png}
       
  1238   \end{bubble}
       
  1239   \end{center}
       
  1240   \end{textblock}}
       
  1241   
       
  1242 
       
  1243 \end{frame}
       
  1244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       
  1245 
       
  1246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1247 \begin{frame}[c]
       
  1248 \frametitle{\begin{tabular}{c}The Proof Idea\\[-1mm] by Sulzmann \& Lu
       
  1249 \end{tabular}}
       
  1250 
       
  1251 \begin{itemize}
       
  1252 \item introduce an inductively defined ordering relation 
       
  1253 \bl{$v \succ_r v'$} which captures the idea of POSIX matching
       
  1254 
       
  1255 \item the algorithm returns the maximum of all possible
       
  1256  values that are possible for a regular expression.\pause
       
  1257  \bigskip\small
       
  1258  
       
  1259 \item the idea is from a paper by Cardelli \& Frisch about 
       
  1260 GREEDY matching (GREEDY $=$ preferring instant gratification to delayed
       
  1261 repletion):
       
  1262 
       
  1263 \item e.g.~given \bl{$(a + (b + ab))^*$} and string \bl{$ab$}
       
  1264 
       
  1265 \begin{center}
       
  1266 \begin{tabular}{ll}
       
  1267 GREEDY: & \bl{$[Left(a), Right(Left(b)]$}\\
       
  1268 POSIX:  & \bl{$[Right(Right(Seq(a, b))))]$}  
       
  1269 \end{tabular}
       
  1270 \end{center} 
       
  1271 \end{itemize}
       
  1272 
       
  1273 \end{frame}
       
  1274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1275 
       
  1276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1277 \begin{frame}[c]
       
  1278 \frametitle{}
       
  1279 \centering
       
  1280 
       
  1281 
       
  1282 \bl{\infer{\vdash Empty : \epsilon}{}}\hspace{15mm}
       
  1283 \bl{\infer{\vdash Char(c): c}{}}\bigskip
       
  1284 
       
  1285 \bl{\infer{\vdash Seq(v_1, v_2) : r_1\cdot r_2}{\vdash v_1 : r_1 \quad \vdash v_2 : r_2}}
       
  1286 \bigskip
       
  1287 
       
  1288 \bl{\infer{\vdash Left(v) : r_1 + r_2}{\vdash v : r_1}}\hspace{15mm}
       
  1289 \bl{\infer{\vdash Right(v): r_1 + r_2}{\vdash v : r_2}}\bigskip
       
  1290 
       
  1291 \bl{\infer{\vdash [] : r^*}{}}\hspace{15mm}
       
  1292 \bl{\infer{\vdash [v_1,\ldots, v_n] : r^*}
       
  1293           {\vdash v_1 : r \quad\ldots\quad \vdash v_n : r}}
       
  1294 
       
  1295 \end{frame}
       
  1296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       
  1297 
       
  1298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1299 \begin{frame}<1>[c]
       
  1300 \frametitle{}
       
  1301 \small
       
  1302 
       
  1303 %\begin{tabular}{@{}lll@{}}
       
  1304 %\bl{$POSIX(v, r)$} & \bl{$\dn$} & \bl{$\vdash v : r$}\\ 
       
  1305 % & &   \bl{$\wedge \;\;(\forall v'.\;\; \vdash v' : r \,\wedge\, |v'| = |v| 
       
  1306 %     \Rightarrow v \succ_{\alert<2>{r}} v')$}
       
  1307 %\end{tabular}\bigskip\bigskip\bigskip
       
  1308 
       
  1309 
       
  1310 \centering
       
  1311 
       
  1312 %\bl{\infer{Seq(v_1, v_2) \succ_{\alert<2>{r_1\cdot r_2}} Seq(v'_1, v'_2)}
       
  1313 %   {v_1 = v'_1 \quad v_2 \succ_{\alert<2>{r_2}} v'_2}}\hspace{3mm}
       
  1314 %\bl{\infer{Seq(v_1, v_2) \succ_{\alert<2>{r_1\cdot r_2}} Seq(v'_1, v'_2)}
       
  1315 %   {v_1 \not= v'_1 \quad v_1 \succ_{\alert<2>{r_1}} v'_1}}
       
  1316 %\bigskip
       
  1317 
       
  1318 %\bl{\infer{Left(v) \succ_{\alert<2>{r_1 + r_2}} Left(v')}
       
  1319 %          {v \succ_{\alert<2>{r_1}} v'}}\hspace{15mm}
       
  1320 %\bl{\infer{Right(v) \succ_{\alert<2>{r_1 + r_2}} Right(v')}
       
  1321 %          {v \succ_{\alert<2>{r_2}} v'}}\bigskip\medskip
       
  1322 
       
  1323 %\bl{\infer{Left(v) \succ_{\alert<2>{r_1 + r_2}} Right(v')}
       
  1324 %          {length |v|  \ge length |v'|}}\hspace{15mm}
       
  1325 %\bl{\infer{Right(v) \succ_{\alert<2>{r_1 + r_2}} Left(v')}
       
  1326 %          {length |v| >  length |v'|}}\bigskip
       
  1327 
       
  1328 %\bl{$\big\ldots$}
       
  1329 
       
  1330 \end{frame}
       
  1331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       
  1332 
       
  1333 
       
  1334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1335 \begin{frame}[c]
       
  1336 \frametitle{Problems}
       
  1337 
       
  1338 \begin{itemize}
       
  1339 \item Sulzmann: \ldots Let's assume \bl{$v$} is not 
       
  1340     a $POSIX$ value, then there must be another one
       
  1341     \ldots contradiction.\bigskip\pause
       
  1342 
       
  1343 \item Exists?
       
  1344 
       
  1345 \begin{center}
       
  1346 \bl{$L(r) \not= \varnothing \;\Rightarrow\; \exists v.\;POSIX(v, r)$}
       
  1347 \end{center}\bigskip\bigskip\pause
       
  1348 
       
  1349 \item in the sequence case 
       
  1350 \bl{$Seq(v_1, v_2)\succ_{r_1\cdot r_2} Seq(v_1', v_2')$}, 
       
  1351 the induction hypotheses require
       
  1352 \bl{$|v_1| = |v'_1|$} and \bl{$|v_2| = |v'_2|$}, 
       
  1353 but you only know
       
  1354 
       
  1355 \begin{center}
       
  1356 \bl{$|v_1| \;@\; |v_2| = |v'_1| \;@\; |v'_2|$}
       
  1357 \end{center}\pause\small
       
  1358 
       
  1359 \item although one begins with the assumption that the two 
       
  1360 values have the same flattening, this cannot be maintained 
       
  1361 as one descends into the induction (alternative, sequence)
       
  1362 \end{itemize}
       
  1363 
       
  1364 \end{frame}
       
  1365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       
  1366 
       
  1367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1368 \begin{frame}[c]
       
  1369 \frametitle{Our Solution}
       
  1370 
       
  1371 \begin{itemize}
       
  1372 \item a direct definition of what a POSIX value is, using
       
  1373 the relation \bl{$s \in r \to v$} (specification):\medskip
       
  1374 
       
  1375 \begin{center}
       
  1376 \bl{\infer{[] \in \epsilon \to Empty}{}}\hspace{15mm}
       
  1377 \bl{\infer{c \in c \to Char(c)}{}}\bigskip\medskip
       
  1378 
       
  1379 \bl{\infer{s \in r_1 + r_2 \to Left(v)}
       
  1380           {s \in r_1 \to v}}\hspace{10mm}
       
  1381 \bl{\infer{s \in r_1 + r_2 \to Right(v)}
       
  1382           {s \in r_2 \to v & s \not\in L(r_1)}}\bigskip\medskip
       
  1383 
       
  1384 \bl{\infer{s_1 @ s_2 \in r_1 \cdot r_2 \to Seq(v_1, v_2)}
       
  1385           {\small\begin{array}{l}
       
  1386            s_1 \in r_1 \to v_1 \\
       
  1387            s_2 \in r_2 \to v_2 \\
       
  1388            \neg(\exists s_3\,s_4.\; s_3 \not= []
       
  1389            \wedge s_3 @ s_4 = s_2 \wedge
       
  1390            s_1 @ s_3 \in L(r_1) \wedge
       
  1391            s_4 \in L(r_2))
       
  1392            \end{array}}}
       
  1393            
       
  1394 \bl{\ldots}           
       
  1395 \end{center}
       
  1396 \end{itemize}
       
  1397 
       
  1398 \end{frame}
       
  1399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1400 
       
  1401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1402 \begin{frame}[c]
       
  1403 \frametitle{Properties}
       
  1404 
       
  1405 It is almost trival to prove:
       
  1406 
       
  1407 \begin{itemize}
       
  1408 \item Uniqueness
       
  1409 \begin{center}
       
  1410 If \bl{$s \in r \to v_1$} and \bl{$s \in r \to v_2$} then
       
  1411 \bl{$v_1 = v_2$}.
       
  1412 \end{center}\bigskip
       
  1413 
       
  1414 \item Correctness
       
  1415 \begin{center}
       
  1416 \bl{$lexer(r, s) = v$} if and only if \bl{$s \in r \to v$}
       
  1417 \end{center}
       
  1418 \end{itemize}\bigskip\bigskip\pause
       
  1419 
       
  1420 
       
  1421 You can now start to implement optimisations and derive
       
  1422 correctness proofs for them. But we still do not know whether
       
  1423 
       
  1424 \begin{center}
       
  1425 \bl{$s \in r \to v$} 
       
  1426 \end{center}
       
  1427 
       
  1428 is a POSIX value according to Sulzmann \& Lu's definition
       
  1429 (biggest value for \bl{$s$} and \bl{$r$})
       
  1430 \end{frame}
       
  1431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       
  1432 
       
  1433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1434 \begin{frame}[t]
       
  1435   \frametitle{\Large\begin{tabular}{@{}c@{}}Pencil-and-Paper Proofs\\[-1mm] 
       
  1436   in CS are normally incorrect\end{tabular}}
       
  1437 
       
  1438 \begin{itemize}
       
  1439 \item case in point: in one of Roy's proofs he made the 
       
  1440 incorrect inference
       
  1441 
       
  1442 \begin{center}
       
  1443 if \bl{$\forall s.\; |v_2| \alert{\not}\in L(der\,c\,r_1) \cdot s$}
       
  1444 then \bl{$\forall s.\; c\,|v_2| \alert{\not}\in L(r_1) \cdot s$}
       
  1445 \end{center}\bigskip
       
  1446 
       
  1447 while 
       
  1448 
       
  1449 \begin{center}
       
  1450 if \bl{$\forall s.\; |v_2| \in L(der\,c\,r_1) \cdot s$}
       
  1451 then \bl{$\forall s.\; c\,|v_2| \in L(r_1) \cdot s$}
       
  1452 \end{center}
       
  1453 
       
  1454 is correct
       
  1455 
       
  1456 \end{itemize}
       
  1457 
       
  1458 
       
  1459 \begin{textblock}{11}(12,11)
       
  1460 \includegraphics[scale=0.15]{pics/roy.jpg}
       
  1461 \end{textblock}
       
  1462 \end{frame}
       
  1463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1464   \begin{frame}[c]
       
  1465   \frametitle{Proofs in Math~vs.~in CS}
       
  1466   
       
  1467   \alert{\bf My theory on why CS-proofs are often buggy}
       
  1468   \\[-10mm]\mbox{}
       
  1469   
       
  1470   \begin{center}
       
  1471   \begin{tabular}{@{}cc@{}}
       
  1472   \begin{tabular}{@{}p{5.6cm}} 
       
  1473   \includegraphics[scale=0.43]{pics/icosahedron.png}\\[2mm] 
       
  1474   {\bf Math}: \\
       
  1475   \raggedright\small
       
  1476   in math, ``objects'' can be ``looked'' at from all 
       
  1477   ``angles'';\\\smallskip 
       
  1478   non-trivial proofs, but it seems
       
  1479   difficult to make mistakes
       
  1480   \end{tabular} &
       
  1481   \begin{tabular}{p{5cm}} 
       
  1482   \includegraphics[scale=0.2]{pics/sel4callgraph.jpg}\\[3mm]
       
  1483   \raggedright
       
  1484   {\bf Code in CS}: \\
       
  1485   \raggedright\small
       
  1486   the call-graph of the seL4 microkernel OS;\\\smallskip 
       
  1487   easy to make mistakes\\ \mbox{}\\
       
  1488   \end{tabular}
       
  1489   \end{tabular}
       
  1490   \end{center}
       
  1491 
       
  1492   \end{frame}
       
  1493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1494 
       
  1495 
       
  1496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1497 \begin{frame}[c]
       
  1498 \frametitle{Conclusion}
       
  1499 
       
  1500 \begin{itemize}
       
  1501 
       
  1502 \item we replaced the POSIX definition of Sulzmann \& Lu by a
       
  1503       new definition (ours is inspired by work of Vansummeren,
       
  1504       2006)\medskip
       
  1505   
       
  1506 \item their proof contained small gaps (acknowledged) but had
       
  1507       also fundamental flaws\medskip
       
  1508 
       
  1509 \item now, its a nice exercise for theorem proving\medskip
       
  1510 
       
  1511 \item some optimisations need to be applied to the algorithm
       
  1512       in order to become fast enough\medskip
       
  1513 
       
  1514 \item can be used for lexing, is a small beautiful functional
       
  1515       program
       
  1516  
       
  1517 \end{itemize}
       
  1518 
       
  1519 \end{frame}
       
  1520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       
  1521 
       
  1522 
       
  1523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
  1524   \begin{frame}[b]
       
  1525   \frametitle{
       
  1526   \begin{tabular}{c}
       
  1527   \mbox{}\\[13mm]
       
  1528 %  \alert{\Large Thank you very much again}\\
       
  1529 %  \alert{\Large for the invitation!}\\
       
  1530   \alert{\LARGE Questions?}
       
  1531   \end{tabular}}
       
  1532 
       
  1533   \end{frame}
       
  1534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
  1535 
       
  1536 \end{document}
       
  1537 
       
  1538 
       
  1539 %%% Local Variables:  
       
  1540 %%% mode: latex
       
  1541 %%% TeX-master: t
       
  1542 %%% End: 
       
  1543