In Naive set theory, Halmos defines an ordered pair (a,b) as
(a,b) = {{a},{a,b}}
In the next chapter on relations, he provides an example: a relation of equality on the cartesian product $X \times X$ as all those pairs (x,y) for which x=y.
My question is: based on the definition of an ordered pair, if a=b, then
(a,b) = {{a},{a,a}} = {a}
which leads me to conclude that an equality relation cannot be defined on a set as it would not yield a set of ordered pairs. Where am i going wrong?
Also, are there any good references on relations that discusses properties like connectedness, partial orders etc. ?
To get a concrete example, let $X=\{0,1,2\}$. Then the equality relation is equal to S=$\{\{\{0\}\}, \{\{1\}\}, \{\{2\}\}\}$. Nothing weird is happening here; every element of $S$ is an ordered pair. For example, the set $\{\{0\}\} = (0,0)$. Indeed, any set of the form $\{\{x\}\}$ for some $x$ is an ordered pair. The fact that these sets don't look like $(x,y)$ when $x\neq y$ isn't a problem.
Th sentence "$x$ is an ordered pair" is expanded as $$(\exists y,z)(x=\{\{y\}, \{y,z\}\})$$ Both sets like $\{\{0\}\}$ and $\{\{0\}, \{0,1\}\}$ satisfy this predicate, so no problems arise.