Definition:Primitive Recursion/Partial Function

Definition
Let $f: \N^k \to \N$ and $g: \N^{k+2} \to \N$ be partial functions.

Let $\left({n_1, n_2, \ldots, n_k}\right) \in \N^k$.

Then the partial function $h: \N^{k+1} \to \N$ is obtained from $f$ and $g$ by primitive recursion if:
 * $\forall n \in \N: h \left({n_1, n_2, \ldots, n_k, n}\right) \approx \begin{cases}

f \left({n_1, n_2, \ldots, n_k}\right) & : n = 0 \\ g \left({n_1, n_2, \ldots, n_k, n-1, h \left({n_1, n_2, \ldots, n_k, n-1}\right)}\right) & : n > 0 \end{cases}$

where $\approx$ is as defined in Partial Function Equality.

Note that $h \left({n_1, n_2, \ldots, n_k, n}\right)$ is defined only when:
 * $h \left({n_1, n_2, \ldots, n_k, n - 1}\right)$ is defined
 * $g \left({n_1, n_2, \ldots, n_k, n-1, h \left({n_1, n_2, \ldots, n_k, n-1}\right)}\right)$ is defined.