# Is there any algorithmic way to decide the equivalence classes in the nerode relation?

Consider the language $L= \{ x\in \{0,1\}^* |x$ ends with $00 \}$

The Nerode relation $R_L$ says

$xR_Ly \iff \forall z\in \Sigma^*:xz\in L\iff yz\in L$

By looking at the language : I can conclude that the equivalence classes should be something like

$[\epsilon]=\{x|x$ doesnt end with $0\}$

$[0]=\{x|x$ ends with $0$ but not with $00\}$

$[00]=\{x|x$ ends with $00\}$

My question is : Is there any smart way to find the equivalence classes of any Language ? Can we do this algorithmically?

• Does DFA minimization answer your needs? – Yuval Filmus May 5 '18 at 21:09
• Before this question can be answered, you need to formulate it formally: explain what is the input, and what is the desired output. – Yuval Filmus May 5 '18 at 21:12
• This information should be merged into the post. You also need to explain how the language and equivalence classes are encoded. Be as formal as possible. Imagine writing an actual program- what would be its input and output? – Yuval Filmus May 5 '18 at 21:17
• Your problem isn't well-defined. It's hard to answer vague questions. If your language is given as a DFA, then as pointed out above, in a sense you can find the equivalence classes by minimizing the DFA. – Yuval Filmus May 5 '18 at 21:24
• What kind of grammar? If I remember correctly, given a context-free grammar, it is undecidable whether it generates a regular language. – Yuval Filmus May 5 '18 at 21:31