You are on page 1of 18

Theory of Computation (With Automata Theory)

VARIANTS OF TURING
MACHINES

Turing Machines Variants

Introduction

The Turing machine is a


powerful model that can
represent
general-purpose
computers.

There are other variations of


the Turing machine with
features that seem to give
these variants more power.

Is the Turing machine robust?

Variants of Turing Machines

* Property of STI
Page 1 of 18

Theory of Computation (With Automata Theory)

Multitape Turing Machines

A multitape Turing machine is


similar to the standard Turing
machine except that it has
several tapes.

Each tape has its own


read/write head that works
independent of the others.

At the start of the computation,


the input string is stored on the
first tape while the others are
blank.

The transition function of a


multitape machine allows for
reading, writing, and moving
the heads on all tapes
simultaneously.

Variants of Turing Machines

* Property of STI
Page 2 of 18

Theory of Computation (With Automata Theory)

Representation of a Multitape TM
Multitape TM

...

...

...

Tape 1

Tape 2

Tape 3

Variants of Turing Machines

* Property of STI
Page 3 of 18

Theory of Computation (With Automata Theory)

During
the
computation
process, the multitape TM
considers the current state it is
in and the different symbols on
the tapes being pointed to by
the read/write heads.
The machine can then move to
another state, replace the
symbols on the tapes, and
move the read/write heads
independently to the left or to
the right.
Example:
(qi, b, 0, z) =
(qj, a, 1, y, L, R, L)

Variants of Turing Machines

* Property of STI
Page 4 of 18

Theory of Computation (With Automata Theory)

The multitape Turing machine


seem to have more power
than the single-tape Turing
machine.

It can, however, be shown that


both machines have the same
power. They can recognize
the same class of languages.

It will be shown that every


multitape machine has an
equivalent
single-tape
machine.
In other words, a single-tape
machine can simulate the
computation of a multitape
machine.

Variants of Turing Machines

* Property of STI
Page 5 of 18

Theory of Computation (With Automata Theory)

Equivalent Single-Tape Turing


Machine:
Single-tape TM

a b c

0'

z o o . . .

Tape

A special delimiter symbol # is


used to separate the data of
the three tapes.
Special markers are used to
keep track of the location of
the three heads.

Variants of Turing Machines

* Property of STI
Page 6 of 18

Theory of Computation (With Automata Theory)

Assume that the multitape TM


moves the head of Tape 1
from symbol b to symbol c.
The single-tape TM can
simulate this action by first
replacing b' with b, and then
replacing c with c.

If the multitape TM moves the


head of Tape 1 from symbol c
to the next cell to the right,
then the single-tape TM will
shift all the symbols of the tape
starting from the symbol to the
right of c' one cell position to
the right. It will then store a '
on the cell that was freed up
and replace c' with c.

Variants of Turing Machines

* Property of STI
Page 7 of 18

Theory of Computation (With Automata Theory)

Since the single-tape TM can


simulate
every
action
performed by the multitape
TM, it can be concluded that
every
multitape
Turing
machine has an equivalent
single-tape Turing machine.
In fact, a single-tape TM can
be viewed as a special case of
the multitape TM.

So both multitape and singletape Turing machines have the


same computational power.
It can also be concluded that a
language
is
Turingrecognizable if and only if
some
multitape
Turing
machine recognizes it.

Variants of Turing Machines

* Property of STI
Page 8 of 18

Theory of Computation (With Automata Theory)

Nondeterministic Turing Machines

Deterministic machines can


only perform one action (or set
of actions) for every input (or
set of inputs).

Nondeterministic
machines
can perform several actions
(or sets of actions) for every
input (or set of inputs).

A Nondeterministic Turing
Machine (NTM) has the option
of moving to different states
and/or performing different
actions for a certain set of
inputs.

It must be proven that every


Nondeterministic TM has an
equivalent Deterministic TM.

Variants of Turing Machines

* Property of STI
Page 9 of 18

Theory of Computation (With Automata Theory)

Recall that the computation of


a
nondeterministic
finite
automaton can be viewed as a
tree as shown below:
state
q0

q0

q1

q0

q1

q2

q0

q2

q3 (stopped)

q0

Variants of Turing Machines

(start)

q1

q0

q1

q2

q0

q2

q3

q3 (stopped)

* Property of STI
Page 10 of 18

Theory of Computation (With Automata Theory)

The
computation
of
a
nondeterministic
Turing
machine can also be viewed
as a tree as shown below:
configuration
q00101

0q0101

xq1101

0xq101

01q201 xxq101

0q2x01

01xq21 xx0q31

01q201

0xq301 01xxqreject

0q5101 010q41 0xxq31

0xq501 0101q6 0xxxqaccept

Variants of Turing Machines

* Property of STI
Page 11 of 18

Theory of Computation (With Automata Theory)

To
easily
identify
each
configuration
in
the
computation tree of an NTM,
addresses will be assigned to
each node.
An address is a string of
numbers such as 2132. A
node with this address is the
node that is reached by
starting at the root,
1. going to the 2nd child of the
root,
2. going to the 1st child of that
node,
3. going to the 3rd child of that
node, and
4. going to the 2nd child of
that node.

Variants of Turing Machines

* Property of STI
Page 12 of 18

Theory of Computation (With Automata Theory)

Some examples of node addresses:

configuration
q00101

0q0101

xq1101

0xq101

01q201 xxq101

0q2x01

01xq21 xx0q31

01q201

Address
211

Address
1211

0xq301 01xxqreject

0q5101 010q41 0xxq31

Address
111211

0xq501 0101q6 0xxxqaccept


Address
111121

Variants of Turing Machines

* Property of STI
Page 13 of 18

Theory of Computation (With Automata Theory)

Aside from identifying a node,


an address also describes the
path that leads to the node.

Each address describes a


branch of computation of the
nondeterministic
Turing
machine.
Some branches will lead to a
halting configuration while
others will end in a loop.

For a DTM to simulate the


computation of an NTM, it
must be able to try all possible
branches
of
the
NTMs
computation tree.

Variants of Turing Machines

* Property of STI
Page 14 of 18

Theory of Computation (With Automata Theory)

Equivalent Deterministic TM:


Deterministic TM

...

Tape 1 (input tape)

...

Tape 2 (simulation tape)

...

Tape 3 (address tape)

Variants of Turing Machines

* Property of STI
Page 15 of 18

Theory of Computation (With Automata Theory)

Algorithm:
1. Tape 1 contains the input
string while Tapes 2 and 3
are empty.
2. Copy the contents of Tape
1 onto Tape 2.
3. Use Tape 2 to simulate
one
branch
of
the
computation of the NTM:
a. Tape 3 is used to
determine the next

configuration the
deterministic TM has
to enter in this branch
of the NTMs
computation tree.

Variants of Turing Machines

* Property of STI
Page 16 of 18

Theory of Computation (With Automata Theory)

b. If no more symbols
remain on Tape 3, or if
this address is invalid,
abort this branch of
computation and go to
step 4.
c. If
a
rejecting
configuration
is
reached go to step 4; if
an
accepting
configuration
is
encountered,
accept
the input string.
4. Replace the string on Tape
3 with the next address
string (in lexicographic
order) and go back to step
2 to simulate the next
branch of computation.

Variants of Turing Machines

* Property of STI
Page 17 of 18

Theory of Computation (With Automata Theory)

It can therefore be said that


every nondeterministic Turing
machine has an equivalent
deterministic Turing machine.

It can also be concluded that a


language
is
Turingrecognizable if and only if
some nondeterministic Turing
machine recognizes it.

Variants of Turing Machines

* Property of STI
Page 18 of 18