You are on page 1of 2

User name: !

tmfcogsci1 Cognitive Science 1 – Fall 2007


Password: c@1folders Week 3 Lab
Turing Machine

A Turing Machine Demo: Subtraction

http://ironphoenix.org/tril/tm/

1. Select "subtraction" from the pull-down list next to "load new program", then
click the button "load new program". You will see the word "subtracter"
appears in the field next to "Machine name" and the "Initial characters on tape"
shows the expression of " 111111-1111=".

You can change the expression of the subtraction by typing in other operands, for
example "111-11=", then click the button "install program".

2. To start the automatic run, click "start" button. You can then click "stop" and
"resume" to control the running of the program.

Alternatively, you can click the "step" button to execute the computations one
step a time to observe what happens during each step.

3. The "Programming window" at the left hand corner shows the current program
being used. It's a series of 5-tuples in the format of:

[state] – 1 (scanning), 2 (remembering), 3 (backing up), 4 (subtracting), H (halting)


[character] – "1", "-", "=", or "_" (blank)
[new state] – the state to enter
[new character] – overwrite the original character to this one
[direction] – the direction to move

For example, "1,_ 1,_,>" means


- at state 1
- if scan a blank
- the new state is 1
- the new character is blank (overwrite the current character)
- move to right

4. When observe the Turing Machine in action, pay attention to two things:
- the current state (shown at the top of the window)
- the message box, which tells you the state of the demo
User name: !tmfcogsci1 Cognitive Science 1 – Fall 2007
Password: c@1folders Week 3 Lab
Assignment:

Use the "subtraction" Turing Machine to perform the operation of "111 – 11 =" and fill
out the following table for each step of the operation:

Step # Tape State Rule New State


1 1 1 1 - 1 1 = 1 1,1 1,1,> 1
2 1 1 1 - 1 1 = 1 1,1 1,1,> 1
3 1 1 1 - 1 1 = 1 1,1 1,1,> 1
4 1 1 1 - 1 1 = 1 1,- 1,-,> 1
5 1 1 1 - 1 1 = 1 1,1 1,1,> 1
6 1 1 1 - 1 1 = 1 1,1 1,1,> 1
7 1 1 1 - 1 1 = 1 1,= 2,_,< 2
8 1 1 1 - 1 1 = 2 2,1 3,=,< 3
9 1 1 1 - 1 = 3 3,1 3,1,< 3
10 1 1 1 - 1 = 3 3,- 4,-,< 4
11 1 1 1 - 1 = 4 4,1 1,_,> 1
12 1 1 - 1 = 1 1,- 1,-,> 1
13 1 1 - 1 = 1 1,1 1,1,> 1
14 1 1 - 1 = 1 1,= 2,_,< 2
15 1 1 - 1 2 2,1 3,=,< 3
16 1 1 - = 3 3,- 4,-,< 4
17 1 1 - = 4 4,_ 4,_,< 4
18 1 1 - = 4 4,1 1,_,> 1
19 1 - = 1 1,_ 1,_,> 1
20 1 - = 1 1,- 1,-,> 1
21 1 - = 1 1,= 2,_,< 2
22 1 - 2 2,- H,_,< H

23 1 H