7

Let $\mbox{bin}(n)$ denote the binary representation of an integer $n$. Let $L = \{ \mbox{bin}(n^2) \mid n \in \mathbb{N} \}$.

Is $L$ a regular language?

I think one can prove that $L$ is not regular by using the pumping lemma, but I don't know how to use it here.

Pål GD
  • 16,115
  • 2
  • 41
  • 65
  • 4
    Welcome to CSTheory, a Q&A site for research-level questions in theoretical computer science (TCS). Your question does not appear to be a research-level question in TCS. Please see the [FAQ] for more information on what is meant by this and suggestions for sites that might welcome your question. Finally, if your question is closed for being out of scope, and you believe you can edit the question to make it a research-level question, please feel free to do so. Closing is not permanent and questions can be reopened, check the [FAQ] for more information. –  May 03 '13 at 17:59
  • you may use :[wikipedia]http://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages – Fayez Abdlrazaq Deab May 04 '13 at 08:34
  • 3
    An interesting question. While it seems that the language should not be regular, it should be noted that the language of binary representations of quadratic residues modulo power of 2 is regular. – Karolis Juodelė May 04 '13 at 15:23
  • 3
    http://math.stackexchange.com/questions/380411/is-language-of-binary-representations-regular somebody already asked here the same, and includes tentative answer. – Alejandro Sazo May 05 '13 at 01:38
  • There are other methods to show that a language is not regular (see http://cs.stackexchange.com/questions/1031/how-to-prove-that-a-language-is-not-regular). I think I'd use Myhill–Nerode theorem. – AProgrammer May 05 '13 at 12:50

1 Answers1

10

We start with a lemma.

Lemma. Let $a>b \geq 4$. If $2^a+2^b+1$ is a square then $a \geq 2b-3$.

Proof. Let $2^a+2^b+1 = x^2$. Clearly $x$ must be odd, say $x = 2y+1$. Then $x^2 = 4y^2 + 4y + 1$, and so $(y+1)y = y^2+y = 2^{a-2} + 2^{b-2} = 2^{b-2}(2^{a-b}+1)$. If $y$ is even then $y+1$ is odd and so $y = 2^{b-2}z$ for some odd $z$, and therefore $2^{a-b}+1 = (2^{b-2}z+1)z \geq 2^{b-2}+1$ and so $a \geq 2b-2$. If $y$ is odd then necessarily $y+1 = 2^{b-2}z$ for some odd $z$, and therefore $2^{a-b}+1 = z(2^{b-2}z-1) \geq 2^{b-2}-1 = 2^{b-3} + 1 + (2^{b-3}-2)$. Since $b \geq 4$, we can conclude that $a \geq 2b-3$. $\square$

Let $L' = L \cap 10^*10^*0001$. According to the lemma, all words in $L'$ are of the form $10^{a-b-1}10^{b-1}1$ with $a-b-1 \geq (b-1)-3$. Moreover, since $2^{2c} + 2^{c+1} + 1 = (2^c+1)^2$, for all $c \geq 3$, $10^{c-2}10^c1 \in L'$.

If $L$ is regular then so is $L'$, say its minimal DFA has $p$ states. Consider the word $10^{p-2}10^p1 \in L'$, and mark the substring $0^p$. The extended pumping lemma shows that for some $0 < q \leq p$, $10^{p-2}10^{p+q(t-1)}1 \in L'$ for all $t \geq 0$. However, according to our lemma, for all $t$ we must have $p-2 \geq p+q(t-1)-3$ and so $1 \geq q(t-1)$, which is false for $t \geq 3$.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503