Suppose that i codes a URM program, M , that acts on input variables x and y to compute a function λ xy . f ( x , y ). It is certainly trivial to modify program M to compute λ x . f ( x , a ) instead. In computer programming terms, we replace an instruction such as “read y ” by one that says “ y ← a ”.

In URM terms, since the input variables X 11, X 111, … are initialized before the computation starts, the way to implement the suggested “decommissioning” of y as an input variable—opting rather to initialize it with the number a explicitly, first thing during the computation—is to do the following, assuming x and y of f are mapped to X 11 and X 111 of M :

(1) Remove X 111 from the input variables list, X 11, X 111, and

(2) Modify M into M ′ by adding the instruction X 111 ← a as the very first instruction.

Images From the original code, i , a new code (depending on i and a ) can be easily calculated. This is the intuition of Kleene’s iteration or “S-m-n” theorem below.           Images

The mathematical details are as follows.

2.6.0.31 Definition. (Code Concatenation)

images

Images 2.6.0.32 Remark. Clearly, λ xy . x * y is primitive recursive. The definition’s aim is to achieve this—which it clearly does:

[ a 1 ,…, a n ] * [ b 1 ,…, b m ] = [ a 1 ,…, a n , b 1 ,…, b m ]

If Seq ( x ) or Seq ( y ) fail, then the result of x * y is irrelevant to us.           images Images

2.6.0.33 Exercise. What is 10 * 5?           images

2.6.0.34 Exercise. What is 1 * z ? z * 1?           images

2.6.0.35 Definition. (Concatenating URMs) Given two URMs M and N of codes m and n . We denote their concatenation by MN and m ⌢ n in terms of their codes. Note that MN means the superposition of the two URMs, in that order, with the stop -instruction removed from M and all the instructions of N adjusted to reflect that the first label of N now is lh ( m ).

We define m ⌢ n to be 0 if either of m or n is not a valid URM code.           images

2.6.0.36 Lemma. Let adj ( n , k ) (“ adjust n ”) be the expression that codes a URM n after k was added to all its instruction numbers (and all if-statements were adjusted to still transfer to the same instructions as before). Let also adj ( n , k ) = 0 if n does not code a URM. Then the function λ nk . adj ( n , k ) is primitive recursive.

Proof . First let us define a less ambitious function, f , that adjusts one instruction due to adding k to the instruction number:

images

Note that 231 = 3 · 7 · 11. Clearly, f images images . Finally,

images

Clearly, adj is primitive recursive.           images

2.6.0.37 Lemma. λ mn.m ⌢ n is primitive recursive.

Proof .

images

The left hand operand of * above represents the removal of the stop -instruction of the URM m prior to concatenation. It is immediate from the above and the preceding lemma that λ mn.m ⌢ n is primitive recursive.           images

2.6.0.38 Theorem. (Kleene’s Iteration or “S-m-n” Theorem) For each m ≥ 1 and n ≥ 1, there is a primitive recursive function λ i images n . images ( i , images n ) such that, for all i , images m , images n ,

images

Proof. The construction of images is guided by the introductory remarks of this section: If i codes a URM M such that

images

then we remove the n variables X 1 m +2 ,…, X 1 m + n +1 from the designated input-variable list and add the instructions below at the top of program M.

X 1 m +2 ← y 1 , X 1 m +3 ← y 2 ,…, X 1 m + n +1 ← y n

To avail ourselves of the tools we have developed in this section, we implement the above plan by concatenating the following URM, N , to the left of M. Note that N is not normalized, but N M is, since M is.

images

The code for N is a function of images n (recall that m , n are constants) which we will name init ( images n ). Referring to 2.3.0.2 ,

images

It is immediate that λ images n . init ( images n ) is primitive recursive. Thus, images , given below for all i , images n , is too by Lemma 2.6.0.37 .

images

It is important to note that (by 2.6.0.37 ) if i fails the U RM ( i ) “test”, then so does images ( i , images n ) (indeed, equals 0; cf. 2.6.0.37 ) and thus both sides of (1) are (Kleene-) completely equal (the empty function is undefined on all inputs).           images

Images 2.6.0.39 Remark. (1) It is important to note by inspecting (2) and (3) in the proof above that if U RM ( i ) holds, then images is strictly increasing with respect to each y i variable. Of course, if U RM ( i ) fails, then images returns 0 no matter what the inputs y i may be.           Images

(2) A note on notation: In images the upper index, m , is a mnemonic tool for how many variables stayed “up” (in the images argument), while the lower index, n , indicates how many variables were moved “down”, to be hardwired into the “program” images ( i , images n ) as it were.

These considerations led to the nickname of the iteration theorem as the “S-m-n theorem”.

(3) In practice, the S-m-n theorem is applied as follows: If λ images k y images r . f ( images k , y , images r ) images images , then there is a 1-1 h images images , such that, for all images k , y , images r , we have

images

By the assumption on f and 2.3.0.12 , there is an i images images , such that f ( images k , y , images r ) ⋍ images ( images k , images r , y ). Note the permutation of variables, where y was moved to the end of the argument list of images , to align with requirements of the S-m-n theorem. Can we do this? Yes, since we may chose the URM i such that we have mapped the variables images k , y , images r of f to the “formal” variables X 11, … X 1 k + r +2 so that y ’s role is played by X 1 k + r +2 .

Pause. Is this the same as saying “use 2.1.2.6 (iii) to permute variables so that y is last”? Images

We take h = λ y . images ( i , y ). Note that the italicized part, “a 1-1”, above is a weakening of the observation (1) above.          images images