I need help proving the set difference between a context free grammar A and a regular language, B, is a context free language.
I'm trying to prove by example like this:
Let A = {a^n b^n | n >= 1}
Let B = {w {a,b}* | w has atleast three a's }
Then A-B should be {a^n b^n | 1 <= n < 3 }, ex. (ab, aabb)
If A-B is a context free language, then there must some context free grammar G than can represent it.
G = ({S}, {a,b}, P, S)
S->aAb | ab
A->ab
G is context free because it can be rewritten in Normal Chomsky form :
S -> BD | BC
D -> AC
A -> BC
B -> a
C -> b
Thus the result of A - B must also context free.
I'm not sure this is the correct way to approach this problem. Any assistance is welcome.