I'm working on converting this grammar to CNF (Chomsky Normal Form).
S-> abAB
A-> bAB | lambda
B-> BAa | A | lambda
So I started off by eliminating the lambda productions, and in doing so I got this:
S-> abAB | abB | abA | ab
A-> bAB | bA | bB | b
B-> BAa | A | Ba | Aa | a
I went a little bit further into the conversion process and ran into an issue of adding more unit productions than necessary, so I went and checked the answer key to see what I missed and it turns out that when we remove the lambdas, the following productions are not correct:
S-> ab
A-> b
B-> a
I would like to know why because it is not obvious to me yet. If we are looking at the production:
A-> bAB
and A and B can produce lambda, then we are just simply left with b correct? So why is it not a part of our production after eliminating lambda?
After the $\lambda$ eliminination the key has the following grammar:
S-> abAB | abA | abB
A-> bAB | bA | bB
B-> BAa | A | Ba | Aa