author | Christian Urban <christian.urban@kcl.ac.uk> |
Mon, 19 Oct 2020 14:17:18 +0100 | |
changeset 783 | 06cbaaad3ba8 |
parent 744 | 99c5916d9a8f |
child 818 | 6928a677d26f |
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:
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} |
315
470922b46a63
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
224
diff
changeset
|
6 |
\usepackage{../graphics} |
470922b46a63
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
224
diff
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:
215
diff
changeset
|
9 |
\tikzset{onslide/.code args={<#1>#2}{% |
e4b29b57f6a3
added
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 |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
11 |
}} |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
12 |
|
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
13 |
\makeatletter |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
14 |
\newenvironment<>{btHighlight}[1][] |
e4b29b57f6a3
added
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}} |
e4b29b57f6a3
added
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}} |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
17 |
|
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
18 |
\newcommand<>\btHL[1][]{% |
e4b29b57f6a3
added
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}% |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
20 |
} |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
21 |
\def\bt@HL@endenv{% |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
22 |
\end{btHighlight}% |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
23 |
\egroup |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
24 |
} |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
25 |
\newcommand{\bt@HL@box}[2][]{% |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
26 |
\tikz[#1]{% |
e4b29b57f6a3
added
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}}% |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
28 |
\pgfusepath{use as bounding box}% |
e4b29b57f6a3
added
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}}; |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
30 |
}% |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
31 |
} |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
32 |
\makeatother |
e4b29b57f6a3
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
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:
224
diff
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:
224
diff
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:
224
diff
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:
224
diff
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] |
|
80 |
||
81 |
||
82 |
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm] |
|
83 |
def fact(n: Int) : Int = { |
|
84 |
if (n == 0) 1 else n * fact(n - 1) |
|
85 |
} |
|
86 |
||
87 |
||
88 |
def factC(n: Int, ret: Int => Int) : Int = { |
|
89 |
if (n == 0) ret(1) |
|
90 |
else factC(n - 1, x => ret(n * x)) |
|
91 |
} |
|
92 |
||
93 |
fact(10) |
|
94 |
factC(10, identity) |
|
95 |
\end{lstlisting} |
|
96 |
\end{frame} |
|
97 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
98 |
||
99 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
100 |
\begin{frame}[c,fragile] |
|
101 |
||
102 |
||
103 |
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm] |
|
104 |
def fibC(n: Int, ret: Int => Int) : Int = { |
|
105 |
if (n == 0 || n == 1) ret(1) else |
|
106 |
fibC(n - 1, |
|
107 |
r1 => fibC(n - 2, |
|
108 |
r2 => ret(r1 + r2))) |
|
109 |
} |
|
110 |
||
111 |
fibC(10, identity) |
|
112 |
\end{lstlisting} |
|
113 |
\end{frame} |
|
114 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
115 |
||
116 |
||
117 |
||
118 |
||
543 | 119 |
|
120 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
121 |
\begin{frame}[c] |
|
122 |
||
704 | 123 |
\Large\bf Are there more strings in \\ \hfill\bl{$L(a^*)$} or |
617 | 124 |
\bl{$L((a + b)^*)$}? |
543 | 125 |
|
126 |
\end{frame} |
|
127 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
128 |
||
129 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
130 |
\begin{frame}[c] |
|
704 | 131 |
\frametitle{Can you remember this HW?} |
132 |
||
133 |
\begin{itemize} |
|
134 |
\item (1) How many basic regular expressions are there to match |
|
135 |
the string \bl{$abcd$}? |
|
136 |
\item (2) How many if they cannot include |
|
137 |
\bl{$\ONE$} and \bl{$\ZERO$}? |
|
138 |
\item (3) How many if they are also not |
|
139 |
allowed to contain stars? |
|
140 |
\item (4) How many if they are also |
|
141 |
not allowed to contain \bl{$\_ + \_$}? |
|
142 |
\end{itemize} |
|
143 |
||
144 |
\end{frame} |
|
145 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
146 |
||
147 |
||
148 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
149 |
\begin{frame}[c] |
|
543 | 150 |
|
151 |
\Large\bf There are more problems, than there are |
|
152 |
programs.\bigskip\bigskip\pause\\ |
|
153 |
||
154 |
There must be a problem for which there is no program. |
|
155 |
\end{frame} |
|
156 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
157 |
||
158 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
159 |
\begin{frame}[c] |
|
160 |
\frametitle{Subsets} |
|
161 |
||
162 |
\Large |
|
163 |
If \bl{$A \subseteq B$} then \bl{$A$} has fewer or equal elements |
|
164 |
than \bl{$B$}\bigskip\bigskip |
|
165 |
||
166 |
\Large |
|
167 |
\bl{$A \subseteq B$} and \bl{$B \subseteq A$}\bigskip |
|
168 |
||
169 |
then \bl{$A = B$} |
|
170 |
\end{frame} |
|
171 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
172 |
||
173 |
||
174 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
175 |
\begin{frame}[c] |
|
176 |
||
177 |
\begin{center} |
|
178 |
\begin{tikzpicture} |
|
179 |
||
180 |
\draw (-4,2.5) node [scale=2.5] (X) |
|
181 |
{\begin{tabular}{l} |
|
182 |
$\{$ |
|
183 |
\!\includegraphics[scale=0.02]{../pics/o1.jpg}, |
|
184 |
\includegraphics[scale=0.02]{../pics/o2.jpg}, |
|
185 |
\!\includegraphics[scale=0.02]{../pics/o3.jpg}, |
|
186 |
\includegraphics[scale=0.02]{../pics/o4.jpg}, |
|
187 |
\!\includegraphics[scale=0.027]{../pics/o5.jpg} |
|
188 |
$\}$ |
|
189 |
\end{tabular}}; |
|
190 |
||
191 |
\draw (-5.6,-2.5) node [scale=2.5] (Y) |
|
192 |
{\begin{tabular}{l} |
|
193 |
$\{$ |
|
194 |
\!\includegraphics[scale=0.059]{../pics/a1.jpg}, |
|
195 |
\includegraphics[scale=0.048]{../pics/a2.jpg}, |
|
196 |
\includegraphics[scale=0.02]{../pics/a3.jpg} |
|
197 |
$\}$ |
|
198 |
\end{tabular}}; |
|
199 |
||
200 |
\draw (0,1.5) node (X1) {5 elements}; |
|
201 |
\draw (0,-3.5) node (y1) {3 elements}; |
|
202 |
\end{tikzpicture} |
|
203 |
\end{center} |
|
204 |
||
205 |
\end{frame} |
|
206 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
207 |
||
208 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
209 |
\begin{frame}[c] |
|
210 |
\frametitle{Newton vs Feynman} |
|
211 |
||
212 |
\begin{center} |
|
213 |
\begin{tabular}{cc} |
|
214 |
\includegraphics[scale=0.2]{../pics/newton.jpg} & |
|
215 |
\includegraphics[scale=0.2]{../pics/feynman.jpg}\\ |
|
216 |
classical physics & quantum physics |
|
217 |
\end{tabular} |
|
218 |
\end{center} |
|
219 |
\end{frame} |
|
220 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
221 |
||
222 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
223 |
\begin{frame}[c] |
|
224 |
\frametitle{The Goal of the Talk} |
|
225 |
\large |
|
226 |
\begin{itemize} |
|
227 |
\item show you that something very unintuitive happens with very large sets |
|
228 |
\bigskip\bigskip |
|
229 |
||
230 |
\item convince you that there are more {\bf problems} than {\bf programs} |
|
231 |
\end{itemize} |
|
232 |
\end{frame} |
|
233 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
234 |
||
235 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
236 |
\begin{frame}[t] |
|
237 |
% |
|
238 |
\begin{center} |
|
239 |
\begin{tikzpicture} |
|
240 |
||
241 |
\draw (-5,2.5) node [scale=2.3] (X) |
|
242 |
{\begin{tabular}{@ {\hspace{-3mm}}l} |
|
243 |
\bl{$B$ $=$ $\{$ |
|
244 |
\!\includegraphics[scale=0.02]{../pics/o1.jpg}, |
|
245 |
\includegraphics[scale=0.02]{../pics/o2.jpg}, |
|
246 |
\!\includegraphics[scale=0.02]{../pics/o3.jpg}, |
|
247 |
\includegraphics[scale=0.02]{../pics/o4.jpg}, |
|
248 |
\!\includegraphics[scale=0.027]{../pics/o5.jpg} |
|
249 |
$\}$} |
|
250 |
\end{tabular}}; |
|
251 |
||
252 |
\draw (-6.6,-0.5) node [scale=2.3] (Y) |
|
253 |
{\begin{tabular}{@ {\hspace{-3mm}}l} |
|
254 |
\bl{$A$ $=$ $\{$ |
|
255 |
\!\includegraphics[scale=0.059]{../pics/a1.jpg}, |
|
256 |
\includegraphics[scale=0.048]{../pics/a2.jpg}, |
|
257 |
\includegraphics[scale=0.02]{../pics/a3.jpg} |
|
258 |
$\}$} |
|
259 |
\end{tabular}}; |
|
260 |
||
261 |
\only<1>{\draw (-5, -3) node[scale=2] |
|
262 |
{\bl{$|A|$ $=$ $5$}, \bl{$|B|$ $=$ $3$}};} |
|
263 |
\only<2>{ |
|
264 |
\draw [->, line width=1mm, red] (-7.4, 0.2) -- (-6.1, 2.1); |
|
265 |
\draw [->, line width=1mm, red] (-5.8, 0.2) -- (-3.1, 2.1); |
|
266 |
\draw [->, line width=1mm, red] (-4.5, 0.2) -- (-7.6, 2.1); |
|
267 |
\draw (-5, -3) node[scale=2] {then \bl{$|A|$ $\le$ $|B|$}}; |
|
268 |
} |
|
269 |
\only<3>{ |
|
270 |
\draw [<-, line width=1mm, red] (-7.5, 0.2) -- (-6.1, 2.1); |
|
271 |
\draw [<-, line width=1mm, red] (-7.3, 0.2) -- (-3.1, 2.1); |
|
272 |
\draw [<-, line width=1mm, red] (-6, 0.2) -- (-7.5, 2.1); |
|
273 |
\draw [<-, line width=1mm, red] (-4.5, 0.2) -- (-4.5, 2.1); |
|
274 |
\draw [<-, line width=1mm, red] (-4.3, 0.2) -- (-1.3, 2.1); |
|
275 |
||
276 |
\draw (-5, -3) node[scale=1.5] {\small{}for \bl{$=$} |
|
277 |
has to be a {\bf one-to-one} mapping}; |
|
278 |
} |
|
279 |
||
280 |
||
281 |
\end{tikzpicture} |
|
282 |
\end{center} |
|
283 |
||
284 |
\end{frame} |
|
285 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
286 |
||
287 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
288 |
\begin{frame}[c] |
|
289 |
\frametitle{Cardinality} |
|
290 |
||
291 |
\Large |
|
292 |
\bl{$|A|$} $\dn$ ``how many elements''\bigskip\\ |
|
293 |
||
294 |
\bl{$A \subseteq B \Rightarrow |A| \leq |B|$}\bigskip\\\pause |
|
295 |
||
296 |
if there is an injective function \bl{$f: A \rightarrow B$} then \bl{$|A| \leq |B|$}\ |
|
297 |
||
298 |
\begin{center} |
|
299 |
\bl{\large$\forall x y.\; f(x) = f(y) \Rightarrow x = y$} |
|
300 |
\end{center} |
|
301 |
\end{frame} |
|
302 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
303 |
||
304 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
305 |
\begin{frame}[t] |
|
306 |
||
307 |
\begin{center} |
|
308 |
\begin{tikzpicture} |
|
309 |
||
310 |
\draw (-6.6,2.5) node [scale=2.3] (X) |
|
311 |
{\begin{tabular}{@ {\hspace{-3mm}}l} |
|
312 |
$A$ $=$ $\{$ |
|
313 |
\!\includegraphics[scale=0.02]{../pics/o1.jpg}, |
|
314 |
\includegraphics[scale=0.02]{../pics/o2.jpg}, |
|
315 |
\!\includegraphics[scale=0.02]{../pics/o3.jpg} |
|
316 |
$\}$ |
|
317 |
\end{tabular}}; |
|
318 |
||
319 |
\draw (-6.6,-0.5) node [scale=2.3] (Y) |
|
320 |
{\begin{tabular}{@ {\hspace{-3mm}}l} |
|
321 |
$B$ $=$ $\{$ |
|
322 |
\!\includegraphics[scale=0.059]{../pics/a1.jpg}, |
|
323 |
\includegraphics[scale=0.048]{../pics/a2.jpg}, |
|
324 |
\includegraphics[scale=0.02]{../pics/a3.jpg} |
|
325 |
$\}$ |
|
326 |
\end{tabular}}; |
|
327 |
\onslide<3->{\draw (-7, -3) node[scale=1.5] |
|
328 |
{then \bl{$|A|$ \alert{$=$} $|B|$}};} |
|
329 |
\only<1>{ |
|
330 |
\draw [->, line width=1mm, red] (-7.4, 0.2) -- (-6.1, 2.1); |
|
331 |
\draw [->, line width=1mm, red] (-5.8, 0.2) -- (-4.3, 2.1); |
|
332 |
\draw [->, line width=1mm, red] (-4.5, 0.2) -- (-7.6, 2.1); |
|
333 |
} |
|
334 |
\only<2->{ |
|
335 |
\draw [<-, line width=1mm, blue] (-7.5, 0.2) -- (-7.5, 2.1); |
|
336 |
\draw [<-, line width=1mm, blue] (-5.8, 0.2) -- (-4.3, 2.1); |
|
337 |
\draw [<-, line width=1mm, blue] (-4.5, 0.2) -- (-6.1, 2.1); |
|
338 |
} |
|
339 |
||
340 |
||
341 |
\end{tikzpicture} |
|
342 |
\end{center} |
|
343 |
||
344 |
\end{frame} |
|
345 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
315
470922b46a63
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
224
diff
changeset
|
346 |
|
86
6a7fe83820c8
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
347 |
|
543 | 348 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
349 |
\begin{frame}[c] |
|
350 |
\frametitle{Natural Numbers} |
|
351 |
||
352 |
\Large |
|
353 |
\bl{$\mathbb{N}$} \bl{$\dn$} \bl{$\{0, 1, 2, 3, .......\}$}\bigskip\pause |
|
354 |
||
355 |
\bl{$A$} is \alert{countable} iff \bl{$|A| \leq |\mathbb{N}|$} |
|
356 |
||
357 |
\end{frame} |
|
358 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
359 |
||
360 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
361 |
\begin{frame}[c] |
|
362 |
\frametitle{First Question} |
|
363 |
||
364 |
\Large |
|
365 |
\bl{$|\mathbb{N} - \{0\}| \;\;\;\alert{?}\;\;\; |\mathbb{N}| $}\bigskip\bigskip |
|
366 |
||
367 |
\large |
|
368 |
\bl{$\geq$} or \bl{$\leq$} or \bl{$=$} ? |
|
369 |
\bigskip\bigskip\bigskip\pause |
|
370 |
||
371 |
\bl{$x$ $\mapsto$ $x + 1$},\\ \bl{$|\mathbb{N} - \{0\}|$ $=$ |
|
372 |
$|\mathbb{N}|$} |
|
373 |
\end{frame} |
|
374 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
375 |
||
376 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
377 |
\mode<presentation>{ |
|
378 |
\begin{frame}[c] |
|
379 |
||
380 |
\Large |
|
381 |
\bl{$|\mathbb{N} - \{0, 1\}| \;\;\;\alert{?}\;\;\; |\mathbb{N}| $}\bigskip\pause |
|
382 |
||
383 |
\bl{$|\mathbb{N} - \mathbb{O}| \;\;\;\alert{?}\;\;\; |\mathbb{N}| $}\bigskip\bigskip |
|
384 |
||
385 |
\normalsize |
|
386 |
\bl{$\mathbb{O}$} $\dn$ odd numbers\quad \bl{$\{1,3,5......\}$}\\ \pause |
|
387 |
\bl{$\mathbb{E}$} $\dn$ even numbers\quad \bl{$\{0,2,4......\}$}\\ |
|
388 |
\end{frame}} |
|
389 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
390 |
||
391 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
392 |
\mode<presentation>{ |
|
393 |
\begin{frame}[c] |
|
394 |
||
395 |
\Large |
|
396 |
\bl{$|\mathbb{N} \cup \mathbb{-N}| \;\;\;\alert{?}\;\;\; |\mathbb{N}| $}\bigskip\bigskip |
|
397 |
||
398 |
||
399 |
\normalsize |
|
400 |
\bl{$\mathbb{\phantom{-}N}$} $\dn$ positive numbers\quad \bl{$\{0,1,2,3,......\}$}\\ |
|
401 |
\bl{$\mathbb{-N}$} $\dn$ negative numbers\quad \bl{$\{0,-1,-2,-3,......\}$}\\ |
|
402 |
\end{frame}} |
|
403 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
404 |
||
405 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
406 |
\mode<presentation>{ |
|
407 |
\begin{frame}[c] |
|
408 |
||
409 |
\Large |
|
410 |
\bl{$A$} is \alert{countable} if there exists an injective \bl{$f : A \rightarrow \mathbb{N}$}\bigskip |
|
411 |
||
412 |
\bl{$A$} is \alert{uncountable} if there does not exist an injective \bl{$f : A \rightarrow \mathbb{N}$}\bigskip\bigskip |
|
413 |
||
414 |
||
415 |
countable: \bl{$|A| \leq |\mathbb{N}|$}\\ |
|
416 |
uncountable: \bl{$|A| > |\mathbb{N}|$}\pause\bigskip |
|
417 |
||
418 |
||
419 |
Does there exist such an \bl{$A$} ? |
|
420 |
||
421 |
\end{frame}} |
|
422 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
423 |
||
424 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
425 |
\mode<presentation>{ |
|
426 |
\begin{frame}[c] |
|
427 |
\frametitle{Hilbert's Hotel} |
|
428 |
||
429 |
\begin{center} |
|
430 |
\includegraphics[scale=0.8]{../pics/hilberts_hotel.jpg} |
|
431 |
\end{center} |
|
432 |
||
433 |
\begin{itemize} |
|
434 |
\item \ldots has as many rooms as there are natural numbers |
|
435 |
\end{itemize} |
|
436 |
||
437 |
\end{frame}} |
|
438 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
439 |
||
440 |
||
441 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
442 |
\begin{frame}[t] |
|
443 |
\frametitle{\begin{tabular}{c}Real Numbers between\\[-2mm] 0 and 1\end{tabular}} |
|
444 |
||
445 |
\begin{center} |
|
446 |
\begin{tikzpicture} |
|
447 |
\draw [fill, color=black!50] (1,4) rectangle (2, 3); |
|
448 |
\draw [fill, color=black!50] (2,3) rectangle (3, 2); |
|
449 |
\draw [fill, color=black!50] (3,2) rectangle (4, 1); |
|
450 |
\draw [fill, color=black!50] (4,1) rectangle (5, 0); |
|
451 |
\draw (0, 0) grid (8, 5); |
|
452 |
\draw [line width = 1.mm] (1,0) -- (1, 5); |
|
453 |
\draw [line width = 1.mm] (0, 4) -- (8, 4); |
|
454 |
\draw (0.5,3.5) node {$1$}; |
|
455 |
\draw (0.5,2.5) node {$2$}; |
|
456 |
\draw (0.5,1.5) node {$3$}; |
|
457 |
\draw (0.5,0.5) node {$4$}; |
|
458 |
||
459 |
\draw (1.5,3.5) node {\only<1>{$3$}\only<2->{$4$}}; |
|
460 |
\draw (2.5,3.5) node {$3$}; |
|
461 |
\draw (3.5,3.5) node {$3$}; |
|
462 |
\draw (4.5,3.5) node {$3$}; |
|
463 |
\draw (5.5,3.5) node {$3$}; |
|
464 |
\draw (6.5,3.5) node {$3$}; |
|
465 |
\draw (7.5,3.5) node {$\ldots$}; |
|
466 |
||
467 |
\draw (1.5,2.5) node {$1$}; |
|
468 |
\draw (2.5,2.5) node {\only<1-2>{$2$}\only<3->{$3$}}; |
|
469 |
\draw (3.5,2.5) node {$3$}; |
|
470 |
\draw (4.5,2.5) node {$4$}; |
|
471 |
\draw (5.5,2.5) node {$5$}; |
|
472 |
\draw (6.5,2.5) node {$6$}; |
|
473 |
\draw (7.5,2.5) node {$7$}; |
|
474 |
||
475 |
\draw (1.5,1.5) node {$0$}; |
|
476 |
\draw (2.5,1.5) node {$1$}; |
|
477 |
\draw (3.5,1.5) node {\only<1-3>{$0$}\only<4->{$1$}}; |
|
478 |
\draw (4.5,1.5) node {$1$}; |
|
479 |
\draw (5.5,1.5) node {$0$}; |
|
480 |
\draw (6.5,1.5) node {$\ldots$}; |
|
481 |
||
482 |
\draw (1.5,0.5) node {$7$}; |
|
483 |
\draw (2.5,0.5) node {$8$}; |
|
484 |
\draw (3.5,0.5) node {$5$}; |
|
485 |
\draw (4.5,0.5) node {\only<1-4>{$3$}\only<5->{$4$}}; |
|
486 |
\draw (5.5,0.5) node {$9$}; |
|
487 |
\draw (6.5,0.5) node {$\ldots$}; |
|
488 |
||
489 |
\draw (1.5,-0.5) node {$\ldots$}; |
|
490 |
\draw (8.5,3.5) node {$\ldots$}; |
|
491 |
\end{tikzpicture} |
|
492 |
\end{center} |
|
493 |
\mbox{}\\[-20mm]\mbox{} |
|
494 |
||
495 |
\onslide<6->{ |
|
496 |
\begin{center} |
|
497 |
\Large\bl{$|\mathbb{N}| < |R|$} |
|
498 |
\end{center} |
|
499 |
} |
|
500 |
||
501 |
\end{frame} |
|
502 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
503 |
||
504 |
||
505 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
506 |
\mode<presentation>{ |
|
507 |
\begin{frame}[t] |
|
508 |
\frametitle{The Set of Problems} |
|
509 |
||
510 |
$\aleph_0$ |
|
511 |
||
512 |
\begin{center} |
|
513 |
\begin{tikzpicture} |
|
514 |
\draw [fill, color=black!50] (1,4) rectangle (2, 3); |
|
515 |
\draw [fill, color=black!50] (2,3) rectangle (3, 2); |
|
516 |
\draw [fill, color=black!50] (3,2) rectangle (4, 1); |
|
517 |
\draw [fill, color=black!50] (4,1) rectangle (5, 0); |
|
518 |
\draw (0, 0) grid (8, 5); |
|
519 |
\draw [line width = 1.mm] (1,0) -- (1, 5); |
|
520 |
\draw [line width = 1.mm] (0, 4) -- (8, 4); |
|
521 |
\draw (0.5,3.5) node {$1$}; |
|
522 |
\draw (0.5,2.5) node {$2$}; |
|
523 |
\draw (0.5,1.5) node {$3$}; |
|
524 |
\draw (0.5,0.5) node {$4$}; |
|
525 |
||
526 |
\draw (1.5,4.5) node {$0$}; |
|
527 |
\draw (2.5,4.5) node {$1$}; |
|
528 |
\draw (3.5,4.5) node {$2$}; |
|
529 |
\draw (4.5,4.5) node {$3$}; |
|
530 |
\draw (5.5,4.5) node {$4$}; |
|
531 |
\draw (6.5,4.5) node {$5$}; |
|
532 |
\draw (7.5,4.5) node {$\ldots$}; |
|
533 |
||
534 |
\draw (1.5,3.5) node {$0$}; |
|
535 |
\draw (2.5,3.5) node {$1$}; |
|
536 |
\draw (3.5,3.5) node {$0$}; |
|
537 |
\draw (4.5,3.5) node {$1$}; |
|
538 |
\draw (5.5,3.5) node {$0$}; |
|
539 |
\draw (6.5,3.5) node {$1$}; |
|
540 |
\draw (7.5,3.5) node {$\ldots$}; |
|
541 |
||
542 |
\draw (1.5,2.5) node {$0$}; |
|
543 |
\draw (2.5,2.5) node {$0$}; |
|
544 |
\draw (3.5,2.5) node {$0$}; |
|
545 |
\draw (4.5,2.5) node {$1$}; |
|
546 |
\draw (5.5,2.5) node {$1$}; |
|
547 |
\draw (6.5,2.5) node {$0$}; |
|
548 |
\draw (7.5,2.5) node {$0$}; |
|
549 |
||
550 |
\draw (1.5,1.5) node {$0$}; |
|
551 |
\draw (2.5,1.5) node {$0$}; |
|
552 |
\draw (3.5,1.5) node {$0$}; |
|
553 |
\draw (4.5,1.5) node {$0$}; |
|
554 |
\draw (5.5,1.5) node {$0$}; |
|
555 |
\draw (6.5,1.5) node {$\ldots$}; |
|
556 |
||
557 |
\draw (1.5,0.5) node {$1$}; |
|
558 |
\draw (2.5,0.5) node {$1$}; |
|
559 |
\draw (3.5,0.5) node {$0$}; |
|
560 |
\draw (4.5,0.5) node {$1$}; |
|
561 |
\draw (5.5,0.5) node {$1$}; |
|
562 |
\draw (6.5,0.5) node {$\ldots$}; |
|
563 |
||
564 |
\draw (1.5,-0.5) node {$\ldots$}; |
|
565 |
\draw (8.5,3.5) node {$\ldots$}; |
|
566 |
||
567 |
\end{tikzpicture} |
|
568 |
\end{center} |
|
569 |
||
570 |
||
571 |
\onslide<2>{ |
|
572 |
\begin{center} |
|
573 |
\large \bl{|Progs| $=$ $|\mathbb{N}|$ $<$ |Probs|} |
|
574 |
\end{center} |
|
575 |
} |
|
576 |
||
577 |
||
578 |
\end{frame}} |
|
579 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
580 |
||
581 |
||
582 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
583 |
\mode<presentation>{ |
|
584 |
\begin{frame}[c] |
|
585 |
\frametitle{Halting Problem} |
|
586 |
||
587 |
\large |
|
588 |
Assume a program \bl{$H$} that decides for all programs \bl{$A$} and all |
|
589 |
input data \bl{$D$} whether\bigskip |
|
590 |
||
591 |
\begin{itemize} |
|
592 |
\item \bl{$H(A, D) \dn 1$} iff \bl{$A(D)$} terminates |
|
593 |
\item \bl{$H(A, D) \dn 0$} otherwise |
|
594 |
\end{itemize} |
|
595 |
||
596 |
\end{frame}} |
|
597 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
598 |
||
599 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
600 |
\mode<presentation>{ |
|
601 |
\begin{frame}[c] |
|
602 |
\frametitle{Halting Problem (2)} |
|
603 |
||
604 |
\large |
|
605 |
Given such a program \bl{$H$} define the following program \bl{$C$}: |
|
606 |
for all programs \bl{$A$}\bigskip |
|
607 |
||
608 |
\begin{itemize} |
|
609 |
\item \bl{$C(A) \dn 0$} iff \bl{$H(A, A) = 0$} |
|
610 |
\item \bl{$C(A) \dn$ loops} otherwise |
|
611 |
\end{itemize} |
|
612 |
||
613 |
\end{frame}} |
|
614 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
615 |
||
616 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
617 |
\mode<presentation>{ |
|
618 |
\begin{frame}[c] |
|
619 |
\frametitle{Contradiction} |
|
620 |
||
621 |
||
622 |
\bl{$H(C, C)$} is either \bl{$0$} or \bl{$1$}. |
|
623 |
||
624 |
\begin{itemize} |
|
625 |
\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$} |
|
626 |
\item \bl{$H(C, C) = 0$} $\stackrel{\text{def}\,H}{\Rightarrow}$ \bl{$C(C)$} loops $\stackrel{\text{def}\,C}{\Rightarrow}$\\ |
|
627 |
\hspace{7cm}\bl{$H(C, C)=1$} |
|
628 |
\end{itemize} |
|
629 |
||
630 |
Contradiction in both cases. So \bl{$H$} cannot exist. |
|
631 |
||
632 |
\end{frame}} |
|
633 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
634 |
||
635 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
636 |
\mode<presentation>{ |
|
637 |
\begin{frame}[c] |
|
638 |
\frametitle{Take Home Points} |
|
639 |
\large |
|
640 |
||
641 |
\begin{itemize} |
|
642 |
\item there are sets that are more infinite than others\bigskip |
|
643 |
\item even with the most powerful computer we can imagine, there |
|
644 |
are problems that cannot be solved by any program\bigskip\bigskip |
|
645 |
||
646 |
\item in CS we actually hit quite often such problems (halting problem) |
|
647 |
\end{itemize} |
|
648 |
||
649 |
\end{frame}} |
|
650 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
651 |
||
86
6a7fe83820c8
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
652 |
\end{document} |
6a7fe83820c8
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
653 |
|
6a7fe83820c8
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
654 |
%%% Local Variables: |
6a7fe83820c8
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
655 |
%%% mode: latex |
6a7fe83820c8
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
656 |
%%% TeX-master: t |
6a7fe83820c8
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
657 |
%%% End: |
6a7fe83820c8
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
658 |