2.4k views
1 vote
2. Is the following language context free? Prove your case. 10 points L = {a"blab", in which n, j>0}

User Caleb Koch
by
7.9k points

1 Answer

5 votes

Step-by-step explanation:

The given language L = a^jblab^j is not context-free. I will prove this by applying the pumping lemma for context-free languages.

The pumping lemma states that if a language L is context-free, there exists a pumping length (p) such that any string s in L with a length of at least p can be divided into five parts: s = uvwxy, satisfying the following conditions:

1. |vwx| ≤ p

2. |vx| > 0

3. For all integers i ≥ 0, u(v^i)w(x^i)y ∈ L

Let's assume that L is context-free and has a pumping length p. Consider the string s = a^pblab^p ∈ L.

Now, let's analyze the possible divisions of s = uvwxy, taking into account the conditions of the pumping lemma:

1. |vwx| ≤ p: Since vwx must be contained within the first p characters of s, it can only consist of a's. Therefore, vwx must be of the form a^k for some k ≤ p.

2. |vx| > 0: Since |vwx| ≤ p and |vx| > 0, vx must contain at least one 'a'.

3. For all integers i ≥ 0, u(v^i)w(x^i)y ∈ L: Let's consider the case when i = 2. According to the pumping lemma, u(v^2)w(x^2)y must also be in L. However, if we pump the 'a's in v and x, we would have more 'a's than b's, which violates the condition of the language L. Therefore, u(v^2)w(x^2)y cannot be in L.

Since the pumping lemma condition fails for s = a^pblab^p, we can conclude that L = a^jblab^j is not a context-free language.

Hence, the given language is not context-free.

User Phemmer
by
8.6k points