in Theory of Computation edited by
3,546 views
28 votes
28 votes

Let $L$ be a given context-free language over the alphabet $\left\{a, b\right\}$. Construct $L_{1},L_{2}$ as follows. Let $L_{1}= L - \left\{xyx\mid x, y \in \left\{a, b\right\}^*\right\}$, and $L_{2} = L \cdot L$. Then,

  1. Both $L_{1}$ and $L_{2}$ are regular.
  2. Both $L_{1}$ and $L_{2}$ are context free but not necessarily regular.
  3. $L_{1}$ is regular and $L_{2}$ is context free.
  4. $L_{1}$ and $L_{2}$ both may not be context free.
  5. $L_{1}$ is regular but $L_{2}$ may not be context free.
in Theory of Computation edited by
3.5k views

4 Comments

Since x,y both belong to (a+b)*

You can imagine y to have any length. So it would actually match all strings starting and ending in the same symbol.

Ex: ababba belongs to the language because in this case x = a and y = babb

Since there is no restriction on x's length, x can even be $\epsilon$

The regular expression for such a language would be

= a(a+b)*a + b(a+b)*b + $\epsilon$(a+b)*$\epsilon$

= (a+b)*

1
1

no restriction on length, i.e I can choose any length for x & y

abbabbaab, here if x = ab then is it in the language??

0
0
Yes. Only condition is x and y should belong to (a+b)*
0
0

2 Answers

54 votes
54 votes
Best answer

$L$ is a context free language over $\{a,b\}$
$L_1 = L - \{xyx \mid x,y \in \{a,b\}^* \}$    

      $= L - \{ \text{all strings over} \{a,b\} \}$    [ Note: all strings can be generated from y by putting $x= \epsilon$]

      $= L - (a+b)^* = \{\}$ , empty set.    [Note : $L_1 - L_2 = \{ \text{string in $L_1$ but not in L2 }\}$ ]

So , $L_1$ is a Regular Language. 

$L$ is a context free language over $\{a,b\}$ 

$L_2 = L \cdot L$
Context free languages are closed under Concatenation. 

So, $L_2$ is Context Free Language.

Option C is correct.

edited by

4 Comments

@Praveen Saini

Sir

Plz tell me

For $L_{1},$ if we take $L=a^{n}b^{n}$

And $L_{1}=a^{n}b^{n}-\Phi =a^{n}b^{n}\cap \left ( a+ \right )*=a^{n}b^{n}$

Isnot it  be CFL as maximum? 

Though u have told it Regular, but in the above example regular also not possible. Isnot it? Plz tell me if anything is wrong.

1
1
Regarding $L_1$, I could just as easily set $y$ to epsilon and we would have $xx$, which is a CSL. But I guess that the reason it's regular is that by setting $x$ to epsilon, it degenerates to $\sum^*$, meaning it can generate not only $xx$ but all possible strings in $\sum^*$.

In the end it all boils down to writing the language as a set...
0
0

L1 = CFL - Regular => CFL ∩ Compliment(Regular) = CFL ∩ R = CFL

L2 = CFL.CFL = CFL

 

I think, correct option should be B.

0
0
9 votes
9 votes

L1 =  CFL - (x+y)* = ∅  Which is Regular.

L2 = CFL . CFL = CFL

Since CFL Is  Closed Under Concatination.

C Is Answer.

edited by

4 Comments

L1 is regular as per answer key. Correct answer marked in Green.
0
0
it may b case that cfl also in input x,y... then cfl always subset of regular because it is sigma* .. so ans always phi.
1
1
**regular is proper subset of cfl
0
0

@Anirudh 

Suppose L=anbn

L2=L.L = anbn . anbn  

So after concatination it will be CFL ...can u tell me what changes has been happen over here ..

1
1
Answer:

Related questions