Turing Variations
Turing Variations
of the
Turing Machine
1
The Standard Model
Infinite Tape
aababbcac a
Control Unit
Deterministic
2
Variations of the Standard Model
We will prove:
each new class has the same power
with Standard Turing Machine
4
Same Power of two classes means:
such that: L( M1 ) L( M 2 )
and vice-versa
5
Simulation: A standard technique for showing
the equivance of machine classes.
Simulate the machine of one class
with a machine of the other class
Second Class
First Class Simulation Machine
Original Machine M2
M1 M1
simulates M1
6
Configurations in the Original Machine M1
have corresponding configurations
in the Simulation Machine M 2
M1
Original Machine: d0 d1 d n
Simulation Machine: d 0 d1 d n
M2
7
Accepting Configuration
Original Machine: df
Simulation Machine: d f
aababbcac a
q1 a b, S q2
10
Theorem: Stay-Option machines
have the same power with
Standard Turing machines
12
2. Standard Turing machines
simulate Stay-Option machines
13
Stay-Option Machine
a b, S
q1 q2
a b, L x x, R
q1 q2
a b, L
q1 q2
a b, L
q1 q2
Stay-Option Machine:
q1 a b, S q2 aaba baba
1 2
q1 q2
END OF PROOF
16
Multiple Track Tape
A useful trick to perform more
complicated simulations
One Tape
a b a b track 1
b a c d track 2
One head
One symbol ( a, b)
17
a b a b track 1
b a c d track 2
q1
a c a b track 1
b d c d track 2
q2
(b, a ) (c, d ), L
q1 q2
18
Multi-tape Turing Machine
Read as:
If the TM is in state qi and
the heads are reading symbols a1 through ak,
Then the machine goes to state qj, and
the heads write symbols b1 through bk, and
Move in the specified directions.
20
Multi-tape Turing Machines
Control unit
(state machine)
Tape 1 Tape 2
a b c e f g
Input string
21
Tape 1 Time 1 Tape 2
a b c e f g
q1 q1
(b, f ) ( g , d ), L, R
q1 q2
22
Theorem: Multi-tape machines
have the same power with
Standard Turing machines
24
2. Standard Turing machines simulate
Multi-tape machines:
Standard machine:
• Uses a multi-track tape to simulate
the multiple tapes
25
Multi-tape Machine
Tape 1 Tape 2
a b c e f g h
28
Nondeterministic Turing Machines
q2 Choice 1
a b, L
q1
a c, R q3 Choice 2
29
Time 0
a b c
Time 1
q1
Choice 1
q2 b b c
a b, L
q2
q1
Choice 2
a c, R q3 c b c
q3 30
A computation of a Nondeterministic TM
is a tree, where each branch of the tree
looks like a computation of an ordinary
TM.
31
Deterministic Non-Deterministic
Computation Computation
reject
There is a computation:
33
Theorem: Nondeterministic machines
have the same power with
Standard Turing machines
35
2. Standard (deterministic) Turing machines
simulate Nondeterministic machines:
Proof Idea:
• Show that we can simulate an NTM N
with DTM D.
37
Design D to explore the tree by using a
breadth-first search.
38
D has three tapes,
......
01 bq
10
... q bb 11 ... b
Address Tape
Every node in N(w) can have at most b children,
where b is the size of the largest set of possible
choices given by N’s transition function.
42
The Description of D
1. Initially tape 1 contains w and tape 2 and 3 are
empty.
2. Copy tape 1 over 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
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.
If a rejecting configuration is reached go to stage 4; if an
accepting configuration is encountered, accept the input.
4. Replace the string on tape 3 with the next string as if
it is a counter and go to stage 2.
43
A Universal Turing Machine
44
A limitation of Turing Machines:
they execute
only one program
Question: Can we build a programmable TM that accepts
as input a (M: Turing machine, w: input string) pair and
outputs whatever M would output when started up on w?
Attributes:
• Reprogrammable machine
46
Universal Turing Machine
simulates any Turing Machine M
Description of transitions of M
Input string of M
47
To define the Universal Turing Machine U
we need to:
48
Tape 1
Three tapes
Description of M
Universal
Tape 2
Turing
Machine
Tape Contents of M
Tape 3
State of M 49
Tape 1
Description of M
50
Alphabet Encoding
Symbols: a b c d
51
State Encoding
States: q1 q2 q3 q4
Move: L R
Encoding: 1 11
52
Transition Encoding
Encoding: 1 0 1 0 11 0 11 0 1
separator
53
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 1 10 111 0 111 0 11
separator
54
Tape 1 contents of Universal Turing Machine:
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
55
How it works
Initialization of U :
56
Simulate the steps of M :
57