Is the language $\lbrace (aaaaa)^n aa (aaaaa)^n \mid n \in \mathbb{N} \rbrace$ regular? It looks like I need infinitely many states so it is not regular.
-
This is solvable by basic techniques, so you should definitely include more of your own thoughts. In particular, try proving your claim. Either that works or you find out why not, which helps proving the converse. – Raphael Feb 11 '13 at 12:05
2 Answers
The language consists of those strings that contain $5 n + 2 + 5 n = 10 n + 2$ symbols $a$ for some $n \in \mathbb{N}$, i.e., $$\lbrace(aaaaa)^n aa (aaaaa)^n \mid n \in \mathbb{N}\rbrace = \lbrace (aaaaaaaaaa)^n aa \mid n \in \mathbb{N} \rbrace.$$ It is regular because it is accepted by the automaton which has twelve states $s_0, \ldots, s_{11}$ with a starting state $s_0$, accepting state $s_2$, and transitions $s_i \stackrel{a}{\longrightarrow} s_{i+1}$ for each $i = 0, \ldots, 10$, and one more transition $s_{11} \stackrel{a}{\longrightarrow} s_0$. In essence, this automaton counts the number of letters modulo 10 and accepts if the answer is 2.

- 30,396
- 1
- 70
- 117
-
I think that any language of the form $a^{e_1}a^{e_2}a^{e_3}a^{e_4}a^{e_5}\dots$, where the $e_i$'s are natural numbers, is regular. – mrk Feb 11 '13 at 13:04
-
What do you mean? If you put in those $a^n$ for which the $n$-th Turing machine halts, you get an undecidable set, let alone regular. See Yuval's answer. – Andrej Bauer Feb 13 '13 at 06:16
-
Just rearrange the expression like you did in the example and you get an automaton for the expression! – mrk Feb 13 '13 at 09:26
-
But it is not clear what you mean by $a^{e_1} a^{e_2} a^{e_3} \cdots$. Can there be infinitely many $e_i$? What do $e_i$ depend on, are they functions of some $n$, or what? – Andrej Bauer Feb 14 '13 at 05:54
-
-
Since your $e_i's$ do not seem to depend on additional parameter, your language consists of a single string of $a$'s of length $e_1 + e_2 + \cdots + e_k$. Correct? – Andrej Bauer Feb 14 '13 at 21:45
-
-
Ok, thanks for clarifying this up. Your remark is completely trivial, because all you are saying is that every language consisting of a single word is regular. Still correct? – Andrej Bauer Feb 14 '13 at 23:42
-
-
-
You answered a special case. My remark is more general! What are you sorry for? – mrk Feb 16 '13 at 14:32
-
I answered what was asked. What you are suggesting is not more general. There are two ways to interpret your imprecise statement. One is false, and the other one is trivial. From the above discussion I undestood that you meant a trivial one. Perhaps you think that the $e_i$'s are functions of $n$? (Something you explicitly denied above.) If so, then you are in the other situation: your statement is false. – Andrej Bauer Feb 16 '13 at 18:17
We can prove a more general theorem. The language $\{ a^n : n \in A \}$ is regular if and only if the set $A$ is eventually periodic, i.e. there exist $m$ and $k$ such that for all $n \geq m$, $n \in A$ iff $n+k \in A$.
Indeed, a language of this form is clearly regular. For the other direction, consider a DFA accepting the language. It has outdegree $1$ and so must consist of a path leading into a cycle. Given that representation, we see that it can be represented using an eventually periodic $A$.

- 276,994
- 27
- 311
- 503
-
Or, simpler (to apply here): $\mathrm{CFG} \cap 2^{{a}^*} \subseteq \mathrm{REG}$ – Raphael Feb 12 '13 at 06:31
-
-
3The set of even numbers. The set of odd numbers. The set of even numbers larger than 57. And so on. – Yuval Filmus Feb 12 '13 at 16:37