27.04.2015 Views

Computability and Logic

Computability and Logic

Computability and Logic

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

50 ABACUS COMPUTABILITY<br />

We remove a stone from box m 1 before each dumping operation, so that when box m 1 is<br />

empty we have<br />

[m 2 ] + [m 2 ] +···+[m 2 ] ([m 1 ] summ<strong>and</strong>s)<br />

stones in box n.<br />

5.5 Example (Exponentiation). Just as multiplication is repeated addition, so exponentiation<br />

is repeated multiplication. The program is perfectly straightforward, once we arrange<br />

the multiplication program of the preceding example to have [m 2 ] · [n] → n. How that is to<br />

be accomplished is shown in Figure 5-6.<br />

Figure 5-6. Exponentiation.<br />

The cumulative multiplication indicated in this abbreviated flow chart is carried out in<br />

two steps. First, use a program like Example 5.4 with a new auxiliary:<br />

[n] · [m 2 ] → q<br />

0 → n.<br />

Second, use a program like Example 5.2:<br />

[q] + [n] → n<br />

0 → q.<br />

The result gives [n] · [m 2 ] → n. Provided the boxes n, p, <strong>and</strong> q are empty initially, the<br />

program for exponentiation has the effect<br />

[m 2 ] [m1] → n<br />

0 → m 1<br />

in strict analogy to the program for multiplication. (Compare the diagrams in the preceding<br />

example <strong>and</strong> in this one.)<br />

Structurally, the abbreviated flow charts for multiplication <strong>and</strong> exponentiation<br />

differ only in that for exponentiation we need to put a single stone in box n at the<br />

beginning. If [m 1 ] = 0wehaven = 1 when the program terminates (as it will<br />

at once, without going through the multiplication routine). This corresponds to the<br />

convention that x 0 = 1 for any natural number x. But if [m 1 ] is positive, [n] will<br />

finally be a product of [m 1 ] factors [m 2 ], corresponding to repeated application of

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

Saved successfully!

Ooh no, something went wrong!