We note that two subsets are equal if and only if the intersection of one with the complement of the other is empty, and vice versa:
\begin {aligned}
& \mathcal {L}{\mathopen {}\left (R\right )\mathclose {}}=\mathcal {L}{\mathopen {}\left (S\right )\mathclose {}}
\\
&\quad \Leftrightarrow
\mathcal {L}{\mathopen {}\left (R\right )\mathclose {}}\subseteq \mathcal {L}{\mathopen {}\left (S\right )\mathclose {}}\land \mathcal {L}{\mathopen {}\left (S\right )\mathclose {}}\subseteq \mathcal {L}{\mathopen {}\left (R\right )\mathclose {}}
\\
&\quad \Leftrightarrow
{\mathopen {}\left ({\mathopen {}\left (\Sigma ^\star \setminus \mathcal {L}{\mathopen {}\left (R\right )\mathclose {}}\right )\mathclose {}}\cap \mathcal {L}{\mathopen {}\left (S\right )\mathclose {}}\right )\mathclose {}} =\varnothing = {\mathopen {}\left ({\mathopen {}\left (\Sigma ^\star \setminus \mathcal {L}{\mathopen {}\left (S\right )\mathclose {}}\right )\mathclose {}}\cap \mathcal {L}{\mathopen {}\left (R\right )\mathclose {}}\right )\mathclose {}}
\end {aligned}
We therefore let M and N be two DFAs recognising the language {\mathopen {}\left (\Sigma ^\star \setminus \mathcal {L}{\mathopen {}\left (R\right )\mathclose {}}\right )\mathclose {}}\cap \mathcal {L}{\mathopen {}\left (S\right )\mathclose {}} and {\mathopen {}\left (\Sigma ^\star \setminus \mathcal {L}{\mathopen {}\left (S\right )\mathclose {}}\right )\mathclose {}}\cap \mathcal {L}{\mathopen {}\left (R\right )\mathclose {}} respectively. (These DFAs can be obtained computably using the compilation procedure by which we proved Corollary [018A].) It follows then that \mathcal {L}{\mathopen {}\left (R\right )\mathclose {}}=\mathcal {L}{\mathopen {}\left (S\right )\mathclose {}} if and only if \mathcal {L}{\mathopen {}\left (M\right )\mathclose {}}=\varnothing =\mathcal {L}{\mathopen {}\left (N\right )\mathclose {}}.
So it now remains to check whether there exists any string at all that is accepted by M and likewise for N. We do not have to check all strings over \Sigma , which would be impossible: we observe that the number of states in M bounds the number of transitions required to reach an accepting state, because any loops about a state q can be excised from the path without changing the result. This is a special property of the finite automata that we have studied so far, corresponding to the fact that they have no memory.