Which of the following languages are not regular? A. L={ (01)n 0k | n > k,…
2021
Which of the following languages are not regular?
A. L={ (01)n 0k | n > k, k>=0 }
B. L={ cn bk an+k | n >= 0, k>=0 }
C. L={ 0n 1k | n≠k }
Choose the correct answer from the options given below:
- A.
A and B only
- B.
A and C only
- C.
B and C only
- D.
A, B and C
Attempted by 60 students.
Show answer & explanation
Correct answer: D
Answer: All three languages are not regular.
Language A (strings of the form (01)^n0^k with n > k) — Use the pumping lemma. Let p be the pumping length and choose s = (01)^{p}0^{p-1}, which satisfies n>k. Any decomposition s=xyz with |xy|≤p forces y to lie entirely within the prefix that consists of repeated (01) blocks. Pumping y changes the number of (01) blocks n while leaving the trailing zeros count k unchanged, so for some pumped string the inequality n>k will fail. Thus the language is not regular.
Language B (strings of the form c^n b^k a^{n+k}) — Apply the pumping lemma. Let p be the pumping length and take s = c^{p}b^{p}a^{2p} which satisfies n=p, k=p so a-count = n+k = 2p. Any valid splitting with |xy|≤p forces y to lie inside the initial block of c's. Pumping y changes the number of c's without changing the number of a's; after pumping the required relation between the number of a's and the sum of c's and b's is violated. Hence the language is not regular.
Language C (strings of the form 0^n1^k with n ≠ k) — Use a closure/contradiction argument. The set 0^*1^* is regular. If the language of strings with n ≠ k were regular, then the difference 0^*1^* \ (strings with n ≠ k) would be regular as well. But that difference is exactly {0^n1^n}, which is known to be non-regular. This contradiction shows the language with n ≠ k is not regular.
A video solution is available for this question — log in and enroll to watch it.