Solution (source code)

= Solution

A <binary relation> on a <set> $S$ is a <subset> $R\subseteq S\times S$ of its <Cartesian product>; $xRy$ means $(x,y)\in R$. It is an <equivalence relation> when it is a <reflexive relation>, a <symmetric relation>, and a <transitive relation>:
$$
\boxed{\begin{aligned}&xRx&&\text{for every }x\in S,\\&xRy\Longrightarrow yRx&&\text{for every }x,y\in S,\\&xRy\ \text{and}\ yRz\Longrightarrow xRz&&\text{for every }x,y,z\in S.\end{aligned}}
$$
An <equivalence relation> partitions $S$ into <equivalence classes>: two elements belong to the same class exactly when they are related.