61/77
\begin{frame}{Exercise}
  \begin{exampleblock}{}
    Remove all unit production rules from
    \begin{talign}
      S \to Aa \mid B &&
      A \to a \mid bc \mid B &&
      B \to A \mid bb
    \end{talign}
    \pause
    Note that there are no $\lambda$-productions.\\
    (So no need to first remove $\lambda$-productions.)
    \pause\medskip
    
    We determine all pairs $A \neq B$ with $A \Rightarrow^+ B$:
    \begin{talign}
      \mpause[1]{S \Rightarrow^+ B} &&
      \mpause{A \Rightarrow^+ B} &&
      \mpause{B \Rightarrow^+ A} &&
      \mpause{S \Rightarrow^+ A}
    \end{talign}
    \pause\pause\pause\pause\pause
    Thus we add the following rules:
    \begin{talign}
      S &\to Aa \mid B \alert{\mpause[1]{\mid a}\mpause{\mid bc}\mpause{\mid A}\mpause{\mid bb}} \\
      A &\to a \mid bc \mid B \alert{\mpause{\mid A}\mpause{\mid bb}} \\
      B &\to A \mid bb \alert{\mpause{\mid a}\mpause{\mid bc}\mpause{\mid B}}
    \end{talign}
    \pause\pause\pause\pause\pause\pause\pause\pause\pause\pause
    Removing all unit production rules yields the final result:
    \begin{talign}
      S &\to a \mid bb \mid bc \mid Aa &&&
      A &\to a \mid bb \mid bc &&&
      B &\to a \mid bb \mid bc
    \end{talign}
  \end{exampleblock}
\end{frame}

\subsection{Chomsky Normal Form}

\themex{Chomsky Normal Form}