58
1 Variations of the Turing Machine

1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

Embed Size (px)

Citation preview

Page 1: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

1

Variationsof the

Turing Machine

Page 2: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

2

Read-Write Head

Control Unit

a a c b a cb b a a

Deterministic

The Standard Model

Infinite Tape

(Left or Right)

Page 3: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

3

Variations of the Standard Model

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

Turing machines with:

Page 4: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

4

We want to prove:

Each Class has the samepower with the Standard Model

The variations form differentTuring Machine Classes

Page 5: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

5

Same Power of two classes means:

Both classes of Turing machines accept the same languages

Page 6: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

6

Same Power of two classes means:

For any machine of first class 1M

there is a machine of second class 2M

such that: )()( 21 MLML

And vice-versa

Page 7: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

7

a technique to prove same powerSimulation:

Simulate the machine of one classwith a machine of the other class

First ClassOriginal Machine

1M 1M

2M

Second ClassSimulation Machine

Page 8: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

8

Configurations in the Original Machinecorrespond to configurations in the Simulation Machine

nddd 10Original Machine:

Simulation Machine: nddd

10

Page 9: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

9

The Simulation Machineand the Original Machineaccept the same language

fdOriginal Machine:

Simulation Machine: fd

Final Configuration

Page 10: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

10

Turing Machines with Stay-Option

The head can stay in the same position

a a c b a cb b a a

Left, Right, Stay

L,R,S: moves

Page 11: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

11

Example:

a a c b a cb b a a

Time 1

b a c b a cb b a a

Time 2

1q 2q

1q

2q

Sba ,

Page 12: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

12

Stay-Option Machineshave the same power with Standard Turing machines

Theorem:

Page 13: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

13

Proof:

Part 1: Stay-Option Machines are at least as powerful as Standard machines

Proof: a Standard machine is alsoa Stay-Option machine(that never uses the S move)

Page 14: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

14

Part 2: Standard Machines are at least as powerful as Stay-Option machines

Proof: a standard machine can simulatea Stay-Option machine

Proof:

Page 15: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

15

1q 2qLba ,

1q 2qLba ,

Stay-Option Machine

Simulation in Standard Machine

Similar for Right moves

Page 16: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

16

1q 2qSba ,

1q 3qLba ,

2qRxx ,

Stay-Option Machine

Simulation in Standard Machine

For every symbol x

Page 17: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

17

Example

a a b a

1q

Stay-Option Machine:

1 b a b a

2q

21q 2q

Sba ,

Simulation in Standard Machine:

a a b a

1q

1 b a b a

2q

2 b a b a

3q

3

Page 18: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

18

Standard Machine--Multiple Track Tape

bd

abbaac

track 1

track 2

one symbol

Page 19: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

19

bd

abbaac

track 1

track 2

1q 2qLdcab ),,(),(

1q

bd

abcdac

track 1

track 2

2q

Page 20: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

20

Semi-Infinite Tape

.........# a b a c

Page 21: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

21

Standard Turing machines simulateSemi-infinite tape machines:

Trivial

Page 22: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

22

Semi-infinite tape machines simulateStandard Turing machines:

Standard machine

.........

Semi-infinite tape machine

..................

Page 23: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

23

Standard machine

.........

Semi-infinite tape machine with two tracks

..................

reference point

#

#

Right part

Left part

a b c d e

ac bd e

Page 24: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

24

Theorem: Semi-infinite tape machineshave the same power with Standard Turing machines

Page 25: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

25

The Off-Line Machine

Control Unit

Input File

Tape

read-only

a b c

d eg

read-write

Page 26: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

26

Off-line machines simulate Standard Turing Machines:

Off-line machine:

1. Copy input file to tape

2. Continue computation as in Standard Turing machine

Page 27: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

27

1. Copy input file to tape

Input Filea b c

Tape

a b c Standard machine

Off-line machine

a b c

Page 28: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

28

2. Do computations as in Turing machine

Input Filea b c

Tape

a b c

a b c

1q

1q

Standard machine

Off-line machine

Page 29: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

29

Standard Turing machines simulate Off-line machines:

Use a Standard machine with four track tapeto keep track ofthe Off-line input file and tape contents

Page 30: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

30

Input Filea b c

Tape

Off-line Machine

e f gd

Four track tape -- Standard Machine

a b c d

e f g0 0 0

0 0

1

1

Input File

head position

Tapehead position

##

Page 31: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

31

Off-line machineshave the same power withStandard machines

Theorem:

Page 32: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

32

Multitape Turing Machines

a b c e f g

Control unit

Tape 1 Tape 2

Input

Page 33: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

33

a b c e f g

1q 1q

a g c e d g

2q 2q

Time 1

Time 2

RLdgfb ,),,(),( 1q 2q

Tape 1 Tape 2

Page 34: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

34

Multitape machines simulate Standard Machines:

Use just one tape

Page 35: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

35

Standard machines simulate Multitape machines:

• Use a multi-track tape

• A tape of the Multiple tape machine corresponds to a pair of tracks

Standard machine:

Page 36: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

36

a b c h e f g

Multitape MachineTape 1 Tape 2

Standard machine with four track tape

a b c

e f g0 0

0 0

1

1

Tape 1

head position

Tape 2head position

h0

Page 37: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

37

Repeat for each state transition:•Return to reference point•Find current symbol in Tape 1•Find current symbol in Tape 2•Make transition

a b c

e f g0 0

0 0

1

1

Tape 1

head position

Tape 2head position

h0

####

Reference point

Page 38: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

38

Theorem: Multi-tape machineshave the same power withStandard Turing Machines

Page 39: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

39

Same power doesn’t imply same speed:

Language }{ nnbaL

Acceptance Time

Standard machine

Two-tape machine

2n

n

Page 40: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

40

}{ nnbaL

Standard machine:

Go back and forth times 2n

Two-tape machine:

Copy to tape 2 nb

Leave on tape 1 naCompare tape 1 and tape 2

n( steps)

n( steps)

n( steps)

Page 41: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

41

MultiDimensional Turing Machines

x

y

ab

c

Two-dimensional tape

HEADPosition: +2, -1

MOVES: L,R,U,DU: up D: down

Page 42: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

42

Multidimensional machines simulate Standard machines:

Use one dimension

Page 43: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

43

Standard machines simulateMultidimensional machines:

Standard machine:

• Use a two track tape

• Store symbols in track 1• Store coordinates in track 2

Page 44: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

44

x

y

ab

c

a1

b#

symbols

coordinates

Two-dimensional machine

Standard Machine

1 # 2 # 1c

# 1

1q

1q

Page 45: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

45

Repeat for each transition

• Update current symbol• Compute coordinates of next position• Go to new position

Standard machine:

Page 46: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

46

MultiDimensional Machineshave the same powerwith Standard Turing Machines

Theorem:

Page 47: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

47

NonDeterministic Turing Machines

Lba ,

Rca ,

1q

2q

3q

Non Deterministic Choice

Page 48: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

48

a b c

1q

Lba ,

Rca ,

1q

2q

3q

Time 0

Time 1

b b c

2q

c b c

3q

Choice 1 Choice 2

Page 49: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

49

Input string is accepted if this a possible computation

w

yqxwq f

0

Initial configuration Final Configuration

Final state

Page 50: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

50

NonDeterministic Machines simulate Standard (deterministic) Machines:

Every deterministic machine is also a nondeterministic machine

Page 51: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

51

Deterministic machines simulateNonDeterministic machines:

Keeps track of all possible computations

Deterministic machine:

Page 52: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

52

Non-Deterministic Choices

Computation 1

1q

2q

4q

3q

5q

6q 7q

Page 53: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

53

Non-Deterministic Choices

Computation 2

1q

2q

4q

3q

5q

6q 7q

Page 54: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

54

• Keeps track of all possible computations

Deterministic machine:

Simulation

• Stores computations in a two-dimensional tape

Page 55: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

55

a b c

1q

Lba ,

Rca ,

1q

2q

3q

Time 0

NonDeterministic machine

Deterministic machine

a b c1q

# # # # ##### # #

##

# #

Computation 1

Page 56: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

56

Lba ,

Rca ,

1q

2q

3q

b b c2q

# # # # #### #

#

# #

Computation 1

b b c

2q

Choice 1

c b c

3q

Choice 2

c b c3q ## Computation 2

NonDeterministic machine

Deterministic machine

Time 1

Page 57: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

57

Theorem: NonDeterministic Machines have the same power with Deterministic machines

Page 58: 1 Variations of the Turing Machine. 2 Read-Write Head Control Unit Deterministic The Standard Model Infinite Tape (Left or Right)

58

Remark: The simulation in the Deterministic machine takes time exponential time compared to the NonDeterministic machine