Are functions defined or modeled as sets? In his book Analysis I, Tao says functions are not technically sets. In this post, all the answers agree that functions are not sets, especially the one given by Peter Smith. But almost every book on Set Theory I read says something along the line that functions are sets.
I think a function is a mathematical object describing how the elements of set $A$ correspond to the elements of set $B$. Just as sets "tell" us what elements are in there, a function "tells" us which elements in set $A$ correspond to which elements in set $B$. As it turns out, sets of ordered pairs model this mathematical object (functions) very well.
So, what is the next step here? Do I define functions to be sets of ordered pairs or as mathematical objects and let sets be models of them? Why do mathematicians have different views on this?
 A: From a practical point of view, in the vast majority of mathematics it hardly ever matters whether you think that functions are "really" sets of ordered pairs or are "really" some other kind of object that happen to be well-modelled by sets of ordered pairs.  You can treat that as a question of philosophy/metaphysics, but it doesn't have much impact on the practice of doing mathematics.
If you are interested in using set theory as a foundation for mathematics as a whole, then it is very convenient to assume that everything is a set (or perhaps class, for technical reasons).  That everything should include every function (and also every number, every group, etc).  More technically, set theorists typically work in the universe of pure sets, $V$.  Thinking of a function as being a set of ordered pairs lets you view the function as living inside $V$.
On the other hand, you could make a perfectly coherent foundation for mathematics that is based on two types of things (functions and sets).  That approach is somewhat similar to (but not exactly the same as) category-theoretic foundations.  On this view functions are really a different type of thing than sets, and one carefully distinguishes between a function itself and the graph of the function (i.e., the corresponding set of ordered pairs).
Here's a fairly simple example.  Suppose that you have a function $f : \mathbb{R} \to \mathbb{R}$. If you think that functions are sets of pairs then you can define the restriction of $f$ to $[0, 1]$ to be $f \cap ([0, 1] \times \mathbb{R})$.  If you think that functions are not sets then the expression $f \cap ([0, 1] \times \mathbb{R})$ is nonsense, and you should really speak of "the function whose graph is (graph of $f$) $\cap ([0, 1] \times \mathbb{R})$".  Either way you get the same result, and your mathematics proceeds the same regardless of your choice.
Despite the above, I think it's fair to say that even most people working in foundations don't think a whole lot about whether functions are "really" sets of pairs or not.  When it's convenient to treat them that way, they do.  When it's not, they don't.
