slides10.tex
changeset 86 6a7fe83820c8
child 87 72d0b688e942
equal deleted inserted replaced
85:1a4065f965fb 86:6a7fe83820c8
       
     1 \documentclass[dvipsnames,14pt,t]{beamer}
       
     2 \usepackage{beamerthemeplainculight}
       
     3 \usepackage[T1]{fontenc}
       
     4 \usepackage[latin1]{inputenc}
       
     5 \usepackage{mathpartir}
       
     6 \usepackage[absolute,overlay]{textpos}
       
     7 \usepackage{ifthen}
       
     8 \usepackage{tikz}
       
     9 \usepackage{pgf}
       
    10 \usepackage{calc} 
       
    11 \usepackage{ulem}
       
    12 \usepackage{courier}
       
    13 \usepackage{listings}
       
    14 \renewcommand{\uline}[1]{#1}
       
    15 \usetikzlibrary{arrows}
       
    16 \usetikzlibrary{automata}
       
    17 \usetikzlibrary{shapes}
       
    18 \usetikzlibrary{shadows}
       
    19 \usetikzlibrary{positioning}
       
    20 \usetikzlibrary{calc}
       
    21 \usetikzlibrary{plotmarks}
       
    22 \usepackage{graphicx} 
       
    23 \usepackage{pgfplots}
       
    24 
       
    25 
       
    26 \definecolor{javared}{rgb}{0.6,0,0} % for strings
       
    27 \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
       
    28 \definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
       
    29 \definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
       
    30 
       
    31 \lstset{language=Java,
       
    32 	basicstyle=\ttfamily,
       
    33 	keywordstyle=\color{javapurple}\bfseries,
       
    34 	stringstyle=\color{javagreen},
       
    35 	commentstyle=\color{javagreen},
       
    36 	morecomment=[s][\color{javadocblue}]{/**}{*/},
       
    37 	numbers=left,
       
    38 	numberstyle=\tiny\color{black},
       
    39 	stepnumber=1,
       
    40 	numbersep=10pt,
       
    41 	tabsize=2,
       
    42 	showspaces=false,
       
    43 	showstringspaces=false}
       
    44 
       
    45 \lstdefinelanguage{scala}{
       
    46   morekeywords={abstract,case,catch,class,def,%
       
    47     do,else,extends,false,final,finally,%
       
    48     for,if,implicit,import,match,mixin,%
       
    49     new,null,object,override,package,%
       
    50     private,protected,requires,return,sealed,%
       
    51     super,this,throw,trait,true,try,%
       
    52     type,val,var,while,with,yield},
       
    53   otherkeywords={=>,<-,<\%,<:,>:,\#,@},
       
    54   sensitive=true,
       
    55   morecomment=[l]{//},
       
    56   morecomment=[n]{/*}{*/},
       
    57   morestring=[b]",
       
    58   morestring=[b]',
       
    59   morestring=[b]"""
       
    60 }
       
    61 
       
    62 
       
    63 \lstset{language=Scala,
       
    64 	basicstyle=\ttfamily,
       
    65 	keywordstyle=\color{javapurple}\bfseries,
       
    66 	stringstyle=\color{javagreen},
       
    67 	commentstyle=\color{javagreen},
       
    68 	morecomment=[s][\color{javadocblue}]{/**}{*/},
       
    69 	numbers=left,
       
    70 	numberstyle=\tiny\color{black},
       
    71 	stepnumber=1,
       
    72 	numbersep=10pt,
       
    73 	tabsize=2,
       
    74 	showspaces=false,
       
    75 	showstringspaces=false}
       
    76 
       
    77 \lstdefinelanguage{while}{
       
    78   morekeywords={if,then,else,while,do,true,false,write},
       
    79   otherkeywords={=,!=,:=,<,>,;},
       
    80   sensitive=true,
       
    81   morecomment=[n]{/*}{*/},
       
    82 }
       
    83 
       
    84 
       
    85 \lstset{language=While,
       
    86 	basicstyle=\ttfamily,
       
    87 	keywordstyle=\color{javapurple}\bfseries,
       
    88 	stringstyle=\color{javagreen},
       
    89 	commentstyle=\color{javagreen},
       
    90 	morecomment=[s][\color{javadocblue}]{/**}{*/},
       
    91 	numbers=left,
       
    92 	numberstyle=\tiny\color{black},
       
    93 	stepnumber=1,
       
    94 	numbersep=10pt,
       
    95 	tabsize=2,
       
    96 	showspaces=false,
       
    97 	showstringspaces=false}
       
    98 
       
    99 
       
   100 % beamer stuff 
       
   101 \renewcommand{\slidecaption}{AFL 10, King's College London, 5.~December 2012}
       
   102 \newcommand{\bl}[1]{\textcolor{blue}{#1}}       
       
   103 \newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
       
   104 
       
   105 
       
   106 % The data files, written on the first run.
       
   107 \begin{filecontents}{compiled.data}
       
   108 %1 0.234146
       
   109 %5000 0.227539
       
   110 %10000 0.280748
       
   111 50000 1.087897
       
   112 100000 3.713165
       
   113 250000 21.6624545
       
   114 500000 85.872613
       
   115 750000 203.6408015
       
   116 1000000 345.736574
       
   117 \end{filecontents}
       
   118 
       
   119 \begin{filecontents}{interpreted.data}
       
   120 %1 0.00503
       
   121 200 1.005863
       
   122 400 7.8296765
       
   123 500 15.43106
       
   124 600 27.2321885
       
   125 800 65.249271
       
   126 1000 135.4493445
       
   127 1200 232.134097
       
   128 1400 382.527227
       
   129 \end{filecontents}
       
   130 
       
   131 \begin{filecontents}{interpreted2.data}
       
   132 %1 0.00503
       
   133 200 1.005863
       
   134 400 7.8296765
       
   135 600 27.2321885
       
   136 800 65.249271
       
   137 1000 135.4493445
       
   138 1200 232.134097
       
   139 1400 382.527227
       
   140 \end{filecontents}
       
   141 
       
   142 \begin{filecontents}{compiled2.data}
       
   143 200 0.222058
       
   144 400 0.215204
       
   145 600 0.202031
       
   146 800 0.21986
       
   147 1000 0.205934
       
   148 1200 0.1981615
       
   149 1400 0.207116
       
   150 \end{filecontents}
       
   151 
       
   152 \begin{document}
       
   153 
       
   154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   155 \mode<presentation>{
       
   156 \begin{frame}<1>[t]
       
   157 \frametitle{%
       
   158   \begin{tabular}{@ {}c@ {}}
       
   159   \\[-3mm]
       
   160   \LARGE Automata and \\[-2mm] 
       
   161   \LARGE Formal Languages (10)\\[3mm] 
       
   162   \end{tabular}}
       
   163 
       
   164   \normalsize
       
   165   \begin{center}
       
   166   \begin{tabular}{ll}
       
   167   Email:  & christian.urban at kcl.ac.uk\\
       
   168   Of$\!$fice: & S1.27 (1st floor Strand Building)\\
       
   169   Slides: & KEATS (also home work is there)\\
       
   170   \end{tabular}
       
   171   \end{center}
       
   172 
       
   173 \end{frame}}
       
   174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
   175 
       
   176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   177 \mode<presentation>{
       
   178 \begin{frame}[c]
       
   179 
       
   180 \Large\bf
       
   181 There are more problems, than there are programs.\bigskip\bigskip\pause\\
       
   182 
       
   183 There must be a problem for which there is no program.
       
   184 \end{frame}}
       
   185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   186 
       
   187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   188 \mode<presentation>{
       
   189 \begin{frame}[c]
       
   190 \frametitle{Revision: Proofs}
       
   191 
       
   192 \begin{center}
       
   193 \includegraphics[scale=0.4]{river-stones.jpg}
       
   194 \end{center}
       
   195 
       
   196 \end{frame}}
       
   197 
       
   198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   199 \mode<presentation>{
       
   200 \begin{frame}[c]
       
   201 \frametitle{Subsets}
       
   202 
       
   203 \Large
       
   204 \bl{$A \subseteq B$}\bigskip\bigskip\\
       
   205 
       
   206 \bl{$\forall e.\; e \in A \Rightarrow e \in B$}
       
   207 \end{frame}}
       
   208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   209 
       
   210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   211 \mode<presentation>{
       
   212 \begin{frame}[c]
       
   213 \frametitle{Subsets}
       
   214 
       
   215 \Large
       
   216 \bl{$A \subseteq B$} and \bl{$B \subseteq A$}\bigskip
       
   217 
       
   218 then \bl{$A = B$}
       
   219 \end{frame}}
       
   220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   221 
       
   222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   223 \mode<presentation>{
       
   224 \begin{frame}[c]
       
   225 \frametitle{Injective Function}
       
   226 
       
   227 \Large
       
   228 \bl{f} is an injective function iff \bigskip
       
   229 
       
   230 \bl{$\forall x y.\; f(x) = f(y) \Rightarrow x = y$}
       
   231 
       
   232 \end{frame}}
       
   233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   234 
       
   235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   236 \mode<presentation>{
       
   237 \begin{frame}[c]
       
   238 \frametitle{Cardinality}
       
   239 
       
   240 \Large
       
   241 \bl{$|A|$} $\dn$ ``how many elements''\bigskip\\
       
   242 
       
   243 \bl{$A \subseteq B  \Rightarrow |A| \leq |B|$}\bigskip\\\pause
       
   244 
       
   245 if there is an injective function \bl{$f: A \rightarrow B$} then \bl{$|A| \leq |B|$}\
       
   246 
       
   247 \end{frame}}
       
   248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   249 
       
   250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   251 \mode<presentation>{
       
   252 \begin{frame}[c]
       
   253 \frametitle{Natural Numbers}
       
   254 
       
   255 \Large
       
   256 \bl{$\mathbb{N}$} \bl{$\dn$} \bl{$\{0, 1, 2, 3, .......\}$}\bigskip\pause 
       
   257 
       
   258 \bl{$A$} is \alert{countable} iff \bl{$|A| \leq |\mathbb{N}|$}
       
   259 
       
   260 \end{frame}}
       
   261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   262 
       
   263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   264 \mode<presentation>{
       
   265 \begin{frame}[c]
       
   266 \frametitle{First Question}
       
   267 
       
   268 \Large
       
   269 \bl{$|\mathbb{N} - \{0\}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\bigskip 
       
   270 
       
   271 \normalsize
       
   272 \bl{$\geq$} or \bl{$\leq$} or \bl{$=$} 
       
   273 \end{frame}}
       
   274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   275 
       
   276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   277 \mode<presentation>{
       
   278 \begin{frame}[c]
       
   279 
       
   280 \Large
       
   281 \bl{$|\mathbb{N} - \{0, 1\}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\pause 
       
   282 
       
   283 \bl{$|\mathbb{N} - \mathbb{O}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\bigskip
       
   284 
       
   285 \normalsize
       
   286 \bl{$\mathbb{O}$} $\dn$ odd numbers\quad   \bl{$\{1,3,5......\}$}\\ \pause
       
   287 \bl{$\mathbb{E}$} $\dn$ even numbers\quad   \bl{$\{0,2,4......\}$}\\
       
   288 \end{frame}}
       
   289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   290 
       
   291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   292 \mode<presentation>{
       
   293 \begin{frame}[c]
       
   294 
       
   295 \Large
       
   296 \bl{$|\mathbb{N} \cup \mathbb{-N}|   \;\;\;\alert{?}\;\;\;  |\mathbb{N}| $}\bigskip\bigskip
       
   297 
       
   298 
       
   299 \normalsize
       
   300 \bl{$\mathbb{\phantom{-}N}$} $\dn$ positive numbers\quad   \bl{$\{0,1,2,3,......\}$}\\
       
   301 \bl{$\mathbb{-N}$} $\dn$ negative numbers\quad   \bl{$\{0,-1,-2,-3,......\}$}\\
       
   302 \end{frame}}
       
   303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   304 
       
   305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   306 \mode<presentation>{
       
   307 \begin{frame}[c]
       
   308 
       
   309 \Large
       
   310 \bl{$A$} is \alert{countable} if there exists an injective \bl{$f : A \rightarrow \mathbb{N}$}\bigskip
       
   311 
       
   312 \bl{$A$} is \alert{uncountable} if there does not exist an injective \bl{$f : A \rightarrow \mathbb{N}$}\bigskip\bigskip 
       
   313 
       
   314 
       
   315 countable:  \bl{$|A| \leq |\mathbb{N}|$}\\
       
   316 uncountable:  \bl{$|A| > |\mathbb{N}|$}\pause\bigskip
       
   317 
       
   318 
       
   319 Does there exist such an \bl{$A$} ?
       
   320 
       
   321 \end{frame}}
       
   322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   323 
       
   324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   325 \mode<presentation>{
       
   326 \begin{frame}[c]
       
   327 \frametitle{Halting Problem}
       
   328 
       
   329 \large
       
   330 Assume a program \bl{$H$} that decides for all programs \bl{$A$} and all 
       
   331 input data \bl{$D$} whether\bigskip
       
   332 
       
   333 \begin{itemize}
       
   334 \item \bl{$H(A, D) \dn 1$} iff \bl{$A(D)$} terminates
       
   335 \item \bl{$H(A, D) \dn 0$} otherwise
       
   336 \end{itemize}
       
   337 
       
   338 \end{frame}}
       
   339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   340 
       
   341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   342 \mode<presentation>{
       
   343 \begin{frame}[c]
       
   344 \frametitle{Halting Problem}
       
   345 
       
   346 \large
       
   347 Given such a program \bl{$H$} define the following program \bl{$C$}:
       
   348 for all programs \bl{$A$}\bigskip
       
   349 
       
   350 \begin{itemize}
       
   351 \item \bl{$C(A) \dn 0$} iff \bl{$H(A, A) = 0$} 
       
   352 \item \bl{$C(A) \dn 1$} otherwise
       
   353 \end{itemize}
       
   354 
       
   355 \end{frame}}
       
   356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   357 
       
   358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   359 \mode<presentation>{
       
   360 \begin{frame}[c]
       
   361 \frametitle{Halting Problem (2)}
       
   362 
       
   363 \large
       
   364 Given such a program \bl{$H$} define the following program \bl{$C$}:
       
   365 for all programs \bl{$A$}\bigskip
       
   366 
       
   367 \begin{itemize}
       
   368 \item \bl{$C(A) \dn 0$} iff \bl{$H(A, A) = 0$} 
       
   369 \item \bl{$C(A) \dn 1$} otherwise
       
   370 \end{itemize}
       
   371 
       
   372 \end{frame}}
       
   373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   374 
       
   375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   376 \mode<presentation>{
       
   377 \begin{frame}[c]
       
   378 \frametitle{Contradiction}
       
   379 
       
   380 
       
   381 \bl{$H(C, C)$} is either \bl{$0$} or \bl{$1$}.
       
   382 
       
   383 \begin{itemize}
       
   384 \item \bl{$H(C, C) = 1$} $\stackrel{def H}{\Rightarrow}$ \bl{$C(C)\downarrow$} $\stackrel{def C}{\Rightarrow}$ \bl{$H(C, C)=0$} 
       
   385 \item \bl{$H(C, C) = 0$} $\stackrel{def H}{\Rightarrow}$ \bl{$C(C)$} loops $\stackrel{def C}{\Rightarrow}$\\ 
       
   386 \hspace{7cm}\bl{$H(C, C)=1$} 
       
   387 \end{itemize}
       
   388 
       
   389 Contradiction in both cases. So \bl{$H$} cannot exist.
       
   390 
       
   391 \end{frame}}
       
   392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
       
   393 
       
   394 \end{document}
       
   395 
       
   396 %%% Local Variables:  
       
   397 %%% mode: latex
       
   398 %%% TeX-master: t
       
   399 %%% End: 
       
   400