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}
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}
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 a
s as you need. X generates b
and c
in equal quantity. Therefore this CFG specifies the language L.
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.