|         |      1 \documentclass[dvipsnames,14pt,t,xelatex]{beamer} | 
|         |      2 \usepackage{../slides} | 
|         |      3 \usepackage{../graphics} | 
|         |      4 \usepackage{../langs} | 
|         |      5 %%\usepackage{../data} | 
|         |      6 \usepackage[export]{adjustbox} | 
|         |      7  | 
|         |      8 \hfuzz=220pt  | 
|         |      9  | 
|         |     10 %\setmonofont[Scale=.88]{Consolas} | 
|         |     11 %\newfontfamily{\consolas}{Consolas} | 
|         |     12  | 
|         |     13 \lstset{language=Scala, | 
|         |     14         style=mystyle, | 
|         |     15         numbersep=0pt, | 
|         |     16         numbers=none, | 
|         |     17         xleftmargin=0mm} | 
|         |     18  | 
|         |     19 \newcommand{\bl}[1]{\textcolor{blue}{#1}}      | 
|         |     20  | 
|         |     21 % beamer stuff  | 
|         |     22 \renewcommand{\slidecaption}{PEP (Scala) 05, King's College London} | 
|         |     23  | 
|         |     24 \begin{filecontents}{re3a.data} | 
|         |     25 1 0.00003 | 
|         |     26 500001 0.22527 | 
|         |     27 1000001 0.62752 | 
|         |     28 1500001 0.88485 | 
|         |     29 2000001 1.39815 | 
|         |     30 2500001 1.68619 | 
|         |     31 3000001 1.94957 | 
|         |     32 3500001 2.15878 | 
|         |     33 4000001 2.59918 | 
|         |     34 4500001 5.90679 | 
|         |     35 5000001 13.11295 | 
|         |     36 5500001 19.15376 | 
|         |     37 6000001 40.16373 | 
|         |     38 \end{filecontents} | 
|         |     39 \begin{filecontents}{re-python2.data} | 
|         |     40 1 0.033 | 
|         |     41 5 0.036 | 
|         |     42 10 0.034 | 
|         |     43 15 0.036 | 
|         |     44 18 0.059 | 
|         |     45 19 0.084 | 
|         |     46 20 0.141 | 
|         |     47 21 0.248 | 
|         |     48 22 0.485 | 
|         |     49 23 0.878 | 
|         |     50 24 1.71 | 
|         |     51 25 3.40 | 
|         |     52 26 7.08 | 
|         |     53 27 14.12 | 
|         |     54 28 26.69 | 
|         |     55 \end{filecontents} | 
|         |     56  | 
|         |     57 \begin{filecontents}{re-java.data} | 
|         |     58 5  0.00298 | 
|         |     59 10  0.00418 | 
|         |     60 15  0.00996 | 
|         |     61 16  0.01710 | 
|         |     62 17  0.03492 | 
|         |     63 18  0.03303 | 
|         |     64 19  0.05084 | 
|         |     65 20  0.10177 | 
|         |     66 21  0.19960 | 
|         |     67 22  0.41159 | 
|         |     68 23  0.82234 | 
|         |     69 24  1.70251 | 
|         |     70 25  3.36112 | 
|         |     71 26  6.63998 | 
|         |     72 27  13.35120 | 
|         |     73 28  29.81185 | 
|         |     74 \end{filecontents} | 
|         |     75  | 
|         |     76 %All O2 technical teams are working closely with one of our third party suppliers who has identified a global software issue in their system which has impacted data services.   | 
|         |     77  | 
|         |     78  | 
|         |     79 \begin{document} | 
|         |     80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |     81 \begin{frame}[t] | 
|         |     82 \frametitle{% | 
|         |     83   \begin{tabular}{@ {}c@ {}} | 
|         |     84   \\[5mm] | 
|         |     85   \huge PEP Scala (5)  | 
|         |     86   \end{tabular}} | 
|         |     87  | 
|         |     88   \normalsize | 
|         |     89   \begin{center} | 
|         |     90   \begin{tabular}{ll} | 
|         |     91     Email:  & christian.urban at kcl.ac.uk\\ | 
|         |     92     Office: & N\liningnums{7.07} (North Wing, Bush House)\\ | 
|         |     93     Slides \& Code: & KEATS\medskip\\ | 
|         |     94     Office Hours: &  Mondays 12:00 -- 14:00\\ | 
|         |     95   \end{tabular} | 
|         |     96   \end{center} | 
|         |     97  | 
|         |     98  | 
|         |     99 \end{frame} | 
|         |    100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%      | 
|         |    101  | 
|         |    102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    103 \begin{frame}[c,fragile] | 
|         |    104 \small | 
|         |    105    | 
|         |    106 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-7mm] | 
|         |    107 def get_csv_url(url: String) : List[String] = { | 
|         |    108   val csv = Try(Source.fromURL(url)).getOrElse(null) | 
|         |    109    if (csv == null){ | 
|         |    110      List() | 
|         |    111    } | 
|         |    112    else { | 
|         |    113      .... | 
|         |    114    } | 
|         |    115 } | 
|         |    116 \end{lstlisting} | 
|         |    117  | 
|         |    118 \pause | 
|         |    119 \bigskip | 
|         |    120 \rule{11cm}{0.3mm} | 
|         |    121 \bigskip | 
|         |    122  | 
|         |    123 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-7mm] | 
|         |    124 def get_csv_url(url: String) : List[String] = { | 
|         |    125   Try(Source.fromURL(url)....).getOrElse(Nil) | 
|         |    126 \end{lstlisting} | 
|         |    127  | 
|         |    128  | 
|         |    129 \end{frame} | 
|         |    130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  | 
|         |    131  | 
|         |    132  | 
|         |    133  | 
|         |    134  | 
|         |    135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    136 \begin{frame}[c,fragile] | 
|         |    137 \small | 
|         |    138    | 
|         |    139 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-7mm] | 
|         |    140 def get_csv_url(url: String) : List[String] = { | 
|         |    141     try { | 
|         |    142         val csvFile = Source.fromURL(url) | 
|         |    143         .... | 
|         |    144     } catch { | 
|         |    145         case unknown : Throwable => List() | 
|         |    146     } | 
|         |    147 } | 
|         |    148 \end{lstlisting} | 
|         |    149  | 
|         |    150  | 
|         |    151 \bigskip | 
|         |    152 \rule{11cm}{0.3mm} | 
|         |    153 \bigskip | 
|         |    154  | 
|         |    155 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-7mm] | 
|         |    156 def get_csv_url(url: String) : List[String] = { | 
|         |    157   Try(Source.fromURL(url)....).getOrElse(Nil) | 
|         |    158 \end{lstlisting} | 
|         |    159  | 
|         |    160  | 
|         |    161 \end{frame} | 
|         |    162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  | 
|         |    163  | 
|         |    164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    165   \begin{frame}[c] | 
|         |    166   \frametitle{Dijkstra on Testing} | 
|         |    167    | 
|         |    168   \begin{bubble}[10cm] | 
|         |    169   ``Program testing can be a very effective way to show the | 
|         |    170   presence of bugs, but it is hopelessly inadequate for showing | 
|         |    171   their absence.'' | 
|         |    172   \end{bubble}\bigskip | 
|         |    173    | 
|         |    174    | 
|         |    175   \end{frame} | 
|         |    176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    177  | 
|         |    178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    179 \begin{frame}[c] | 
|         |    180 \frametitle{\Large Proving Programs to be Correct} | 
|         |    181  | 
|         |    182 \begin{bubble}[10cm] | 
|         |    183 \small | 
|         |    184 {\bf Theorem:} There are infinitely many prime  | 
|         |    185 numbers.\medskip\\ | 
|         |    186  | 
|         |    187 {\bf Proof} \ldots\\ | 
|         |    188 \end{bubble}\bigskip | 
|         |    189  | 
|         |    190  | 
|         |    191 similarly\bigskip | 
|         |    192  | 
|         |    193 \begin{bubble}[10cm] | 
|         |    194 \small | 
|         |    195 {\bf Theorem:} The program is doing what  | 
|         |    196 it is supposed to be doing.\medskip | 
|         |    197  | 
|         |    198 {\bf Long, long proof} \ldots\\ | 
|         |    199 \end{bubble}\bigskip\medskip | 
|         |    200  | 
|         |    201 \small This can be a gigantic proof. The only hope is to have | 
|         |    202 help from the computer. `Program' is here to be understood to be | 
|         |    203 quite general (compiler, OS, \ldots). | 
|         |    204  | 
|         |    205 \end{frame} | 
|         |    206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    207  | 
|         |    208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%      | 
|         |    209  | 
|         |    210 \begin{frame}[c] | 
|         |    211 \frametitle{Can This Be Done?} | 
|         |    212  | 
|         |    213 \begin{itemize} | 
|         |    214 \item in 2011, verification of a small C-compiler (CompCert) | 
|         |    215 \begin{itemize} | 
|         |    216 \item ``if my input program has a certain behaviour, then the compiled machine code has the same behaviour'' | 
|         |    217 \item is as good as \texttt{gcc -O1}, but much, much less buggy  | 
|         |    218 \end{itemize} | 
|         |    219 \end{itemize} | 
|         |    220  | 
|         |    221 \begin{center} | 
|         |    222   \includegraphics[scale=0.12]{../pics/compcert.png} | 
|         |    223 \end{center} | 
|         |    224  | 
|         |    225 \end{frame} | 
|         |    226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    227  | 
|         |    228  | 
|         |    229  | 
|         |    230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%      | 
|         |    231 \begin{frame}[c] | 
|         |    232 \frametitle{Fuzzy Testing C-Compilers} | 
|         |    233  | 
|         |    234 \begin{itemize} | 
|         |    235 \item tested GCC, LLVM and others by randomly generating  | 
|         |    236 C-programs | 
|         |    237 \item found more than 300 bugs in GCC and also | 
|         |    238 many in LLVM (some of them highest-level critical)\bigskip | 
|         |    239 \item about CompCert: | 
|         |    240  | 
|         |    241 \begin{bubble}[10cm]\small ``The striking thing about our CompCert | 
|         |    242 results is that the middle-end bugs we found in all other | 
|         |    243 compilers are absent. As of early 2011, the under-development | 
|         |    244 version of CompCert is the only compiler we have tested for | 
|         |    245 which Csmith cannot find wrong-code errors. This is not for | 
|         |    246 lack of trying: we have devoted about six CPU-years to the | 
|         |    247 task.''  | 
|         |    248 \end{bubble}  | 
|         |    249 \end{itemize} | 
|         |    250  | 
|         |    251 \end{frame} | 
|         |    252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%      | 
|         |    253  | 
|         |    254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    255 \begin{frame}[c] | 
|         |    256 \frametitle{seL4 / Isabelle} | 
|         |    257  | 
|         |    258 \begin{itemize} | 
|         |    259 \item verified a microkernel operating system ($\approx$8000 lines of C code)\bigskip | 
|         |    260 \item US DoD has competitions to hack into drones; they found that the | 
|         |    261   isolation guarantees of seL4 hold up\bigskip | 
|         |    262 \item CompCert and seL4 sell their code   | 
|         |    263 \end{itemize} | 
|         |    264  | 
|         |    265 \only<2>{ | 
|         |    266 \begin{textblock}{5}(5.5,1.9) | 
|         |    267   \includegraphics[scale=0.25]{../pics/drone.jpg} | 
|         |    268 \end{textblock}} | 
|         |    269  | 
|         |    270 \end{frame} | 
|         |    271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    272  | 
|         |    273  | 
|         |    274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   | 
|         |    275 \begin{frame}[c] | 
|         |    276   \frametitle{CW9 : Regexes} | 
|         |    277    | 
|         |    278 \begin{center} | 
|         |    279   Graphs: $(a^*)^* b$ and strings $\underbrace{\;a\ldots a\;}_{n}$\bigskip | 
|         |    280    | 
|         |    281 \begin{tabular}[t]{@{\hspace{-8mm}}c@{\hspace{-4mm}}c@{}} | 
|         |    282 \raisebox{6mm}{\begin{tikzpicture} | 
|         |    283 \begin{axis}[ | 
|         |    284     xlabel={$n$}, | 
|         |    285     x label style={at={(1.05,0.0)}}, | 
|         |    286     ylabel={time in secs}, | 
|         |    287     enlargelimits=false, | 
|         |    288     xtick={0,5,...,30}, | 
|         |    289     xmax=33, | 
|         |    290     ymax=35, | 
|         |    291     ytick={0,5,...,30}, | 
|         |    292     scaled ticks=false, | 
|         |    293     axis lines=left, | 
|         |    294     width=5.5cm, | 
|         |    295     height=5cm,  | 
|         |    296     legend entries={Python,  Java 8},   | 
|         |    297     legend pos=north west, | 
|         |    298     legend cell align=left] | 
|         |    299 \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};   | 
|         |    300 \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data}; | 
|         |    301 \end{axis} | 
|         |    302 \end{tikzpicture}} | 
|         |    303   & | 
|         |    304 \onslide<1>{\begin{tikzpicture} | 
|         |    305   \begin{axis}[ | 
|         |    306     xlabel={$n$}, | 
|         |    307     x label style={at={(1.05,0.0)}}, | 
|         |    308     ylabel={time in secs}, | 
|         |    309     enlargelimits=false, | 
|         |    310     ymax=35, | 
|         |    311     ytick={0,5,...,30}, | 
|         |    312     axis lines=left, | 
|         |    313     %%scaled ticks=false, | 
|         |    314     width=5.5cm,  | 
|         |    315     height=5cm] | 
|         |    316 %%\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};     | 
|         |    317 \addplot[red,mark=square*,mark options={fill=white}] table {re3a.data}; | 
|         |    318 \end{axis} | 
|         |    319 \end{tikzpicture}} | 
|         |    320 \end{tabular} | 
|         |    321 \end{center} | 
|         |    322  | 
|         |    323  | 
|         |    324 \small | 
|         |    325 \hfill Kuklewicz: most POSIX matchers are buggy\\ | 
|         |    326 \footnotesize | 
|         |    327 \hfill \url{http://www.haskell.org/haskellwiki/Regex_Posix} | 
|         |    328 \end{frame} | 
|         |    329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%      | 
|         |    330  | 
|         |    331 \begin{frame}[c] | 
|         |    332 \frametitle{Where to go on from here?} | 
|         |    333  | 
|         |    334 \begin{itemize} | 
|         |    335 \item Martin Odersky (EPFL)\ldots he is currently throwing out everything | 
|         |    336   and starts again with the dotty compiler for Scala\medskip | 
|         |    337  | 
|         |    338 \item Elm (\url{http://elm-lang.org})\ldots web applications with style\medskip    | 
|         |    339  | 
|         |    340 \item Haskell, Ocaml, Standard ML, Scheme, \ldots  | 
|         |    341 \end{itemize}   | 
|         |    342 \end{frame} | 
|         |    343  | 
|         |    344  | 
|         |    345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    346  | 
|         |    347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    348 \begin{frame}[c,fragile] | 
|         |    349 \frametitle{\alert{Questions?}} | 
|         |    350  | 
|         |    351 {\tiny | 
|         |    352 \begin{verbatim} | 
|         |    353                                * | 
|         |    354                               * * | 
|         |    355                              *   * | 
|         |    356                             * * * * | 
|         |    357                            *       * | 
|         |    358                           * *     * * | 
|         |    359                          *   *   *   * | 
|         |    360                         * * * * * * * * | 
|         |    361                        *               * | 
|         |    362                       * *             * * | 
|         |    363                      *   *           *   * | 
|         |    364                     * * * *         * * * * | 
|         |    365                    *       *       *       * | 
|         |    366                   * *     * *     * *     * * | 
|         |    367                  *   *   *   *   *   *   *   * | 
|         |    368                 * * * * * * * * * * * * * * * * | 
|         |    369                *                               * | 
|         |    370               * *                             * * | 
|         |    371              *   *                           *   * | 
|         |    372             * * * *                         * * * * | 
|         |    373            *       *                       *       * | 
|         |    374           * *     * *                     * *     * * | 
|         |    375          *   *   *   *                   *   *   *   * | 
|         |    376         * * * * * * * *                 * * * * * * * * | 
|         |    377        *               *               *               * | 
|         |    378       * *             * *             * *             * * | 
|         |    379      *   *           *   *           *   *           *   * | 
|         |    380     * * * *         * * * *         * * * *         * * * * | 
|         |    381    *       *       *       *       *       *       *       * | 
|         |    382   * *     * *     * *     * *     * *     * *     * *     * * | 
|         |    383  *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   * | 
|         |    384 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | 
|         |    385 \end{verbatim}} | 
|         |    386  | 
|         |    387  | 
|         |    388 \begin{textblock}{6}(8.5,3.5) | 
|         |    389 \begin{bubble}[5cm] | 
|         |    390 \footnotesize | 
|         |    391 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm] | 
|         |    392 ++++++++[>+>++++<<-]>++>> | 
|         |    393 +<[-[>>+<<-]+>>]>+[-<<<[- | 
|         |    394 >[+[-]+>++>>>-<<]<[<]>>++ | 
|         |    395 ++++[<<+++++>>-]+<<++.[-] | 
|         |    396 <<]>.>+[>>]>+] | 
|         |    397 \end{lstlisting} | 
|         |    398 \end{bubble} | 
|         |    399 \end{textblock} | 
|         |    400    | 
|         |    401 \end{frame} | 
|         |    402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    | 
|         |    403  | 
|         |    404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%      | 
|         |    405  | 
|         |    406 \begin{frame}[c] | 
|         |    407 \frametitle{Marks for CW6 (Part 1 + 2)} | 
|         |    408  | 
|         |    409 Raw marks: | 
|         |    410  | 
|         |    411 \begin{itemize} | 
|         |    412 \item 6\%: 154 students | 
|         |    413 \item 5\%: 66 | 
|         |    414 \item 4\%: 18 | 
|         |    415 \item 3\%: 13 | 
|         |    416 \item 2\%: 2 | 
|         |    417 \item 1\%: 1 | 
|         |    418 \item 0\%: 21  | 
|         |    419 \end{itemize}   | 
|         |    420 \end{frame} | 
|         |    421  | 
|         |    422  | 
|         |    423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
|         |    424  | 
|         |    425 \end{document} | 
|         |    426  | 
|         |    427  | 
|         |    428 \end{document} | 
|         |    429  | 
|         |    430 %%% Local Variables:   | 
|         |    431 %%% mode: latex | 
|         |    432 %%% TeX-master: t | 
|         |    433 %%% End:  | 
|         |    434  |