# Creating ways to encode  recursive function.

This is from an exercise in Boolos' Computability text. My problem is as follows:

I am looking for a method that encode numbers for recursive functions. Then given such an encoding for recursive functions by natural numbers, let d(x) = 1 if the one-place recursive function with encoding number x is deﬁned and has value 0 for argument x, and d(x) = 0 otherwise. Show that this function is not recursive.

I am thinking the actual question is just a diagonalization argument, and it doesn't depend in any way on details of the coding.

-

It is indeed just a diagonalisation argument, and it doesn't depend on the details of the enumeration at all – just that it can be done. – Zhen Lin May 5 '12 at 16:58
Boolos has already set up the argument for you. It's a proof by contradiction: suppose $d$ is recursive. Then it has a number, etc. – Zhen Lin May 5 '12 at 17:00
So the coding scheme is: Let d(x) = 1 if the one-place recursive function with code number x is deﬁned and has value 0 for argument x, and d(x) = 0 otherwise ? How do I get that d is not recursive from this? I'm not seeing it. – Quaternary May 5 '12 at 17:02
No, that's not the coding scheme, and as I said, the coding scheme doesn't matter if all you want is to solve the exercise. (In other words, you're asking two separate questions here.) – Zhen Lin May 5 '12 at 18:32

## 1 Answer

The subject of enumerating the recursive functions in a reasonable way is rather sophisticated. However, it is easy to see that the set of all recursive functions $\mathbb{N} \rightharpoondown \mathbb{N}$ must be a countable set, so there is some surjection from $\mathbb{N}$ to the set of all recursive functions.

Fix one such surjection, and let $d$ be the function as described by Boolos. Suppose $d$ is recursive; then it has a number, say $x$. What is $d (x)$? If it's $0$, then that by definition of $d (x)$ we must have $d(x) = 1$ – contradiction. If it's not $0$, then that means $d (x) = 0$ – contradiction. If it's not defined, then that means $d (x) = 0$ – contradiction. So $d$ can't be recursive.

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 14, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9394839406013489, "perplexity_flag": "head"}