slides/slides09.tex
author Christian Urban <urbanc@in.tum.de>
Tue, 09 Oct 2018 08:16:25 +0100
changeset 574 bd4f144326c7
parent 538 17acdd516ccd
child 609 e33545bb2eba
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     2
\usepackage{../slides}
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 207
diff changeset
     3
\usepackage{../langs}
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     4
\usepackage{../graphics}
379
fa2589ec0fae updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 312
diff changeset
     5
\usepackage{../grammar}
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
     6
\usepackage{soul}
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
     7
\usepackage{mathpartir}
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
     8
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
     9
% beamer stuff 
459
780486571e38 updated
Christian Urban <urbanc@in.tum.de>
parents: 384
diff changeset
    10
\renewcommand{\slidecaption}{CFL 09, King's College London}
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    11
\newcommand{\bl}[1]{\textcolor{blue}{#1}}
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
    12
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
\begin{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    15
\begin{frame}[t]
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
\frametitle{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
  \begin{tabular}{@ {}c@ {}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
  \\[-3mm]
459
780486571e38 updated
Christian Urban <urbanc@in.tum.de>
parents: 384
diff changeset
    19
  \LARGE Compilers and \\[-2mm] 
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    20
  \LARGE Formal Languages (9)\\[3mm] 
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
  \end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
  \normalsize
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
  \begin{tabular}{ll}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
  Email:  & christian.urban at kcl.ac.uk\\
500
c502933be072 updated
Christian Urban <urbanc@in.tum.de>
parents: 459
diff changeset
    27
  Office: & N7.07 (North Wing, Bush House)\\
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
  Slides: & KEATS (also home work is there)\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
  \end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
  \end{center}
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    31
\end{frame}
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    32
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    34
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    35
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    36
  \begin{frame}[c]
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    37
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    38
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    39
  \includegraphics[scale=0.6]{../pics/bridge-limits.png}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    40
  \end{center}
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    41
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    42
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    44
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    46
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    47
  \frametitle{Old-Fashioned Eng.~vs.~CS}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    48
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    49
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    50
  \begin{tabular}{@{}cc@{}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    51
  \begin{tabular}{@{}p{5.2cm}} 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    52
  \includegraphics[scale=0.058]{../pics/towerbridge.jpg}\\ 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    53
  {\bf bridges}: \\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    54
  \raggedright\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    55
  engineers can ``look'' at a bridge and have a pretty good
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    56
  intuition about whether it will hold up or not\\ 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    57
  (redundancy; predictive theory)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    58
  \end{tabular} &
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    59
  \begin{tabular}{p{5cm}} 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    60
  \includegraphics[scale=0.265]{../pics/code.jpg}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    61
  \raggedright
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    62
  {\bf code}: \\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    63
  \raggedright\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    64
  programmers have very little intuition about their code; 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    65
  often it is too expensive to have redundancy;
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    66
  not ``continuous'' 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    67
  \end{tabular}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    68
  \end{tabular}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    69
  \end{center}
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
    70
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    71
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    72
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
    73
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
    74
d384fe01d0e8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 309
diff changeset
    75
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    76
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    77
  \begin{frame}[c]
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    78
  \frametitle{Dijkstra on Testing}
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    79
  
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    80
  \begin{bubble}[10cm]
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    81
  ``Program testing can be a very effective way to show the
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    82
  presence of bugs, but it is hopelessly inadequate for showing
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    83
  their absence.''
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    84
  \end{bubble}\bigskip
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
    85
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    86
  \end{frame}
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    87
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    88
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    89
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    90
\begin{frame}[c]
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    91
\frametitle{\Large Proving Programs to be Correct}
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    92
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    93
\begin{bubble}[10cm]
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    94
\small
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    95
{\bf Theorem:} There are infinitely many prime 
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    96
numbers.\medskip\\
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    97
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    98
{\bf Proof} \ldots\\
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
    99
\end{bubble}\bigskip
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   100
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   101
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   102
similarly\bigskip
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   103
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   104
\begin{bubble}[10cm]
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   105
\small
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   106
{\bf Theorem:} The program is doing what 
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   107
it is supposed to be doing.\medskip
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   108
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   109
{\bf Long, long proof} \ldots\\
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   110
\end{bubble}\bigskip\medskip
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   111
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   112
\small This can be a gigantic proof. The only hope is to have
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   113
help from the computer. `Program' is here to be understood to be
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   114
quite general (protocols, OS, \ldots).
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   115
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   116
\end{frame}
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   117
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   118
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   119
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   120
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   121
  \frametitle{\Large{}Mars Pathfinder Mission 1997}
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   122
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   123
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   124
  \includegraphics[scale=0.15]{../pics/marspath1.png}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   125
  \includegraphics[scale=0.16]{../pics/marspath3.png}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   126
  \includegraphics[scale=0.3]{../pics/marsrover.png}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   127
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   128
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   129
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   130
  \item despite NASA's famous testing procedures, the lander crashed frequently on Mars
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   131
  \item a scheduling algorithm was not used in the OS
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   132
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   133
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   134
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   135
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   136
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   137
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   138
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   139
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   140
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   141
  \begin{textblock}{11}(1,3)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   142
  \begin{tabular}{@{\hspace{-10mm}}l}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   143
  \begin{tikzpicture}[scale=1.1]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   144
  \node at (-2.5,-1.5) {\textcolor{white}{a}};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   145
  \node at (8,4) {\textcolor{white}{a}};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   146
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   147
    
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   148
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   149
  \only<1>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   150
   \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   151
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   152
  \only<2>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   153
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   154
   \draw[fill, blue!50] (3,0) rectangle (5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   155
   \draw[fill, blue!100] (2,3) rectangle (3,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   156
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   157
  \only<3>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   158
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   159
   \draw[fill, blue!50] (3,0) rectangle (4.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   160
   \draw[fill, blue!50] (5.5,0) rectangle (6,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   161
   \draw[fill, blue!100] (2,3) rectangle (3,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   162
   \draw[fill, blue!100] (4.5,3) rectangle (5.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   163
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   164
  \only<4>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   165
   \node at (2.5,0.9) {\small locked a resource};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   166
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   167
   \draw[blue!50, very thick] (2,0) rectangle (4,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   168
   \draw[blue!100, very thick] (2,3) rectangle (3, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   169
   \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   170
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   171
  \only<5>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   172
   \node at (2.5,0.9) {\small locked a resource};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   173
   \draw[fill, blue!50] (1,0) rectangle (4,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   174
   \draw[blue!100, fill] (4,3) rectangle (5, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   175
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   176
  \only<6>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   177
   \node at (2.5,0.9) {\small locked a resource};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   178
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   179
   \draw[blue!50, very thick] (2,0) rectangle (4,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   180
   \draw[blue!100, very thick] (2,3) rectangle (3, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   181
   \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   182
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   183
  \only<7>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   184
   \node at (2.5,0.9) {\small locked a resource};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   185
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   186
   \draw[blue!50, very thick] (2.5,0) rectangle (4,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   187
   \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   188
   \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   189
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   190
  \only<8>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   191
   \node at (2.5,0.9) {\small locked a resource}; 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   192
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   193
   \draw[blue!50, very thick] (2.5,0) rectangle (4,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   194
   \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   195
   \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   196
   \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   197
   \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   198
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   199
  \only<9>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   200
   \node at (2.5,0.9) {\small locked a resource}; 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   201
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   202
   \draw[blue!50, very thick] (3.5,0) rectangle (5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   203
   \draw[blue!100, very thick] (3.5,3) rectangle (4.5, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   204
   \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   205
   \draw[red, <-, line width = 2mm] (3.5,-0.1) -- (3.5, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   206
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   207
  \only<10>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   208
   \node at (2.5,0.9) {\small locked a resource}; 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   209
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   210
   \draw[blue!50, very thick] (3.5,0) rectangle (5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   211
   \draw[blue!100, very thick] (3.5,3) rectangle (4.5, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   212
   \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   213
   \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   214
   \draw[red, <-, line width = 2mm] (3.5,-0.1) -- (3.5, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   215
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   216
  \only<11>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   217
   \node at (2.5,0.9) {\small locked a resource};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   218
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   219
   \draw[blue!50, very thick] (4.5,0) rectangle (6,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   220
   \draw[blue!100, very thick] (4.5,3) rectangle (5.5, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   221
   \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   222
   \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   223
   \draw[red, <-, line width = 2mm] (4.5,-0.1) -- (4.5, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   224
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   225
  \only<12>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   226
   \node at (2.5,0.9) {\small locked a resource}; 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   227
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   228
   \draw[blue!50, very thick] (5.5,0) rectangle (7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   229
   \draw[blue!100, very thick] (5.5,3) rectangle (6.5, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   230
   \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   231
   \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   232
   \draw[red, fill] (4.55,1.5) rectangle (5.5,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   233
   \draw[red, <-, line width = 2mm] (5.5,-0.1) -- (5.5, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   234
   \node [anchor=base] at (6.3, 1.8) {\Large\ldots};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   235
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   236
  \only<13>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   237
   \node at (2.5,0.9) {\small locked a resource}; 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   238
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   239
   \draw[blue!50, very thick] (2,0) rectangle (4,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   240
   \draw[blue!100, very thick] (2,3) rectangle (3, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   241
   \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   242
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   243
  \only<14>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   244
   \node at (2.5,3.9) {\small locked a resource}; 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   245
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   246
   \draw[blue!50, fill] (2,3) rectangle (4,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   247
   \draw[blue!100, very thick] (4,3) rectangle (5, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   248
   \draw[blue!50, ->, line width = 2mm] (2,1) -- (2, 2.5);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   249
   \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   250
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   251
  \only<15>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   252
   \node at (2.5,3.9) {\small locked a resource};  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   253
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   254
   \draw[blue!50, fill] (2,3) rectangle (4,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   255
   \draw[blue!100, very thick] (4,3) rectangle (5, 3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   256
   \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   257
   \draw[red, very thick] (2.5,1.5) rectangle (3.5,2.1); 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   258
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   259
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   260
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   261
  \draw[very thick,->](0,0) -- (8,0);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   262
  \node [anchor=base] at (8, -0.3) {\scriptsize time};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   263
  \node [anchor=base] at (0, -0.3) {\scriptsize 0};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   264
  \node [anchor=base] at (-1.2, 0.2) {\small low priority};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   265
  \only<2->{\node [anchor=base] at (-1.2, 3.2) {\small high priority};}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   266
  \only<8->{\node [anchor=base] at (-1.5, 1.7) {\small medium pr.};}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   267
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   268
  \end{tikzpicture}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   269
  \end{tabular}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   270
  \end{textblock}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   271
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   272
  \begin{textblock}{0}(2.5,13)%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   273
  \small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   274
  \onslide<3->{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   275
  \begin{bubble}[8cm]%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   276
  Scheduling: You want to avoid that a high 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   277
  priority process is starved indefinitely.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   278
  \end{bubble}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   279
  \end{textblock}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   280
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   281
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   282
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   283
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   284
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   285
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   286
  \frametitle{\Large Priority Inheritance Scheduling}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   287
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   288
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   289
  \item Let a low priority process $L$ temporarily inherit 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   290
    the high priority of $H$ until $L$ leaves the critical 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   291
    section unlocking the resource.\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   292
  \item Once the resource is unlocked $L$ returns to its original 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   293
    priority level.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   294
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   295
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   296
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   297
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   298
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   299
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   300
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   301
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   302
  \begin{textblock}{11}(1,3)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   303
  \begin{tabular}{@{\hspace{-10mm}}l}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   304
  \begin{tikzpicture}[scale=1.1]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   305
  \node at (-2.5,-1.5) {\textcolor{white}{a}};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   306
  \node at (8,4) {\textcolor{white}{a}};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   307
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   308
  \only<1>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   309
    \draw[fill, blue!50] (1,0) rectangle (6,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   310
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   311
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   312
    \node at (3.5,0.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   313
    \node at (5.7,0.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   314
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   315
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   316
    \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   317
    \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   318
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   319
  \only<2>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   320
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   321
    \draw[very thick, blue!50] (3,0) rectangle (6,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   322
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   323
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   324
    \node at (3.5,0.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   325
    \node at (5.7,0.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   326
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   327
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   328
    \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   329
    \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   330
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   331
  \only<3>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   332
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   333
    \draw[very thick, blue!50] (3,0) rectangle (6,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   334
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   335
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   336
    \node at (3.5,0.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   337
    \node at (5.7,0.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   338
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   339
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   340
    \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   341
    \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   342
    \draw[very thick,blue!100] (3,3) rectangle (4,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   343
    \node at (3.5,3.3) {\small $A$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   344
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   345
  \only<4>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   346
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   347
    \draw[very thick, blue!50] (3,0) rectangle (6,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   348
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   349
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   350
    \node at (3.5,0.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   351
    \node at (5.7,0.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   352
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   353
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   354
    \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   355
    \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   356
    \draw[very thick,blue!100] (3,3) rectangle (4,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   357
    \node at (3.5,3.3) {\small $A$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   358
    \draw[very thick,blue!100] (4,3) rectangle (5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   359
    \node at (4.5,3.3) {\small $B$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   360
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   361
  \only<5>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   362
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   363
    \draw[very thick, blue!50] (3,3) rectangle (6,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   364
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   365
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   366
    \node at (3.5,3.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   367
    \node at (5.7,3.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   368
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   369
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   370
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   371
    \draw[very thick,blue!100] (5.7,3) -- (5.7,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   372
    \draw[very thick,blue!100] (6,3) rectangle (7,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   373
    \node at (6.5,3.3) {\small $A$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   374
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   375
    \node at (7.5,3.3) {\small $B$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   376
    \draw[blue!50, ->, line width = 2mm] (3,1) -- (3, 2.5);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   377
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   378
  \only<6>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   379
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   380
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   381
    \draw[very thick, blue!50] (3.5,3) rectangle (6,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   382
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   383
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   384
    \node at (3.5,3.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   385
    \node at (5.7,3.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   386
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   387
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   388
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   389
    \draw[very thick,blue!100] (5.7,3) -- (5.7,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   390
    \draw[very thick,blue!100] (6,3) rectangle (7,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   391
    \node at (6.5,3.3) {\small $A$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   392
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   393
    \node at (7.5,3.3) {\small $B$}; 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   394
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   395
  \only<7>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   396
   \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   397
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   398
    \draw[very thick, blue!50] (3.5,0) rectangle (6,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   399
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   400
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   401
    \node at (3.5,3.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   402
    \node at (5.7,0.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   403
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   404
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   405
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   406
    \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   407
    \draw[very thick,blue!100] (6,3) rectangle (7,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   408
    \node at (6.5,3.3) {\small $A$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   409
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   410
    \node at (7.5,3.3) {\small $B$};  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   411
    \draw[blue!50, <-, line width = 2mm] (3.5,1) -- (3.5, 2.5);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   412
    \draw[blue!50, <-, line width = 2mm] (4,3.3) -- (5.5,3.3);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   413
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   414
  \only<8>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   415
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   416
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   417
    \draw[very thick, blue!50] (4.5,0) rectangle (7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   418
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   419
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   420
    \node at (3.5,3.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   421
    \node at (6.7,0.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   422
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   423
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   424
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   425
    \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   426
    \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   427
    \node at (4,3.3) {\small $A$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   428
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   429
    \node at (7.5,3.3) {\small $B$};  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   430
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   431
  \only<9>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   432
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   433
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   434
    \draw[fill, blue!50] (4.5,0) rectangle (5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   435
    \draw[very thick, blue!50] (5,0) rectangle (7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   436
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   437
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   438
    \node at (3.5,3.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   439
    \node at (6.7,0.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   440
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   441
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   442
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   443
    \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   444
    \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   445
    \node at (4,3.3) {\small $A$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   446
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   447
    \node at (7.5,3.3) {\small $B$};  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   448
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   449
  \only<10>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   450
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   451
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   452
    \draw[fill, blue!50] (4.5,0) rectangle (5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   453
    \draw[very thick, blue!50] (5,0) rectangle (7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   454
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   455
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   456
    \node at (3.5,3.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   457
    \node at (6.7,0.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   458
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   459
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   460
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   461
    \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   462
    \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   463
    \node at (4,3.3) {\small $A$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   464
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   465
    \node at (7.5,3.3) {\small $B$};  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   466
    \draw[red, fill] (5,1.5) rectangle (6,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   467
    \draw[red, fill] (6.05,1.5) rectangle (7,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   468
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   469
  \only<11>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   470
   \draw[fill, blue!50] (1,0) rectangle (3,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   471
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   472
    \draw[fill, blue!50] (4.5,0) rectangle (5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   473
    \draw[very thick, blue!50] (5,0) rectangle (7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   474
    \node at (1.5,0.9) {\small $A_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   475
    \node at (2.0,0.9) {\small $B_L$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   476
    \node at (3.5,3.9) {\small $A_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   477
    \node at (6.7,0.9) {\small $B_R$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   478
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   479
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   480
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   481
    \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   482
    \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   483
    \node at (4,3.3) {\small $A$};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   484
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   485
    \node at (7.5,3.3) {\small $B$};  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   486
    \draw[red, fill] (5,1.5) rectangle (6,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   487
    \draw[red, fill] (6.05,1.5) rectangle (7,2.1);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   488
    \draw[blue!50, ->, line width = 2mm] (7.1,0.4) -- (8, 0.4);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   489
    \draw[blue!50, ->, line width = 2mm] (7.1,4) -- (8,4);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   490
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   491
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   492
  \draw[very thick,->](0,0) -- (8,0);
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   493
  \node [anchor=base] at (8, -0.3) {\scriptsize time};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   494
  \node [anchor=base] at (0, -0.3) {\scriptsize 0};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   495
  \node [anchor=base] at (-1.2, 0.2) {\small low priority};
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   496
  \only<2->{\node [anchor=base] at (-1.2, 3.2) {\small high priority};}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   497
  \only<10->{\node [anchor=base] at (-1.5, 1.7) {\small medium pr.};}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   498
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   499
  \end{tikzpicture}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   500
  \end{tabular}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   501
  \end{textblock}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   502
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   503
  \begin{textblock}{0}(2.5,13)%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   504
  \small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   505
  \onslide<11>{
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   506
  \begin{bubble}[8cm]%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   507
  Scheduling: You want to avoid that a high 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   508
  priority process is staved indefinitely.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   509
  \end{bubble}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   510
  \end{textblock}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   511
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   512
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   513
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   514
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   515
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   516
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   517
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   518
  \frametitle{\Large Priority Inheritance Scheduling}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   519
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   520
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   521
  \item Let a low priority process $L$ temporarily inherit 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   522
    the high priority of $H$ until $L$ leaves the critical 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   523
    section unlocking the resource.\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   524
  \item Once the resource is unlocked $L$ returns to its original 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   525
    priority level. \alert{\bf BOGUS}\pause\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   526
  \item \ldots $L$ needs to switch to the highest 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   527
    \alert{remaining} priority of the threads that it blocks.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   528
  \end{itemize}\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   529
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   530
  \small this error is already known since around 1999
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   531
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   532
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   533
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   534
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   535
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   536
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   537
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   538
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   539
  \includegraphics[scale=0.25]{../pics/p3.jpg}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   540
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   541
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   542
   \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   543
  \item by Rajkumar, 1991
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   544
  \item \it ``it resumes the priority it had at the point of entry into the critical 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   545
  section''
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   546
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   547
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   548
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   549
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   550
     
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   551
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   552
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   553
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   554
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   555
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   556
  \includegraphics[scale=0.25]{../pics/p2.jpg}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   557
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   558
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   559
   \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   560
  \item by Jane Liu, 2000
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   561
  \item {\it ``The job $J_l$ executes at its inherited 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   562
    priority until it releases $R$; at that time, the 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   563
    priority of $J_l$ returns to its priority 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   564
    at the time when it acquires the resource $R$.''}\medskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   565
  \item \small gives pseudo code and totally bogus data structures  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   566
  \item \small interesting part ``{\it left as an exercise}''
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   567
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   568
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   569
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   570
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   571
     
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   572
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   573
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   574
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   575
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   576
  \includegraphics[scale=0.15]{../pics/p1.pdf}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   577
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   578
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   579
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   580
  \item by Laplante and Ovaska, 2011 (\$113.76)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   581
  \item \it ``when $[$the task$]$ exits the critical section that
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   582
        caused the block, it reverts to the priority it had
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   583
        when it entered that section'' 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   584
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   585
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   586
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   587
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   588
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   589
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   590
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   591
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   592
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   593
  \includegraphics[scale=0.25]{../pics/p4.jpg}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   594
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   595
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   596
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   597
  \item by Silberschatz, Galvin, and Gagne, 2013 (OS-bible)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   598
  \item \it ``Upon releasing the lock, the 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   599
  $[$low-priority$]$ thread will revert to 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   600
  its original priority.''
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   601
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   602
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   603
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   604
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   605
   
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   606
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   607
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   608
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   609
  \frametitle{Priority Scheduling}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   610
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   611
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   612
  \item a scheduling algorithm that is widely used in real-time operating systems
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   613
  \item has been ``proved'' correct by hand in a paper in 1983
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   614
  \item but this algorithm turned out to be incorrect, despite its ``proof''\bigskip\pause
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   615
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   616
  \item we used the corrected algorithm and then {\bf really} proved
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   617
    that it is correct
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   618
    
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   619
  \item we implemented this algorithm in a small OS called PINTOS
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   620
    (used for teaching at Stanford)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   621
    
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   622
  \item our implementation was much more efficient than their
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   623
    reference implementation
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   624
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   625
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   626
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   627
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   628
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   629
   
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   630
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   631
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   632
\begin{frame}[c]
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   633
\frametitle{Big Proofs in CS (1)}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   634
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   635
Formal proofs in CS sound like science fiction?
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   636
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   637
\begin{itemize}
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   638
\item in 2008, verification of a C-compiler
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   639
\begin{itemize}
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   640
\item ``if my input program has a certain behaviour, then the compiled machine code has the same behaviour''
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   641
\item is as good as \texttt{gcc -O1}, but much less buggy 
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   642
\end{itemize}
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   643
\end{itemize}
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   644
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   645
\begin{center}
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   646
  \includegraphics[scale=0.12]{../pics/compcert.png}
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   647
\end{center}
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   648
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   649
\end{frame}
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   650
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   651
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   652
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   653
% \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   654
% \frametitle{Fuzzy Testing C-Compilers}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   655
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   656
% \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   657
% \item tested GCC, LLVM and others by randomly generating 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   658
% C-programs
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   659
% \item found more than 300 bugs in GCC and also
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   660
% many in LLVM (some of them highest-level critical)\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   661
% \item about CompCert:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   662
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   663
% \begin{bubble}[10cm]\small ``The striking thing about our CompCert
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   664
% results is that the middle-end bugs we found in all other
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   665
% compilers are absent. As of early 2011, the under-development
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   666
% version of CompCert is the only compiler we have tested for
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   667
% which Csmith cannot find wrong-code errors. This is not for
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   668
% lack of trying: we have devoted about six CPU-years to the
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   669
% task.'' 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   670
% \end{bubble} 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   671
% \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   672
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   673
% \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   674
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   675
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   676
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   677
\begin{frame}[c]
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   678
\frametitle{Big Proofs in CS (2)}
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   679
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   680
\begin{itemize}
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   681
\item in 2010, verification of a micro-kernel operating system (approximately 8700 loc)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   682
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   683
  \item used in helicopters and mobile phones
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   684
  \item 200k loc of proof
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   685
  \item 25 - 30 person years
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   686
  \item found 160 bugs in the C code (144 by the proof)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   687
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   688
\end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   689
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   690
\begin{bubble}[10cm]\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   691
``Real-world operating-system kernel with an end-to-end proof
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   692
of implementation correctness and security enforcement''
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   693
\end{bubble}\bigskip\pause
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   694
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   695
unhackable kernel (New Scientists, September 2015)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   696
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   697
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   698
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   699
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   700
\begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   701
\frametitle{Big Proofs in CS (3)}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   702
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   703
\begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   704
\item verified TLS implementation\medskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   705
\item verified compilers (CompCert, CakeML)\medskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   706
\item verified distributed systems (Verdi)\medskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   707
\item verified OSes or OS components\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   708
(seL4, CertiKOS, \ldots)\bigskip\pause
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   709
\item Infer static analyser developed by Facebook  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   710
\end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   711
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   712
\end{frame}
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   713
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   714
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   715
\begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   716
\frametitle{How Did This Happen?}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   717
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   718
Lots of ways!
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   719
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   720
\begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   721
\item better programming languages
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   722
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   723
  \item basic safety guarantees built in
  \item powerful mechanisms for abstraction and modularity
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   724
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   725
\item better software development methodology
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   726
\item stable platforms and frameworks
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   727
\item better use of specifications\medskip\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   728
  \small If you want to build software that works or is secure, 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   729
    it is helpful to know what you mean by ``works'' and by ``is secure''!
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   730
\end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   731
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   732
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   733
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   734
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   735
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   736
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   737
\begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   738
\frametitle{Goal}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   739
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   740
Remember the Bridges example?
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   741
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   742
\begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   743
\item Can we look at our programs and somehow ensure
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   744
they are bug free/correct?\pause\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   745
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   746
\item Very hard: Anything interesting about programs is equivalent
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   747
to the Halting Problem, which is undecidable.\pause\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   748
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   749
\item \alert{Solution:} We avoid this ``minor'' obstacle by
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   750
      being as close as possible of deciding the halting
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   751
      problem, without actually deciding the halting problem.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   752
      \small$\quad\Rightarrow$ yes, no, don't know (static analysis)
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   753
\end{itemize}
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   754
383
a6a6bf32fade updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 381
diff changeset
   755
\end{frame}
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   756
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   757
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   758
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   759
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   760
  \frametitle{What is Static Analysis?}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   761
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   762
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   763
  \includegraphics[scale=0.4]{../pics/state.png}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   764
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   765
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   766
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   767
  \item depending on some initial input, a program 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   768
  (behaviour) will ``develop'' over time.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   769
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   770
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   771
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   772
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   773
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   774
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   775
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   776
  \frametitle{What is Static Analysis?}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   777
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   778
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   779
  \includegraphics[scale=0.4]{../pics/state2.png}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   780
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   781
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   782
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   783
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   784
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   785
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   786
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   787
  \frametitle{What is Static Analysis?}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   788
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   789
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   790
  \includegraphics[scale=0.4]{../pics/state3.jpg}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   791
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   792
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   793
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   794
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   795
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   796
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   797
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   798
  \frametitle{What is Static Analysis?}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   799
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   800
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   801
  \includegraphics[scale=0.4]{../pics/state4.jpg}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   802
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   803
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   804
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   805
  \item to be avoided
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   806
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   807
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   808
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   809
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   810
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   811
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   812
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   813
  \frametitle{What is Static Analysis?}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   814
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   815
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   816
  \includegraphics[scale=0.4]{../pics/state5.png}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   817
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   818
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   819
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   820
  \item this needs more work
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   821
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   822
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   823
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   824
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   825
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   826
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   827
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   828
  \frametitle{What is Static Analysis?}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   829
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   830
  \begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   831
  \includegraphics[scale=0.4]{../pics/state6.png}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   832
  \end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   833
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   834
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   835
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   836
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   837
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   838
  \begin{frame}[c,fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   839
    \frametitle{\Large\begin{tabular}{c}Concrete Example:\\[-1mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   840
                  Are Vars Definitely Initialised?\end{tabular}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   841
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   842
Assuming \texttt{x} is initialised, what about \texttt{y}?\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   843
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   844
Prog.~1:\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   845
\begin{lstlisting}[numbers=none,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   846
                   basicstyle=\ttfamily,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   847
                   language=While,xleftmargin=3mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   848
if x < 1 then y := x else y := x + 1;
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   849
y := y + 1
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   850
\end{lstlisting}\medskip     
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   851
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   852
Prog.~2:\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   853
\begin{lstlisting}[numbers=none,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   854
                   basicstyle=\ttfamily,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   855
                   language=While,xleftmargin=3mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   856
if x < x then y := y + 1 else y := x;
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   857
y := y + 1
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   858
\end{lstlisting}            
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   859
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   860
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   861
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   862
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   863
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   864
  \begin{frame}[c,fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   865
    \frametitle{\Large\begin{tabular}{c}Concrete Example:\\[-1mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   866
                  Are Vars Definitely Initialised?\end{tabular}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   867
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   868
              What should the rules be for deciding when a
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   869
              variable is initialised?\bigskip\pause
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   870
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   871
\begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   872
\item variable \texttt{x} is definitely initialized after
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   873
  \texttt{skip}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   874
  iff \texttt{x} is definitely initialized before \texttt{skip}.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   875
\end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   876
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   877
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   878
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   879
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   880
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   881
  \begin{frame}[c,fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   882
%    \frametitle{\Large\begin{tabular}{c}Concrete Example:\\[-1mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   883
%                  Are Vars Definitely Initialised?\end{tabular}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   884
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   885
$\bl{A}$ is the set of definitely defined variables:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   886
              
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   887
\begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   888
\begin{tabular}{c}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   889
  \bl{\infer{\mbox{}}{A\;\texttt{skip}\;A}}\qquad
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   890
  \bl{\infer{vars(a) \subseteq A}{A\;\;(\texttt{x\,:=\,a})\;\;\{x\}\cup A}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   891
  \medskip\\\pause
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   892
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   893
  \bl{\infer{A_1\;s_1\;A_2\quad A_2\;s_2\;A_3}{A_1\;(s_1 ; s_2)\;A_3}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   894
  \medskip\\\pause
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   895
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   896
  \bl{\infer{vars(b)\subseteq A\quad A\;s_1\;A_1\quad A\;s_2\;A_2}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   897
  {A\;(\texttt{if}\;b\;\texttt{then}\;s_1\;\texttt{else}\;s_2)\;A_1\cap A_2}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   898
  \medskip\\\pause
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   899
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   900
  \bl{\infer{vars(b)\subseteq A\quad A\;s\;A'}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   901
  {A\;(\texttt{while}\;b\;\texttt{do}\;s)\;A}}\pause
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   902
\end{tabular}  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   903
\end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   904
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   905
\hfill we start with $\bl{A = \{\}}$
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   906
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   907
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   908
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   909
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   910
\begin{frame}[fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   911
\frametitle{\large Concrete Example: Sign-Analysis}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   912
\mbox{}\\[-20mm]\mbox{}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   913
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   914
\bl{\begin{plstx}[rhs style=,one per line]
: \meta{Exp} ::= \meta{Exp} + \meta{Exp}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   915
         | \meta{Exp} * \meta{Exp}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   916
         | \meta{Exp} = \meta{Exp} 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   917
         | \meta{num}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   918
         | \meta{var}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   919
: \meta{Stmt} ::= \meta{label} :
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   920
         | \meta{var} := \meta{Exp}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   921
         | \pcode{jmp?} \meta{Exp} \meta{label}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   922
         | \pcode{goto} \meta{label}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   923
: \meta{Prog} ::= \meta{Stmt} \ldots{} \meta{Stmt}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   924
\end{plstx}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   925
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   926
\begin{textblock}{0}(7.8,2.5)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   927
\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   928
\begin{bubble}[5.6cm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   929
\begin{lstlisting}[numbers=none,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   930
                   basicstyle=\ttfamily,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   931
                   language={},xleftmargin=3mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   932
      a := 1
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   933
      n := 5 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   934
top:  jmp? n = 0 done 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   935
      a := a * n 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   936
      n := n + -1 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   937
      goto top 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   938
done:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   939
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   940
\end{bubble}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   941
\end{textblock}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   942
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   943
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   944
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   945
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   946
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   947
\begin{frame}[fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   948
\frametitle{\large Concrete Example: Sign-Analysis}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   949
\mbox{}\\[-20mm]\mbox{}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   950
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   951
\bl{\begin{plstx}[rhs style=,one per line]
: \meta{Exp} ::= \meta{Exp} + \meta{Exp}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   952
         | \meta{Exp} * \meta{Exp}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   953
         | \meta{Exp} = \meta{Exp} 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   954
         | \meta{num}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   955
         | \meta{var}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   956
: \meta{Stmt} ::= \meta{label} :
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   957
         | \meta{var} := \meta{Exp}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   958
         | \pcode{jmp?} \meta{Exp} \meta{label}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   959
         | \pcode{goto} \meta{label}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   960
: \meta{Prog} ::= \meta{Stmt} \ldots{} \meta{Stmt}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   961
\end{plstx}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   962
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   963
\begin{textblock}{0}(7.8,3.5)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   964
\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   965
\begin{bubble}[5.6cm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   966
\begin{lstlisting}[numbers=none,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   967
                   basicstyle=\ttfamily,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   968
                   language={},xleftmargin=3mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   969
      n := 6
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   970
      m1 := 0
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   971
      m2 := 1
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   972
top:  jmp? n = 0 done
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   973
      tmp := m2
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   974
      m2 := m1 + m2
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   975
      m1 := tmp
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   976
      n := n + -1
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   977
      goto top
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   978
done:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   979
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   980
\end{bubble}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   981
\end{textblock}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   982
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   983
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   984
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   985
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   986
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   987
\begin{frame}[fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   988
\frametitle{\large Concrete Example: Sign-Analysis}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   989
\mbox{}\\[-20mm]\mbox{}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   990
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   991
\bl{\begin{plstx}[rhs style=,one per line]
: \meta{Exp} ::= \meta{Exp} + \meta{Exp}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   992
         | \meta{Exp} * \meta{Exp}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   993
         | \meta{Exp} = \meta{Exp} 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   994
         | \meta{num}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   995
         | \meta{var}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   996
: \meta{Stmt} ::= \meta{label} :
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   997
         | \meta{var} := \meta{Exp}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   998
         | \pcode{jmp?} \meta{Exp} \meta{label}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
   999
         | \pcode{goto} \meta{label}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1000
: \meta{Prog} ::= \meta{Stmt} \ldots{} \meta{Stmt}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1001
\end{plstx}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1002
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1003
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1004
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1005
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1006
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1007
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1008
\begin{frame}[fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1009
\frametitle{Eval: An Interpreter}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1010
\mbox{}\\[-14mm]\mbox{}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1011
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1012
\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1013
\begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1014
\bl{\begin{tabular}{lcl}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1015
$[n]_{env}$ & $\dn$ & $n$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1016
$[x]_{env}$ & $\dn$ & $env(x)$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1017
$[e_1 + e_2]_{env}$ & $\dn$ & $[e_1]_{env} + [e_2]_{env}$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1018
$[e_1 * e_2]_{env}$ & $\dn$ & $[e_1]_{env} * [e_2]_{env}$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1019
$[e_1 = e_2]_{env}$ & $\dn$ & 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1020
$\begin{cases}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1021
1 & \text{if}\quad[e_1]_{env} = [e_2]_{env}\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1022
0 & \text{otherwise}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1023
\end{cases}$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1024
\end{tabular}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1025
\end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1026
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1027
\footnotesize
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1028
\begin{lstlisting}[numbers=none,xleftmargin=-5mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1029
def eval_exp(e: Exp, env: Env) : Int = e match {
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1030
  case Num(n) => n
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1031
  case Var(x) => env(x)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1032
  case Plus(e1, e2) => eval_exp(e1, env) + eval_exp(e2, env)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1033
  case Times(e1, e2) => eval_exp(e1, env) * eval_exp(e2, env)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1034
  case Equ(e1, e2) => 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1035
    if (eval_exp(e1, env) == eval_exp(e2, env)) 1 else 0
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1036
}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1037
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1038
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1039
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1040
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1041
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1042
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1043
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1044
\begin{frame}[fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1045
\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1046
A program
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1047
\begin{bubble}[6cm]\footnotesize
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1048
\begin{lstlisting}[numbers=none,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1049
                   language={},
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1050
                   basicstyle=\ttfamily,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1051
                   xleftmargin=1mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1052
      a := 1
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1053
      n := 5 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1054
top:  jmp? n = 0 done 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1055
      a := a * n 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1056
      n := n + -1 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1057
      goto top 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1058
done:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1059
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1060
\end{bubble}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1061
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1062
The \emph{snippets} of the program:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1063
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1064
\footnotesize
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1065
\begin{columns}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1066
\begin{column}[t]{5cm}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1067
\begin{bubble}[4.5cm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1068
\begin{lstlisting}[numbers=none,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1069
                   basicstyle=\ttfamily,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1070
                   language={},xleftmargin=1mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1071
""    a := 1
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1072
      n := 5 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1073
top:  jmp? n = 0 done 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1074
      a := a * n 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1075
      n := n + -1 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1076
      goto top 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1077
done:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1078
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1079
\end{bubble}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1080
\end{column}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1081
\begin{column}[t]{5cm}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1082
\begin{bubble}[4.5cm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1083
\begin{lstlisting}[numbers=none,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1084
                   basicstyle=\ttfamily,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1085
                   language={},xleftmargin=1mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1086
top:  jmp? n = 0 done 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1087
      a := a * n 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1088
      n := n + -1 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1089
      goto top 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1090
done:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1091
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1092
\end{bubble}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1093
\end{column}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1094
\begin{column}[t]{2cm}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1095
\begin{bubble}[1.1cm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1096
\begin{lstlisting}[numbers=none,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1097
                   basicstyle=\ttfamily,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1098
                   language={},xleftmargin=1mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1099
done:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1100
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1101
\end{bubble}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1102
\end{column}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1103
\end{columns}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1104
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1105
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1106
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1107
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1108
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1109
\begin{frame}[fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1110
\frametitle{Eval for Stmts}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1111
\mbox{}\\[-12mm]\mbox{}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1112
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1113
Let \bl{$sn$} be the snippets of a program
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1114
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1115
\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1116
\begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1117
\bl{\begin{tabular}{lcl}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1118
$[\texttt{nil}]_{env}$ & $\dn$ & $env$\medskip\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1119
$[\texttt{Label}(l:)::rest]_{env}$ & $\dn$ & $[rest]_{env}$\medskip\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1120
$[x \,\texttt{:=}\, a::rest]_{env}$ & $\dn$ & 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1121
$[rest]_{(env[x:= [a]_{env}])}$\medskip\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1122
$[\texttt{jmp?}\;b\;l::rest]_{env}$ & $\dn$ & 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1123
$\begin{cases}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1124
[sn(l)]_{env} & \text{if}\quad[b]_{env} = true\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1125
[rest]_{env}  & \text{otherwise}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1126
\end{cases}$\medskip\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1127
$[\texttt{goto}\;l::rest]_{env}$ & $\dn$ & $[sn(l)]_{env}$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1128
\end{tabular}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1129
\end{center}\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1130
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1131
Start with \bl{$[sn(\mbox{\code{""}})]_{\varnothing}$}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1132
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1133
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1134
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1135
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1136
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1137
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1138
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1139
\begin{frame}[fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1140
\frametitle{Eval in Code}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1141
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1142
\footnotesize
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1143
\begin{lstlisting}[language=Scala,numbers=none,xleftmargin=-5mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1144
def eval(sn: Snips) : Env = {
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1145
  def eval_stmts(sts: Stmts, env: Env) : Env = sts match {
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1146
    case Nil => env
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1147
    
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1148
    case Label(l)::rest => eval_stmts(rest, env)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1149
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1150
    case Assign(x, e)::rest => 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1151
      eval_stmts(rest, env + (x -> eval_exp(e, env)))
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1152
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1153
    case Jmp(b, l)::rest => 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1154
      if (eval_exp(b, env) == 1) eval_stmts(sn(l), env) 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1155
      else eval_stmts(rest, env)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1156
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1157
    case Goto(l)::rest => eval_stmts(sn(l), env)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1158
  }
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1159
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1160
  eval_stmts(sn(""), Map())
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1161
}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1162
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1163
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1164
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1165
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1166
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1167
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1168
\begin{frame}[fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1169
\frametitle{The Idea of Static Analysis}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1170
\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1171
\mbox{}\bigskip\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1172
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1173
\begin{columns}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1174
\begin{column}{5cm}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1175
\begin{bubble}[4.5cm]\footnotesize
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1176
\begin{lstlisting}[numbers=none,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1177
                   language={},
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1178
                   basicstyle=\ttfamily,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1179
                   xleftmargin=1mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1180
      a := 1
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1181
      n := 5 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1182
top:  jmp? n = 0 done 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1183
      a := a * n 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1184
      n := n + -1 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1185
      goto top 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1186
done:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1187
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1188
\end{bubble}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1189
\end{column}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1190
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1191
\begin{column}{1cm}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1192
\raisebox{-20mm}{\LARGE\bf$\Rightarrow$}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1193
\end{column}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1194
\begin{column}{6cm}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1195
\begin{bubble}[4.7cm]\footnotesize
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1196
\begin{lstlisting}[numbers=none,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1197
                   language={},
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1198
                   basicstyle=\ttfamily,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1199
                   xleftmargin=1mm,
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1200
                   escapeinside={(*}{*)}]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1201
      a := (*\hl{'+'}*)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1202
      n := (*\hl{'+'}*) 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1203
top:  jmp? n = (*\hl{'0'}*) done 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1204
      a := a * n 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1205
      n := n + (*\hl{'-'}*) 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1206
      goto top 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1207
done:
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1208
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1209
\end{bubble}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1210
\end{column}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1211
\end{columns}\bigskip\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1212
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1213
Replace all constants and variables by either 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1214
\pcode{+}, \pcode{-} or \pcode{0}. What we want to find out
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1215
is what the sign of \texttt{a} and \texttt{n} is (they should 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1216
always positive).
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1217
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1218
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1219
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1220
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1221
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1222
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1223
  \frametitle{Sign Analysis?}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1224
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1225
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1226
  \begin{columns}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1227
  \begin{column}{3cm}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1228
  \begin{tabular}{cc|l}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1229
  $e_1$ & $e_2$ & $e_1 + e_2$\\\hline{}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1230
  - & - & -\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1231
  - & 0 & -\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1232
  - & + & -, 0, +\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1233
  0 & $x$ & $x$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1234
  + & - & -, 0, +\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1235
  + & 0 & +\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1236
  + & + & +\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1237
  \end{tabular}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1238
  \end{column}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1239
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1240
  \begin{column}{3cm}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1241
  \begin{tabular}{cc|l}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1242
  $e_1$ & $e_2$ & $e_1 * e_2$\\\hline{}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1243
  - & - & +\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1244
  - & 0 & 0\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1245
  - & + & -\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1246
  0 & $x$ & 0\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1247
  + & - & -\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1248
  + & 0 & 0\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1249
  + & + & +\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1250
  \end{tabular}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1251
  \end{column}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1252
  \end{columns}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1253
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1254
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1255
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1256
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1257
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1258
\begin{frame}[fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1259
\mbox{}\\[-13mm]\mbox{}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1260
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1261
\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1262
\begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1263
\bl{\begin{tabular}{lcl}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1264
$[n]_{aenv}$ & $\dn$ & 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1265
$\begin{cases}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1266
\{+\} & \text{if}\; n > 0\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1267
\{-\} & \text{if}\; n < 0\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1268
\{0\} & \text{if}\; n = 0
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1269
\end{cases}$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1270
$[x]_{aenv}$ & $\dn$ & $aenv(x)$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1271
$[e_1 + e_2]_{aenv}$ & $\dn$ & $[e_1]_{aenv} \oplus [e_2]_{aenv}$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1272
$[e_1 * e_2]_{aenv}$ & $\dn$ & $[e_1]_{aenv} \otimes [e_2]_{aenv}$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1273
$[e_1 = e_2]_{aenv}$ & $\dn$ & $\{0, +\}$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1274
\end{tabular}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1275
\end{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1276
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1277
\scriptsize
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1278
\begin{lstlisting}[language=Scala,numbers=none,xleftmargin=-5mm]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1279
def aeval_exp(e: Exp, aenv: AEnv) : Set[Abst] = e match {
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1280
  case Num(0) => Set(Zero)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1281
  case Num(n) if (n < 0) => Set(Neg)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1282
  case Num(n) if (n > 0) => Set(Pos)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1283
  case Var(x) => aenv(x)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1284
  case Plus(e1, e2) => 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1285
    aplus(aeval_exp(e1, aenv), aeval_exp(e2, aenv))
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1286
  case Times(e1, e2) => 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1287
    atimes(aeval_exp(e1, aenv), aeval_exp(e2, aenv))
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1288
  case Equ(e1, e2) => Set(Zero, Pos)
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1289
}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1290
\end{lstlisting}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1291
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1292
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1293
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1294
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1295
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1296
\begin{frame}[fragile]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1297
\frametitle{AEval for Stmts}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1298
\mbox{}\\[-12mm]\mbox{}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1299
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1300
Let \bl{$sn$} be the snippets of a program
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1301
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1302
\small
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1303
\begin{center}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1304
\bl{\begin{tabular}{lcl}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1305
$[\texttt{nil}]_{aenv}$ & $\to$ & $(\texttt{nil},aenv)$\medskip\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1306
$[\texttt{Label}(l:)::rest]_{aenv}$ & $\to$ & $(rest, aenv)$\medskip\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1307
$[x \,\texttt{:=}\, e::rest]_{aenv}$ & $\to$ & 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1308
$(rest, aenv[x:= [e]_{aenv}])$\medskip\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1309
$[\texttt{jmp?}\;e\;l::rest]_{aenv}$ & $\to$ & 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1310
$(sn(l),aenv)$ \textcolor{black}{and} $(rest, aenv)$\medskip\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1311
$[\texttt{goto}\;l::rest]_{aenv}$ & $\to$ & $(sn(l), aenv)$\\
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1312
\end{tabular}}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1313
\end{center}\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1314
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1315
Start with \bl{$[sn(\mbox{\code{""}})]_{\varnothing}$}, try to 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1316
reach all \emph{states} you can find (until a fix point is reached).
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1317
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1318
Check whether there are only $aenv$ in the final states that have 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1319
your property.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1320
\end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1321
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1322
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1323
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1324
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1325
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1326
  \frametitle{Sign Analysis}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1327
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1328
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1329
  \item We want to find out whether \texttt{a} and \texttt{n}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1330
  are always positive?\medskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1331
  \item After a few optimisations, we can indeed find this out.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1332
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1333
  \item equal signs return only \texttt{+} or \texttt{0}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1334
  \item branch into only one direction if you know
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1335
  \item if $x$ is \texttt{+}, then $x + \texttt{-1}$ 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1336
  cannot be negative 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1337
  \end{itemize}\bigskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1338
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1339
  \item What is this good for? Well, you do not need 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1340
  underflow checks (in order to prevent buffer-overflow
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1341
  attacks). In general this technique is used to make sure 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1342
  keys stay secret.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1343
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1344
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1345
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1346
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1347
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1348
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1349
  \begin{frame}[c]
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1350
  \frametitle{Take Home Points}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1351
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1352
  \begin{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1353
  \item While testing is important, it does not show the 
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1354
    absence of bugs/vulnerabilities.\medskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1355
  \item More and more we need (formal) proofs that show
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1356
    a program is bug free.\medskip
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1357
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1358
  \item Static analysis is more and more employed nowadays
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1359
    in order to automatically hunt for bugs.
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1360
  \end{itemize}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1361
  
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1362
  \end{frame}
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1363
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1364
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1365
82
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
  1366
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1367
\end{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1368
538
17acdd516ccd updated
Christian Urban <urbanc@in.tum.de>
parents: 537
diff changeset
  1369
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1370
%%% Local Variables:  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1371
%%% mode: latex
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1372
%%% TeX-master: t
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1373
%%% End: 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1374