You are on page 1of 24

Variations

of the
Turing Machine

3/10/2022 1
The Standard Model
Infinite Tape
◊ ◊aababbcac a◊◊◊

Read-Write Head (Left or Right)

Control Unit

Deterministic

3/10/2022 2
Variations of the Standard Model

Turing machines with: • Multitape


• Nondeterministic
• Stay-Option
• Semi-Infinite Tape
• Off-Line
• Multidimensional

Different Turing Machine Classes


3/10/2022 3
Same Power of two machine classes:
both classes accept the
same set of languages

We will prove:
each new class has the same power
with Standard Turing Machine

(accept Turing-Recognizable Languages)

3/10/2022 4
Multi-tape Turing Machines

Control unit
(state machine)

Tape 1 Tape 2
◊ a b c ◊ ◊ e f g ◊
Input string

Input string appears on Tape 1

3/10/2022 5
Tape 1 Time 1 Tape 2
◊ a b c ◊ ◊ e f g ◊
q1 q1

Tape 1 Time 2 Tape 2


◊ a g c ◊ ◊ e d g ◊
q2 q2

(b, f ) → ( g , d ), L, R
q1 q2
3/10/2022 6
Theorem: Multi-tape machines
have the same power with
Standard Turing machines

Proof: 1. Multi-tape machines


simulate Standard Turing machines

2. Standard Turing machines


simulate Multi-tape machines
3/10/2022 7
1. Multi-tape machines simulate
Standard Turing Machines:

Trivial: Use just one tape

3/10/2022 8
2. Standard Turing machines simulate
Multi-tape machines:

Standard machine:
• Uses a multi-track tape to simulate
the multiple tapes

• A tape of the Multi-tape machine


corresponds to a pair of tracks

3/10/2022 9
Multi-tape Machine
Tape 1 Tape 2
◊ a b c ◊ ◊ e f g h ◊

Standard machine with four track tape


a b c Tape 1
0 1 0 head position
e f g h Tape 2
0 0 1 0 head position
3/10/2022 10
Reference point
a b c Tape 1
#
# 0 1 0 head position
# e f g h Tape 2
# 0 0 1 0 head position

Repeat for each state transition:


1. Return to reference point
2. Find current symbol in Tape 1
3. Find current symbol in Tape 2
4. Make transition
END OF PROOF
3/10/2022 11
Same power doesn’t imply same speed:
n n
L = {a b }
2
Standard Turing machine: O ( n ) time
2
Go back and forth O ( n ) times
to match the a’s with the b’s

2-tape machine: O (n) time


1. Copy b n to tape 2 (O(n) steps)
n
2. Compare a on tape 1
n
and b tape 2 (O(n) steps)
3/10/2022 12
Nondeterministic Turing Machines

q2 Choice 1
a → b, L

q1

a → c, R q3 Choice 2

Allows Non Deterministic Choices

3/10/2022 13
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 ◊

3/10/2022
q3 14
Input string w is accepted if
there is a computation:

q0 w  x q f y

Initial configuration Final Configuration

Any accept state

There is a computation:

3/10/2022 15
Theorem: Nondeterministic machines
have the same power with
Standard Turing machines

Proof: 1. Nondeterministic machines


simulate Standard Turing machines

2. Standard Turing machines


simulate Nondeterministic machines
3/10/2022 16
1. Nondeterministic Machines simulate
Standard (deterministic) Turing Machines

Trivial: every deterministic machine


is also nondeterministic

3/10/2022 17
2. Standard (deterministic) Turing machines
simulate Nondeterministic machines:

Deterministic machine:
• Uses a 2-dimensional tape
(which is equivalent to 1-dimensional tape)

• Stores all possible computations


of the non-deterministic machine
on the 2-dimensional tape
3/10/2022 18
All possible computation paths
Initial state

Step 1

Step 2

Step i
reject accept infinite
Step i+1
path
3/10/2022 19
The Deterministic Turing machine
simulates all possible computation paths:

•simultaneously

•step-by-step

•in a breadth-first search fashion

3/10/2022 20
NonDeterministic machine

Time 0
a → b, L q2
◊ a b c ◊
q1
q1
a → c, R q3
Deterministic machine
# # # # # #
# a b c current
#
# q1 # configuration
# # # # #
3/10/2022 21
NonDeterministic machine
Time 1
◊ b b c ◊ Choice 1
a → b, L q2
q2
q1
◊ c b c ◊ Choice 2
a → c, R q3 q3
Deterministic machine
# # # # # #
# b b c # Computation 1
# q2 #
# c b c # Computation 2
# q3 #
3/10/2022 22
Deterministic Turing machine

Repeat
For each configuration in current step
of non-deterministic machine,
if there are two or more choices:
1. Replicate configuration
2. Change the state in the replicas
Until either the input string is accepted
or rejected in all configurations

END OF PROOF
3/10/2022 23
Remark:
The simulation takes in the worst case
exponential time compared to the shortest
accepting path length of the
nondeterministic machine

3/10/2022 24

You might also like