# Languages with infinitely many but finite Myhill-Nerode equivalence classes

I'm kind of new to automata theory and I'm dealing with the equivalence classes used for example in the Myhill-Nerode theorem right now; in other words aba* / a = ba*; aba* / b = ⌀, and such.

In an exercise I'm asked to find a language defined by an infinite set of equivalence classes, but where each class is actually finite. Unfortunately this seems a bit counterintuitive to me, and I can only manage to find languages with an infinite set of equivalence classes where the classes are infinite.

If someone could help me out with the reasoning, and what I'm missing here, I'd really appreciate it.

A random language would do. If $L$ is chosen by putting every word in $\Sigma^*$ in $L$ with probability $1/2$, then for every two given words $x \neq y$ and any third word $z$, the probability that $xz \in L \Leftrightarrow yz \in L$ is $1/2$. Hence almost surely $x$ and $y$ are not equivalent (since we can choose an infinite sequence $z_i$ so that the words $xz_1,yz_1,xz_2,yz_2,\ldots$ are all distinct). Since there are only countably many pairs of words, we find that almost surely, every word is its own equivalence class.
It is also not too difficult to explicitly construct such a language. It suffices to find a subset $A$ of the natural numbers such that for every $x,y \in \mathbb{N}$ there exists $z \in \mathbb{N}$ such that $x+z \in A \not\Leftrightarrow y+z \in A$ (why?). Let $$A = \bigcup_{i=0}^\infty \{4^i+1,\ldots,2\cdot 4^i\}.$$ Given $x < y$, let $z = 4^y + 1 - y$. Then $z + y = 4^y + 1 \in A$, while $x + z < 4^y + 1$ and $x + z \geq z = 4^y + 1 - y > 2 \cdot 4^{y-1}$ (check!), showing that $x + z \notin A$.
{"ft_lang_label":"__label__en","ft_lang_prob":0.95959014,"math_prob":0.9993724,"size":600,"snap":"2019-51-2020-05","text_gpt3_token_len":135,"char_repetition_ratio":0.12919463,"word_repetition_ratio":0.01923077,"special_character_ratio":0.21833333,"punctuation_ratio":0.09565217,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9999521,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-12-11T12:28:28Z\",\"WARC-Record-ID\":\"<urn:uuid:6b4f4a60-564a-4145-b35e-7624af7eb40d>\",\"Content-Length\":\"129995\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b8e8fc11-1101-47c8-9c2f-7f1719aa64d4>\",\"WARC-Concurrent-To\":\"<urn:uuid:01cae8f1-6eac-4d11-ae02-7b06fde9b3e8>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://cs.stackexchange.com/questions/74768/languages-with-infinitely-many-but-finite-myhill-nerode-equivalence-classes\",\"WARC-Payload-Digest\":\"sha1:T273ZOHRAEP5SULWEX766QDP2DQHUJ5O\",\"WARC-Block-Digest\":\"sha1:6KJZAAFJ5TB7QBLKVV673S2RHI3GHUS6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-51/CC-MAIN-2019-51_segments_1575540530857.12_warc_CC-MAIN-20191211103140-20191211131140-00478.warc.gz\"}"}