We now return to the systematic development of the basic theory of partial recursive functions, with a view of gaining an insight in the inherent limitations of the computing processes. Instrumental to this study is a mathematical characterization of what is going on during a URM computation as well as a mathematical “coding”, as a primitive recursive predicate, of the statement “ the URM M, when presented with input x has a terminating computation, coded by the number y ” —the so-called Kleene-predicate. We achieve this “mathematization” via a process that Gödel (1931) invented in his paper on incompleteness of arithmetic, namely, arithmetization . The arithmetization of URM computations is our first task in this section. This must begin with a mathematically precise definition of “URM computation”.
As an “agent” executes some URM’s, M , instructions, it generates at each step instantaneous descriptions ( ID s)—intuitively, “snapshots”—of a computation. The information each such description includes is simply the values of each variable of M , and the label (instruction number) of the instruction that is about to be executed next —the so-called current instruction.
In this section we will arithmetize URMs and their computations—just as Gödel did in the case of formal arithmetic and its proofs (loc. cit.)—and prove a cornerstone result of computability, the “normal form theorem” of Kleene that, essentially, says that the URM programming language is rich enough to allow us write a universal program for computable functions. Such a program, U , receives two inputs: One is a URM description, M , and the other is “data”, x . U then simulates M on the data, behaving exactly as M would on input x . Programmers may call such a universal program an interpreter or a compiler .
2.3.0.2 Definition. (Codes for Instructions) The instructions are coded—using prime-power coding as in Definition 2.1.2.44 —as follows, where X 1 i is short for
(1) L : X 1 i ← a has code [1, L , i , a ].
(2) L : X 1 i ← X 1 i + 1 has code [2, L , i ].
(3) L : X 1 i ← X 1 i ∸ 1 has code [3, L , i ].
(4) L : if X 1 i = 0 goto P else goto R has code [4, L , i , P , R ].
(5) L : stop has code [5, L ].
The first component of each instruction code z , ( z ) 0 , denotes the instruction type , the second—( z ) 1 —denotes the label, and the remaining components give enough information for us to uniquely know what precise instruction we are talking about. For example, in z = [3, L , i ] we read that we are talking about the “decrement by one” instruction (( z ) 0 = 3) applied to X 1 i (( z ) 2 = i ), which is found at label L (( z ) 1 = L ).
In turn, we code a URM M as an ordered sequence of numbers, each being a code for an instruction. Thus given a code z [i.e., z codes something : Seq ( z ) is true] we can determine algorithmically whether z codes some URM. This remark is made precise in Theorem 2.3.0.3 below.
2.3.0.3 Theorem. The relation URM ( z ) that holds precisely if z codes a URM is in
* .
Proof. In what follows we employ shorthand such as (∃ z , w ) < u for (∃ z ) < u (∃ w ) < u , and similarly for longer quantifier groupings, as well as for ∀.
2.3.0.4 Remark. (Normalizing Input/Output:) There is clearly no loss of generality (why?) in assuming that any URM that computes a function of n ≥ 1 inputs does so using X 11 through X 1 n +1 as input variables and X 1 as the output variable. Such a URM will have at least two instructions, since the stop instruction does not reference any variables.
2.3.0.5 Definition. An ID of a computation of a URM M is an ordered sequence L ; a 1 ,…, a r , where all of M ’s variables appear among the X 1, X 11, … X 1 r — the latter denoted in metanotation as x 1 , …, x r —and a i , is the current value of x i immediately before instruction L is executed. L points precisely to the current instruction , meaning the immediately next to be executed.
All IDs have the same length, and we say that ID I 1 = L ; a 1 , …, a r yields ID I 2 = P ; b 1 , …, b r , in symbols I 1 ⊢ I 2 , exactly when
(i) L labels “x i ← c ”, and I 1 and I 2 are identical, except that b i \= c and P = L + 1.
(ii) L labels “x i ← x i + 1”, and I 1 and I 2 are identical, except that b i \= a i + 1 and P = L + 1.
(iii) L labels “x i ← x i ∸ 1”, and I 1 and I 2 are identical, except that b i \= a i ∸ 1 and P = L + 1.
(iv) L labels “if x i = 0 goto R else goto Q ”, and I 1 and I 2 are identical, except that P = R if a i \= 0, while P = Q otherwise.
(v) L labels “stop”, and I 1 and I 2 are identical.
A terminating computation of M with input a 1 , …, a k is a sequence I 0 ,…, I n such that for all i < n we have I i ⊢ I i +1 and for some j ≤ n , I j has as 0th member the label of stop. Moreover, I 0 is initial; that is,
The above reflects the normalizing convention of 2.3.0.4 , and the standard convention of implicitly —i.e., not as part of the computation—setting all the non-input variables to 0, i.e., the x k+2 ,…, x r and x 1 , before the computation “starts”.
The length or run time of the computation is its number of steps I i , ⊢ I i +1 : That is, n .
We code an ID I = L ; a 1 ,…, a r , as code ( I ) = [ L , a 1 ,…, a r ] and a terminating computation I 0 ,…, I n by [ code ( I 0 ),…, code ( I n )].
2.3.0.6 Theorem. For any n ≥ 1, the relation Comp ( n ) ( z , y ), which is true iff y codes a terminating computation of the n-input normalized URM coded by z is primitive recursive.
Proof. By the remark on p. 143 , which normalizes the input/output convention, it must be that lh ( y ) ≥ 2. In the course of the proof we will want to keep our quantifiers bounded by some primitive recursive function so that the placement of Comp ( n ) ( z , y ) in
can be achieved.
So, how long need an ID be? Given its format ( 2.3.0.5 ), it suffices that it is as long as the largest index j of of any variable X j that occurs in the URM; plus one .
Since the maximum j is max
and
we adopt the generous, but simple, bound z + 1. Observe next that
Comp ( z , y ) ≡ URM ( z ) ∧ Seq ( y ) ∧ (∀ i ) < lh ( y ) ( Seq (( y ) i ) ∧ lh (( y ) i ) = z + 1) ∧
lh ( y ) > 1 ∧ (∀ j ) < lh ( y ) ∸ 1 yield ( z ,( y ) j , ( y ) j +1 ) ∧
{ Comment. The last ID surely has the label of z ’s stop .} (( y ) lh ( y ) ∸ 1 ) 0 = lh ( z ) ∧
{ Comment. The initial ID.} (( y ) 0 ) 0 = 1 ∧ (( y ) 0 ) 1 = 0 ∧ (∀ i ) ≤ z ( n + 1 < i → (( y ) 0 ) i = 0)
The relation “ yield ( z , ( y ) j , ( y ) j +1 )” above says “URM z causes ( y ) j ⊢ ( y ) j + 1 ”. The notation “ yield ( z , u , v )” is thus shorthand that expands as follows (cf. 2.3.0.5 and 2.3.0.2 ):
2.3.0.7 Corollary. (The Kleene T -predicate ) For each n ≥ 1, the Kleene predicate T ( n ) ( z
, y ) that is true precisely when the n-input URM z with input
has a terminating computation y, is primitive recursive .
Proof. By earlier remarks, T ( n ) ( z ,
, y ) ≡ Comp ( n ) ( z , y ) ∧ (( y ) 0 ) 2 = x 1 ∧ (( y ) 0 ) 3 = x 2 ∧ … ∧ (( y ) 0 ) n +1 \= x n .
Recalling that for any predicate R ( y ,
), ( μy ) R ( y ,
) is alternative notation for ( μy )χ R ( y ,
)—cf. 2.1.2.39 —we have:
2.3.0.8 Corollary. (The Kleene Normal Form Theorem)
(1) For any input/output normalized URM M of code z ( 2.3.0.2 ) and n inputs, we have that
is defined on the input
n iff (∃ y ) T ( n ) ( z ,
n , y ).
(2) There is a primitive recursive function d such that for any λ
n . f (
n )
there is a number z and we have for all
n :
Proof. Statement (1) is immediate as “(∃ y ) T ( n ) ( z ,
n , y )” says that there is a terminating computation of M (coded as z ) on input
n .
For (2), let
, where M is a normalized URM of code z . The role of d is to extract, from a terminating computation’s last ID, its 1st component. Thus, for all y , we let d ( y ) =
.
In what follows, the term computation will stand for terminating computation. Note that the “complete” equality (cf. 1.2.0.11 ) in the corollary, (2), becomes standard equality, =, iff we do have a (terminating) computation.
2.3.0.9 Definition. (
-Notation of Rogers (1967)) We denote by
the partial recursive n -ary function computed by a URM of code z, as
. That is,
. We usually write
z for
and T ( z , x , y ) for T (1) ( z , x , y ).
Pause. Why did I not write “≃” above? (Cf. 1.8.32 .)
2.3.0.10 Remark. If f =
, for some URM code i , then we call i a
-index of f .
We now readily obtain the very important number-theoretic characterization of
, a class that was originally defined in 2.1.1.2 via the URM formalism. This result is a direct consequence of 2.3.0.8 and is the direct analog of Theorem 2.2.1.5 , about
.
2.3.0.11 Corollary. (Number-Theoretic Characterization of
)
is the closure of the same
that we used for
, under composition, primitive recursion, and unbounded search.
Proof. If we temporarily call
the closure that we mentioned in the corollary, then since
contains
and is closed under the three stated operations (cf. 2.1.1.12 , 2.1.1.16 , and 2.1.1.19 ), we immediately have
⊆
.
Conversely, ignoring closure under ( μy ) for a moment, we get
⊆
. Thus λ
n . d (( μy ) T ( n ) ( z ,
n , y ))
, for all z . This shows
⊆
.
The preceding corollary provides an alternative formalism—that is, a syntactic, finite description other than via URM programs—for the functions of
: Via
-derivations, which can be defined totally analogously with the case of 2.1.2.1 , by adding the operation of unbounded search. Both types of derivation are special cases of the general case of 1.6.0.6 .
2.3.0.12 Remark. (1) The normal form theorem says, in particular, that every unary function that is computable in the technical sense of 2.1.1.2 —or, equivalently, 2.3.0.11 —can be expressed as an unbounded search followed by a composition, using a toolbox of just two primitive recursive functions(!) : d and λ zxy .χ T ( z , x , y ). This representation, or “normal form”, is parametrized by z , which denotes a URM M that computes the function in a normalized manner: as
. Thus what we had set out to do at the beginning of this section is now done: The two-input URM
that computes
—a computable function by 2.3.0.11 — is universal, in precise the same way that compilers 72 of practical computing are: The universal URM
accepts two inputs—a program M , coded as a number z , and data for said program, x . It then “interprets” and acts exactly as program z would on x , i.e., as
.
(2) From Definition 2.3.0.2 it is clear that not every z
represents a URM. Nevertheless , “
” in Definition 2.3.0.9 is meaningful for all natural numbers z regardless of whether they code a URM or not,
and is in
, by the latter’s closure properties.
Thus, if z is not a URM code, then T ( z , x , y ) will simply be false, for all x , and all y ; thus we will have
z ( x ) ↑ for all x . This is perfectly fine ! Indeed, it is consistent with the phenomenon where a real-life computer program that is not syntactically correct (like our z here) will not be translated by the compiler and thus will not run. Therefore, for any input it will decline to offer an output; the corresponding function will be totally undefined.
Due to these considerations we extend the concept of
-index to all of
, and correspondingly remove the hedging from Definition 2.3.0.9 : “computed by a URM of code z , as
”.
We now say: For all z
,
denotes the function
.
(3) In view of the above redefinition, Definition 2.1.1.2 can now be rephrased as “λ
n . f (
n )
iff, for some z
, f =
”—not just “for some z that is a URM code”.
2.3.0.13 Exercise. Prove that every function of
has infinitely many
-indices.
Hint. There are infinitely many ways to modify a program and yet have all programs so obtained compute the same function.
2.3.0.14 Example. The nowhere-defined function,
, is in
, as it can be obtained from any invalid code. For example,
Pause. Why is 0 not a URM code?
It can, however, also be obtained from a program that compiles all right. Setting
= λ yx . x + 1 we note:
(1) λ x .( μy )
( y , x )
by 2.1.2.12 and 2.1.1.19 .
(2) By the techniques of 2.1.1.17 we can write a program for
= λ x .( μy )
( y , x ).
As a side-effect we have that
≠
and
≠
.