In: Computer Science
Let swap_every_two be an operation on languages that is defined as follows:
swap_every_two(L) = {a2a1a4a3 . . . a2na2n−1 | a1a2a3a4 . . . a2n−1a2n ∈ L where a1, . . . , a2n ∈ Σ} In this definition, Σ is the alphabet for the language L. (it is a2a1a4a3 not a^2a^1 !!)
1. What languages result from applying swap_every_two to the following languages:
(a) {1^n | n ≥ 0}, where the alphabet is {1}.
(b) {(01)^n | n ≥ 0}, where the alphabet is {0, 1}.
2. Show that if L is a regular language then so it swap every two(L).