Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Let G = ({S, A}, sigma, R, S) be the context-free grammar with sigma = {a, b} and rules R = S rightarrow SS |
Let G = ({S, A}, sigma, R, S) be the context-free grammar with sigma = {a, b} and rules R = S rightarrow SS | ASa | aA, A rightarrow bA | SAa | a. And let T be the language of strings x such that #a(x) is even. (a) Show that this grammar is unsound for T-that is, find a string in L(G)\T. (b) Change one of the rules to make a grammar G' that is sound for T. Make it a "single-edit" change: that is, inserting, deleting, or changing just one character (terminal or variable symbol). Then explain why your new G' is sound. (c) Is the original grammar comprehensive for T? OK, it's not: elementof elementof \L(G). So let's change the target language to be T' = T\{elementof}and revise the question: Is the original grammar comprehensive for T'? If you say yes, argue why as best you can; if you say no, give a nonempty string with an even number of a's that G does not generate, and explain why not. Let G = ({S, A}, sigma, R, S) be the context-free grammar with sigma = {a, b} and rules R = S rightarrow SS | ASa | aA, A rightarrow bA | SAa | a. And let T be the language of strings x such that #a(x) is even. (a) Show that this grammar is unsound for T-that is, find a string in L(G)\T. (b) Change one of the rules to make a grammar G' that is sound for T. Make it a "single-edit" change: that is, inserting, deleting, or changing just one character (terminal or variable symbol). Then explain why your new G' is sound. (c) Is the original grammar comprehensive for T? OK, it's not: elementof elementof \L(G). So let's change the target language to be T' = T\{elementof}and revise the question: Is the original grammar comprehensive for T'? If you say yes, argue why as best you can; if you say no, give a nonempty string with an even number of a's that G does not generate, and explain why not
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