slides/slides10.tex
author Christian Urban <christian.urban@kcl.ac.uk>
Thu, 26 Oct 2023 14:30:20 +0100
changeset 945 5070392a1bd7
parent 940 46eee459a999
child 959 64ec1884d860
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
704
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
     1
% !TEX program = xelatex
744
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
     2
\documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer}
315
470922b46a63 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 224
diff changeset
     3
\usepackage{../slides}
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
     4
\usepackage{../langs}
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
     5
\usepackage{../data}
871
94b84d880c2b updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 864
diff changeset
     6
\usepackage{../graphicss}
315
470922b46a63 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 224
diff changeset
     7
\usepackage{soul}
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
223
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     9
\tikzset{onslide/.code args={<#1>#2}{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    10
  \only<#1>{\pgfkeysalso{#2}} % \pgfkeysalso doesn't change the path
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    11
}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    12
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    13
\makeatletter
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    14
\newenvironment<>{btHighlight}[1][]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    15
{\begin{onlyenv}#2\begingroup\tikzset{bt@Highlight@par/.style={#1}}\begin{lrbox}{\@tempboxa}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    16
{\end{lrbox}\bt@HL@box[bt@Highlight@par]{\@tempboxa}\endgroup\end{onlyenv}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    17
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    18
\newcommand<>\btHL[1][]{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    19
  \only#2{\begin{btHighlight}[#1]\bgroup\aftergroup\bt@HL@endenv}%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    20
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    21
\def\bt@HL@endenv{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    22
  \end{btHighlight}%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    23
  \egroup
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    24
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    25
\newcommand{\bt@HL@box}[2][]{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    26
  \tikz[#1]{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    27
    \pgfpathrectangle{\pgfpoint{1pt}{0pt}}{\pgfpoint{\wd #2}{\ht #2}}%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    28
    \pgfusepath{use as bounding box}%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    29
    \node[anchor=base west, fill=orange!30,outer sep=0pt,inner xsep=1pt, inner ysep=0pt, rounded corners=3pt, minimum height=\ht\strutbox+1pt,#1]{\raisebox{1pt}{\strut}\strut\usebox{#2}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    30
  }%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    31
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    32
\makeatother
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    33
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
315
470922b46a63 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 224
diff changeset
    35
% beamer stuff
459
780486571e38 updated
Christian Urban <urbanc@in.tum.de>
parents: 315
diff changeset
    36
\renewcommand{\slidecaption}{CFL 10, King's College London}
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
315
470922b46a63 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 224
diff changeset
    38
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
\begin{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
315
470922b46a63 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 224
diff changeset
    43
\begin{frame}[t]
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    44
\frametitle{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
  \begin{tabular}{@ {}c@ {}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
  \\[-3mm]
459
780486571e38 updated
Christian Urban <urbanc@in.tum.de>
parents: 315
diff changeset
    47
  \LARGE Compilers and \\[-2mm] 
904
d97283992d4f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    48
  \LARGE Formal Languages\\[-3mm] 
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
  \end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    50
904
d97283992d4f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    51
   \normalsize
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    52
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    53
  \begin{tabular}{ll}
940
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 904
diff changeset
    54
    Email:  & christian.urban at kcl.ac.uk\\
46eee459a999 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 904
diff changeset
    55
    Office Hour: & Thurdays 15 -- 16\\  
904
d97283992d4f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    56
  Location: & N7.07 (North Wing, Bush House)\\
d97283992d4f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    57
  Slides \& Progs: & KEATS\\
d97283992d4f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    58
  Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\  
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
  \end{tabular}
904
d97283992d4f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
    60
  \end{center} 
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    61
744
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    62
  \begin{center}
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    63
    \begin{tikzpicture}
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    64
      \node[drop shadow,fill=white,inner sep=0pt] 
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    65
      {\footnotesize\rowcolors{1}{capri!10}{white}
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    66
        \begin{tabular}{|p{4.8cm}|p{4.8cm}|}\hline
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    67
          1 Introduction, Languages          & 6 While-Language \\
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    68
          2 Regular Expressions, Derivatives & 7 Compilation, JVM \\
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    69
          3 Automata, Regular Languages      & 8 Compiling Functional Languages \\
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    70
          4 Lexing, Tokenising               & 9 Optimisations \\
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    71
          5 Grammars, Parsing                & \cellcolor{blue!50}10 LLVM \\ \hline
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    72
        \end{tabular}%
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    73
      };
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    74
    \end{tikzpicture}
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 704
diff changeset
    75
  \end{center}
315
470922b46a63 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 224
diff changeset
    76
\end{frame}
864
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    77
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    78
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    79
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    80
\tikzstyle{sensor}=[draw, fill=blue!20, text width=3.8em, line width=1mm,
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    81
    text centered, minimum height=2em,drop shadow]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    82
\tikzstyle{ann} = [above, text width=4em, text centered]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    83
\tikzstyle{sc} = [sensor, text width=7em, fill=red!20, 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    84
    minimum height=6em, rounded corners, drop shadow,line width=1mm]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    85
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    86
\begin{frame}[fragile,c]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    87
\frametitle{LLVM: Overview}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    88
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    89
\begin{tikzpicture}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    90
    % Validation Layer is the same except that there are a set of nodes and links which are added
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    91
   
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    92
    \path (0,0) node (IR) [sc] {\textbf{LLVM-IR}\\ Optimisations};
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    93
    \path (IR.west)+(-2.2,1.7) node (sou1) [sensor] {C++};
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    94
    \path (IR.west)+(-2.2,0.5) node (sou2)[sensor] {C};
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    95
    \path (IR.west)+(-2.2,-1.0) node (dots)[ann] {$\vdots$}; 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    96
    \path (IR.west)+(-2.2,-1.8) node (sou3)[sensor] {Haskell};    
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    97
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    98
    \path [draw,->,line width=1mm] (sou1.east) -- node [above] {} (IR.160);
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
    99
    \path [draw,->,line width=1mm] (sou2.east) -- node [above] {} (IR.180);
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   100
    \path [draw,->,line width=1mm] (sou3.east) -- node [above] {} (IR.200);
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   101
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   102
    \path (IR.east)+(2.2,2.0)  node (tar1)[sensor] {x86};
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   103
    \path (IR.east)+(2.2,0.8)  node (tar2)[sensor] {ARM};
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   104
    \path (IR.east)+(2.2,-0.4) node (tar3)[sensor] {MIPS}; 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   105
    \path (IR.east)+(2.2,-1.6) node (tar4)[sensor] {RISC}; 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   106
    \path (IR.east)+(2.2,-2.8) node (tar5)[sensor] {Power PC};
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   107
    \path (IR.east)+(2.2,-4.2) node (dots2)[ann] {$\vdots$};
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   108
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   109
    \path [draw,<-,line width=1mm] (tar1.west) -- node [above] {} (IR.10);
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   110
    \path [draw,<-,line width=1mm] (tar2.west) -- node [above] {} (IR.5);
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   111
    \path [draw,<-,line width=1mm] (tar3.west) -- node [above] {} (IR.0);
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   112
    \path [draw,<-,line width=1mm] (tar4.west) -- node [above] {} (IR.-5);
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   113
    \path [draw,<-,line width=1mm] (tar5.west) -- node [above] {} (IR.-10);
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   114
    
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   115
\end{tikzpicture}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   116
\end{frame}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   117
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   118
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   119
704
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   120
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   121
\begin{frame}[c,fragile]
818
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   122
\frametitle{Static Single-Assignment}  
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   123
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   124
\bl{$(1 + a) + (3 + (b * 5))$}\bigskip\bigskip  
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   125
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   126
\begin{lstlisting}[language=LLVMIR,numbers=left]
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   127
let tmp0 = add 1 a in   
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   128
let tmp1 = mul b 5 in 
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   129
let tmp2 = add 3 tmp1 in 
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   130
let tmp3 = add tmp0 tmp2
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   131
  in tmp3 
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   132
\end{lstlisting}  
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   133
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   134
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   135
\end{frame}
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   136
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   137
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   138
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   139
\begin{frame}[c,fragile]
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   140
\small
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   141
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   142
\mbox{}\bigskip\bigskip\bigskip
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   143
864
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   144
\begin{lstlisting}[language=llvm,numbers=left]
818
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   145
define i32 @fact (i32 %n) {
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   146
   %tmp_20 = icmp eq i32  %n, 0
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   147
   br i1 %tmp_20, label %if_branch_24, label %else_branch_25
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   148
 if_branch_24:
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   149
   ret i32 1
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   150
 else_branch_25:
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   151
   %tmp_22 = sub i32  %n, 1
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   152
   %tmp_23 = call i32 @fact (i32 %tmp_22)
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   153
   %tmp_21 = mul i32  %n, %tmp_23
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   154
   ret i32 %tmp_21
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   155
}  
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   156
\end{lstlisting}  
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   157
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   158
\begin{lstlisting}[language={},numbers=none]
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   159
def fact(n) = if n == 0 then 1 else n * fact(n - 1)
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   160
\end{lstlisting}  
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   161
\end{frame}
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   162
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   163
864
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   164
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   165
\begin{frame}[fragile,c]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   166
\frametitle{LLVM Types}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   167
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   168
\tt
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   169
\begin{center}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   170
\begin{tabular}{ll}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   171
boolean & i1 \\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   172
byte    & i8 \\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   173
short   & i16\\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   174
char    & i16\\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   175
integer & i32\\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   176
long    & i64\\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   177
float   & float\\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   178
double  & double\\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   179
*\_      & pointer to \\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   180
**\_     & pointer to a pointer to\\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   181
\mbox{}[\_]    & arrays of\\
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   182
\end{tabular}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   183
\end{center}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   184
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   185
\end{frame}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   186
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   187
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   188
818
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   189
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   190
\begin{frame}[c,fragile]
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   191
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   192
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   193
\begin{lstlisting}[language=LLVM,numbers=none]
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   194
br i1 %var, label %if_br, label %else_br
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   195
  
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   196
icmp eq i32  %x, %y     ; for equal
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   197
icmp sle i32 %x, %y     ;   signed less or equal
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   198
icmp slt i32 %x, %y     ;   signed less than
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   199
icmp ult i32 %x, %y     ;   unsigned less than 
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   200
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   201
%var = call i32 @foo(...args...)
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   202
\end{lstlisting}  
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   203
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   204
\end{frame}
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   205
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   206
864
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   207
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   208
\begin{frame}[fragile,c]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   209
\frametitle{Abstract Syntax Trees}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   210
\footnotesize
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   211
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   212
\begin{lstlisting}[language=Scala,numbers=none,xleftmargin=-3mm]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   213
// Fun language (expressions)
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   214
abstract class Exp 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   215
abstract class BExp 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   216
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   217
case class Call(name: String, args: List[Exp]) extends Exp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   218
case class If(a: BExp, e1: Exp, e2: Exp) extends Exp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   219
case class Write(e: Exp) extends Exp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   220
case class Var(s: String) extends Exp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   221
case class Num(i: Int) extends Exp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   222
case class Aop(o: String, a1: Exp, a2: Exp) extends Exp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   223
case class Sequence(e1: Exp, e2: Exp) extends Exp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   224
case class Bop(o: String, a1: Exp, a2: Exp) extends BExp  
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   225
\end{lstlisting}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   226
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   227
\end{frame}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   228
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   229
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   230
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   231
\begin{frame}[fragile,c]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   232
\frametitle{K-(Intermediate)Language}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   233
\footnotesize
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   234
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   235
\begin{lstlisting}[language=Scala,numbers=none,xleftmargin=-3mm]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   236
abstract class KExp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   237
abstract class KVal
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   238
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   239
// K-Values
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   240
case class KVar(s: String) extends KVal
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   241
case class KNum(i: Int) extends KVal
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   242
case class Kop(o: String, v1: KVal, v2: KVal) extends KVal
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   243
case class KCall(o: String, vrs: List[KVal]) extends KVal
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   244
case class KWrite(v: KVal) extends KVal
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   245
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   246
// K-Expressions
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   247
case class KIf(x1: String, e1: KExp, e2: KExp) extends KExp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   248
case class KLet(x: String, v: KVal, e: KExp) extends KExp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   249
case class KReturn(v: KVal) extends KExp
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   250
\end{lstlisting}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   251
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   252
\end{frame}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   253
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   254
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   255
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   256
\begin{frame}[fragile,c]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   257
\frametitle{KLet}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   258
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   259
\begin{lstlisting}[language=LLVM]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   260
tmp0 = add 1 a   
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   261
tmp1 = mul b 5 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   262
tmp2 = add 3 tmp1 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   263
tmp3 = add tmp0 tmp2  
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   264
\end{lstlisting}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   265
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   266
\begin{lstlisting}[language=LLVMIR]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   267
  KLet tmp0 , add 1 a in  
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   268
   KLet tmp1 , mul b 5 in
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   269
    KLet tmp2 , add 3 tmp1 in 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   270
     KLet tmp3 , add tmp0 tmp2 in
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   271
      ...
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   272
\end{lstlisting}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   273
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   274
\begin{lstlisting}[language=Scala,numbers=none]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   275
case class KLet(x: String, e1: KVal, e2: KExp)
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   276
\end{lstlisting}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   277
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   278
\end{frame}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   279
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   280
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   281
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   282
\begin{frame}[fragile,c]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   283
\frametitle{KLet}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   284
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   285
\begin{lstlisting}[language=LLVM]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   286
tmp0 = add 1 a   
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   287
tmp1 = mul b 5 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   288
tmp2 = add 3 tmp1 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   289
tmp3 = add tmp0 tmp2  
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   290
\end{lstlisting}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   291
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   292
\begin{lstlisting}[language=LLVMIR]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   293
  let tmp0 = add 1 a in  
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   294
   let tmp1 = mul b 5 in
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   295
    let tmp2 = add 3 tmp1 in 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   296
     let tmp3 = add tmp0 tmp2 in
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   297
      ...
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   298
\end{lstlisting}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   299
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   300
\begin{lstlisting}[language=Scala,numbers=none]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   301
case class KLet(x: String, e1: KVal, e2: KExp)
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   302
\end{lstlisting}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   303
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   304
\end{frame}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   305
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   306
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   307
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   308
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   309
\begin{frame}[fragile,c]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   310
\frametitle{CPS-Translation}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   311
\small
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   312
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   313
\begin{lstlisting}[language=Scala,numbers=none]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   314
def CPS(e: Exp)(k: KVal => KExp) : KExp = 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   315
  e match { ... }
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   316
\end{lstlisting}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   317
\bigskip\bigskip
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   318
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   319
the continuation \texttt{k} can be thought of:\medskip
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   320
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   321
\small
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   322
\begin{lstlisting}[language=LLVMIR,numbers=none,xleftmargin=30mm,escapeinside={(*@}{@*)}]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   323
let tmp0 = add 1 a in   
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   324
let tmp1 = mul (*@$\Box$@*) 5 in 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   325
let tmp2 = add 3 tmp1 in 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   326
let tmp3 = add tmp0 tmp2 in
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   327
  KReturn tmp3 
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   328
\end{lstlisting}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   329
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   330
\end{frame}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   331
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   332
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   333
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   334
818
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   335
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
6928a677d26f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   336
\begin{frame}[c,fragile]
704
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   337
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   338
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   339
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm]
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   340
def fact(n: Int) : Int = {
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   341
  if (n == 0) 1 else n * fact(n - 1) 
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   342
}
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   343
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   344
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   345
def factC(n: Int, ret: Int => Int) : Int = {
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   346
  if (n == 0) ret(1) 
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   347
  else factC(n - 1, x => ret(n * x)) 
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   348
}
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   349
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   350
fact(10)
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   351
factC(10, identity)
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   352
\end{lstlisting}
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   353
\end{frame}
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   354
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   355
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   356
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   357
\begin{frame}[c,fragile]
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   358
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   359
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   360
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm]
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   361
def fibC(n: Int, ret: Int => Int) : Int = {
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   362
  if (n == 0 || n == 1) ret(1) else
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   363
  fibC(n - 1,
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   364
       r1 => fibC(n - 2,
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   365
        r2 => ret(r1 + r2)))
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   366
}
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   367
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   368
fibC(10, identity)
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   369
\end{lstlisting}
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   370
\end{frame}
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   371
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   372
904
d97283992d4f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
   373
\begin{frame}<1-15>[c]
704
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   374
904
d97283992d4f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 871
diff changeset
   375
\end{frame}  
704
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   376
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   377
543
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   378
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   379
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   380
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   381
704
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   382
  \Large\bf Are there more strings in \\ \hfill\bl{$L(a^*)$} or
617
f7de0915fff2 updated
Christian Urban <urbanc@in.tum.de>
parents: 616
diff changeset
   383
  \bl{$L((a + b)^*)$}?
543
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   384
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   385
\end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   386
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   387
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   388
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   389
\begin{frame}[c]
704
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   390
\frametitle{Can you remember this HW?}
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   391
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   392
  \begin{itemize}
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   393
  \item (1) How many basic regular expressions are there to match
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   394
      the string \bl{$abcd$}? 
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   395
  \item (2) How many if they cannot include
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   396
      \bl{$\ONE$} and \bl{$\ZERO$}? 
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   397
  \item (3) How many if they are also not
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   398
      allowed to contain stars? 
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   399
  \item (4) How many if they are also
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   400
      not allowed to contain \bl{$\_ + \_$}?
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   401
   \end{itemize}  
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   402
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   403
\end{frame}
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   404
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   405
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   406
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   407
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6d9c960a2b26 updated
Christian Urban <urbanc@in.tum.de>
parents: 617
diff changeset
   408
\begin{frame}[c]
543
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   409
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   410
\Large\bf There are more problems, than there are
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   411
programs.\bigskip\bigskip\pause\\
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   412
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   413
There must be a problem for which there is no program.
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   414
\end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   415
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   416
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   417
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   418
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   419
\frametitle{Subsets}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   420
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   421
\Large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   422
If \bl{$A \subseteq B$} then \bl{$A$} has fewer or equal elements 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   423
than \bl{$B$}\bigskip\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   424
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   425
\Large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   426
\bl{$A \subseteq B$} and \bl{$B \subseteq A$}\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   427
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   428
then \bl{$A = B$}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   429
\end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   430
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   431
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   432
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   433
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   434
  \begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   435
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   436
  \begin{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   437
  \begin{tikzpicture}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   438
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   439
  \draw (-4,2.5) node [scale=2.5] (X) 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   440
    {\begin{tabular}{l}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   441
     $\{$  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   442
     \!\includegraphics[scale=0.02]{../pics/o1.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   443
     \includegraphics[scale=0.02]{../pics/o2.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   444
     \!\includegraphics[scale=0.02]{../pics/o3.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   445
     \includegraphics[scale=0.02]{../pics/o4.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   446
     \!\includegraphics[scale=0.027]{../pics/o5.jpg}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   447
     $\}$
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   448
    \end{tabular}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   449
    
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   450
    \draw (-5.6,-2.5) node [scale=2.5] (Y) 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   451
    {\begin{tabular}{l}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   452
     $\{$  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   453
     \!\includegraphics[scale=0.059]{../pics/a1.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   454
     \includegraphics[scale=0.048]{../pics/a2.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   455
     \includegraphics[scale=0.02]{../pics/a3.jpg}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   456
     $\}$
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   457
    \end{tabular}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   458
    
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   459
     \draw (0,1.5) node (X1) {5 elements};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   460
     \draw (0,-3.5) node (y1) {3 elements};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   461
  \end{tikzpicture}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   462
  \end{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   463
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   464
  \end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   465
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   466
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   467
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   468
  \begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   469
  \frametitle{Newton vs Feynman}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   470
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   471
  \begin{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   472
  \begin{tabular}{cc}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   473
  \includegraphics[scale=0.2]{../pics/newton.jpg} &
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   474
  \includegraphics[scale=0.2]{../pics/feynman.jpg}\\
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   475
  classical physics & quantum physics
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   476
  \end{tabular}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   477
  \end{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   478
  \end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   479
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   480
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   481
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   482
  \begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   483
  \frametitle{The Goal of the Talk}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   484
 \large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   485
  \begin{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   486
  \item show you that something very unintuitive happens with very large sets	
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   487
  \bigskip\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   488
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   489
  \item convince you that there are more {\bf problems} than {\bf programs}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   490
  \end{itemize}	
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   491
  \end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   492
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   493
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   494
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   495
\begin{frame}[t]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   496
%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   497
  \begin{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   498
  \begin{tikzpicture}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   499
 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   500
  \draw (-5,2.5) node [scale=2.3] (X) 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   501
    {\begin{tabular}{@ {\hspace{-3mm}}l}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   502
     \bl{$B$ $=$ $\{$  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   503
     \!\includegraphics[scale=0.02]{../pics/o1.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   504
     \includegraphics[scale=0.02]{../pics/o2.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   505
     \!\includegraphics[scale=0.02]{../pics/o3.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   506
     \includegraphics[scale=0.02]{../pics/o4.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   507
     \!\includegraphics[scale=0.027]{../pics/o5.jpg}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   508
     $\}$}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   509
    \end{tabular}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   510
    
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   511
    \draw (-6.6,-0.5) node [scale=2.3] (Y) 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   512
    {\begin{tabular}{@ {\hspace{-3mm}}l}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   513
     \bl{$A$ $=$ $\{$  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   514
     \!\includegraphics[scale=0.059]{../pics/a1.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   515
     \includegraphics[scale=0.048]{../pics/a2.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   516
     \includegraphics[scale=0.02]{../pics/a3.jpg}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   517
     $\}$}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   518
     \end{tabular}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   519
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   520
     \only<1>{\draw (-5, -3) node[scale=2] 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   521
       {\bl{$|A|$ $=$ $5$}, \bl{$|B|$ $=$ $3$}};}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   522
     \only<2>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   523
       \draw [->, line width=1mm, red] (-7.4, 0.2) -- (-6.1, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   524
       \draw [->, line width=1mm, red] (-5.8, 0.2) -- (-3.1, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   525
       \draw [->, line width=1mm, red] (-4.5, 0.2) -- (-7.6, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   526
       \draw (-5, -3) node[scale=2] {then \bl{$|A|$ $\le$ $|B|$}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   527
       }
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   528
    \only<3>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   529
       \draw [<-, line width=1mm, red] (-7.5, 0.2) -- (-6.1, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   530
       \draw [<-, line width=1mm, red] (-7.3, 0.2) -- (-3.1, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   531
       \draw [<-, line width=1mm, red] (-6, 0.2) -- (-7.5, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   532
       \draw [<-, line width=1mm, red] (-4.5, 0.2) -- (-4.5, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   533
       \draw [<-, line width=1mm, red] (-4.3, 0.2) -- (-1.3, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   534
       
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   535
       \draw (-5, -3) node[scale=1.5] {\small{}for \bl{$=$}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   536
        has to be a {\bf one-to-one} mapping};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   537
       }
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   538
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   539
    
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   540
  \end{tikzpicture}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   541
  \end{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   542
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   543
\end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   544
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   545
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   546
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   547
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   548
\frametitle{Cardinality}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   549
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   550
\Large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   551
\bl{$|A|$} $\dn$ ``how many elements''\bigskip\\
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   552
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   553
\bl{$A \subseteq B  \Rightarrow |A| \leq |B|$}\bigskip\\\pause
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   554
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   555
if there is an injective function \bl{$f: A \rightarrow B$} then \bl{$|A| \leq |B|$}\
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   556
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   557
\begin{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   558
\bl{\large$\forall x y.\; f(x) = f(y) \Rightarrow x = y$}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   559
\end{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   560
\end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   561
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   562
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   563
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   564
\begin{frame}[t]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   565
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   566
  \begin{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   567
  \begin{tikzpicture}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   568
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   569
  \draw (-6.6,2.5) node [scale=2.3] (X) 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   570
    {\begin{tabular}{@ {\hspace{-3mm}}l}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   571
     $A$ $=$ $\{$  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   572
     \!\includegraphics[scale=0.02]{../pics/o1.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   573
     \includegraphics[scale=0.02]{../pics/o2.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   574
     \!\includegraphics[scale=0.02]{../pics/o3.jpg}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   575
     $\}$
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   576
    \end{tabular}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   577
    
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   578
    \draw (-6.6,-0.5) node [scale=2.3] (Y) 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   579
    {\begin{tabular}{@ {\hspace{-3mm}}l}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   580
     $B$ $=$ $\{$  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   581
     \!\includegraphics[scale=0.059]{../pics/a1.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   582
     \includegraphics[scale=0.048]{../pics/a2.jpg},
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   583
     \includegraphics[scale=0.02]{../pics/a3.jpg}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   584
     $\}$
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   585
     \end{tabular}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   586
   \onslide<3->{\draw (-7, -3) node[scale=1.5] 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   587
      {then \bl{$|A|$ \alert{$=$} $|B|$}};}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   588
     \only<1>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   589
       \draw [->, line width=1mm, red] (-7.4, 0.2) -- (-6.1, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   590
       \draw [->, line width=1mm, red] (-5.8, 0.2) -- (-4.3, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   591
       \draw [->, line width=1mm, red] (-4.5, 0.2) -- (-7.6, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   592
     }
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   593
    \only<2->{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   594
       \draw [<-, line width=1mm, blue] (-7.5, 0.2) -- (-7.5, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   595
       \draw [<-, line width=1mm, blue] (-5.8, 0.2) -- (-4.3, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   596
       \draw [<-, line width=1mm, blue] (-4.5, 0.2) -- (-6.1, 2.1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   597
       }
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   598
   
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   599
    
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   600
  \end{tikzpicture}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   601
  \end{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   602
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   603
\end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   604
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
315
470922b46a63 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 224
diff changeset
   605
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   606
543
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   607
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   608
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   609
\frametitle{Natural Numbers}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   610
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   611
\Large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   612
\bl{$\mathbb{N}$} \bl{$\dn$} \bl{$\{0, 1, 2, 3, .......\}$}\bigskip\pause 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   613
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   614
\bl{$A$} is \alert{countable} iff \bl{$|A| \leq |\mathbb{N}|$}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   615
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   616
\end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   617
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   618
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   619
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   620
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   621
\frametitle{First Question}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   622
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   623
\Large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   624
\bl{$|\mathbb{N} - \{0\}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\bigskip 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   625
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   626
\large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   627
\bl{$\geq$} or \bl{$\leq$} or \bl{$=$} ?
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   628
\bigskip\bigskip\bigskip\pause
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   629
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   630
\bl{$x$ $\mapsto$ $x + 1$},\\  \bl{$|\mathbb{N} - \{0\}|$ $=$  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   631
$|\mathbb{N}|$}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   632
\end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   633
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   634
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   635
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   636
\mode<presentation>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   637
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   638
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   639
\Large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   640
\bl{$|\mathbb{N} - \{0, 1\}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\pause 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   641
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   642
\bl{$|\mathbb{N} - \mathbb{O}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   643
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   644
\normalsize
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   645
\bl{$\mathbb{O}$} $\dn$ odd numbers\quad   \bl{$\{1,3,5......\}$}\\ \pause
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   646
\bl{$\mathbb{E}$} $\dn$ even numbers\quad   \bl{$\{0,2,4......\}$}\\
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   647
\end{frame}}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   648
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   649
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   650
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   651
\mode<presentation>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   652
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   653
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   654
\Large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   655
\bl{$|\mathbb{N} \cup \mathbb{-N}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   656
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   657
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   658
\normalsize
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   659
\bl{$\mathbb{\phantom{-}N}$} $\dn$ positive numbers\quad   \bl{$\{0,1,2,3,......\}$}\\
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   660
\bl{$\mathbb{-N}$} $\dn$ negative numbers\quad   \bl{$\{0,-1,-2,-3,......\}$}\\
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   661
\end{frame}}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   662
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   663
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   664
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   665
\mode<presentation>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   666
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   667
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   668
\Large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   669
\bl{$A$} is \alert{countable} if there exists an injective \bl{$f : A \rightarrow \mathbb{N}$}\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   670
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   671
\bl{$A$} is \alert{uncountable} if there does not exist an injective \bl{$f : A \rightarrow \mathbb{N}$}\bigskip\bigskip 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   672
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   673
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   674
countable:  \bl{$|A| \leq |\mathbb{N}|$}\\
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   675
uncountable:  \bl{$|A| > |\mathbb{N}|$}\pause\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   676
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   677
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   678
Does there exist such an \bl{$A$} ?
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   679
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   680
\end{frame}}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   681
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   682
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   683
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   684
  \mode<presentation>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   685
  \begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   686
  \frametitle{Hilbert's Hotel}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   687
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   688
  \begin{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   689
 \includegraphics[scale=0.8]{../pics/hilberts_hotel.jpg}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   690
  \end{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   691
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   692
  \begin{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   693
  \item \ldots has as many rooms as there are natural numbers
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   694
  \end{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   695
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   696
  \end{frame}}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   697
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   698
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   699
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   700
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   701
\begin{frame}[t]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   702
 \frametitle{\begin{tabular}{c}Real Numbers between\\[-2mm] 0 and 1\end{tabular}}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   703
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   704
  \begin{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   705
  \begin{tikzpicture}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   706
  \draw [fill, color=black!50] (1,4) rectangle (2, 3);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   707
  \draw [fill, color=black!50] (2,3) rectangle (3, 2);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   708
  \draw [fill, color=black!50] (3,2) rectangle (4, 1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   709
  \draw [fill, color=black!50] (4,1) rectangle (5, 0);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   710
  \draw (0, 0) grid (8, 5);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   711
  \draw [line width = 1.mm] (1,0) -- (1, 5);    
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   712
  \draw [line width = 1.mm] (0, 4) -- (8, 4);    
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   713
  \draw (0.5,3.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   714
  \draw (0.5,2.5) node {$2$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   715
  \draw (0.5,1.5) node {$3$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   716
  \draw (0.5,0.5) node {$4$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   717
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   718
  \draw (1.5,3.5) node {\only<1>{$3$}\only<2->{$4$}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   719
  \draw (2.5,3.5) node {$3$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   720
  \draw (3.5,3.5) node {$3$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   721
  \draw (4.5,3.5) node {$3$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   722
  \draw (5.5,3.5) node {$3$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   723
  \draw (6.5,3.5) node {$3$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   724
  \draw (7.5,3.5) node {$\ldots$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   725
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   726
  \draw (1.5,2.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   727
  \draw (2.5,2.5) node {\only<1-2>{$2$}\only<3->{$3$}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   728
  \draw (3.5,2.5) node {$3$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   729
  \draw (4.5,2.5) node {$4$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   730
  \draw (5.5,2.5) node {$5$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   731
  \draw (6.5,2.5) node {$6$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   732
  \draw (7.5,2.5) node {$7$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   733
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   734
  \draw (1.5,1.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   735
  \draw (2.5,1.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   736
  \draw (3.5,1.5) node {\only<1-3>{$0$}\only<4->{$1$}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   737
  \draw (4.5,1.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   738
  \draw (5.5,1.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   739
  \draw (6.5,1.5) node {$\ldots$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   740
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   741
   \draw (1.5,0.5) node {$7$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   742
  \draw (2.5,0.5) node {$8$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   743
  \draw (3.5,0.5) node {$5$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   744
  \draw (4.5,0.5) node {\only<1-4>{$3$}\only<5->{$4$}};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   745
  \draw (5.5,0.5) node {$9$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   746
  \draw (6.5,0.5) node {$\ldots$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   747
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   748
   \draw (1.5,-0.5) node {$\ldots$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   749
   \draw (8.5,3.5) node {$\ldots$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   750
  \end{tikzpicture}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   751
  \end{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   752
  \mbox{}\\[-20mm]\mbox{}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   753
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   754
  \onslide<6->{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   755
  \begin{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   756
  \Large\bl{$|\mathbb{N}| < |R|$}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   757
  \end{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   758
  }
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   759
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   760
\end{frame}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   761
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   762
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   763
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   764
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   765
\mode<presentation>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   766
\begin{frame}[t]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   767
 \frametitle{The Set of Problems}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   768
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   769
  $\aleph_0$
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   770
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   771
  \begin{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   772
  \begin{tikzpicture}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   773
  \draw [fill, color=black!50] (1,4) rectangle (2, 3);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   774
  \draw [fill, color=black!50] (2,3) rectangle (3, 2);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   775
  \draw [fill, color=black!50] (3,2) rectangle (4, 1);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   776
  \draw [fill, color=black!50] (4,1) rectangle (5, 0);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   777
  \draw (0, 0) grid (8, 5);
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   778
  \draw [line width = 1.mm] (1,0) -- (1, 5);    
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   779
  \draw [line width = 1.mm] (0, 4) -- (8, 4);    
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   780
  \draw (0.5,3.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   781
  \draw (0.5,2.5) node {$2$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   782
  \draw (0.5,1.5) node {$3$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   783
  \draw (0.5,0.5) node {$4$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   784
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   785
  \draw (1.5,4.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   786
  \draw (2.5,4.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   787
  \draw (3.5,4.5) node {$2$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   788
  \draw (4.5,4.5) node {$3$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   789
  \draw (5.5,4.5) node {$4$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   790
  \draw (6.5,4.5) node {$5$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   791
  \draw (7.5,4.5) node {$\ldots$}; 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   792
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   793
  \draw (1.5,3.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   794
  \draw (2.5,3.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   795
  \draw (3.5,3.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   796
  \draw (4.5,3.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   797
  \draw (5.5,3.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   798
  \draw (6.5,3.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   799
  \draw (7.5,3.5) node {$\ldots$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   800
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   801
  \draw (1.5,2.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   802
  \draw (2.5,2.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   803
  \draw (3.5,2.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   804
  \draw (4.5,2.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   805
  \draw (5.5,2.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   806
  \draw (6.5,2.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   807
  \draw (7.5,2.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   808
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   809
  \draw (1.5,1.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   810
  \draw (2.5,1.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   811
  \draw (3.5,1.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   812
  \draw (4.5,1.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   813
  \draw (5.5,1.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   814
  \draw (6.5,1.5) node {$\ldots$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   815
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   816
   \draw (1.5,0.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   817
  \draw (2.5,0.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   818
  \draw (3.5,0.5) node {$0$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   819
  \draw (4.5,0.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   820
  \draw (5.5,0.5) node {$1$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   821
  \draw (6.5,0.5) node {$\ldots$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   822
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   823
  \draw (1.5,-0.5) node {$\ldots$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   824
   \draw (8.5,3.5) node {$\ldots$};
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   825
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   826
  \end{tikzpicture}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   827
  \end{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   828
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   829
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   830
  \onslide<2>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   831
  \begin{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   832
  \large \bl{|Progs| $=$ $|\mathbb{N}|$ $<$ |Probs|}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   833
 \end{center}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   834
  }
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   835
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   836
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   837
\end{frame}}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   838
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   839
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   840
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   841
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   842
\mode<presentation>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   843
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   844
\frametitle{Halting Problem}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   845
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   846
\large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   847
Assume a program \bl{$H$} that decides for all programs \bl{$A$} and all 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   848
input data \bl{$D$} whether\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   849
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   850
\begin{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   851
\item \bl{$H(A, D) \dn 1$} iff \bl{$A(D)$} terminates
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   852
\item \bl{$H(A, D) \dn 0$} otherwise
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   853
\end{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   854
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   855
\end{frame}}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   856
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   857
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   858
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   859
\mode<presentation>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   860
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   861
\frametitle{Halting Problem (2)}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   862
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   863
\large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   864
Given such a program \bl{$H$} define the following program \bl{$C$}:
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   865
for all programs \bl{$A$}\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   866
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   867
\begin{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   868
\item \bl{$C(A) \dn 0$} iff \bl{$H(A, A) = 0$} 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   869
\item \bl{$C(A) \dn$ loops} otherwise
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   870
\end{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   871
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   872
\end{frame}}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   873
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   874
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   875
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   876
\mode<presentation>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   877
\begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   878
\frametitle{Contradiction}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   879
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   880
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   881
\bl{$H(C, C)$} is either \bl{$0$} or \bl{$1$}.
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   882
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   883
\begin{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   884
\item \bl{$H(C, C) = 1$} $\stackrel{\text{def}\,H}{\Rightarrow}$ \bl{$C(C)\downarrow$} $\stackrel{\text{def}\,C}{\Rightarrow}$ \bl{$H(C, C)=0$} 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   885
\item \bl{$H(C, C) = 0$} $\stackrel{\text{def}\,H}{\Rightarrow}$ \bl{$C(C)$} loops $\stackrel{\text{def}\,C}{\Rightarrow}$\\ 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   886
\hspace{7cm}\bl{$H(C, C)=1$} 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   887
\end{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   888
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   889
Contradiction in both cases. So \bl{$H$} cannot exist.
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   890
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   891
\end{frame}}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   892
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   893
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   894
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   895
  \mode<presentation>{
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   896
  \begin{frame}[c]
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   897
  \frametitle{Take Home Points}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   898
 \large
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   899
 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   900
  \begin{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   901
  \item there are sets that are more infinite than others\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   902
  \item even  with the most powerful computer we can imagine, there 
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   903
  are problems that cannot be solved by any program\bigskip\bigskip
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   904
  
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   905
  \item in CS we actually hit quite often such problems (halting problem)
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   906
  \end{itemize}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   907
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   908
  \end{frame}}
16adebf18ef9 updated
Christian Urban <urbanc@in.tum.de>
parents: 500
diff changeset
   909
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
864
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   910
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   911
\begin{frame}<1-20>[c]
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   912
\end{frame}
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   913
Christian Urban <christian.urban@kcl.ac.uk>
parents: 818
diff changeset
   914
86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   915
\end{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   916
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   917
%%% Local Variables:  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   918
%%% mode: latex
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   919
%%% TeX-master: t
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   920
%%% End: 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   921