28/136
\begin{frame}{Removal of Useless Variables}
  \begin{exampleblock}{}
    \vspace{-1ex}
    \begin{align*}
      S &\to aSb \mid BC \mid \lambda &
      A &\to Sb &
      B &\to a &
      C &\to C
    \end{align*}
    \pause
    Which variables are non-productive?
    \begin{itemize}
    \pause
      \item $C$ is not productive
    \end{itemize}
    \pause\medskip
    We remove all rules containing non-productive variables:
    \begin{talign}
      S &\to aSb \mid \lambda &
      A &\to Sb &
      B &\to a 
    \end{talign}
    \pause
    Which variables are reachable from $S$?
    \begin{itemize}
    \pause
      \item only $S$ is reachable
    \end{itemize}
    \pause\medskip
    We remove all rules containing non-reachable variables:
    \begin{talign}
      S &\to aSb \mid \lambda
    \end{talign}
    \pause
    Hence only $S$ is useful, the variables $A,B,C$ are not useful.
  \end{exampleblock}
\end{frame}