\begin{frame}{Removal of Unit Production Rules}
    A rule $A \to B$ is called \emph{unit production rule} (here $B \in V$).

    For every context-free language $L$ 
    there is a context-free grammar $G$ 
    \alert{without $\lambda$- and unit-productions} with $L(G) = L \setminus \{\lambda\}$.
    Let $G$ be context-free, without $\lambda$-rules, and $L(G) = L \setminus \{\lambda\}$.
    Determine all pairs $A \neq B$ with \alert{$A \Rightarrow^+ B$}.
    Whenever \alert{$A \Rightarrow^+ B$} and \alert{$B \to y$} is a rule, add a rule \alert{$A \to y$}.

    Remove all unit production rules.
    The resulting grammar $G$ has no $\lambda$- and unit-productions and 
    it has the property \alert{$L(G)= L \setminus \{\lambda\}$}.