Question: = { a, b, c }, design a context-free grammar G such that L(G) equals the complement of { a n b n c n
= { a, b, c }, design a context-free grammar G such that L(G) equals the complement of { an bn cn : n 0 }
To do this we can: First design a DFA M such that L(M) = a b c . Then complement the DFA to get M' such that L(M') = a b c . Next, allocate a variable Aq for each state q. Then convert arcs (p, c, q) into rules Ap cAq, plus Ap c if q is a final state of M' . Call the new grammar G' and use G' as an option from the start symbol S of G to handle strings not of the form a b c . Now you need to handle strings that do have this form but dont have their numbers of as, bs, and cs all equal. Write those inequalities as further disjunctions of > and < and a or c cases.
Explain why this shows that the class of context-free languages is not closed under complementation.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
