Constant Function is Primitive Recursive

Theorem
The constant function $f_c: \N \to \N$, defined as:
 * $f_c \left({n}\right) = c$ where $c \in \N$

is primitive recursive‎.

Generalization
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 by induction
First we note that $f_0: \N \to \N$ is the zero function, which is a basic primitive recursive function.

Base Case
Next we show that $f_1: \N \to \N$ is primitive recursive‎, as follows.

The successor function $\operatorname{succ}: \N \to \N$, defined as:
 * $\forall n \in \N: \operatorname{succ} \left({n}\right) = n + 1$

is a basic primitive recursive function.

Since $\operatorname{succ} \left({0}\right) = 1$, we have that:
 * $f_1 \left({n}\right) = \operatorname{succ} \left({\operatorname{zero} \left({n}\right)}\right)$.

Thus $f_1$ is obtained from the basic primitive recursive functions $\operatorname{succ}$ and $\operatorname{zero}$ by substitution.

So $f_1: \N \to \N$ is primitive recursive‎.

This is our base case.

Induction Hypothesis
This is our induction hypothesis:
 * $f_k: \N \to \N$ is primitive recursive‎ for some $k \in \N$.

Then we need to show:
 * $f_{k+1}: \N \to \N$ is primitive recursive‎.

Induction Step
This is our induction step:
 * $f_{k+1} \left({n}\right) = k+1 = \operatorname{succ} \left({k}\right) = \operatorname{succ} \left({f_k \left({n}\right)}\right)$.

Now $f_k \left({n}\right)$ is primitive recursive‎ from our induction hypothesis.

Thus $f_{k+1} \left({n}\right)$ is obtained from the basic primitive recursive function $\operatorname{succ}$ and $f_k \left({n}\right)$ by substitution.

The result follows by the Principle of Mathematical Induction.

Therefore $\forall c \in \N: f_c \left({n}\right) = c$ where $c \in \N$ is primitive recursive‎.

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

We already know from the main proof 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‎.