# Formal and general definition of natural domain (natural set) of a function

Can anyone give me a (as much as possible) formal and general definition of natural domain of a function?

Let's say that a function is a triplet $(X,Y,f)$ where $f \subseteq X \times Y$ such that

\begin{eqnarray} \forall x \in X, \exists ! y \in Y | (x,y) \in f \end{eqnarray}

where $X$ is called the domain and $Y$ the codomain. This is rather general and formal: it does not specify anything about $X$, $Y$ and how we form the pairs in $f$. In the same manner it is possible to define what the image of a subset $A \subseteq X$ and what the preimage of $D \subseteq Y$ are as

\begin{eqnarray} &f(A) = \{y | (y \in Y) \wedge (\exists x \in A : y = f(x)\} \\ &f^{-1}(D) = \{x | (x \in X) \land (f(x) \in D)\} \end{eqnarray}

(using the notation $y=f(x)$ here just for convenience)

About the natural domain, I came up with something like:

The domain $X$ and the codomain $Y$ are often assumed from the context (or explicitly mentioned) to be some improper subset of some standard sets (like $N$, $R$, $R \times R = R^2$, $C$, etc.). The natural domain of a function $(X,Y,f)$ is the biggest superset $\hat X$ of $X$ for which $(\hat X, K, f)$ is still a function, where $K$ is one of those standard sets assumed from the context and $\hat X$ is a subset of one of those standard sets.

I know that this is far from formal and doesn't make great sense because $f$ remains the same set of ordered pairs here, so $(\hat X, Y, f)$ is not a function unless $\hat X = X$.

-