# How to define functions that have functions as parameters?

On the most basic level I would like to define something like this: $$g:\Bbb R\to\Bbb R, x \mapsto x$$ $$f:\Bbb R\times?\to\Bbb R, (x, g)\mapsto xg(x)$$ My question is: How would one define a function such that another function can be a parameter?

-

You don't need any special notation for this, the only thing you would like to do is specify the domain. The usual mathematical notation for set of functions $A \to B$ is $B^A$, so you could write like this:

$$f : B^A \to C,$$

but

$$f : (A \to B) \to C$$

should be understood as well (especially within the area of computer-science-related math). The definition itself is not special, e.g.

$$f(g) = g(5).$$

However, be aware, that there is a notation for functions returning functions (i.e. having functions as values). As before we could write $f : A \to C^B$ or $f : A \to (B \to C)$, but there are two ways to define it:

$$f(x) = y \mapsto x+y$$

or

$$f(x)(y) = x+y.$$

Finally, you can combine the first part and the second part, for example $f : \mathbb{R}^\mathbb{R} \to \mathbb{R}^\mathbb{R}$ or $f : (\mathbb{R} \to \mathbb{R}) \to (\mathbb{R} \to \mathbb{R})$ and

$$f(g) = x \mapsto x\cdot g(x)$$ or $$f(g)(x) = x \cdot g(x).$$

I hope this helps $\ddot\smile$

-
Ah yes, currying. –  kahen Sep 19 '13 at 21:47

$f: \mathbb R \times {\mathbb R}^{\mathbb R} \to \mathbb R$.

$X^Y$ is the set-theoretic notation for the set of functions from $Y$ to $X$ (mind the order!)

For example $2^{\mathbb N} = \{0,1\}^{\mathbb N} =$ the set of sequences of zeroes and ones.

-
Can you explain how $2$ becomes ${0,1}$ –  Alizter Sep 19 '13 at 22:49
That's standard with the usual set representation of $\omega$, the first infinite ordinal. $0 = \emptyset$, $1 = \{0\}$, $2 = 1 \cup \{1\} = \{0,1\}$, $3 = 2 \cup \{2\} = \{0,1,2\}$, etc. See von Neumann's definition of ordinals. –  kahen Sep 19 '13 at 23:01