a).
Here we have to prove NECESSARYCFG is Turing recognizable.
Let S be decider for Context Free Grammar A
Let us construct a Turing Machine M such that:
- Construct Context Free Grammar G/A by removing non-terminal A and all production that contain G
- Mention the string w one-by-one generated by G. Now we will run all such strings on S to check if w is generated by G/A.
- If string w is not generated byG/A , accept
Else
Keep searching and reject on other outputs.
Now, the languagecontain all or only those string w which belong to language G i.e., .
So, our Turing Machine M will recognize such string w and accept it.
If A is not necessary for G, in such situationand M will keep searching and rejecting unwanted string.
Thus, M recognize NECESSARYCFG.