0

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?

1 Answers1

1

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$

dtldarek
  • 37,969
  • I guess it would be off-topic to ask why L is non-regular? All, I can think about is that it is non-regular because it's exponent is prime and produces some sort of infinite non-periodic alphabet. Also,are you stating that n is prime or even? Or, that it is prime AND even? – knowKnothing Oct 16 '13 at 21:20
  • I think the $\lor$ connective should be clear: $(n$ is prime$)$ OR $(n$ is even$)$. The beginning of the sequence starts $0,2,3,4,5,6,7,8,10,11,12,13,14,16,\ldots$. As to why it is non-regular, try pumping lemma, it is not even context-free. If you have troubles, then you can pick any undecidable language (e.g. take the standard enumeration of all Turing machines and their inputs $f : \mathbb{N} \to \mathcal{M}\times {0,1}^*$, and use $X = {a^n \mid f(n)\text{ halts}}$), and use the second construction. $Y$ is undecidable, because using it you could answer the questions on $X$. – dtldarek Oct 16 '13 at 21:44