TITLE: How to justify the existence of a function, in general?
QUESTION [8 upvotes]: Maybe I'm too naive in asking this question, but I think it's important and I'd like to know your answer. So, for example I always see that people just write something like "let $f:R\times R\longrightarrow R$ such that $f(x,y)=x^2y+1$", or for example "Let $g:A\longrightarrow A\times \mathbb{N}$ such that for every function $f:\mathbb{N}\longrightarrow A$ we have $g(f(n))=(f(n),n)$)". They never justify the existence, but rather they assume the function to exist. So my question is why? How do you justify the existence?

REPLY [2 votes]: Your first example is the just the composition of several real-valued functions. For simplicity, lets recast it as $f(x)=xxy+1$. It is just the composition of known functions: the multiplication and addition of real numbers. Multiplication maps every pair of real numbers to a real number. Likewise for addition. (Things get more complicated with division and exponentiation.) So, it is easy to verify that for every pair of reals numbers $x$ and $y$, $xxy+1$ gives you a real number, and that $f$ is indeed a function.
Not all functions are defined in terms of simple compositions of known functions, however. If you are starting from, say, Peano's Axioms, and want to prove the existence of an add function on the natural numbers, you would have to construct a suitable subset $A$ of the set of ordered triples of natural numbers (tricky!) and prove that:
$\forall a,b\in N (\exists c\in N((a,b,c)\in A))$
$\forall a,b,c_1, c_2\in N((a,b,c_1)\in A\land(a,b,c_2)\in A \rightarrow c_1=c_2)$ 
Then you would be entitled to use the function notation $A: N^2 \rightarrow N$, or (my preference) $\forall a,b\in N (A(a,b)\in N)$. Then, of course, you would have to prove that the function $A$ has all the required properties of an add function: associativity, commutativity, etc.
BTW, that subset $A$ is such that:
$\forall a,b,c ((a,b,c)\in A \leftrightarrow (a,b,c)\in N^3$ 
$\land \forall d\in P(N^3) (\forall e\in N ((e,1,s(e)\in d))$ 
$\land \forall e,f,g\in N ((e,f,g)\in d \rightarrow (e,s(f),s(g))\in d)$ 
$ \rightarrow (a,b,c)\in d)))$
where $1$ is the first natural number and $s$ is the usual successor function.
From this construction, you can derive:
$\forall a\in N (A(a,1)=s(a)$
$\forall a,b\in N (A(a,s(b))=s(A(a,b)))$