Question

Is this a context free language?

{a^(2k) b^n c^n : k >= 0 ∧ 0 <= n <= m}
{a^(2k+1) b^n c^m :k >= 0 ∧ n >= m >= 0}

Was it helpful?

Solution

One way to prove a Language a Context-Free-Language is to write Context-Free-Grammar for the given language:(or either draw PDA)

The language below:

{a(2k) bn cm : k >= 0 and 0 <= n <= m} U {a(2k+1) bn cm : k >= 0 and n >= m >= 0}

is Context Free Language

I think you have made mistake in writing question as I commented to you question, I am doing for above grammar

We can write Context-Free-Grammar for this Language:

in Context-Free-Grammar productions of kind α --> β where α is a single variable.

S --> S1 | S2

S1 generates this part {a(2k) bn cm : k >= 0 and 0 <= n <= m} and S2 generates {a(2k+1) bn cm : k >= 0 and n >= m >= 0}

S1 --> AB

A --> Aaa | ^

B --> bBc | ^

B --> Bc

And

S2 --> AaC

C --> bCc | ^

C --> bC

In grammar S is start Variable and {S, S1, S2, A, B, C} all are variable.
So in above grammar every productions are in the form α --> β where α is a single variable hence given language is Context-Free-Language.

Let me know if you have other doubt or if your language I misunderstood

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top