TuME stands for "Turing machine emulator" and this is what it is
actually aimed to do. The Turing machine is a mathematical model of an
idealized digital computer, described by English scientist Alan Turing
in 1936. Almost every modern book about algorithm theory contains a
thorough, formal description of the Turing machine, so here I will give
only a brief overview, enough to start your experience with TuME. The
Turing machine consists of an infinite length tape divided
into cells, each containing a symbol from a finite set. The latter set
is called the machine's external alphabet. One of its
symbol is reserved and called empty symbol. There is also a
head over the tape, able to move in both directions (namely right
and left), read a symbol from cell below it and write a
symbol to it. When head attempts to move behind the last
cell of the tape, a new cell is attached to the corresponding end of
the tape, and it is filled with an empty symbol. That is
how tape becomes infinite. Machine always reside in a state
from a finite state set and operates in a discrete time.
There are two elements of state set with a special meaning:
an initial and final states. The head's
behavior is determined by a set of commands, each of which
specifies the conditions that must be met at the time (i),
and actions undertaken at (i+1). Previously mentioned initial
state is supposed to appear only in the conditional part of the
commands, whilst final state - only in the actions part.
Other states can appear anywhere. Combination of an external alphabet,
state set, tape with a word on it and a head located
somewhere on it, and current machine state is called configuration.
A set of commands is called the machine's program.
During the execution step (i), machine compares currently
observed symbol on tape and current state with those of commands from
its program. When a command matches, it is executed (which means, its
actions are performed at the step (i+1)). Now current
symbol/state are compared with the program data and the process
continues... It halts due to one of the following conditions:
TuME is a fast, easy to use tool for running Turing machine programs on multiple platforms, both desktop and mobile. Amongst its features are the following:
Once You have loaded TuME, You can see two tabs at the top of main window, corresponding to "Emulation" and "Program" sections of the application. Select the "Program" tab. Now, at the left side of main window You should see three tabs relating to “Sets”, “Commands” and “Tape” subsections of editor. Their content relates to edition of the corresponding aspects of machine. Note that, as far as word on tape and program commands depend on external alphabet and state set elements, this aspect should be edited before the other two.
Select the "Sets" subsection in the "Program" section, You will see
two lists corresponding to state set and external
alphabet edition. Below each of them there is a line of control
elements. To add a new element of the set, write its name into text
field below the corresponding list and press button. To rename the element, select it in the
list, enter new name into text field and press
button. Once the element is renamed in the sets
editor, it will be renamed everywhere it is already in use. To remove
last element, simply press
button. You cannot
delete an element that is in use somewhere in the program
or tape, so alter or remove relative commands and tape
cells first.
Note: restriction to delete only the last element might seem
inconvenient, but remember, that You can achieve same effect by
removing some elements from the tail of the list and then renaming the
others.
On the "Commands" subsection You shall see a big table in the center and four buttons below it. The table describes program of the machine. Each row refers to a command. There are 6 columns in the table:
Column name | Editable | Description |
---|---|---|
Current state |
yes |
A state that machine needs to reside in at (i) for this command to be chosen |
Observed symbol |
yes |
A symbol that must appear below the head at (i) for this command to be chosen |
Movement direction |
yes |
Where to move the head at (i+1) if this command is executed |
State to switch to |
yes |
A state that machine will switch to at (i+1) if this command is executed |
Symbol to write |
yes |
A symbol that will be written in the cell at (i+1) before the head movement performed |
TML code |
no |
The command represented in TML |
To edit a command, select the corresponding cell in the table and
switch to edit mode (it is platform-dependent, e. g., pressing a space
for desktop, pressing a command hard button on a Symbian device, etc.).
From a drop-down list select an appropriate item and leave edit mode.
To add a new row, press
button. Newly added rows are highlighted with gray, so that You could
easily identify them. Once such row has been altered, it is no longer
highlighted. To remove a row, select a row You wish to remove (if You won't do, the last one will be removed) and press
button.
Once You have finished the edition, press button to push the program into machine, or
to erase the changes You have made and pull the program from machine to editor.
Note: unlike the other editor subsections, changes made in this one need to be explicitly confirmed by user. If You won't press button after edition is completed, machine will still run an obsolete set of commands (although changes won't be dropped until
button is pressed).
Tape edition subsection allows You to specify initial word on tape and initial head position relative to the first symbol on tape. Word on tape is presented in the list at the left side of main window. Unlike tape view in the emulation section,
symbols here are aligned vertically, leftmost being at the top of the
list and rightmost – at the end. To add a new symbol to the end of the tape, select appropriate symbol from the drop-down list at the right part of the window, and press button. To change a symbol somewhere on the tape, select it in the list, select new symbol from drop-down list and press
button. To remove a symbol from the tape, select it in the list and press
button.
When You need to change initial offset of head from the beginning of the tape,
enter it manually to the text field with a spinner at the right side of
the window ("0" points to the first symbol, "1" to the second and so
on). Or You can simply pick the symbol You wish head to point to, and press button.
Machine configuration and program can be saved to and load from a single file. Current TuME version supports only text-based TML
format, but there will be an option in the future to save/load binary
files as well. TML files can be easily edited from the simplest external text editor, if You dislike the way TuME editor does.
Once the machine have been saved or loaded, a corresponding restore
point is created (or overwritten, if any). Each time the machine is
reset, its configuration and program will be set to those from restore
point.
To begin emulation, go to "Emulation" section by selecting the corresponding tab at the top of main window. Now You shall see the emulation screen. Here is a list of components that You shall see here from top to bottom of the screen:
Execution control is based on the following menu items in "Emulation" menu:
If TuME is running on desktop platform, these items have equivalent buttons in navigation pane.
Running the machine in automatic mode allows You to test quickly, whether it is applicable to the word on
tape in initial configuration, and acquire results of its execution.
Execution sessions that are finished due to appearance of the final state in machine configuration are the only that considered successful. Information in the status bar can help You to determine execution status. If execution trace was not disabled at the moment of execution start, it will be available in the emulation screen after the execution is finished.
In step-by-step mode You can manually trace the execution, even if
it is disabled. Be aware that You cannot enter this mode explicitly –
machine always resides in it, except for the periods of automatic
execution.
Even when the machine is empty, it stays in step-by-step execution
mode. There are two main actions to control execution in this
mode: step forward (menu item "Emulation > Step forward") and reset ("Emulation > Reset"). To execute machine in this mode, do the following:
These actions can be undertaken continuously, until You find that the program execution finished.
When machine execution finished, You can reset it to the most recent restore point by activating "Emulation > Reset" menu item (or pressing button, if present).
TML stands for Turing machine Markup Language. It has
nothing in common with the SGML and its derivatives. It is used for
textual representation of TuME configuration and program, and is not
knows to be used elsewhere.
The TML file consists of three types of lexical elements:
<single-value>
is an arbitrary string of alphanumeric characters. Spaces withing strings allowed for symbol values (symbol set elements, tape symbols) but prohibited for state values.":"
and ","
symbols allow arbitrary number of spaces or tabulations around them.<condition>
is a combination of machine current state and observed symbol on the
tape that are used to test the command for its applicability.<action>
describes changes in machine that will come to power in case this command is selected.<single-state-value>
is an arbitrary string of alphanumeric characters without spaces.<single-symbol-value>
is an arbitrary string of alphanumeric characters.<movement-dir>
value describes movement direction of the head: left ("L
"), right ("R
") or stand still ("S
")."->"
symbol allow arbitrary number of spaces or tabulations around it.<text-line>
is an arbitrary text ended with a newline symbol.Here is a sample TML code that, when executed, replaces all "0" symbols with "1" from the beginning of the tape until the first "1" is under machine's head:
As it was written in introduction, Turing machine operates with an infinite tape. It is also well-known that computers operate with finite numbers located in finite memory. This limitation is especially sensible for mobile devices. TuME tape size is limited by amount of memory available for a user application on the target platform. Also, as far as TuME counts machine time and traces execution process, execution time is limited by the value 264. It's a reasonable high value, but it's a divergence from formal definition given by A. Turing. That's why I'm not sure the application would fit for all tasks that engage Turing machines.
That's all for now. Your bug reports about TuME are welcome (see below).