Constant Function is Primitive Recursive/General Case

Theorem
The constant function of $k$ variables: $f^k_c: \N^k \to \N$, defined as:
 * $f^k_c \left({n_1, n_2, \ldots, n_k}\right) = c$ where $c \in \N$

is primitive recursive‎.

Proof
For $k \ge 1$, let $f^k_c$ be the constant function of $k$ variables with value $c$.

We know from Constant Function is Primitive Recursive that $f^1_c$ is primitive recursive‎.

Now:


 * $f^k_c \left({n_1, n_2, \ldots, n_k}\right) = f^1_c \left({n_1}\right) = f^1_c \left({\operatorname{pr}^k_1 \left({n_1, n_2, \ldots, n_k}\right)}\right)$

where $\operatorname{pr}^k_1$ is a projection function which is basic primitive recursive.

So $f^k_c$ is obtained from the primitive recursive‎ function $f^1_c$ and the basic primitive recursive function $\operatorname{pr}^k_1$ by substitution.

Hence by definition, $f^k_c$ is primitive recursive‎.