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}_1 \left({n}\right), \operatorname{pr}_2 \left({n}\right), \ldots, \operatorname{pr}_{i-1} \left({n}\right), f_a \left({n}\right), \operatorname{pr}_i \left({n}\right), \ldots, \operatorname{pr}_k \left({n}\right)}\right)$$.

We have that:
 * $$\operatorname{pr}_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‎.