Search code examples
context-free-grammarformal-languages

Can you help me understand this answer?


I'm currently studying for an exam and I came across a question regarding grammar in formal languages for which I'm pretty sure the professor got the answer wrong, I'd like to hear your idea.

The question presents this grammar: Grammar definition

The question asks to define the language opposite of S (complement of S) of even length, meaning describe the rule for all the words of even length that are not accepted by grammar S. Their answer is this: enter image description here

I believe this answer is wrong, as the word "aaabab" also will not be accepted by S and is not a word concatenated to itself as their answer describes.

Any thoughts? Am I missing something here?

Thanks in advance, Avi.


Solution

  • Never mind, after 2 freakin days i got it.

    On a different note - I really wish you'd tell me if I broke some forum rules instead of just down voting, how will I know what not to do in the future?

    As Jean correctly said - I should post the answer. I was wrong in my understanding of S, there don't have to be the same number of characters around the a and b, so what I said is absolutely wrong - the word "aaabab" WILL actually be accepted by S, the first "a" will be X and the rest is Y.