27.04.2015 Views

Computability and Logic

Computability and Logic

Computability and Logic

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

60 ABACUS COMPUTABILITY<br />

Figure 5-16. Recursion.<br />

Initially, [1] = x, [2] = y, <strong>and</strong> [3] = [4] =···=0. We use a register number p that<br />

is not used in the f <strong>and</strong> g programs as a counter. We put y into it at the beginning, <strong>and</strong><br />

after each stage of the computation we see whether [p] = 0. If so, the computation<br />

is essentially finished; if not, we subtract 1 from [p] <strong>and</strong> go through another stage.<br />

In the first three steps we calculate f (x) <strong>and</strong> see whether entry y was 0. If so, the<br />

first of the pair of equations for h is operative: h(x, y) = h(x, 0) = f (x), <strong>and</strong> the<br />

computation is finished, with the result in box 3, as required. If not, the second of<br />

the pair of equations for h is operative, <strong>and</strong> we successively compute h(x, 1),<br />

h(x, 2), ...(see the cyle in Figure 5-16) until the counter (box p) is empty. At that<br />

point the computation is finished, with h(x, y) in box 3, as required.<br />

A final process is minimization. Suppose we have a 2-place function f ; then we<br />

can define a 1-place function h as follows. If f (x, 0), ..., f (x, i − 1) are all defined<br />

<strong>and</strong> ̸= 0, <strong>and</strong> f (x, i) = 0, then h(x) = i. If there is no i with these properties, either<br />

because for some i the values f (x, 0), ..., f (x, j − 1) are all defined <strong>and</strong> ≠ 0but<br />

f (x, j) is not defined, or because for all i the value f (x, i) is defined <strong>and</strong> ≠ 0,<br />

then h(x) is undefined. The function h is called the function obtained from f by<br />

minimization. If f is abacus computable, so is h, with a flow chart as in Figure 5-17.<br />

Initially, box 2 is empty, so that if f (x, 1)= 0, the program will halt with the<br />

correct answer, h(x) = 0, in box 2. (Box 3 will be empty.) Otherwise, box 3 will be

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!