Hi so consider the language $L= \{(0^i)(1^j)\mid i=k*j \text{ for some positive }k\}$ Could I not rewrite this as $\{((0^k)^j)(b^j)\mid k>1\}$. Seeing it in this form makes me think of a form $a^n b^n$ which we know is context free so therefore it should be context free. Is my logic wrong and if not what would be the best way to show it's context free.
Asked
Active
Viewed 225 times
1 Answers
1
The best way to show that a language is context-free is to use one of the equivalent definitions of context-free languages. The two most popular ones are:
- A language is context-free if it is generated by a context-free grammar.
- A language is context-free if it is accepted by a (non-deterministic) push-down automaton.
The language $\{ a^n b^n : n \geq 0 \}$ is generated by the grammar $S \to aSb | \epsilon$. Let's try to use the same idea for your language: $S \to 0^k S 1 | \epsilon$ (we can implement $0^k$ using context-free rules). The problem is that we can't guarantee that the same $k$ is used in all productions. This leads me to conjecture that the language is not context-free.
How do we show that a language is not context-free? The most popular way is to use the pumping lemma or one of its variants, though this method doesn't always work. Perhaps you should give it a try.
Yuval Filmus
- 280,205
- 27
- 317
- 514