edited by
2,516 views
12 votes
12 votes

Consider the language $L\subseteq \left \{ a,b,c \right \}^{*}$ defined as

$L = \left \{ a^{p}b^{q}c^{r} : p=q\quad or\quad q=r \quad or\quad r=p \right \}.$

Which of the following answer is TRUE about the complexity of this language?

  1. $L$ is regular but not context-free
  2. $L$ is context-free but not regular
  3. $L$ is decidable but not context free
  4. The complement of $L,$ defined as $\overline{L} = \left \{ a,b,c \right \}^{*}\backslash L,$ is regular.
  5. $L$ is regular, context-free and decidable
edited by

2 Answers

18 votes
18 votes

$\large L1=a^pb^qc^r: p=q$

$\large L2=a^pb^qc^r: q=r$

$\large L3=a^pb^qc^r: r=p$

$\large L=L1\cup L2\cup L3$

$\large  L1,L2,L3$  are CFL


We know that union of  CFL is CFL
Hence, $\large L$ is Context free language

Answer is option B.

edited by
3 votes
3 votes

The given language L is context free since there is 'or' in between the conditions $p=q, q=r, r=p$. (Union of context free languages is context-free) 

If there were 'and' in between the conditions, the language would be context sensitive.

L is decidable since it is context-free. (All recursive languages are decidable, context free language is a subset of recursive languages)

Complement of L is context-sensitive but not regular.

option B.

Answer:

Related questions

4 votes
4 votes
1 answer
2