Closure-Property
Question 1 |
L1. L2
| |
L1 ∪ L2 | |
L1 ∩ L2 | |
L1 − L2 |
L1. L2 => regular . CFL == CFL. CFL (as every regular is CFL so we can assume regular as CFL)
Since CFL is closed under concatenation so
CFL. CFL= CFL
Hence
Regular . CFL = CFL is true
L1 ∪ L2 => Regular ∪ CFL = CFL
Regular ∪ CFL = CFL ∪ CFL (as every regular is CFL so we can assume regular as CFL)
Since CFL is closed under union
Hence Regular ∪ CFL = CFL is true
L1 ∩ L2 => Regular ∩ CFL = CFL
Regular languages are closed under intersection with any language
I.e,
Regular ∩ L = L (where L is any language such as CFL, CSL etc)
Hence Regular ∩ CFL = CFL is true
Please note this is a special property of regular languages so we will not upgrade regular into CFL (as we did in S1 and S2). We can directly use these closure properties.
L1 − L2 => Regular − CFL = CFL
=> Regular − CFL = regular ∩ CFL (complement)
Since CFL is not closed under complement so complement of CFL may or may not be CFL
Hence Regular − CFL need not be CFL
For ex:
R= (a+b+c)* and L= {am bn ck | m ≠ n or n ≠ k} which is CFL.
The complement of L = {an bn cn | n>0} which is CSL but not CFL.
So
R − L = (a+b+c)* − {am bn ck | m ≠ n or n ≠ k}
=> (a+b+c)* ∩ L (complement)
=> (a+b+c)* ∩ {an bn cn | n>0}
=> {an bn cn | n>0}
Which is CSL. Hence Regular − CFL need not be CFL.
Question 2 |
For any two languages L1 and L2 such that L1 is context-free and L2 is recursively enumerable but not recursive, which of the following is/are necessarily true?
I only | |
III only | |
III and IV only | |
I and IV only |
This one is true, because L1 is context free which is nothing but recursive, recursive language is closed under complement hence true.
2 ⇒ (complement of L2) is recursive
If L2 and both are recursive enumerable then is recursive.
Hence option 2 is false
3 ⇒ is context free
Which is false because context free language does not closed under complement
4 ⇒ ∪L2 is recursive enumerable
⇒ recursive
Every recursive language is also recursive enumerable
L2 ⇒ recursive enumerable
∪ L2 ⇒ recursive enumerable
Because recursive enumerable language closed under union.