Top Banner
1 Variations of the Turing Machine part2
51

1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

1

Variationsof the

Turing Machinepart2

Page 2: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

2

Standard Machine--Multiple Track Tape

bd

abbaac

track 1

track 2

onesymbol

Page 3: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

3

bd

abbaac

track 1

track 2

1q 2qLdcab ),,(),(

1q

bd

abcdac

track 1

track 2

2q

Page 4: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

4

Semi-Infinite Tape

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

Page 5: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

5

Standard Turing machines simulateSemi-infinite tape machines

Trivial

Page 6: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

6

Semi-infinite tape machines simulateStandard Turing machines

Turing machine

.........

Semi-infinite tape machine

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

Page 7: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

7

Turing machine

.........

Semi-infinite tape with two tracks

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

reference point

#

#

Right part

Left part

a b c d e

ac bd e

Page 8: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

8

1q2q

Rq2Lq1

Lq2 Rq1

Left part Right part

Turing machine

Semi-infinite tape machine

Page 9: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

9

1q 2qRga ,

Turing machine

Lq1Lq2

Lgxax ),,(),(

Rq1Rq2

Rxgxa ),,(),(

Semi-infinite tape machine

Left part

Right part

For all symbols x

Page 10: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

10

Turing machine

.................. a b c d e

1q

.........

Semi-infinite tape

#

#

Right part

Left part ac bd e

Lq1

Time 1

Page 11: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

11

Time 2Turing machine

.................. g b c d e

2q

.........

Semi-infinite tape

#

#

Right part

Left part gc bd e

Lq2

Page 12: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

12

Lq1Rq1

R),#,(#)#,(#

Semi-infinite tape machine

Left part

At the border:

Rq1Lq1

R),#,(#)#,(# Right part

Page 13: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

13

.........

Semi-infinite tape

#

#

Right part

Left part gc bd e

Lq1

.........#

#

Right part

Left part gc bd e

Rq1

Time 1

Time 2

Page 14: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

14

Theorem:

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

Page 15: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

15

The Off-Line Machine

Control Unit

Input File

Tape

read-only

a b c

d eg

read-write

Page 16: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

16

Off-line Machines simulate Turing Machines

Off-line machine:

1. Copy input file to tape

2. Continue computation as in Standard Turing machine

Page 17: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

171. Copy input file to tape

Input Filea b c

Tape

a b c Turing Machine

Off-line Machine

a b c

Page 18: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

182. Do computations as in Turing machine

Input Filea b c

Tape

a b c Turing Machine

Off-line Machine

a b c

1q

1q

Page 19: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

19

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 20: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

20

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 21: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

21

a b c d

e f g0 0 0

0 0

1

1

input file

head position

tapehead position

##

Repeat for each state transition:

Return to reference pointFind current input file symbolFind current tape symbolmake transition

Reference point

Page 22: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

22

Off-line machineshave the same power withStansard machines

Theorem:

Page 23: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

23

Multitape Turing Machines

a b c e f g

Control unit

tape 1 tape 2

Input

Page 24: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

24

a b c e f g

1q 1q

a g c e d g

2q 2q

Time 1

Time 2

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

Page 25: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

25

Multitape machines simulate Standard Machines

Just use one tape

Page 26: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

26

Standard machines simulate Multitape machines

Use a multi-track tape

A tape of the Multiple tape machinecorresponds to a pair of tracks

Standard machine:

Page 27: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

27

a b c h e f g

Multitape MachineTape 1 Tape 2

Four track tape -- Standard Machine

a b c

e f g0 0

0 0

1

1

Tape 1

head position

Tape 2head position

h0

Page 28: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

28

Repeat for each state transition:

Return to reference pointFind current symbol on Tape 1Find current symbol on Tape 2make transition

a b c

e f g0 0

0 0

1

1

Tape 1

head position

Tape 2head position

h0

####

Reference point

Page 29: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

29

Theorem:

Multi-tape machineshave the same power withStandard Turing Machines

Page 30: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

30

Same power doesn’t mean same speed:

Language }{ nnbaL

Acceptance Time

Standard machine

Two-tape machine

2n

n

Page 31: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

31

}{ nnbaL

Standard machine:

Go back and forth times 2n

Two-tape machine:

Copy to tape 2 nb

Leave to tape 1 na

Compare tape 1 and tape 2

n( steps)

n( steps)

n( steps)

Page 32: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

32

MultiDimensional Turing Machines

x

y

ab

c

Two-dimensional tape

HEADPosition: +2, -1

MOVES: L,R,U,D

U: up D: down

Page 33: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

33

Multidimensional machinessimulate Standard machines

Just use one dimension

Page 34: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

34

Standard machinessimulateMultidimensional machines

Standard machine:

Use a two track tape

Store symbols in track 1Store coordinates in track 2

Page 35: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

35

x

y

ab

c

a1

b#

symbols

coordinates

Two-dimensional machine

Standard Machine

1 # 2 # 1c

# 1

1q

1q

Page 36: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

36

Repeat for each transition

Update current symbolCompute coordinates of next positionGo to new position

Simulation:

Page 37: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

37

Theorem:

MultiDimensional Machines have the same power with Turing Machines

Page 38: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

38

NonDeterministic Turing Machines

Lba ,

Rca ,

1q

2q

3q

Non Deterministic Choice

Page 39: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

39

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 40: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

40

Input is accepted if this a possible computation

w

yqxwq f

0

Initial configuration Final Configuration

Final state

Page 41: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

41

NonDeterministic Machinessimulate Standard (deterministic) Machines

Every deterministic machine is also a nondeterministic machine

Page 42: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

42

Deterministic machinessimulateNonDeterministic machines

Keeps track of all possible computations

Deterministic machine:

Page 43: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

43

Non-Deterministic Choices

Computation 1

1q

2q

4q

3q

5q

6q 7q

Page 44: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

44

Non-Deterministic Choices

Computation 2

1q

2q

4q

3q

5q

6q 7q

Page 45: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

45

Keeps track of all possible computations

Deterministic machine:

Simulation

Stores computations in atwo-dimensional tape

Page 46: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

46

a b c

1q

Lba ,

Rca ,

1q

2q

3q

TIME 0 NonDeterministic

Deterministic

a b c1q

# # # # ##### # #

##

# #

Computation 1

Page 47: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

47

Lba ,

Rca ,

1q

2q

3q

TIME 1 NonDeterministic

Deterministic

b b c1q

# # # # #### #

#

# #

Computation 1

b b c

2q

Choice 1

c b c

3q

Choice 2

c b c3q ## Computation 2

Page 48: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

48

Repeat Execute a step in each computation:

If there is a choice in current computation: replicate configuration change the state in the replica

Page 49: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

49

Theorem: NonDeterministic Machines have the same power with deterministic machines

Page 50: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

50

Remark:

The simulation in the deterministic Machine takes time exponential time compared to NonDeterministic machines

Page 51: 1 Variations of the Turing Machine part2. 2 Standard Machine--Multiple Track Tape track 1 track 2 one symbol.

51

Polynomial Time in NonDeterministic Machine

NP-Time

Polynomial Time in Deterministic Machine

P-Time

Fundamental Problem: P = NP ?