Is this a context free or context sensitive language?

375 views Asked by At

I am studying Formal Languages and Automata Theory, and I have a question about a problem inside the book that is not answered in it. the question is:

Is this language Context Free, Regular or Context Sensitive?

L={a^i b^j c^k|i<=j or j<=i , j=k}

2

There are 2 answers

5
user2736738 On

It's context sensitive.

Not Regular : We have to remember the number of occurences of b or c which finite state machine can't.

Not context free as if we apply pumping lemma you will see we have more b's than c's after pushing b for a string like a^{2}b^{2} b^{n-4}b^{2}c^{n}.

So it is context sensitive.

0
Welbog On

It's context-free. It can be specified with the following CFG:

S -> AX
A -> aA
A -> epsilon
X -> bXc
X -> epsilon

The A state accepts as many as as you need. X generates b and c in equal quantity. Therefore this CFG specifies the language L.