TITLE: Meaning of notation $f(x)$ in set theory
QUESTION [6 upvotes]: In my book, a function $f$ is defined as a binary relation such that if $(x,y),(x,z)\in f$ then $y=z$. Moreover, as it is usual, author denotes $(x,y)\in f$ by 
$$
y=f(x) .
\tag{1}
$$
So, from this notation, I understand $f(x)$ as the second component of the ordered pair $(x,y)\in f$, i.e $(x,f(x))$. Nevertheless, below, the author says that $f(x)=\bigcap\{y:(x,y)\in f\}$. But I think this notation is different from (1), since
$$
\bigcap\{y:(x,y)\in f\} = \{z: \forall y:(x,y)\in f \Longrightarrow z\in y\} ,
$$
I mean, $\bigcap\{y:(x,y)\in f\}$ is a set of elements of the class $y$, not such a $y$.
And, moreover, some other authors, as Herbert Enderton, define also $f(x)$ as the class
$$
f(x)=\bigcup\{y:(x,y)\in f\} .
$$
How can be all these notations/definitions compatibles?

REPLY [8 votes]: If $A$ is a singleton, $\{a\}$ then $\bigcap A=\bigcup A=a$. Since $f$ is a function, the set $\{y : (x,y)\in f\}$ is a singleton, for a fixed $x$, so the result follows.
The key point to remember is that everything is a set, including $x$ and $y$.