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.

5.1. ABACUS MACHINES 47<br />

be thought of as operated by a little man who is capable of carrying out two sorts of<br />

operations: adding a stone to the box of a specified number, <strong>and</strong> removing a stone<br />

from the box of a specified number, if there are any stones there to be removed.<br />

The table for a Turing machine is in effect a list of numbered instructions, where<br />

‘attending to instruction q’ is called ‘being in state q’. The instructions all have the<br />

following form:<br />

{ if you are scanning a blank then perform action a <strong>and</strong> go to r<br />

(q)<br />

if you are scanning a stroke then perform action b <strong>and</strong> go to s.<br />

Here each of the actions is one of the following four options: erase (put a blank in the<br />

scanned square), print (put a stroke in the scanned square), move left, move right. It<br />

is permitted that one or both of r or s should be q, so ‘go to r’ or ‘go to s’ amounts<br />

to ‘remain with q’.<br />

Turing machines can also be represented by flow charts, in which the states or<br />

instructions do not have to be numbered. An abacus machine program could also be<br />

represented in a table of numbered instructions. These would each be of one or the<br />

other of the following two forms:<br />

(q) add one to box m <strong>and</strong> go to r<br />

{ if box m is not empty then subtract one from box m <strong>and</strong> go to r<br />

(q)<br />

if box m is empty then go to s.<br />

But in practice we are going to be working throughout with a flow-chart representation.<br />

In this representation, the elementary operations will be symbolized as in<br />

Figure 5-1.<br />

Figure 5-1. Elementary operations in abacus machines.<br />

Flow charts can be built up as in the following examples.<br />

5.1 Example (Emptying box n). Emptying the box of a specified number n can be accomplished<br />

with a single instruction as follows:<br />

{ if box n is not empty then subtract 1 from box n <strong>and</strong> stay with 1<br />

(1)<br />

if box n is empty then halt.<br />

The corresponding flow chart is indicated in Figure 5-2.<br />

In the figure, halting is indicated by an arrow leading nowhere. The block diagram also<br />

shown in Figure 5-2 summarizes what the program shown in the flow chart accomplishes,

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

Saved successfully!

Ooh no, something went wrong!