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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started