3,273 views
7 7 votes

Consider two languages, L1 and L2 defined over same alphabet ∑. Let L1⊕L2={w|w belongs to exactly one out of L1 and L2}. Suppose L1 is regular and L2 is context-free, then which of the following statements is true?

  1.   L1⊕L2 is undecidable
  2.  ​​​​​​​ L1⊕L2 is context-free but not necessarily regular
  3.  ​​​​​​​ L1⊕L2 is regular
  4.  ​​​​​​​ L1⊕L2 is decidable but not necessarily context-free
     

3 Answers

8 8 votes

This is a closure property based question ..

We know :

L1  ⊕  L2  =   (L1 - L2)  ∪  (L2 - L1)

(or)           =   (L1 ∪  L2)  -  (L1 ∩ L2)

Let us use the 2nd definition ..

Let X  =    (L1 ∪  L2)  

     Y  =    (L1 ∩ L2)

Now given L1 is regular and L2  is CFL..So they belong to different levels in Chomsky hierarchy..As we know we should go up the Chomsky as upper class is more general as compared to lower class (in this case upper class is referred to CFL).

So we know that every regular language is also CFL..So now we push L1 to upper level and now hence X means union of two CFLs..So X is also a CFL as CFLs are closed under union..

Now coming to Y , Y is not a CFL necessarily as CFLs are not closed under intersection..So now we push Y to next upper level which is CSL..As we know CSLs are closed under intersection , hence  L1  and L2 being CFL will be CSL also by default..So Y is also going to be a CSL..

Hence X - Y means difference of a CFL  and a CSL..But we know

X -  Y   =   X  ∩  Y'

Now the complement of Y will be also a CSL as CSL is closed under complementation as well..Now X is a CFL and Y' is a CSL ..Hence for X ∩  Y'  we need that X is pushed to next higher level which is CSL..Now X is a CSL and Y is also a CSL..Hence X ∩ Y' will also be a CSL always as CSL is closed under intersection..

Hence X - Y will be a CSL(Context Sensitive Language) definitely..

Hence the stronger answer for the above query will be a CSL..

So the given language is a recursive language as well and hence decidable as :

a) Every lower class language in Chomsky hierarchy is by default higher class language as well..

b) Undecidable language begins from recursively enumerable but not recursive level.

So option A) is false..Also option B) is false as explained earlier..

Also option C) is false as a language is not guaranteed to be a CFL even then we cannot guarantee regularity of the language as well..

So the correct answer to the above question is option D) as the language is guaranteed to be CSL and hence also recursive and hence decidable but may or may not be CFL as explained earlier..

6 6 votes
$L_1 \oplus L_2$ is not necessarily context-free. This can be proved by giving a counter exmaple. Let

$L_1 = \Sigma^*$

$L_2 = \text{comp}\{ww\mid w \in \Sigma^*\}$

Now,

$L_1 \oplus L_2 = \left(L_1 \cap L_2^c\right) \cup \left(L_1^c \cap L_2\right)$

$= L_2^c \cup \emptyset = {L_2}^c$

And we know $L_2^c$ is not context-free for the given $L_2$. We could also take any context free language here whose complement is not context-free.
• edited by
0 0 votes
if any language is regular then according to Chomsky hierarchy it must be context free.. so I think it's 2..
Position:
Show:

Related questions

2 2 votes
1 answers 1 answer
2.6k
2.6k views
saurabh rai asked Oct 26, 2016
2,634 views
1. L = {<M>|M is a TM and L(M) is countable}2. L = {<M>|M is a TM and L(M) is uncountable}what is the class of 1 and 2 recursive/RE/NOT RE
0 0 votes
0 0 answers
955
955 views
!KARAN asked Dec 8, 2018
955 views
For $\text{A, B} \subseteq \Sigma^*,$ define$A/B = \{x \in \Sigma^* | \exists y \in B , xy \in A \}$If L is a CFL and R is regular, then L/R isRegularCFL but not regula...
1 1 vote
1 answers 1 answer
3.1k
3.1k views
Na462 asked Sep 11, 2018
3,058 views
Is Language L = {0(n+m) 1(k+l) | m = l, and m,n,k,l ≥ 1 } a regular language ? explain
1 1 vote
1 1 answer
684
684 views
ankitgupta.1729 asked Feb 24, 2018
684 views
Under Which class of language , Set of binary strings represents Fibonacci Sequence over input alphabet {0,1} ? I think either it is Context Sensitive Language or Recursi...