Variants of Turing Machines Model
Variants of Turing Machines Model
1
Equivalence of Turing Machine
variants:
Two models of TM variants are equivalent
if one can be simulated by the other
2
Multitape Turing machine:
An ordinary Turing machine with several tapes.
• Each tape has its own head for reading and
writing.
• Initially the input appears on tape 1, and the
others start out blank.
• The transition function is changed to allow for
reading, writing, and moving the heads on
some or all of the tapes simultaneously.
3
Formal definition of transition function
of multitape Turing machine
: Q x k → Q x k x {L, R, S}k, where k is the
number of tapes, S is stay put (do not move the head).
4
Theorem: Every multitape Turing machine
has an equivalent single-tape Turing machine.
Proof : Convert a multi-tape TM M to an
equivalent single-tape TM S.
Simulate M with S.
• Let M has k tapes.
• S simulates the effect of k tapes by storing
their information on its single tape.
▪ S uses the new symbol # as a delimiter to
separate the contents of the different tapes.
5
Proof: (cont.)
6
Representing three tapes with one
7
Nondeterministic Turing machine
It is a Turing machine in which at any point in a
computation the machine may proceed according to
several possibilities.
• The transition function for a nondeterministic Turing
machine has the form : Q x → P(Q x x {L, R})
(q, a)={(q1, b1, L), . . . (qk, bk, R)}
• The computation is a tree whose branches correspond
to different possibilities for the machine.
• If some branch of the computation leads to the accept
state, the machine accepts its input.
8
Theorem : Every nondeterministic Turing
machine has an equivalent deterministic
Turing machine.
Idea of proof:
Simulate any nondeterministic TM N with a
deterministic TM D.
• Let D try all possible branches of N's
nondeterministic computation.
• If D ever finds the accept state on one of these
branches, D accepts.
• Otherwise, D's simulation will not terminate.
9
Idea of Proof (cont.)
10
Proof
The simulating deterministic TM D has three
tapes.
• Tape 1 always contains the input string and is
never altered.
• Tape 2 maintains a copy of N's tape on some
branch of its nondeterministic computation.
• Tape 3 keeps track of D's location in N's
nondeterministic computation tree.
11
Figure : Deterministic TM D simulating
nondeterministic TM N
12
Data representation on tape 3
Tape 3 contains a string over ∑b. It represents the
branch of N's computation from the root to the node
addressed by that string, unless the address is invalid.
13
Description of TM D
1.Initially tape 1 contains the input w, and tapes 2 and 3
are empty.
2.Copy tape 1 to tape 2.
3.Use tape 2 to simulate N with input w on one branch
of its nondeterministic computation.
• Before each step of N consult the next symbol on
tape 3 to determine which choice to make among
those allowed by N's transition function.
• If no more symbols remain on tape 3 or if this
nondeterministic choice is invalid, abort this
branch by going to stage 4.
14
Description of TM D (cont.)
• Also go to stage 4 if a rejecting configuration is
encountered.
• If an accepting configuration is encountered, accept
the input.
4. Replace the string on tape 3 with the
lexicographically next string.
• Simulate the next branch of N's computation by
going to stage 2.
15
Corollary: A language is Turing-recognizable
if and only if some nondeterministic Turing
machine recognizes it.
Proof:
• Any deterministic TM is automatically a
nondeterministic TM, and so one direction of
this theorem follows immediately.
16
Nondeterministic Turing machine
Decider
A nondeterministic Turing machine is called a
decider if all branches halt on all inputs.
17
Corollary: Decidable language
18
Enumerator :
It is a Turing machine with an attached printer.
• The Turing machine can use that printer as an
output device to print strings.
• Every time the Turing machine wants to add a
string to the list, it sends the string to the
printer.
Turing-recognizable language is also called
recursively enumerable language from this type
of Turing machine variant ,viz., enumerator.
19
Enumerator : (Schematic diagram)
20
Enumerator : (cont.)
21
Theorem: A language is Turing-recognizable if
and only if some enumerator enumerates it.
Proof :
1. Show that if there is an enumerator E that
enumerates a language A, a TM M recognizes A.
The TM M works in the following way.
M = "On input w:
1. Run E. Every time that E outputs a string, compare
it with w.
2. If w ever appears in the output of E, accept."
Clearly, M accepts those strings that appear on E's
list.
22
Proof : (cont.)
24
Linear bounded automaton
A linear bounded automaton is a Turing machine with a
limited amount of memory.
• For an input of length n, the amount of memory
available is linear in n.
• The tape head isn't permitted to move off the portion
of the tape containing the input.
25
Linear bounded automaton as
decider
During simulation of string,
• The LBA may halt and accept or reject the
string,
Or
• Detect looping by simulating the LBA for the
number of steps predetermined for it.
26
Lemma: Maximum number of steps
of simulation of LBA is qngn
Proof:
Let M be an LBA with a tape of length n , states
q and symbols in the tape alphabet g.
Then there are
• gn possible number of strings of tape symbols
and
• qngn distinct configurations of M (maximum
number of steps of simulation of LBA ).
(number of location of head = tape length n)
27
Use of Linear bounded automaton
28
The universal Turing machine
29
Contents of Universal Turing
machine
Universal turing machine is three tape multitape
turing machine
• Tape 1 contains description of TM M
• Tape 2 contains tape contents of M
• Tape 3 contains state of M
30
Encoding of Turing machine M
Describe Turing machine as a string of symbols.
31
Alphabet Encoding
Symbols: a b c d
States: q1 q2 q3 q4
33
Head Move Encoding
Move: L R
Encoding: 1 11
34
Transition Encoding
Encoding: 1 0 1 0 11 0 11 0 1
separator
35
Turing Machine Encoding
Transitions:
(q1, a) = (q2 , b, L) (q2 , b) = (q3 , c, R)
Encoding:
1 0 1 0 11 0 11 0 1 00 11 0 110 111 0 111 0 11
separator
36
Tape 1 - Binary encoding of the
simulated machine M
Tape 1
1 0 1 0 11 0 11 0 10011 0 1 10 111 0 111 0 1100
Head location
37
The set of Turing machines as
language
• A Turing Machine is described with a binary
string of 0’s and 1’s
• Each string of this language is the binary
encoding of a Turing Machine
L = { 010100101, (Turing Machine 1)
00100100101111,
111010011110010101, (Turing Machine 2)
…… }
38