| author | Christian Urban <christian.urban@kcl.ac.uk> | 
| Sat, 04 Dec 2021 00:49:34 +0000 | |
| changeset 860 | abf63cd5e11b | 
| parent 818 | ea65778368cc | 
| child 864 | a24633510c0a | 
| permissions | -rw-r--r-- | 
| 704 | 1 | % !TEX program = xelatex | 
| 744 | 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: 
224diff
changeset | 3 | \usepackage{../slides}
 | 
| 215 
828303e8e4af
updated slides
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
93diff
changeset | 4 | \usepackage{../langs}
 | 
| 
828303e8e4af
updated slides
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
93diff
changeset | 5 | \usepackage{../data}
 | 
| 315 
470922b46a63
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
224diff
changeset | 6 | \usepackage{../graphics}
 | 
| 
470922b46a63
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
224diff
changeset | 7 | \usepackage{soul}
 | 
| 86 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 8 | |
| 223 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 9 | \tikzset{onslide/.code args={<#1>#2}{%
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 10 |   \only<#1>{\pgfkeysalso{#2}} % \pgfkeysalso doesn't change the path
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 11 | }} | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 12 | |
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 13 | \makeatletter | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 14 | \newenvironment<>{btHighlight}[1][]
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 15 | {\begin{onlyenv}#2\begingroup\tikzset{bt@Highlight@par/.style={#1}}\begin{lrbox}{\@tempboxa}}
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 16 | {\end{lrbox}\bt@HL@box[bt@Highlight@par]{\@tempboxa}\endgroup\end{onlyenv}}
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 17 | |
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 18 | \newcommand<>\btHL[1][]{%
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 19 |   \only#2{\begin{btHighlight}[#1]\bgroup\aftergroup\bt@HL@endenv}%
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 20 | } | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 21 | \def\bt@HL@endenv{%
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 22 |   \end{btHighlight}%   
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 23 | \egroup | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 24 | } | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 25 | \newcommand{\bt@HL@box}[2][]{%
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 26 |   \tikz[#1]{%
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 27 |     \pgfpathrectangle{\pgfpoint{1pt}{0pt}}{\pgfpoint{\wd #2}{\ht #2}}%
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 28 |     \pgfusepath{use as bounding box}%
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
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}};
 | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 30 | }% | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 31 | } | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 32 | \makeatother | 
| 
e4b29b57f6a3
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 33 | |
| 86 
6a7fe83820c8
added
 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: 
224diff
changeset | 35 | % beamer stuff | 
| 459 | 36 | \renewcommand{\slidecaption}{CFL 10, King's College London}
 | 
| 86 
6a7fe83820c8
added
 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: 
224diff
changeset | 38 | |
| 86 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 39 | |
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 40 | \begin{document}
 | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 41 | |
| 
6a7fe83820c8
added
 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: 
224diff
changeset | 43 | \begin{frame}[t]
 | 
| 86 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 44 | \frametitle{%
 | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 45 |   \begin{tabular}{@ {}c@ {}}
 | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 46 | \\[-3mm] | 
| 459 | 47 | \LARGE Compilers and \\[-2mm] | 
| 744 | 48 | \LARGE Formal Languages\\[3mm] | 
| 86 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 49 |   \end{tabular}}
 | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 50 | |
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 51 | \normalsize | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 52 |   \begin{center}
 | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 53 |   \begin{tabular}{ll}
 | 
| 704 | 54 | Email: & christian.urban at kcl.ac.uk\\ | 
| 744 | 55 | %Office Hours: & Thursdays 12 -- 14\\ | 
| 56 | %Location: & N7.07 (North Wing, Bush House)\\ | |
| 704 | 57 | Slides \& Progs: & KEATS (also homework is there)\\ | 
| 86 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 58 |   \end{tabular}
 | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 59 |   \end{center}
 | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 60 | |
| 744 | 61 |   \begin{center}
 | 
| 62 |     \begin{tikzpicture}
 | |
| 63 | \node[drop shadow,fill=white,inner sep=0pt] | |
| 64 |       {\footnotesize\rowcolors{1}{capri!10}{white}
 | |
| 65 |         \begin{tabular}{|p{4.8cm}|p{4.8cm}|}\hline
 | |
| 66 | 1 Introduction, Languages & 6 While-Language \\ | |
| 67 | 2 Regular Expressions, Derivatives & 7 Compilation, JVM \\ | |
| 68 | 3 Automata, Regular Languages & 8 Compiling Functional Languages \\ | |
| 69 | 4 Lexing, Tokenising & 9 Optimisations \\ | |
| 70 |           5 Grammars, Parsing                & \cellcolor{blue!50}10 LLVM \\ \hline
 | |
| 71 |         \end{tabular}%
 | |
| 72 | }; | |
| 73 |     \end{tikzpicture}
 | |
| 74 |   \end{center}
 | |
| 315 
470922b46a63
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
224diff
changeset | 75 | \end{frame}
 | 
| 86 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 76 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 77 | |
| 704 | 78 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 79 | \begin{frame}[c,fragile]
 | |
| 818 | 80 | \frametitle{Static Single-Assignment}  
 | 
| 81 | ||
| 82 | \bl{$(1 + a) + (3 + (b * 5))$}\bigskip\bigskip  
 | |
| 83 | ||
| 84 | \begin{lstlisting}[language=LLVMIR,numbers=left]
 | |
| 85 | let tmp0 = add 1 a in | |
| 86 | let tmp1 = mul b 5 in | |
| 87 | let tmp2 = add 3 tmp1 in | |
| 88 | let tmp3 = add tmp0 tmp2 | |
| 89 | in tmp3 | |
| 90 | \end{lstlisting}  
 | |
| 91 | ||
| 92 | ||
| 93 | \end{frame}
 | |
| 94 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 95 | ||
| 96 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 97 | \begin{frame}[c,fragile]
 | |
| 98 | \small | |
| 99 | ||
| 100 | \mbox{}\bigskip\bigskip\bigskip
 | |
| 101 | ||
| 102 | \begin{lstlisting}[language={},numbers=left]
 | |
| 103 | define i32 @fact (i32 %n) {
 | |
| 104 | %tmp_20 = icmp eq i32 %n, 0 | |
| 105 | br i1 %tmp_20, label %if_branch_24, label %else_branch_25 | |
| 106 | if_branch_24: | |
| 107 | ret i32 1 | |
| 108 | else_branch_25: | |
| 109 | %tmp_22 = sub i32 %n, 1 | |
| 110 | %tmp_23 = call i32 @fact (i32 %tmp_22) | |
| 111 | %tmp_21 = mul i32 %n, %tmp_23 | |
| 112 | ret i32 %tmp_21 | |
| 113 | } | |
| 114 | \end{lstlisting}  
 | |
| 115 | ||
| 116 | \begin{lstlisting}[language={},numbers=none]
 | |
| 117 | def fact(n) = if n == 0 then 1 else n * fact(n - 1) | |
| 118 | \end{lstlisting}  
 | |
| 119 | \end{frame}
 | |
| 120 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 121 | ||
| 122 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 123 | \begin{frame}[c,fragile]
 | |
| 124 | ||
| 125 | ||
| 126 | \begin{lstlisting}[language=LLVM,numbers=none]
 | |
| 127 | br i1 %var, label %if_br, label %else_br | |
| 128 | ||
| 129 | icmp eq i32 %x, %y ; for equal | |
| 130 | icmp sle i32 %x, %y ; signed less or equal | |
| 131 | icmp slt i32 %x, %y ; signed less than | |
| 132 | icmp ult i32 %x, %y ; unsigned less than | |
| 133 | ||
| 134 | %var = call i32 @foo(...args...) | |
| 135 | \end{lstlisting}  
 | |
| 136 | ||
| 137 | \end{frame}
 | |
| 138 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 139 | ||
| 140 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 141 | \begin{frame}[c,fragile]
 | |
| 704 | 142 | |
| 143 | ||
| 144 | \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm]
 | |
| 145 | def fact(n: Int) : Int = {
 | |
| 146 | if (n == 0) 1 else n * fact(n - 1) | |
| 147 | } | |
| 148 | ||
| 149 | ||
| 150 | def factC(n: Int, ret: Int => Int) : Int = {
 | |
| 151 | if (n == 0) ret(1) | |
| 152 | else factC(n - 1, x => ret(n * x)) | |
| 153 | } | |
| 154 | ||
| 155 | fact(10) | |
| 156 | factC(10, identity) | |
| 157 | \end{lstlisting}
 | |
| 158 | \end{frame}
 | |
| 159 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 160 | ||
| 161 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 162 | \begin{frame}[c,fragile]
 | |
| 163 | ||
| 164 | ||
| 165 | \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm]
 | |
| 166 | def fibC(n: Int, ret: Int => Int) : Int = {
 | |
| 167 | if (n == 0 || n == 1) ret(1) else | |
| 168 | fibC(n - 1, | |
| 169 | r1 => fibC(n - 2, | |
| 170 | r2 => ret(r1 + r2))) | |
| 171 | } | |
| 172 | ||
| 173 | fibC(10, identity) | |
| 174 | \end{lstlisting}
 | |
| 175 | \end{frame}
 | |
| 176 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 177 | ||
| 178 | ||
| 179 | ||
| 180 | ||
| 543 | 181 | |
| 182 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 183 | \begin{frame}[c]
 | |
| 184 | ||
| 704 | 185 |   \Large\bf Are there more strings in \\ \hfill\bl{$L(a^*)$} or
 | 
| 617 | 186 |   \bl{$L((a + b)^*)$}?
 | 
| 543 | 187 | |
| 188 | \end{frame}
 | |
| 189 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 190 | ||
| 191 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 192 | \begin{frame}[c]
 | |
| 704 | 193 | \frametitle{Can you remember this HW?}
 | 
| 194 | ||
| 195 |   \begin{itemize}
 | |
| 196 | \item (1) How many basic regular expressions are there to match | |
| 197 |       the string \bl{$abcd$}? 
 | |
| 198 | \item (2) How many if they cannot include | |
| 199 |       \bl{$\ONE$} and \bl{$\ZERO$}? 
 | |
| 200 | \item (3) How many if they are also not | |
| 201 | allowed to contain stars? | |
| 202 | \item (4) How many if they are also | |
| 203 |       not allowed to contain \bl{$\_ + \_$}?
 | |
| 204 |    \end{itemize}  
 | |
| 205 | ||
| 206 | \end{frame}
 | |
| 207 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 208 | ||
| 209 | ||
| 210 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 211 | \begin{frame}[c]
 | |
| 543 | 212 | |
| 213 | \Large\bf There are more problems, than there are | |
| 214 | programs.\bigskip\bigskip\pause\\ | |
| 215 | ||
| 216 | There must be a problem for which there is no program. | |
| 217 | \end{frame}
 | |
| 218 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 219 | ||
| 220 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 221 | \begin{frame}[c]
 | |
| 222 | \frametitle{Subsets}
 | |
| 223 | ||
| 224 | \Large | |
| 225 | If \bl{$A \subseteq B$} then \bl{$A$} has fewer or equal elements 
 | |
| 226 | than \bl{$B$}\bigskip\bigskip
 | |
| 227 | ||
| 228 | \Large | |
| 229 | \bl{$A \subseteq B$} and \bl{$B \subseteq A$}\bigskip
 | |
| 230 | ||
| 231 | then \bl{$A = B$}
 | |
| 232 | \end{frame}
 | |
| 233 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 234 | ||
| 235 | ||
| 236 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 237 |   \begin{frame}[c]
 | |
| 238 | ||
| 239 |   \begin{center}
 | |
| 240 |   \begin{tikzpicture}
 | |
| 241 | ||
| 242 | \draw (-4,2.5) node [scale=2.5] (X) | |
| 243 |     {\begin{tabular}{l}
 | |
| 244 |      $\{$  
 | |
| 245 |      \!\includegraphics[scale=0.02]{../pics/o1.jpg},
 | |
| 246 |      \includegraphics[scale=0.02]{../pics/o2.jpg},
 | |
| 247 |      \!\includegraphics[scale=0.02]{../pics/o3.jpg},
 | |
| 248 |      \includegraphics[scale=0.02]{../pics/o4.jpg},
 | |
| 249 |      \!\includegraphics[scale=0.027]{../pics/o5.jpg}
 | |
| 250 | $\}$ | |
| 251 |     \end{tabular}};
 | |
| 252 | ||
| 253 | \draw (-5.6,-2.5) node [scale=2.5] (Y) | |
| 254 |     {\begin{tabular}{l}
 | |
| 255 |      $\{$  
 | |
| 256 |      \!\includegraphics[scale=0.059]{../pics/a1.jpg},
 | |
| 257 |      \includegraphics[scale=0.048]{../pics/a2.jpg},
 | |
| 258 |      \includegraphics[scale=0.02]{../pics/a3.jpg}
 | |
| 259 | $\}$ | |
| 260 |     \end{tabular}};
 | |
| 261 | ||
| 262 |      \draw (0,1.5) node (X1) {5 elements};
 | |
| 263 |      \draw (0,-3.5) node (y1) {3 elements};
 | |
| 264 |   \end{tikzpicture}
 | |
| 265 |   \end{center}
 | |
| 266 | ||
| 267 |   \end{frame}
 | |
| 268 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 269 | ||
| 270 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 271 |   \begin{frame}[c]
 | |
| 272 |   \frametitle{Newton vs Feynman}
 | |
| 273 | ||
| 274 |   \begin{center}
 | |
| 275 |   \begin{tabular}{cc}
 | |
| 276 |   \includegraphics[scale=0.2]{../pics/newton.jpg} &
 | |
| 277 |   \includegraphics[scale=0.2]{../pics/feynman.jpg}\\
 | |
| 278 | classical physics & quantum physics | |
| 279 |   \end{tabular}
 | |
| 280 |   \end{center}
 | |
| 281 |   \end{frame}
 | |
| 282 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 283 | ||
| 284 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 285 |   \begin{frame}[c]
 | |
| 286 |   \frametitle{The Goal of the Talk}
 | |
| 287 | \large | |
| 288 |   \begin{itemize}
 | |
| 289 | \item show you that something very unintuitive happens with very large sets | |
| 290 | \bigskip\bigskip | |
| 291 | ||
| 292 |   \item convince you that there are more {\bf problems} than {\bf programs}
 | |
| 293 |   \end{itemize}	
 | |
| 294 |   \end{frame}
 | |
| 295 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 296 | ||
| 297 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 298 | \begin{frame}[t]
 | |
| 299 | % | |
| 300 |   \begin{center}
 | |
| 301 |   \begin{tikzpicture}
 | |
| 302 | ||
| 303 | \draw (-5,2.5) node [scale=2.3] (X) | |
| 304 |     {\begin{tabular}{@ {\hspace{-3mm}}l}
 | |
| 305 |      \bl{$B$ $=$ $\{$  
 | |
| 306 |      \!\includegraphics[scale=0.02]{../pics/o1.jpg},
 | |
| 307 |      \includegraphics[scale=0.02]{../pics/o2.jpg},
 | |
| 308 |      \!\includegraphics[scale=0.02]{../pics/o3.jpg},
 | |
| 309 |      \includegraphics[scale=0.02]{../pics/o4.jpg},
 | |
| 310 |      \!\includegraphics[scale=0.027]{../pics/o5.jpg}
 | |
| 311 | $\}$} | |
| 312 |     \end{tabular}};
 | |
| 313 | ||
| 314 | \draw (-6.6,-0.5) node [scale=2.3] (Y) | |
| 315 |     {\begin{tabular}{@ {\hspace{-3mm}}l}
 | |
| 316 |      \bl{$A$ $=$ $\{$  
 | |
| 317 |      \!\includegraphics[scale=0.059]{../pics/a1.jpg},
 | |
| 318 |      \includegraphics[scale=0.048]{../pics/a2.jpg},
 | |
| 319 |      \includegraphics[scale=0.02]{../pics/a3.jpg}
 | |
| 320 | $\}$} | |
| 321 |      \end{tabular}};
 | |
| 322 | ||
| 323 |      \only<1>{\draw (-5, -3) node[scale=2] 
 | |
| 324 |        {\bl{$|A|$ $=$ $5$}, \bl{$|B|$ $=$ $3$}};}
 | |
| 325 |      \only<2>{
 | |
| 326 | \draw [->, line width=1mm, red] (-7.4, 0.2) -- (-6.1, 2.1); | |
| 327 | \draw [->, line width=1mm, red] (-5.8, 0.2) -- (-3.1, 2.1); | |
| 328 | \draw [->, line width=1mm, red] (-4.5, 0.2) -- (-7.6, 2.1); | |
| 329 |        \draw (-5, -3) node[scale=2] {then \bl{$|A|$ $\le$ $|B|$}};
 | |
| 330 | } | |
| 331 |     \only<3>{
 | |
| 332 | \draw [<-, line width=1mm, red] (-7.5, 0.2) -- (-6.1, 2.1); | |
| 333 | \draw [<-, line width=1mm, red] (-7.3, 0.2) -- (-3.1, 2.1); | |
| 334 | \draw [<-, line width=1mm, red] (-6, 0.2) -- (-7.5, 2.1); | |
| 335 | \draw [<-, line width=1mm, red] (-4.5, 0.2) -- (-4.5, 2.1); | |
| 336 | \draw [<-, line width=1mm, red] (-4.3, 0.2) -- (-1.3, 2.1); | |
| 337 | ||
| 338 |        \draw (-5, -3) node[scale=1.5] {\small{}for \bl{$=$}
 | |
| 339 |         has to be a {\bf one-to-one} mapping};
 | |
| 340 | } | |
| 341 | ||
| 342 | ||
| 343 |   \end{tikzpicture}
 | |
| 344 |   \end{center}
 | |
| 345 | ||
| 346 | \end{frame}
 | |
| 347 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 348 | ||
| 349 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 350 | \begin{frame}[c]
 | |
| 351 | \frametitle{Cardinality}
 | |
| 352 | ||
| 353 | \Large | |
| 354 | \bl{$|A|$} $\dn$ ``how many elements''\bigskip\\
 | |
| 355 | ||
| 356 | \bl{$A \subseteq B  \Rightarrow |A| \leq |B|$}\bigskip\\\pause
 | |
| 357 | ||
| 358 | if there is an injective function \bl{$f: A \rightarrow B$} then \bl{$|A| \leq |B|$}\
 | |
| 359 | ||
| 360 | \begin{center}
 | |
| 361 | \bl{\large$\forall x y.\; f(x) = f(y) \Rightarrow x = y$}
 | |
| 362 | \end{center}
 | |
| 363 | \end{frame}
 | |
| 364 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 365 | ||
| 366 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 367 | \begin{frame}[t]
 | |
| 368 | ||
| 369 |   \begin{center}
 | |
| 370 |   \begin{tikzpicture}
 | |
| 371 | ||
| 372 | \draw (-6.6,2.5) node [scale=2.3] (X) | |
| 373 |     {\begin{tabular}{@ {\hspace{-3mm}}l}
 | |
| 374 |      $A$ $=$ $\{$  
 | |
| 375 |      \!\includegraphics[scale=0.02]{../pics/o1.jpg},
 | |
| 376 |      \includegraphics[scale=0.02]{../pics/o2.jpg},
 | |
| 377 |      \!\includegraphics[scale=0.02]{../pics/o3.jpg}
 | |
| 378 | $\}$ | |
| 379 |     \end{tabular}};
 | |
| 380 | ||
| 381 | \draw (-6.6,-0.5) node [scale=2.3] (Y) | |
| 382 |     {\begin{tabular}{@ {\hspace{-3mm}}l}
 | |
| 383 |      $B$ $=$ $\{$  
 | |
| 384 |      \!\includegraphics[scale=0.059]{../pics/a1.jpg},
 | |
| 385 |      \includegraphics[scale=0.048]{../pics/a2.jpg},
 | |
| 386 |      \includegraphics[scale=0.02]{../pics/a3.jpg}
 | |
| 387 | $\}$ | |
| 388 |      \end{tabular}};
 | |
| 389 |    \onslide<3->{\draw (-7, -3) node[scale=1.5] 
 | |
| 390 |       {then \bl{$|A|$ \alert{$=$} $|B|$}};}
 | |
| 391 |      \only<1>{
 | |
| 392 | \draw [->, line width=1mm, red] (-7.4, 0.2) -- (-6.1, 2.1); | |
| 393 | \draw [->, line width=1mm, red] (-5.8, 0.2) -- (-4.3, 2.1); | |
| 394 | \draw [->, line width=1mm, red] (-4.5, 0.2) -- (-7.6, 2.1); | |
| 395 | } | |
| 396 |     \only<2->{
 | |
| 397 | \draw [<-, line width=1mm, blue] (-7.5, 0.2) -- (-7.5, 2.1); | |
| 398 | \draw [<-, line width=1mm, blue] (-5.8, 0.2) -- (-4.3, 2.1); | |
| 399 | \draw [<-, line width=1mm, blue] (-4.5, 0.2) -- (-6.1, 2.1); | |
| 400 | } | |
| 401 | ||
| 402 | ||
| 403 |   \end{tikzpicture}
 | |
| 404 |   \end{center}
 | |
| 405 | ||
| 406 | \end{frame}
 | |
| 407 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 315 
470922b46a63
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
224diff
changeset | 408 | |
| 86 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 409 | |
| 543 | 410 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 411 | \begin{frame}[c]
 | |
| 412 | \frametitle{Natural Numbers}
 | |
| 413 | ||
| 414 | \Large | |
| 415 | \bl{$\mathbb{N}$} \bl{$\dn$} \bl{$\{0, 1, 2, 3, .......\}$}\bigskip\pause 
 | |
| 416 | ||
| 417 | \bl{$A$} is \alert{countable} iff \bl{$|A| \leq |\mathbb{N}|$}
 | |
| 418 | ||
| 419 | \end{frame}
 | |
| 420 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 421 | ||
| 422 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 423 | \begin{frame}[c]
 | |
| 424 | \frametitle{First Question}
 | |
| 425 | ||
| 426 | \Large | |
| 427 | \bl{$|\mathbb{N} - \{0\}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\bigskip 
 | |
| 428 | ||
| 429 | \large | |
| 430 | \bl{$\geq$} or \bl{$\leq$} or \bl{$=$} ?
 | |
| 431 | \bigskip\bigskip\bigskip\pause | |
| 432 | ||
| 433 | \bl{$x$ $\mapsto$ $x + 1$},\\  \bl{$|\mathbb{N} - \{0\}|$ $=$  
 | |
| 434 | $|\mathbb{N}|$}
 | |
| 435 | \end{frame}
 | |
| 436 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 437 | ||
| 438 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 439 | \mode<presentation>{
 | |
| 440 | \begin{frame}[c]
 | |
| 441 | ||
| 442 | \Large | |
| 443 | \bl{$|\mathbb{N} - \{0, 1\}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\pause 
 | |
| 444 | ||
| 445 | \bl{$|\mathbb{N} - \mathbb{O}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\bigskip
 | |
| 446 | ||
| 447 | \normalsize | |
| 448 | \bl{$\mathbb{O}$} $\dn$ odd numbers\quad   \bl{$\{1,3,5......\}$}\\ \pause
 | |
| 449 | \bl{$\mathbb{E}$} $\dn$ even numbers\quad   \bl{$\{0,2,4......\}$}\\
 | |
| 450 | \end{frame}}
 | |
| 451 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 452 | ||
| 453 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 454 | \mode<presentation>{
 | |
| 455 | \begin{frame}[c]
 | |
| 456 | ||
| 457 | \Large | |
| 458 | \bl{$|\mathbb{N} \cup \mathbb{-N}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\bigskip
 | |
| 459 | ||
| 460 | ||
| 461 | \normalsize | |
| 462 | \bl{$\mathbb{\phantom{-}N}$} $\dn$ positive numbers\quad   \bl{$\{0,1,2,3,......\}$}\\
 | |
| 463 | \bl{$\mathbb{-N}$} $\dn$ negative numbers\quad   \bl{$\{0,-1,-2,-3,......\}$}\\
 | |
| 464 | \end{frame}}
 | |
| 465 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 466 | ||
| 467 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 468 | \mode<presentation>{
 | |
| 469 | \begin{frame}[c]
 | |
| 470 | ||
| 471 | \Large | |
| 472 | \bl{$A$} is \alert{countable} if there exists an injective \bl{$f : A \rightarrow \mathbb{N}$}\bigskip
 | |
| 473 | ||
| 474 | \bl{$A$} is \alert{uncountable} if there does not exist an injective \bl{$f : A \rightarrow \mathbb{N}$}\bigskip\bigskip 
 | |
| 475 | ||
| 476 | ||
| 477 | countable:  \bl{$|A| \leq |\mathbb{N}|$}\\
 | |
| 478 | uncountable:  \bl{$|A| > |\mathbb{N}|$}\pause\bigskip
 | |
| 479 | ||
| 480 | ||
| 481 | Does there exist such an \bl{$A$} ?
 | |
| 482 | ||
| 483 | \end{frame}}
 | |
| 484 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 485 | ||
| 486 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 487 |   \mode<presentation>{
 | |
| 488 |   \begin{frame}[c]
 | |
| 489 |   \frametitle{Hilbert's Hotel}
 | |
| 490 | ||
| 491 |   \begin{center}
 | |
| 492 |  \includegraphics[scale=0.8]{../pics/hilberts_hotel.jpg}
 | |
| 493 |   \end{center}
 | |
| 494 | ||
| 495 |   \begin{itemize}
 | |
| 496 | \item \ldots has as many rooms as there are natural numbers | |
| 497 |   \end{itemize}
 | |
| 498 | ||
| 499 |   \end{frame}}
 | |
| 500 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 501 | ||
| 502 | ||
| 503 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 504 | \begin{frame}[t]
 | |
| 505 |  \frametitle{\begin{tabular}{c}Real Numbers between\\[-2mm] 0 and 1\end{tabular}}
 | |
| 506 | ||
| 507 |   \begin{center}
 | |
| 508 |   \begin{tikzpicture}
 | |
| 509 | \draw [fill, color=black!50] (1,4) rectangle (2, 3); | |
| 510 | \draw [fill, color=black!50] (2,3) rectangle (3, 2); | |
| 511 | \draw [fill, color=black!50] (3,2) rectangle (4, 1); | |
| 512 | \draw [fill, color=black!50] (4,1) rectangle (5, 0); | |
| 513 | \draw (0, 0) grid (8, 5); | |
| 514 | \draw [line width = 1.mm] (1,0) -- (1, 5); | |
| 515 | \draw [line width = 1.mm] (0, 4) -- (8, 4); | |
| 516 |   \draw (0.5,3.5) node {$1$};
 | |
| 517 |   \draw (0.5,2.5) node {$2$};
 | |
| 518 |   \draw (0.5,1.5) node {$3$};
 | |
| 519 |   \draw (0.5,0.5) node {$4$};
 | |
| 520 | ||
| 521 |   \draw (1.5,3.5) node {\only<1>{$3$}\only<2->{$4$}};
 | |
| 522 |   \draw (2.5,3.5) node {$3$};
 | |
| 523 |   \draw (3.5,3.5) node {$3$};
 | |
| 524 |   \draw (4.5,3.5) node {$3$};
 | |
| 525 |   \draw (5.5,3.5) node {$3$};
 | |
| 526 |   \draw (6.5,3.5) node {$3$};
 | |
| 527 |   \draw (7.5,3.5) node {$\ldots$};
 | |
| 528 | ||
| 529 |   \draw (1.5,2.5) node {$1$};
 | |
| 530 |   \draw (2.5,2.5) node {\only<1-2>{$2$}\only<3->{$3$}};
 | |
| 531 |   \draw (3.5,2.5) node {$3$};
 | |
| 532 |   \draw (4.5,2.5) node {$4$};
 | |
| 533 |   \draw (5.5,2.5) node {$5$};
 | |
| 534 |   \draw (6.5,2.5) node {$6$};
 | |
| 535 |   \draw (7.5,2.5) node {$7$};
 | |
| 536 | ||
| 537 |   \draw (1.5,1.5) node {$0$};
 | |
| 538 |   \draw (2.5,1.5) node {$1$};
 | |
| 539 |   \draw (3.5,1.5) node {\only<1-3>{$0$}\only<4->{$1$}};
 | |
| 540 |   \draw (4.5,1.5) node {$1$};
 | |
| 541 |   \draw (5.5,1.5) node {$0$};
 | |
| 542 |   \draw (6.5,1.5) node {$\ldots$};
 | |
| 543 | ||
| 544 |    \draw (1.5,0.5) node {$7$};
 | |
| 545 |   \draw (2.5,0.5) node {$8$};
 | |
| 546 |   \draw (3.5,0.5) node {$5$};
 | |
| 547 |   \draw (4.5,0.5) node {\only<1-4>{$3$}\only<5->{$4$}};
 | |
| 548 |   \draw (5.5,0.5) node {$9$};
 | |
| 549 |   \draw (6.5,0.5) node {$\ldots$};
 | |
| 550 | ||
| 551 |    \draw (1.5,-0.5) node {$\ldots$};
 | |
| 552 |    \draw (8.5,3.5) node {$\ldots$};
 | |
| 553 |   \end{tikzpicture}
 | |
| 554 |   \end{center}
 | |
| 555 |   \mbox{}\\[-20mm]\mbox{}
 | |
| 556 | ||
| 557 |   \onslide<6->{
 | |
| 558 |   \begin{center}
 | |
| 559 |   \Large\bl{$|\mathbb{N}| < |R|$}
 | |
| 560 |   \end{center}
 | |
| 561 | } | |
| 562 | ||
| 563 | \end{frame}
 | |
| 564 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 565 | ||
| 566 | ||
| 567 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 568 | \mode<presentation>{
 | |
| 569 | \begin{frame}[t]
 | |
| 570 |  \frametitle{The Set of Problems}
 | |
| 571 | ||
| 572 | $\aleph_0$ | |
| 573 | ||
| 574 |   \begin{center}
 | |
| 575 |   \begin{tikzpicture}
 | |
| 576 | \draw [fill, color=black!50] (1,4) rectangle (2, 3); | |
| 577 | \draw [fill, color=black!50] (2,3) rectangle (3, 2); | |
| 578 | \draw [fill, color=black!50] (3,2) rectangle (4, 1); | |
| 579 | \draw [fill, color=black!50] (4,1) rectangle (5, 0); | |
| 580 | \draw (0, 0) grid (8, 5); | |
| 581 | \draw [line width = 1.mm] (1,0) -- (1, 5); | |
| 582 | \draw [line width = 1.mm] (0, 4) -- (8, 4); | |
| 583 |   \draw (0.5,3.5) node {$1$};
 | |
| 584 |   \draw (0.5,2.5) node {$2$};
 | |
| 585 |   \draw (0.5,1.5) node {$3$};
 | |
| 586 |   \draw (0.5,0.5) node {$4$};
 | |
| 587 | ||
| 588 |   \draw (1.5,4.5) node {$0$};
 | |
| 589 |   \draw (2.5,4.5) node {$1$};
 | |
| 590 |   \draw (3.5,4.5) node {$2$};
 | |
| 591 |   \draw (4.5,4.5) node {$3$};
 | |
| 592 |   \draw (5.5,4.5) node {$4$};
 | |
| 593 |   \draw (6.5,4.5) node {$5$};
 | |
| 594 |   \draw (7.5,4.5) node {$\ldots$}; 
 | |
| 595 | ||
| 596 |   \draw (1.5,3.5) node {$0$};
 | |
| 597 |   \draw (2.5,3.5) node {$1$};
 | |
| 598 |   \draw (3.5,3.5) node {$0$};
 | |
| 599 |   \draw (4.5,3.5) node {$1$};
 | |
| 600 |   \draw (5.5,3.5) node {$0$};
 | |
| 601 |   \draw (6.5,3.5) node {$1$};
 | |
| 602 |   \draw (7.5,3.5) node {$\ldots$};
 | |
| 603 | ||
| 604 |   \draw (1.5,2.5) node {$0$};
 | |
| 605 |   \draw (2.5,2.5) node {$0$};
 | |
| 606 |   \draw (3.5,2.5) node {$0$};
 | |
| 607 |   \draw (4.5,2.5) node {$1$};
 | |
| 608 |   \draw (5.5,2.5) node {$1$};
 | |
| 609 |   \draw (6.5,2.5) node {$0$};
 | |
| 610 |   \draw (7.5,2.5) node {$0$};
 | |
| 611 | ||
| 612 |   \draw (1.5,1.5) node {$0$};
 | |
| 613 |   \draw (2.5,1.5) node {$0$};
 | |
| 614 |   \draw (3.5,1.5) node {$0$};
 | |
| 615 |   \draw (4.5,1.5) node {$0$};
 | |
| 616 |   \draw (5.5,1.5) node {$0$};
 | |
| 617 |   \draw (6.5,1.5) node {$\ldots$};
 | |
| 618 | ||
| 619 |    \draw (1.5,0.5) node {$1$};
 | |
| 620 |   \draw (2.5,0.5) node {$1$};
 | |
| 621 |   \draw (3.5,0.5) node {$0$};
 | |
| 622 |   \draw (4.5,0.5) node {$1$};
 | |
| 623 |   \draw (5.5,0.5) node {$1$};
 | |
| 624 |   \draw (6.5,0.5) node {$\ldots$};
 | |
| 625 | ||
| 626 |   \draw (1.5,-0.5) node {$\ldots$};
 | |
| 627 |    \draw (8.5,3.5) node {$\ldots$};
 | |
| 628 | ||
| 629 |   \end{tikzpicture}
 | |
| 630 |   \end{center}
 | |
| 631 | ||
| 632 | ||
| 633 |   \onslide<2>{
 | |
| 634 |   \begin{center}
 | |
| 635 |   \large \bl{|Progs| $=$ $|\mathbb{N}|$ $<$ |Probs|}
 | |
| 636 |  \end{center}
 | |
| 637 | } | |
| 638 | ||
| 639 | ||
| 640 | \end{frame}}
 | |
| 641 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 642 | ||
| 643 | ||
| 644 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 645 | \mode<presentation>{
 | |
| 646 | \begin{frame}[c]
 | |
| 647 | \frametitle{Halting Problem}
 | |
| 648 | ||
| 649 | \large | |
| 650 | Assume a program \bl{$H$} that decides for all programs \bl{$A$} and all 
 | |
| 651 | input data \bl{$D$} whether\bigskip
 | |
| 652 | ||
| 653 | \begin{itemize}
 | |
| 654 | \item \bl{$H(A, D) \dn 1$} iff \bl{$A(D)$} terminates
 | |
| 655 | \item \bl{$H(A, D) \dn 0$} otherwise
 | |
| 656 | \end{itemize}
 | |
| 657 | ||
| 658 | \end{frame}}
 | |
| 659 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 660 | ||
| 661 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 662 | \mode<presentation>{
 | |
| 663 | \begin{frame}[c]
 | |
| 664 | \frametitle{Halting Problem (2)}
 | |
| 665 | ||
| 666 | \large | |
| 667 | Given such a program \bl{$H$} define the following program \bl{$C$}:
 | |
| 668 | for all programs \bl{$A$}\bigskip
 | |
| 669 | ||
| 670 | \begin{itemize}
 | |
| 671 | \item \bl{$C(A) \dn 0$} iff \bl{$H(A, A) = 0$} 
 | |
| 672 | \item \bl{$C(A) \dn$ loops} otherwise
 | |
| 673 | \end{itemize}
 | |
| 674 | ||
| 675 | \end{frame}}
 | |
| 676 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 677 | ||
| 678 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 679 | \mode<presentation>{
 | |
| 680 | \begin{frame}[c]
 | |
| 681 | \frametitle{Contradiction}
 | |
| 682 | ||
| 683 | ||
| 684 | \bl{$H(C, C)$} is either \bl{$0$} or \bl{$1$}.
 | |
| 685 | ||
| 686 | \begin{itemize}
 | |
| 687 | \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$} 
 | |
| 688 | \item \bl{$H(C, C) = 0$} $\stackrel{\text{def}\,H}{\Rightarrow}$ \bl{$C(C)$} loops $\stackrel{\text{def}\,C}{\Rightarrow}$\\ 
 | |
| 689 | \hspace{7cm}\bl{$H(C, C)=1$} 
 | |
| 690 | \end{itemize}
 | |
| 691 | ||
| 692 | Contradiction in both cases. So \bl{$H$} cannot exist.
 | |
| 693 | ||
| 694 | \end{frame}}
 | |
| 695 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 696 | ||
| 697 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 698 |   \mode<presentation>{
 | |
| 699 |   \begin{frame}[c]
 | |
| 700 |   \frametitle{Take Home Points}
 | |
| 701 | \large | |
| 702 | ||
| 703 |   \begin{itemize}
 | |
| 704 | \item there are sets that are more infinite than others\bigskip | |
| 705 | \item even with the most powerful computer we can imagine, there | |
| 706 | are problems that cannot be solved by any program\bigskip\bigskip | |
| 707 | ||
| 708 | \item in CS we actually hit quite often such problems (halting problem) | |
| 709 |   \end{itemize}
 | |
| 710 | ||
| 711 |   \end{frame}}
 | |
| 712 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 713 | ||
| 86 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 714 | \end{document}
 | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 715 | |
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 716 | %%% Local Variables: | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 717 | %%% mode: latex | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 718 | %%% TeX-master: t | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 719 | %%% End: | 
| 
6a7fe83820c8
added
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: diff
changeset | 720 |