32/162
\begin{frame}{\alt<1-11>{Termination}{\alert{Termination is undecidable!}\onslide<12>{}}}
  \vspace{-.5ex}
  \begin{goal}{}
    Assume there would be a \emph{program $\terminatoronitself$}\; with the behaviour: \vspace{-.5ex}
    \begin{itemize}\setlength{\itemsep}{0pt}
      \item input: a program \forestgreen{$P$}  
      \item output: \emph{yes} if \forestgreen{$P$} terminates on input \forestgreen{$P$},
                    \emph{no} otherwise
    \end{itemize}
  \end{goal}
  \pause 

  \begin{center}\vspace{-.25ex}
    \begin{tikzpicture}[p/.style={rectangle,minimum width=37mm,fill=yellow!50!orange!20,draw=black,dashed,rounded corners=2mm,inner sep=2mm,align=left}]
      \node (p) [p] {p = read input;\\[-.5ex]\hspace{1.1cm}\scalebox{.8}{\vdots}\\[-.5ex]print result;};
      \draw [decorate,decoration={brace,amplitude=10pt},xshift=-4pt,yshift=0pt] 
        ($(p.south west) + (-2mm,0)$) to node [left,xshift=-3mm] {program $\terminatoronitself$} ($(p.north west) + (-2mm,0)$);
      
      \mpause[1]{
        \node (p')  at (p.south) [p,anchor=north] {\dm{if} result = yes\\\dm{then}\;\, loop forever\\\dm{else}\;\; terminate};

        \draw [decorate,decoration={brace,amplitude=10pt},xshift=-4pt,yshift=0pt] 
          ($(p.north east) + (2mm,0)$) to node [right,xshift=3mm] {program $\diagonalisator$} ($(p'.south east) + (2mm,0)$);
      }
    \end{tikzpicture}
  \end{center}\vspace{-1.2ex}
  \pause\pause
      
  \begin{goal}{}
    What happens if we run $\diagonalisator$ with input $\diagonalisator$?\vspace{-.5ex}
    \begin{itemize}\setlength{\itemsep}{0pt}
      \pause
        \item initial part $\terminatoronitself$\, decides whether $\diagonalisator$ terminates on input $\diagonalisator$
      \pause
        \item if the result is \alert{yes}, then $\diagonalisator$ runs forever\pause{} $\,$ \alert{$\xmark$}
      \pause
        \item if the result is \alert{no}, then $\diagonalisator$ terminates\pause{} $\,$ \alert{$\xmark$}
    \end{itemize}
  \end{goal}
  \pause
  \vspace{-.5ex}
  \begin{alertblock}{}
    Thus $\terminatoronitself$ has made a mistake!\pause{} And thus also $\terminator\,$! \pause
  \end{alertblock}
  \vspace{10cm}
\end{frame}