slides/slides09.tex
author Christian Urban <urbanc@in.tum.de>
Thu, 28 Nov 2019 08:18:57 +0000
changeset 701 681c36b2af27
parent 612 7a12053567d4
child 702 39e21a33ffb0
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
     1
% !TEX program = xelatex
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
\documentclass[dvipsnames,14pt,t]{beamer}
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     3
\usepackage{../slides}
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 207
diff changeset
     4
\usepackage{../langs}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
     5
\usepackage{../data}
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     6
\usepackage{../graphics}
379
fa2589ec0fae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 312
diff changeset
     7
\usepackage{../grammar}
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
     8
\usepackage{soul}
610
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
     9
\usepackage{mathpartir}
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    10
\usetikzlibrary{shapes,arrows,shadows}
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
    11
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    12
% beamer stuff
459
780486571e38 updated
Christian Urban <urbanc@in.tum.de>
parents: 384
diff changeset
    13
\renewcommand{\slidecaption}{CFL 09, King's College London}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    14
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    15
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
    16
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
\begin{document}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    18
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    20
\begin{frame}[t]
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
\frametitle{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
  \begin{tabular}{@ {}c@ {}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
  \\[-3mm]
459
780486571e38 updated
Christian Urban <urbanc@in.tum.de>
parents: 384
diff changeset
    24
  \LARGE Compilers and \\[-2mm] 
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    25
  \LARGE Formal Languages (9)\\[3mm] 
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
  \end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    27
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
  \normalsize
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
  \begin{tabular}{ll}
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    31
    Email:  & christian.urban at kcl.ac.uk\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    32
    Office Hours: & Thursdays 12 -- 14\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    33
    Location: & N7.07 (North Wing, Bush House)\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    34
    Slides \& Progs: & KEATS (also homework is there)\\  
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    35
  \end{tabular}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    36
  \end{center}
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
    37
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    38
\end{frame}
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    39
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    40
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    41
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    42
\begin{frame}[c,fragile]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    43
\frametitle{Functional Programming}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    44
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    45
\footnotesize
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    46
\begin{textblock}{13}(0.9,3)
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    47
\begin{lstlisting}[]numbers=none]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    48
def fib(n) = if n == 0 then 0 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    49
             else if n == 1 then 1 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    50
             else fib(n - 1) + fib(n - 2);
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    51
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    52
def fact(n) = if n == 0 then 1 else n * fact(n - 1);
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    53
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    54
def ack(m, n) = if m == 0 then n + 1
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    55
                else if n == 0 then ack(m - 1, 1)
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    56
                else ack(m - 1, ack(m, n - 1));
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    57
                
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    58
def gcd(a, b) = if b == 0 then a else gcd(b, a % b);                
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    59
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    60
\end{textblock}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    61
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    62
\end{frame}
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    63
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    64
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    65
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    66
\begin{frame}[c,fragile]
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    67
\frametitle{Factorial on the JVM}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
    68
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    69
\begin{textblock}{7}(1,1.8)\footnotesize
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    70
\begin{minipage}{6cm}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    71
\begin{lstlisting}[language=JVMIS,basicstyle=\ttfamily, numbers=none]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    72
.method public static facT(II)I 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    73
.limit locals 2
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    74
.limit stack 6
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    75
  iload 0
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    76
  ldc 0
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    77
  if_icmpne If_else_2
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    78
  iload 1
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    79
  goto If_end_3
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    80
If_else_2:
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    81
  iload 0
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    82
  ldc 1
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    83
  isub
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    84
  iload 0
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    85
  iload 1
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    86
  imul
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    87
  invokestatic fact/fact/facT(II)I
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    88
If_end_3:
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    89
  ireturn
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    90
.end method 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    91
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    92
\end{minipage}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    93
\end{textblock}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    94
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    95
\begin{textblock}{7}(6,7)
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    96
\begin{bubble}[7cm]\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    97
\begin{lstlisting}[language=Lisp,
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    98
                   basicstyle=\ttfamily, 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
    99
                   numbers=none,
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   100
                   xleftmargin=1mm,linebackgroundcolor=\color{cream}]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   101
def facT(n, acc) = 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   102
  if n == 0 then acc 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   103
  else facT(n - 1, n * acc);
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   104
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   105
\end{bubble}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   106
\end{textblock}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   107
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   108
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   109
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   110
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   111
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   112
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   113
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   114
\frametitle{LLVM}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   115
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   116
\begin{itemize}
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   117
  \item Chris Lattner, Vikram Adve (started in 2000)
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   118
  \item Apple hired Lattner in 2006
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   119
  \item modular architecture, LLVM-IR
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   120
  \item \texttt{lli} and \texttt{llc} 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   121
\end{itemize}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   122
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   123
\end{frame}
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   124
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   125
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   126
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   127
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   128
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   129
\tikzstyle{sensor}=[draw, fill=blue!20, text width=3.8em, line width=1mm,
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   130
    text centered, minimum height=2em,drop shadow]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   131
\tikzstyle{ann} = [above, text width=4em, text centered]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   132
\tikzstyle{sc} = [sensor, text width=7em, fill=red!20, 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   133
    minimum height=6em, rounded corners, drop shadow,line width=1mm]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   134
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   135
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   136
\frametitle{LLVM: Overview}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   137
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   138
\begin{tikzpicture}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   139
    % Validation Layer is the same except that there are a set of nodes and links which are added
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   140
   
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   141
    \path (0,0) node (IR) [sc] {\textbf{LLVM-IR}\\ Optimisations};
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   142
    \path (IR.west)+(-2.2,1.7) node (sou1) [sensor] {C++};
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   143
    \path (IR.west)+(-2.2,0.5) node (sou2)[sensor] {C};
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   144
    \path (IR.west)+(-2.2,-1.0) node (dots)[ann] {$\vdots$}; 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   145
    \path (IR.west)+(-2.2,-1.8) node (sou3)[sensor] {Haskell};    
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   146
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   147
    \path [draw,->,line width=1mm] (sou1.east) -- node [above] {} (IR.160);
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   148
    \path [draw,->,line width=1mm] (sou2.east) -- node [above] {} (IR.180);
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   149
    \path [draw,->,line width=1mm] (sou3.east) -- node [above] {} (IR.200);
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   150
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   151
    \path (IR.east)+(2.2,2.0)  node (tar1)[sensor] {x86};
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   152
    \path (IR.east)+(2.2,0.8)  node (tar2)[sensor] {ARM};
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   153
    \path (IR.east)+(2.2,-0.4) node (tar3)[sensor] {MIPS}; 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   154
    \path (IR.east)+(2.2,-1.6) node (tar4)[sensor] {RISC}; 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   155
    \path (IR.east)+(2.2,-2.8) node (tar5)[sensor] {Power PC};
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   156
    \path (IR.east)+(2.2,-4.2) node (dots2)[ann] {$\vdots$};
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   157
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   158
    \path [draw,<-,line width=1mm] (tar1.west) -- node [above] {} (IR.10);
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   159
    \path [draw,<-,line width=1mm] (tar2.west) -- node [above] {} (IR.5);
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   160
    \path [draw,<-,line width=1mm] (tar3.west) -- node [above] {} (IR.0);
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   161
    \path [draw,<-,line width=1mm] (tar4.west) -- node [above] {} (IR.-5);
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   162
    \path [draw,<-,line width=1mm] (tar5.west) -- node [above] {} (IR.-10);
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   163
    
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   164
\end{tikzpicture}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   165
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   166
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   167
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   168
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   169
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   170
\begin{frame}[fragile,t]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   171
\frametitle{LLVM-IR}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   172
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   173
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   174
\begin{textblock}{7.7}(8,11.4)
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   175
\begin{bubble}[5cm]\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   176
\begin{lstlisting}[language=Lisp,
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   177
                   numbers=none,
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   178
                   xleftmargin=1mm,linebackgroundcolor=\color{cream}]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   179
def fact(n) =
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   180
  if n == 0 then 1 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   181
  else n * fact(n - 1)
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   182
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   183
\end{bubble}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   184
\end{textblock}
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
   185
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   186
\begin{lstlisting}[language=LLVM,xleftmargin=-7mm]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   187
define i32 @fact (i32 %n) {
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   188
   %tmp_19 = icmp eq i32  %n, 0
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   189
   br i1 %tmp_19, label %if_br_23, label %else_br_24
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   190
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   191
if_br_23:
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   192
   ret i32 1
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   193
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   194
else_br_24:
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   195
   %tmp_21 = sub i32  %n, 1
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   196
   %tmp_22 = call i32 @fact (i32 %tmp_21)
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   197
   %tmp_20 = mul i32  %n, %tmp_22
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   198
   ret i32 %tmp_20
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   199
}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   200
\end{lstlisting}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   201
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   202
\end{frame}
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   203
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   204
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   205
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   206
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   207
\frametitle{LLVM Types}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   208
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   209
\tt
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   210
\begin{center}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   211
\begin{tabular}{ll}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   212
boolean & i1 \\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   213
byte    & i8 \\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   214
short   & i16\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   215
char    & i16\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   216
integer & i32\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   217
long    & i64\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   218
float   & float\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   219
double  & double\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   220
*\_      & pointer to \\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   221
**\_     & pointer to a pointer to\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   222
\mbox{}[\_]    & arrays of\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   223
\end{tabular}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   224
\end{center}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   225
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   226
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   227
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   228
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   229
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   230
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   231
\frametitle{LLVM Instructions}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   232
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   233
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   234
\begin{lstlisting}[language=LLVM]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   235
br i1 %var, label %if_br, label %else_br
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   236
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   237
icmp eq i32  %x, %y     ; for equal
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   238
icmp sle i32 %x, %y     ;   signed less or equal
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   239
icmp slt i32 %x, %y     ;   signed less than
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   240
icmp ult i32 %x, %y     ;   unsigned less than 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   241
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   242
%var = call i32 @foo(...args...)
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   243
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   244
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   245
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   246
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   247
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   248
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   249
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   250
\frametitle{SSA Format}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   251
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   252
\bl{$(1 + a) + (3 + (b * 5))$}\bigskip\bigskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   253
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   254
\begin{lstlisting}[language=LLVM]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   255
let tmp0 = add 1 a in   
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   256
let tmp1 = mul b 5 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   257
let tmp2 = add 3 tmp1 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   258
let tmp3 = add tmp0 tmp2 in
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   259
  tmp3 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   260
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   261
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   262
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   263
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   264
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   265
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   266
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   267
\frametitle{Abstract Syntax Trees}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   268
\footnotesize
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   269
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   270
\begin{lstlisting}[language=Scala,numbers=none,xleftmargin=-3mm]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   271
// Fun language (expressions)
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   272
abstract class Exp 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   273
abstract class BExp 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   274
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   275
case class Call(name: String, args: List[Exp]) extends Exp
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   276
case class If(a: BExp, e1: Exp, e2: Exp) extends Exp
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   277
case class Write(e: Exp) extends Exp
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   278
case class Var(s: String) extends Exp
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   279
case class Num(i: Int) extends Exp
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   280
case class Aop(o: String, a1: Exp, a2: Exp) extends Exp
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   281
case class Sequence(e1: Exp, e2: Exp) extends Exp
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   282
case class Bop(o: String, a1: Exp, a2: Exp) extends BExp  
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   283
\end{lstlisting}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   284
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   285
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   286
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   287
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   288
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   289
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   290
\frametitle{K-(Intermediate)Language}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   291
\footnotesize
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   292
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   293
\begin{lstlisting}[language=Scala,numbers=none,xleftmargin=-3mm]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   294
abstract class KExp
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   295
abstract class KVal
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   296
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   297
case class KVar(s: String) extends KVal
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   298
case class KNum(i: Int) extends KVal
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   299
case class Kop(o: String, v1: KVal, v2: KVal) extends KVal
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   300
case class KCall(o: String, vrs: List[KVal]) extends KVal
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   301
case class KWrite(v: KVal) extends KVal
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   302
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   303
case class KIf(x1: String, e1: KExp, e2: KExp) extends KExp
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   304
case class KLet(x: String, v: KVal, e: KExp) extends KExp
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   305
case class KReturn(v: KVal) extends KExp
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   306
\end{lstlisting}
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   307
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   308
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   309
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   310
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   311
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   312
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   313
\frametitle{CPS-Translation}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   314
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   315
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   316
\begin{lstlisting}[language=Scala,numbers=none]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   317
def CPS(e: Exp)(k: KVal => KExp) : KExp = 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   318
  e match { ... }
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   319
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   320
\bigskip\bigskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   321
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   322
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   323
\begin{lstlisting}[language=LLVMIR,numbers=none,xleftmargin=30mm,escapeinside={(*@}{@*)}]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   324
let tmp0 = add 1 a in   
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   325
let tmp1 = mul (*@$\Box$@*) 5 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   326
let tmp2 = add 3 tmp1 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   327
let tmp3 = add tmp0 tmp2 in
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   328
  KReturn tmp3 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   329
\end{lstlisting}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   330
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   331
\end{frame}
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   332
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   333
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   334
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   335
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   336
\frametitle{CPS-Translation}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   337
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   338
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   339
\begin{lstlisting}[language=Scala,numbers=none]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   340
def CPS(e: Exp)(k: KVal => KExp) : KExp = 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   341
  e match { 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   342
     case Var(s) => k(KVar(s)) 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   343
     case Num(i) => k(KNum(i))
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   344
     ...
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   345
  }
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   346
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   347
\bigskip\bigskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   348
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   349
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   350
\begin{lstlisting}[language=LLVMIR,numbers=none,xleftmargin=30mm,escapeinside={(*@}{@*)}]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   351
let tmp0 = add 1 a in   
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   352
let tmp1 = mul (*@$\Box$@*) 5 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   353
let tmp2 = add 3 tmp1 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   354
let tmp3 = add tmp0 tmp2 in
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   355
  KReturn tmp3 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   356
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   357
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   358
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   359
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   360
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   361
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   362
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   363
\frametitle{CPS-Translation}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   364
\small
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   365
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   366
\begin{lstlisting}[language=Scala,numbers=none,xleftmargin=-5mm]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   367
def CPS(e: Exp)(k: KVal => KExp) : KExp = e match { 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   368
  case Aop(o, e1, e2) => {
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   369
    val z = Fresh("tmp")
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   370
    CPS(e1)(y1 => 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   371
      CPS(e2)(y2 => 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   372
               KLet(z, Kop(o, y1, y2), k(KVar(z)))))
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   373
  } ...
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   374
}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   375
\end{lstlisting}
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   376
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   377
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   378
\begin{lstlisting}[language=LLVMIR,numbers=none,xleftmargin=30mm,escapeinside={(*@}{@*)}]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   379
...
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   380
let z = op (*@$\Box_{y_1}$@*) (*@$\Box_{y_2}$@*)
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   381
let tmp0 = add 1 a in   
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   382
let tmp1 = mul (*@$\Box\!\!\!\!\raisebox{0.6mm}{\texttt{z}}$@*) 5 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   383
let tmp2 = add 3 tmp1 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   384
let tmp3 = add tmp0 tmp2 in
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   385
  KReturn tmp3 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   386
\end{lstlisting}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   387
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   388
\end{frame}
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   389
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   390
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   391
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   392
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   393
\frametitle{CPS-Translation}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   394
\small
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   395
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   396
\begin{lstlisting}[language=Scala,numbers=none]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   397
def CPS(e: Exp)(k: KVal => KExp) : KExp = 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   398
  e match { 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   399
    case Sequence(e1, e2) => 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   400
      CPS(e1)(_ => CPS(e2)(y2 => k(y2)))
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   401
     ...
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   402
  }
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   403
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   404
\bigskip\bigskip
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   405
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   406
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   407
\begin{lstlisting}[language=LLVMIR,numbers=none,xleftmargin=30mm,escapeinside={(*@}{@*)}]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   408
let tmp0 = add 1 a in   
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   409
let tmp1 = mul (*@$\Box$@*) 5 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   410
let tmp2 = add 3 tmp1 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   411
let tmp3 = add tmp0 tmp2 in
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   412
  KReturn tmp3 
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   413
\end{lstlisting}
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   414
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   415
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   416
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   417
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   418
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   419
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   420
\frametitle{CPS-Translation}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   421
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   422
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   423
\begin{lstlisting}[language=Scala,numbers=none]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   424
def CPS(e: Exp)(k: KVal => KExp) : KExp = 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   425
  e match { 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   426
    ...
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   427
    case Sequence(e1, e2) => 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   428
      CPS(e1)(_ => CPS(e2)(y2 => k(y2)))
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   429
     ...
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   430
  }
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   431
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   432
\bigskip\bigskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   433
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   434
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   435
\begin{lstlisting}[language=LLVMIR,numbers=none,xleftmargin=30mm,escapeinside={(*@}{@*)}]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   436
let tmp0 = add 1 a in   
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   437
let tmp1 = mul (*@$\Box$@*) 5 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   438
let tmp2 = add 3 tmp1 in 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   439
let tmp3 = add tmp0 tmp2 in
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   440
  KReturn tmp3 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   441
\end{lstlisting}
609
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   442
e33545bb2eba updated
Christian Urban <urbanc@in.tum.de>
parents: 538
diff changeset
   443
\end{frame}
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   444
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
   445
610
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   446
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   447
\begin{frame}[fragile,c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   448
\frametitle{CPS-Translation}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   449
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   450
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   451
\begin{lstlisting}[language=Scala,numbers=none,xleftmargin=-3mm]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   452
def CPS(e: Exp)(k: KVal => KExp) : KExp = 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   453
  e match { 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   454
    ...
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   455
    case If(Bop(o, b1, b2), e1, e2) => {
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   456
      val z = Fresh("tmp")
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   457
      CPS(b1)(y1 => 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   458
        CPS(b2)(y2 => 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   459
          KLet(z, Kop(o, y1, y2), 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   460
                KIf(z, CPS(e1)(k), CPS(e2)(k)))))
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   461
     }
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   462
    ...
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   463
  }
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   464
\end{lstlisting}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   465
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   466
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   467
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   468
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   469
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   470
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   471
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   472
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
610
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   473
\begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   474
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   475
\large\bf
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   476
Using a compiler, \\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   477
how can you mount the\\ 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   478
perfect attack against a system?
610
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   479
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   480
\end{frame}
610
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   481
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   482
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   483
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   484
\mode<presentation>{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   485
\begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   486
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   487
{\large\bf
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   488
What is a \alert{perfect} attack?}\bigskip
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   489
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   490
\begin{enumerate}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   491
\item you can potentially completely take over a target system
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   492
\item your attack is (nearly) undetectable
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   493
\item the victim has (almost) no chance to recover
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   494
\end{enumerate}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   495
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   496
\end{frame}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   497
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   498
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   499
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   500
\mode<presentation>{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   501
\begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   502
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   503
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   504
  \begin{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   505
  \begin{tikzpicture}[scale=1]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   506
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   507
  \onslide<1->{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   508
  \node (A) at (0,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=17mm] {};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   509
  \node [below right] at (A.north west) {\footnotesize\begin{tabular}{@{}l@{}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   510
  \only<1,2>{clean}\only<3->{\alert{hacked}}\\compiler\end{tabular}};}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   511
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   512
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   513
  \onslide<2->{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   514
  \node (B) at (-2,2)  [draw=black, rectangle, very thick, minimum height=10mm, minimum width=12mm] {};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   515
  \node [below right] at (B.north west) {\footnotesize\begin{tabular}{@{}l@{}}login\\(src)\end{tabular}};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   516
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   517
  \node (C) at (2,2)  [draw=black, rectangle, very thick, minimum height=10mm, minimum width=12mm] {};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   518
  \node [below right] at (C.north west) {\footnotesize\begin{tabular}{@{}l@{}}login\\(bin)\end{tabular}};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   519
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   520
  \draw[->, line width=2mm] (B) -- (C);
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   521
  }
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   522
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   523
 \onslide<3->{\node [above left=-1.5mm] at (C.south east) {\footnotesize \alert{$\blacksquare$}};}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   524
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   525
  \end{tikzpicture}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   526
  \end{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   527
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   528
\end{frame}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   529
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   530
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   531
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   532
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   533
\mode<presentation>{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   534
\begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   535
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   536
  \begin{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   537
  \begin{tikzpicture}[scale=1]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   538
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   539
  \onslide<1->{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   540
  \node (A) at (0,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   541
  \node [below right] at (A.north west) {\small V0.01};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   542
  \node [below right] (A1) at (A.south west) {\small Scala};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   543
  \node [below right] (A1) at (A1.south west) {\small\textcolor{gray}{host language}};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   544
  \node [above right] at (A.north west) {my compiler (src)};}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   545
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   546
  \onslide<2->{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   547
  \node (B) at (1.8,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   548
  \node [below right] at (B.north west) {\small V0.02};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   549
  \node [below right] at (B.south west) {\small Scala};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   550
  \node at (3,0) {\ldots};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   551
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   552
  \node (C) at (5,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   553
  \node [below right] at (C.north west) {\small V1.00};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   554
  \node [below right] at (C.south west) {\small Scala};}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   555
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   556
  \onslide<3->{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   557
  \node (D) at (6.8,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   558
  \node [below right] at (D.north west) {\small V1.00};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   559
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   560
  \node (E) at (6.8,2)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   561
  \node [below right] at (E.north west) {\small V1.01};}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   562
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   563
  \onslide<4->{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   564
  \node (F) at (8.6,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   565
  \node [below right] at (F.north west) {\small V1.01};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   566
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   567
  \node (G) at (8.6,2)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   568
  \node [below right] at (G.north west) {\small V1.02};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   569
  \node at (9.8,0) {\ldots};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   570
  \node at (9.8,2) {\ldots};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   571
  \node at (8,-2) {\textcolor{gray}{\begin{tabular}{@{}l@{}}no host language\\needed\end{tabular}}};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   572
  }
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   573
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   574
  \end{tikzpicture}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   575
  \end{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   576
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   577
\end{frame}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   578
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   579
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   580
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   581
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   582
  \mode<presentation>{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   583
  \begin{frame}<1-3>
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   584
  \frametitle{\LARGE\begin{tabular}{c}Hacking Compilers 
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   585
  \end{tabular}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   586
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   587
  %Why is it so paramount to have a small trusted code base (TCB)?
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   588
  \bigskip\bigskip
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   589
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   590
  \begin{columns}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   591
  \begin{column}{2.7cm}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   592
  \begin{minipage}{2.5cm}%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   593
  \begin{tabular}{c@ {}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   594
  \includegraphics[scale=0.2]{../pics/ken-thompson.jpg}\\[-1.8mm]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   595
  \footnotesize Ken Thompson\\[-1.8mm]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   596
  \footnotesize Turing Award, 1983\\
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   597
  \end{tabular}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   598
  \end{minipage}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   599
  \end{column}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   600
  \begin{column}{9cm}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   601
  \begin{tabular}{l@ {\hspace{1mm}}p{8cm}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   602
 
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   603
  & Ken Thompson showed how to hide a Trojan Horse in a 
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   604
  compiler \textcolor{red}{without} leaving any traces in the source code.\\[2mm]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   605
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   606
  & No amount of source level verification will protect 
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   607
  you from such Thompson-hacks.\\[2mm]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   608
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   609
  \end{tabular}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   610
  \end{column}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   611
  \end{columns}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   612
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   613
  \only<2>{
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   614
  \begin{textblock}{6}(4,2)
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   615
  \begin{tikzpicture}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   616
  \draw (0,0) node[inner sep=3mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   617
  {\normalsize
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   618
  \begin{minipage}{8cm}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   619
  \begin{quote}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   620
  \includegraphics[scale=0.05]{../pics/evil.png}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   621
  \begin{enumerate}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   622
  \item[1)] Assume you ship the compiler as binary and also with sources.
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   623
  \item[2)] Make the compiler aware when it compiles itself.
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   624
  \item[3)] Add the Trojan horse.
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   625
  \item[4)] Compile.
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   626
  \item[5)] Delete Trojan horse from the sources of the compiler.
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   627
  \item[6)] Go on holiday for the rest of your life. ;o)\\[-7mm]\mbox{}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   628
  \end{enumerate}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   629
  \end{quote}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   630
  \end{minipage}};
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   631
  \end{tikzpicture}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   632
  \end{textblock}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   633
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   634
  \end{frame}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   635
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   636
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   637
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   638
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   639
  \begin{frame}[c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   640
  \frametitle{Dijkstra on Testing}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   641
  
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   642
  \begin{bubble}[10cm]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   643
  ``Program testing can be a very effective way to show the
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   644
  presence of bugs, but it is hopelessly inadequate for showing
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   645
  their absence.''
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   646
  \end{bubble}\bigskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   647
  
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   648
  \small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   649
  What is good about compilers: the either seem to work,
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   650
  or go horribly wrong (most of the time).
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   651
  
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   652
  \end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   653
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   654
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   655
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   656
\begin{frame}[c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   657
\frametitle{\Large Proving Programs to be Correct}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   658
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   659
\begin{bubble}[10cm]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   660
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   661
{\bf Theorem:} There are infinitely many prime 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   662
numbers.\medskip\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   663
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   664
{\bf Proof} \ldots\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   665
\end{bubble}\bigskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   666
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   667
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   668
similarly\bigskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   669
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   670
\begin{bubble}[10cm]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   671
\small
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   672
{\bf Theorem:} The program is doing what 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   673
it is supposed to be doing.\medskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   674
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   675
{\bf Long, long proof} \ldots\\
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   676
\end{bubble}\bigskip\medskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   677
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   678
\small This can be a gigantic proof. The only hope is to have
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   679
help from the computer. `Program' is here to be understood to be
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   680
quite general (compiler, OS, \ldots).
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   681
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   682
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   683
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   684
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   685
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   686
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   687
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   688
\begin{frame}[c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   689
\frametitle{Can This Be Done?}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   690
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   691
\begin{itemize}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   692
\item in 2008, verification of a small C-compiler
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   693
\begin{itemize}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   694
\item ``if my input program has a certain behaviour, then the compiled machine code has the same behaviour''
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   695
\item is as good as \texttt{gcc -O1}, but much, much less buggy 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   696
\end{itemize}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   697
\end{itemize}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   698
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   699
\begin{center}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   700
  \includegraphics[scale=0.12]{../pics/compcert.png}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   701
\end{center}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   702
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   703
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   704
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   705
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   706
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   707
\begin{frame}[t]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   708
\frametitle{Fuzzy Testing C-Compilers}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   709
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   710
\begin{itemize}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   711
\item tested GCC, LLVM and others by randomly generating 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   712
C-programs
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   713
\item found more than 300 bugs in GCC and also
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   714
many in LLVM (some of them highest-level critical)\bigskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   715
\item about CompCert:
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   716
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   717
\begin{bubble}[10.7cm]\small ``The striking thing about our CompCert
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   718
results is that the middle-end bugs we found in all other
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   719
compilers are absent. As of early 2011, the under-development
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   720
version of CompCert is the only compiler we have tested for
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   721
which Csmith cannot find wrong-code errors. This is not for
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   722
lack of trying: we have devoted about six CPU-years to the
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   723
task.'' 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   724
\end{bubble} 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   725
\end{itemize}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   726
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   727
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   728
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   729
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   730
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   731
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   732
\begin{frame}[c]
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   733
\frametitle{Next Week}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   734
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   735
\begin{itemize}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   736
\item Revision Lecture\medskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   737
\item How many  strings are in $\bl{L(a^*)}$?\pause\medskip
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   738
\item How many  strings are in $\bl{L((a + b)^*)}$?\\ Are there more than
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   739
  in $\bl{L(a^*)}$?
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   740
\end{itemize}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   741
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   742
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   743
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   744
\end{frame}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   745
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   746
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   747
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   748
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   749
\end{document}
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   750
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   751
%%% Local Variables:  
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   752
%%% mode: latex
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   753
%%% TeX-master: t
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   754
%%% End: 
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   755
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   756
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   757
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   758
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 612
diff changeset
   759
610
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   760
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   761
  \begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   762
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   763
  \begin{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   764
  \includegraphics[scale=0.6]{../pics/bridge-limits.png}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   765
  \end{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   766
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   767
  \end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   768
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   769
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   770
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   771
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   772
\begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   773
\frametitle{Compilers \& Boeings 777}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   774
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   775
First flight in 1994. They want to achieve triple redundancy in hardware
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   776
faults.\bigskip
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   777
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   778
They compile 1 Ada program to\medskip
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   779
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   780
\begin{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   781
\item Intel 80486
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   782
\item Motorola 68040 (old Macintosh's)
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   783
\item AMD 29050 (RISC chips used often in laser printers)
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   784
\end{itemize}\medskip
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   785
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   786
using 3 independent compilers.\bigskip\pause
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   787
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   788
\small Airbus uses C and static analysers. Recently started using CompCert.
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   789
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   790
\end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   791
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   792
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   793
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   794
\begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   795
\frametitle{Goal}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   796
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   797
Remember the Bridges example?
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   798
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   799
\begin{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   800
\item Can we look at our programs and somehow ensure
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   801
they are bug free/correct?\pause\bigskip
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   802
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   803
\item Very hard: Anything interesting about programs is equivalent
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   804
to the Halting Problem, which is undecidable.\pause\bigskip
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   805
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   806
\item \alert{Solution:} We avoid this ``minor'' obstacle by
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   807
      being as close as possible of deciding the halting
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   808
      problem, without actually deciding the halting problem.
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   809
      \small$\quad\Rightarrow$ yes, no, don't know (static analysis)
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   810
\end{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   811
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   812
\end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   813
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   814
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   815
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   816
  \begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   817
  \frametitle{What is Static Analysis?}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   818
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   819
  \begin{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   820
  \includegraphics[scale=0.4]{../pics/state.png}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   821
  \end{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   822
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   823
  \begin{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   824
  \item depending on some initial input, a program 
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   825
  (behaviour) will ``develop'' over time.
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   826
  \end{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   827
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   828
  \end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   829
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   830
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   831
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   832
  \begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   833
  \frametitle{What is Static Analysis?}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   834
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   835
  \begin{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   836
  \includegraphics[scale=0.4]{../pics/state2.png}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   837
  \end{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   838
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   839
  \end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   840
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   841
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   842
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   843
  \begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   844
  \frametitle{What is Static Analysis?}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   845
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   846
  \begin{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   847
  \includegraphics[scale=0.4]{../pics/state3.jpg}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   848
  \end{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   849
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   850
  \end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   851
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   852
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   853
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   854
  \begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   855
  \frametitle{What is Static Analysis?}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   856
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   857
  \begin{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   858
  \includegraphics[scale=0.4]{../pics/state4.jpg}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   859
  \end{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   860
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   861
  \begin{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   862
  \item to be avoided
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   863
  \end{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   864
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   865
  \end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   866
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   867
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   868
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   869
  \begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   870
  \frametitle{What is Static Analysis?}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   871
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   872
  \begin{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   873
  \includegraphics[scale=0.4]{../pics/state5.png}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   874
  \end{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   875
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   876
  \begin{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   877
  \item this needs more work
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   878
  \end{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   879
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   880
  \end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   881
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   882
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   883
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   884
  \begin{frame}[c]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   885
  \frametitle{What is Static Analysis?}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   886
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   887
  \begin{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   888
  \includegraphics[scale=0.4]{../pics/state6.png}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   889
  \end{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   890
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   891
  \end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   892
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   893
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   894
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   895
  \begin{frame}[c,fragile]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   896
    \frametitle{\Large\begin{tabular}{c}Concrete Example:\\[-1mm]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   897
                  Are Vars Definitely Initialised?\end{tabular}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   898
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   899
Assuming \texttt{x} is initialised, what about \texttt{y}?\bigskip
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   900
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   901
Prog.~1:\\
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   902
\begin{lstlisting}[numbers=none,
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   903
                   basicstyle=\ttfamily,
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   904
                   language=While,xleftmargin=3mm]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   905
if x < 1 then y := x else y := x + 1;
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   906
y := y + 1
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   907
\end{lstlisting}\medskip     
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   908
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   909
Prog.~2:\\
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   910
\begin{lstlisting}[numbers=none,
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   911
                   basicstyle=\ttfamily,
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   912
                   language=While,xleftmargin=3mm]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   913
if x < x then y := y + 1 else y := x;
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   914
y := y + 1
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   915
\end{lstlisting}            
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   916
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   917
  \end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   918
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   919
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   920
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   921
  \begin{frame}[c,fragile]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   922
    \frametitle{\Large\begin{tabular}{c}Concrete Example:\\[-1mm]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   923
                  Are Vars Definitely Initialised?\end{tabular}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   924
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   925
              What should the rules be for deciding when a
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   926
              variable is initialised?\bigskip\pause
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   927
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   928
\begin{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   929
\item variable \texttt{x} is definitely initialized after
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   930
  \texttt{skip}\\
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   931
  iff \texttt{x} is definitely initialized before \texttt{skip}.
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   932
\end{itemize}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   933
  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   934
\end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   935
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   936
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   937
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   938
  \begin{frame}[c,fragile]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   939
%    \frametitle{\Large\begin{tabular}{c}Concrete Example:\\[-1mm]
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   940
%                  Are Vars Definitely Initialised?\end{tabular}}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   941
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   942
$\bl{A}$ is the set of definitely defined variables:
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   943
              
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   944
\begin{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   945
\begin{tabular}{c}
612
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   946
  \bl{\infer{\mbox{}}{A\triangleright\texttt{skip}\triangleright{}A}}\qquad
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   947
  \bl{\infer{vars(a) \subseteq A}{A\triangleright
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   948
  (\texttt{x\,:=\,a})\triangleright\{x\}\cup A}}
610
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   949
  \medskip\\\pause
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   950
612
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   951
  \bl{\infer{A_1\triangleright{}s_1\triangleright{}A_2
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   952
  \quad A_2\triangleright{}s_2\triangleright{}A_3}
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   953
  {A_1\triangleright{}(s_1 ; s_2)\triangleright{}A_3}}
610
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   954
  \medskip\\\pause
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   955
  
612
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   956
  \bl{\infer{vars(b)\subseteq A\quad A\triangleright{}s_1\triangleright{}A_1
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   957
  \quad A\triangleright{}s_2\triangleright{}A_2}
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   958
  {A\triangleright(\texttt{if}\;b\;\texttt{then}\;s_1\;\texttt{else}\;s_2)\triangleright{}A_1\cap A_2}}
610
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   959
  \medskip\\\pause
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   960
612
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   961
  \bl{\infer{vars(b)\subseteq A\quad A\triangleright{}s\triangleright{}A'}
7a12053567d4 updated
Christian Urban <urbanc@in.tum.de>
parents: 610
diff changeset
   962
  {A\triangleright(\texttt{while}\;b\;\texttt{do}\;s)\triangleright{}A}}\pause
610
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   963
\end{tabular}  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   964
\end{center}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   965
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   966
\hfill we start with $\bl{A = \{\}}$
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   967
\end{frame}
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   968
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
7ec1bdb670ba updated
Christian Urban <urbanc@in.tum.de>
parents: 609
diff changeset
   969