[Math] Is it true that any infinite subset of a non-regular unary language is non-regular

automatainfinite-matrices

My question is very similar to this:
Is there a subset of a non regular language that is regular

My claim is that because the subset is infinite, Myhill Nerode says that the language is not regular.
The first comment on the link above (about palindromes) works for finite subsets, I believe.
Am I right?

Best Answer

This is not true, consider

$$L = \{ a^n \mid n \text{ is prime } \lor n \text{ is even }\}.$$

Clearly this language is non-regular, but

$$E = \{a^n \mid n \text{ is even }\}$$

is infinite, regular and $E \subseteq L$. In fact you can turn any non-regular unary language $X$ into such an example $Y$, e.g. by $$Y = \{a^{2n+1} \mid a^n \in X \} \cup \{a^{2n} \mid n \in \mathbb{N}\}.$$

I hope this helps $\ddot\smile$

Related Question