Substitution of Constant yields Primitive Recursive Function

Theorem
Let $$f: \N^{k+1} \to \N$$ be a primitive recursive function‎.

Then $$g: \N^k \to \N$$ given by:
 * $$g \left({n_1, n_2, \ldots, n_k}\right) = f \left({n_1, n_2, \ldots, n_{i-1}, a, n_i \ldots, n_k}\right)$$

is primitive recursive.

Proof
Let $$n = \left({n_1, n_2, \ldots, n_{i-1}, n_i \ldots, n_k}\right)$$.

We see that:
 * $$g \left({n_1, n_2, \ldots, n_k}\right) = f \left({\operatorname{pr}^k_1 \left({n}\right), \operatorname{pr}^k_2 \left({n}\right), \ldots, \operatorname{pr}^k_{i-1} \left({n}\right), f_a \left({n}\right), \operatorname{pr}^k_i \left({n}\right), \ldots, \operatorname{pr}^k_k \left({n}\right)}\right)$$.

We have that:
 * $$\operatorname{pr}^k_j$$ is a basic primitive recursive‎ function for all $$j$$ such that $$1 \ne j \le k$$;
 * $f_a$ is a primitive recursive‎ function.

So $$g$$ is obtained by substitution from primitive recursive‎ functions and so is primitive recursive‎.