While it is easy to understand what a function is intuitively, I've been trying to wrap my head around how to precisely define what a function is using only mathematical notation. My attempt at this is below, but here is my preliminary understanding:
- A function can have multiple inputs or parameters, but it generates a single output
- Each output is unique for the input values provided.
Here is my attempt at a definition:
A relation $R \subset (D \times C)$ is a function if: $$ (\forall (d_1, c_1) \in R)(\forall (d_2, c_2) \in R)(d_1 = d_2 \rightarrow c_1 = c_2)$$
This definition should cover all functions, not just functions with one input, as $d_1$ and $d_2$ could be n-tuples that define the n inputs of a function, as every element of $R$ is actually an ordered pair $((x_1, x_2, …, x_n),c)$
Does this look like a correct and precise definition? Or could it be written better? I couldn't find any formal definition of a function on the web, even on Wikipedia.
Finally, is it correct to say that all functions with n inputs are (n+1)-ary relations? Since $((x_1, x_2, …, x_n),c)$ is the same as $(x_1, x_2, …, x_n,c)$.
Thanks.
Best Answer
5xum is right -- your definition is not sufficient. However, you may be interested to know that your definition,
is something we care about in some braches of math! This is called a partial function $D \to C$.
Partial functions are especially used in the theory of recursive functions (or computable functions from $\mathbb{N}$ to $\mathbb{N}$).