I came across this question. Palindromes are not regular: It is easy to prove it using pumping lemma. The problem is I want an explicit proof without pumping lemma. I came up with a solution. It goes like this. Let us assume a language L which is palindrome so L can be expressed as x.xR where xR is reverse of x. If x is a regular language then xR will be too and hence the palindrome will be regular. What if x is not a regular language. Lets say x is 1^n0^n. It is not possible to draw a DFA for this as this string needs memory to keep the count of 1s so that it can add exact number of 0s. Since DFA doesn't have memory so it wont be possible to make a DFA for this, but xR = 0^n1^n and L=x.xR that is 1^n0^n.0^n1^n is still palindrome but not a regular language. So we can say palindromes are not regular. I remember from my undergrad class to prove some language is not regular it is sufficient to give one negative example. Will this approach work?
2 Answers
You can use the Myhill–Nerode criterion.
Suppose that $A$ is a DFA accepting your language. Let $q_n$ be the state which the DFA reaches upon reading the word $0^n1$. As the DFA has finitely many states, we must have $q_n = q_m$ for some $n \neq m$. On the one hand, when at state $q_n$, upon reading $0^n$ the DFA must reach an accepting state, since $0^n 1 0^n$ is a palindrome. On the other hand, when at state $q_m$, upon reading $0^n$ the DFA must reach a non-accepting state, since $0^m 1 0^n$ is not a palindrome. We have reached a contradiction since $q_n = q_m$.
- 280,205
- 27
- 317
- 514
You can also use Kolmogorov Complexity.
Very informally:
- suppose that there is a DFA $A$ for palindromes $L_A = \{ w w^r \mid w \in \{0,1\}^+ \}$
- pick a long enough uncompressible string $x$ ( $|x| \gg |A|$ )
- run $A$ on input $x^r x$ and suppose that it is in state $q_i$ after scanning the first half part of the input (i.e. after reading $x^r$)
- then you can build a Turing machine $M$ that on input
$$\langle A, i, |x| \rangle$$
generates all strings $\{0,1\}^{|x|}$ and for each one "continues" the simulation of $A$ starting from $q_i$ until it finds the (unique) string accepted by $A$ which is exactly $x$.
But $|M| = |A| + \log i + \log |x| + c < |x|$ for a long enough $x$, in other words there is a program $M$ that is smaller than $|x|$ that generates the uncompressible string $x$; which is a contradiction.
- 12,743
- 1
- 31
- 62