In what manner are functions sets? From Introduction to Topology, Bert Mendelson, ed. 3, page 15:

A function may be viewed as a special case of what is called a relation.

Yet, a relation is a set

A relation $R$ on a set $E$ is a subset of $E\times E$.

while a function is a correspondence or rule.  Is then a function also a set?

Let's begin at the other end.
A function can be regarded as a rule for assigning a unique value $f(x)$ to each $x$. Let's construct a set $F$ of all the ordered pairs $(x,f(x))$.
If $f:X\to Y$ we need every $x\in X$ to have a value $f(x)$. So for each $x$ there is an ordered pair $(x,y)$ in the set for some $y\in Y$. We also need $f(x)$ to be uniquely defined by $x$ so that whenever the set contains $(x,y)$ and $(x,z)$ we have $y=z$. In this way there is a unique $f(x)$ for each $x$ as we require.
The ordered pairs can be taken as elements of $X \times Y$ so that $F\subset X \times Y$
If we have a set of ordered pairs with the required properties, we can work backwards and see that this gives us back our original idea of a function.
