I'm studying Tao's Analysis I. He defines functions as objects of a distinct type:
Definition 3.3.1 (Functions). Let $X$, $Y$ be sets, and let $P(x, y)$ be a property pertaining to an object $x \in X$ and an object $y \in Y$, such that for every $x \in X$, there is exactly one $y \in Y$ for which $P(x, y)$ is true (this is sometimes known as the vertical line test). Then we define the function $f \colon X \to Y$ defined by $P$ on the domain $X$ and range $Y$ to be the object which, given any input $x \in X$, assigns an output $f(x) \in Y$, defined to be the unique object $f(x)$ for which $P(x, f(x))$ is true. Thus, for any $x \in X$ and $y \in Y$, $$ y = f(x) \iff P(x, y) \text{ is true.} $$
Tao does mention that strictly speaking, above is an axiom that posits the existence of a function given sets $X, Y$ and property $P$.
He defines function equality as follows:
Definition 3.3.7 (Equality of functions). Two functions $f \colon X \to Y$, $g\colon X \to Y$ with the same domain and range are said to be equal, $f = g$, if and only if $f(x) = g(x)$ for all $x \in X$.
However, I don't think that one can deduce the following statement using just the above definition:
$$
\text{Let $X$, $X'$, $Y$ be sets and let $f\colon X\to Y$ and $f\colon X'\to Y$. Then $X=X'$.}
$$
I think that this can be fixed if one assumes, instead of the above equality definition, the following axiom, which has the undefined primitive equality:
Axiom. Let $f$ and $g$ be functions. Then $f=g$ if and only if for any sets $X, Y, X', Y'$, if $f\colon X\to Y$ and $g\colon X'\to Y'$, then $X=X'$, $Y=Y'$ and for each $x\in X$, we have $f(x) = g(x)$.
Question: Is the statement that I think is not deducible from the original definitions indeed so? If so, does my axiom really solves the issue?
Another issue:
In my discussion below with Mauro, I realized that there is another issue with the original definition. I'll just quote my comment:
Definition 3.3.7 can say whether functions are equal or not only if one first fixes their domains and codomains. But we don't yet know (just from the original definitions) whether a given function determines its domain and codomain uniquely. And hence we can't conclude whether two functions $f$ and $g$ are equal or not without mentioning their domains and codomains.