If $L$ is regular, then $\hat{L}$ is also regular

226 Views Asked by At

Let the alphabet be $\{a, b\}$. For a word $w ∈ \{a, b\}^∗$ we define $ŵ$ as being the word obtained from $w$ by replacing the $a$ by $b$ and the $b$ by $a$.

Let $L ⊆ \{a, b\}^∗$. By extension of the definition of the previous question, we ask $\hat{L}= \{ŵ: w ∈ L\}$. For example, if $L = \{ab, bab, bbb\}$ then $\hat{L}= \{ba, aba, aaa\}$. Show that if $L$ is a regular language then $\hat{L}$ is also a regular language.

Proof:

Since $L$ is regular, then there exist a deterministic finite automaton $M = (Q, \sum, \delta, q_0, F)$ which recognise $L$.

Lets define $M' = (Q, \sum, \delta', q_0, F)$, where for $p,q \in Q$, $\delta'(p,a) = q$ each time $\delta(p,b) = q$ and $\delta'(p,b) = q$ each time $\delta(p,a) = q$.

As $M$ is deterministic, each entry word of $L$ leads to one and only state. By construction, $M'$ will be deterministic as well.

Each time a word $w$ of $L$ is accepted by $M$ then the word $\hat{w}$ of $\hat{L}$ will be accepted by $M'$.

Hence, as $L$ is a regular language, then $\hat{L}$ is also a regular language.

QED

It seems that this proof is not fine. Can you tell me what I could add to make it work?