0

I was taught that if you can create a DFA to accept a language, then the grammar that is generating the language is regular.

AND

A DFA is a finite automata that accepts a language and also rejects the strings that aren't a part of the language.

It says if we replace $x$ with $c$ where $c \in \{0,1\}^+$, then $L$ is regular.

But the DFA should reject the string $abbaaaba$ since it doesn't fit the $wxw^R$ criteria and that isn't happening, so how is it regular?

1 Answers1

3

In $\{wxw^R|w,x\in\{0,1\}^+\}$, we're free to choose $x$ to be any non-empty sequence, including all but the first and last characters of $wxw^R$. So we might as well limit $w$ to be a single symbol; it won't change anything.

So $L$ is exactly the same as $L' = \{axa|a\in\{0,1\}\land x\in\{0,1\}^+\}$ which is evidently regular.


Here's a more formal proof, in case the above was too telegraphic. Suppose we have

$$L = \{wxw^R|w,x\in\{0,1\}^+\}$$

Now:

$$\{0,1\}^+ \equiv \{0,1\} \cup \{aw | a \in \{0,1\} \land w \in \{0,1\}^+$$

which just says that $w^+$ is either exactly one symbol or one symbol concatenated with $w^+$. Also observe that if $a$ is a symbol and $w$ is a sequence of symbols, then $a^R\equiv a$ and $(aw)^R\equiv w^Ra$. So we can rewrite $L$ as a union:

$$L = \{axa|a\in\{0,1\}\land x\in\{0,1\}^+\} \cup \{awxw^Ra|a\in\{0,1\}\land w,x\in\{0,1\}^+\}$$

Now, looking at the two sets in that union, we can see that

$$\{awxw^Ra|a\in\{0,1\}\land w,x\in\{0,1\}^+\} \subset \{axa|a\in\{0,1\}\land x\in\{0,1\}^+\}$$

because

$$\{wxw^R|w,x\in\{0,1\}^+\} \subset \{0,1\}^+$$

and since for any sets $A$ and $B$

$$B \subset A \implies A = A \cup B$$

We can simplify the definition of $L$ to

$$L = \{axa|a\in\{0,1\}\land x\in\{0,1\}^+\}$$

which is clearly a regular language.

rici
  • 12,150
  • 22
  • 40