Professional Documents
Culture Documents
S A is redundant as A cannot be
transformed into a terminal string.
Removing this production leaves the
language unaffected.
Removing useless production
Let G = (N, T, S, P) be a CFG A ϵV is useful iff there is w ϵL(G) such that:
S*xAy*w with x, y in (NUT)*
A production is useless if it involves any useless variable.
E.g.
G = ({S, A, B}, {a, b}, S, P)
SA
AaA|λ
BbA
The variable B is useless, either it is no reachable from the start sysmble or generating a terminal string.
Eliminate the useless symbbols and production from G =(V, T, S, P) where V/N=(A,
B, C) and T={a,b} with P consisting
SaS | A | C
SaS|A
Aa
Aa
Baa
CaCb
The remaining are useless production
Removing λ-Productions
Removing λ-Productions
Example
Removing Unit-Productions
Note: the removal of unit production has made B and the associated
productions useless.
Simplification and Normal Forms
Let L be a context-free language that does not contain λ.
Then there exists a CFG that generates L and does not have
any useless productions, O -productions, or unit-productions.
Proof
Remove λ-productions.
Remove unit-productions.
Remove useless-productions