Surjective total computable functions are not r.e

computabilitydiagonalization

I want to prove by diagonalization that the set of surjective total computable functions from N to N is not recursively enumerable. I know that the result is trivial using Rice's theorem, but I am trying to prove it only by a direct diagonalization argument. However, supposing that we can enumerate the functions of the set, I am unable to construct a proper surjective and total function that cannot belong to the set.

Best Answer

Here's how to use a diagonalization argument to prove something even a bit stronger:

Let $\mathbb N$ be the set of natural numbers (including $0,$ for convenience).

Given any sequence $$\begin{align}&S_0:\mathbb N\to\mathbb N, \\ &S_1:\mathbb N\to\mathbb N, \\ &S_2:\mathbb N\to\mathbb N, \\ &...\end{align}$$ of (total) functions in which every surjective recursive function appears at least once, the function $S: \mathbb N\times\mathbb N \to \mathbb N$ defined by $$S(n, k) = S_n(k)$$ is not recursive.

Assume, aiming at a contradiction, that $S$ is recursive.

Define a function $f: \mathbb N\to\mathbb N$ by setting

$$f(n)=\begin{cases} S(n/2,n)+1, &\text{if }n\text{ is even,} \\ (n-1)/2, &\text{if }n\text{ is odd.}\\ \end{cases}$$

Then $f$ is recursive and surjective, so there exists $e\in\mathbb N$ such that $f = S_e.$

It follows that

$$\begin{align}f(2e) &= S(e,2e)+1 &\text{(by the definition of }f\text{)}\\ &= S_e(2e) + 1 &\text{(by the definition of }S\text{)}\\ &= f(2e) + 1 &\text{(since }f=S_e\text{),}\end{align}$$

which is a contradiction.

Related Question