Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What would the assembly language equivalents of the operations on the original Turing machine be?

If you take the original Turing machine definition as follows:

...an infinite memory capacity obtained in the form of an infinite tape marked out into squares, on each of which a symbol could be printed. At any moment there is one symbol in the machine; it is called the scanned symbol. The machine can alter the scanned symbol and its behavior is in part determined by that symbol, but the symbols on the tape elsewhere do not affect the behavior of the machine. However, the tape can be moved back and forth through the machine, this being one of the elementary operations of the machine. Any symbol on the tape may therefore eventually have an innings. (Turing 1948, p. 61)

If you want to map these operations to those done on a processor capable of interpreting assembler/binary instructions - which operations would be mapped?

(I'm aware of the jump from Turing machines to Von Neuman machines inherent in this question)

like image 897
hawkeye Avatar asked Aug 21 '10 12:08

hawkeye


People also ask

What models are equivalent to the Turing machine?

Markov algorithm is another remarkably simple computational model, based on string rewriting, equivalent to the Turing machines.

What does it imply if a computer is equivalent to a Turing machine?

Non-mathematical usage In colloquial usage, the terms "Turing-complete" and "Turing-equivalent" are used to mean that any real-world general-purpose computer or computer language can approximately simulate the computational aspects of any other real-world general-purpose computer or computer language.

What is the operation in Turing machine?

With this head, the machine can perform three very basic operations: Read the symbol on the square under the head. Edit the symbol by writing a new symbol or erasing it. Move the tape left of right by one square so that the machine can read and edit the symbol on a neighbouring square.

What did the Turing machine look like?

A Turing machine consists of an infinitely long tape, which has been divided up into cells. Each cell can contain either a 1, a 0, or an empty space. Above one cell of the tape is a head, which can either move left or right, and can read the symbols written in the cells.


2 Answers

Reading what you've written I'd say you just need:

  • A direct increment instruction (to add to the current tape location)
  • An indirect increment instruction (to move the tape)
  • Something to act in response of the current tape location value

In an ARM-like assembly, for example, if you have R0 containing the address on the tape you should just need

ADDS r0, r0, #1 ;moves the tape forward
ADDS r0, r0, #-1 ;moves the tape backwards
ADDS [r0], [r0], #1 ;increments the value 'pointed by' the tape
ADDS [r0], [r0], #-1 ;decrements the value 'pointed by' the tape

Then, branches to do stuff in case of certain values assumed by the current symbol

BEQ Somewhere

This is more or less how Brainfuck works.

like image 52
Federico klez Culloca Avatar answered Nov 12 '22 06:11

Federico klez Culloca


an infinite memory capacity obtained in the form of an infinite tape marked out into squares, on each of which a symbol could be printed.

Let's call that a int array. int[] Symbols

At any moment there is one symbol in the machine; it is called the scanned symbol.

int inxSym;
int scannedSymbol = Symbols[inxSym]; 

(At the CPU level, this is known as "main memory" or in modern system "program segment".

The machine can alter the scanned symbol

Symbols[inxSym] = newSymbol;

and its behavior is in part determined by that symbol,

switch(scannedSymbol) {....}

(At the CPU level, this is "executing an instruction". There is no op code to tell it to do so; it's just what CPU do.)

but the symbols on the tape elsewhere do not affect the behavior of the machine.

Nothing to do there.

However, the tape can be moved back and forth through the machine, this being one of the elementary operations of the machine.

  ++inxSym;
  --inxSym
   inxSym +=10;
 // etc.

(At the CPU level, this is handle with JMP op codes)

like image 33
James Curran Avatar answered Nov 12 '22 06:11

James Curran