# Which calculus is based on first-order functions and is Turing complete?

Which calculus is based on first-order functions and is Turing complete?

I know of calculi which are Turing complete, but based on higher-order functions:

• Lambda calculus
• SKI combinator calculus

There is also a calculus based on first-order functions, but is not Turing complete:

I know that first-order functions by itself aren't Turing complete, but first-order functions with recursion and primitive types as $\mathbb{N}$ is.

• I'm confused: you give an example of such a calculus in your question. Are you just looking for a big list of such calculi? Also: It's arguable that the $\mathrm{SKI}$ calculus actually is higher-order (just add a binary $\mathrm{app}$ function for application). – cody Oct 23 '15 at 15:25

There are many, but I think the most famous one µ-recursive functions. It describes functions from $\mathbb{N}^{(\mathbb{N})}$ to $\mathbb{N}$, i.e. from tuples of naturals to naturals. This can be transformed into a theory of functions from $\mathbb{N}$ to $\mathbb{N}$ by composing with an encoding of tuples; I think the reason it isn't commonly presented that way is that it doesn't look neat.

µ-recursive functions are defined as follows:

• All constant functions are µ-recursive.
• The successor function ($S(n) = n+1$) is µ-recursive.
• Projections ($\pi_i(n_1,\ldots,n_k) = n_i$) are µ-recursive.
• Composition: if the $f_i$ and $g$ are µ-recursive then $(n_1,\ldots,n_{k_1+\ldots+k_m}) \mapsto g(f_1(n_1,\ldots,n_{k_1}), \ldots, f_m(n_{k_1+\ldots+k_{m-1}+1},\ldots,n_{k_1+\ldots+k_m}))$ is µ-recursive.
• Primitive recursion: if $f$ and $g$ are µ-recursive then the function $h$ defined by $h(0,n_1,\ldots,n_k) = g(n_1,\ldots,n_k)$ and $h(n+1,n_1,\ldots,n_k) = f(n,n_1,\ldots,n_k,h(n,n_1,\ldots,n_k))$ is µ-recursive.
• Minimisation: if $f$ is µ-recursive then so is the function that maps $n_1,\ldots,n_k$ to the smallest $x$ such that $f(n_1,\ldots,n_k,x) = 0$.

Note that in the definition of the minimisation operator, it is possible for $x$ not to exist. In this case the resulting function is partial. This calculus thus defines partial recursive functions.

If you restrict the calculus to total functions, you get the recursive functions, with the same computing power as Turing machines.

The minimisation operator is usually written $\mu$ and gives the calculus its name. If you omit it, the resulting set of functions are exactly the primitive recursive functions (indeed that's a convenient way to define them).

While the statement

If you restrict the calculus to total functions, you get the recursive functions, with the same computing power as Turing machines.

is correct, it might be worth mentioning that there cannot be a calculus $L$ with the following features.

Disclaimer: I abuse notation, I am being reasonably informal and I assume some effective Gödelization $\langle\cdot\rangle\colon L\to \mathbb{N}$ as well as denotational semantics $[\cdot,k]\colon L\to (\mathbb{N}^k\to\mathbb{N})$:

1. There is an element $t\in L$ (think of some sort of a bytecode interpreter) such that for all terms $s\in L$ and all $x\in\mathbb{N}$ the following holds: $[t,2](\langle s\rangle,x)=[s,1](x)$.

2. Given any term $s$ there is a term $s^*$ such that $[s^*,1](x)=[s,2](x,x)$. For every term $s$ there is a term $s'$ such that $[s',1](x)\neq [s,1](x)$ for all $x$. Note that these are pretty trivial assumption about a calculus that is meant to describe any interesting class of computable functions.

3. all functions $[s,k]$ are total.

Proof by contradiction that no such calculus exists:

let $t\in L$ be as 1. above and let $s=(t^*)'$ then \begin{align*} [s,1](\langle s\rangle) &= [(t^*)',1](\langle s\rangle)\\ &\neq [t^*,1](\langle s\rangle)\\ & = [t,2](\langle s\rangle,\langle s\rangle)\\ & = [s,1](\langle s\rangle)\,. \end{align*}

Remark: This argument shows for example that there are total recursive functions that are not primitive recursive (or for that matter, that it is not possible to write a LOOP interpreter in LOOP). Of course, if the calculus describes not only total functions, then the given argument only proves that $[s,1](\langle s\rangle)$ is not defined.