Home » Theory of Computation » Theory of computation miscellaneous » Question

Theory of computation miscellaneous

Theory of Computation

  1. Let L1 = { 0n + m 1n 0m | n , m ≥ 0 } , L2 = { 0n + m 1n + m 0m | n , m ≥ 0 } and L2 = { 0n + m 1n + m 0n + m | n , m ≥ 0 } . Which of these languages is/are not context free?
    1. L1 only
    2. L3 only
    3. L1 and L2
    4. L2 and L3
Correct Option: D

The language is context free or not, this can be proved by finding out the grammar for all the languages.
L1 = { 0n + m 1n 0m | n, m ≥ 0 }
The production for L1 as follows :
S → 0S0 | 0A1 | ε
A → 0A1 | ε
Now, we need to apply these values of the production individually to generate
0n + m | n0m
that is,
0m0n 1n0m → To prove
Applying 0S0 (m times)
S → 0 S0, S → 0mS0m
Applying, S → 0A1
→ S → 0m 0A1 0m
Here applying, A → 0 A1, n - 1 times
S → 0m 0 0n - 1 A1n - 1 10m
→ S → 0m 0n 1n 0m
Hence, proved, so L1 is context-free. Going through the same procedure, we can see that two comparisons are made in the L2 language, So it is not context-free.
L3 → Going through the same procedure again, we can see that two comparisons are made in the L3 language, so it is not context free.



Your comments will be displayed only after manual approval.