patternMinor
Situations where Kleene star of A is context-free, but A is not
Viewed 0 times
starfreenotwherebutcontextkleenesituations
Problem
This question appeared on my Theory of Computer Science final:
True | False: $A^*$ is context-free $\implies$ $A$ is context-free.
My professor says the answer is false, and I believe him, but am having trouble constructing a counterexample or even just convincing myself why. It seems to me that if a grammar can describe repeated concatenation, there must be some nonterminal that is concatenated.
Does anyone have a counterexample?
True | False: $A^*$ is context-free $\implies$ $A$ is context-free.
My professor says the answer is false, and I believe him, but am having trouble constructing a counterexample or even just convincing myself why. It seems to me that if a grammar can describe repeated concatenation, there must be some nonterminal that is concatenated.
Does anyone have a counterexample?
Solution
Let $L$ be any non-context-free language, then we can construct the language $A = \Sigma\cup L$ - i.e. $A$ is either an element of $\Sigma$ or a string from $L$ (these can happily overlap too). This is clearly not context free either (if it were, then we would have a PDA for it, and we can easily modify this PDA to recognise $L$).
If we now take $A^{\ast}$ however, we get $\Sigma^{\ast}$, which is most certainly context free.
If we now take $A^{\ast}$ however, we get $\Sigma^{\ast}$, which is most certainly context free.
Context
StackExchange Computer Science Q#24786, answer score: 8
Revisions (0)
No revisions yet.