1 variations of the turing machine part2. 2 standard machine--multiple track tape track 1 track 2...

51
1 Variations of the Turing Machine part2

Post on 21-Dec-2015

222 views

Category:

Documents


2 download

TRANSCRIPT

1

Variationsof the

Turing Machinepart2

2

Standard Machine--Multiple Track Tape

bd

abbaac

track 1

track 2

onesymbol

3

bd

abbaac

track 1

track 2

1q 2qLdcab ),,(),(

1q

bd

abcdac

track 1

track 2

2q

4

Semi-Infinite Tape

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

5

Standard Turing machines simulateSemi-infinite tape machines

Trivial

6

Semi-infinite tape machines simulateStandard Turing machines

Turing machine

.........

Semi-infinite tape machine

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

7

Turing machine

.........

Semi-infinite tape with two tracks

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

reference point

#

#

Right part

Left part

a b c d e

ac bd e

8

1q2q

Rq2Lq1

Lq2 Rq1

Left part Right part

Turing machine

Semi-infinite tape machine

9

1q 2qRga ,

Turing machine

Lq1Lq2

Lgxax ),,(),(

Rq1Rq2

Rxgxa ),,(),(

Semi-infinite tape machine

Left part

Right part

For all symbols x

10

Turing machine

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

1q

.........

Semi-infinite tape

#

#

Right part

Left part ac bd e

Lq1

Time 1

11

Time 2Turing machine

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

2q

.........

Semi-infinite tape

#

#

Right part

Left part gc bd e

Lq2

12

Lq1Rq1

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

Semi-infinite tape machine

Left part

At the border:

Rq1Lq1

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

13

.........

Semi-infinite tape

#

#

Right part

Left part gc bd e

Lq1

.........#

#

Right part

Left part gc bd e

Rq1

Time 1

Time 2

14

Theorem:

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

15

The Off-Line Machine

Control Unit

Input File

Tape

read-only

a b c

d eg

read-write

16

Off-line Machines simulate Turing Machines

Off-line machine:

1. Copy input file to tape

2. Continue computation as in Standard Turing machine

171. Copy input file to tape

Input Filea b c

Tape

a b c Turing Machine

Off-line Machine

a b c

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

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

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

##

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

22

Off-line machineshave the same power withStansard machines

Theorem:

23

Multitape Turing Machines

a b c e f g

Control unit

tape 1 tape 2

Input

24

a b c e f g

1q 1q

a g c e d g

2q 2q

Time 1

Time 2

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

25

Multitape machines simulate Standard Machines

Just use one tape

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:

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

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

29

Theorem:

Multi-tape machineshave the same power withStandard Turing Machines

30

Same power doesn’t mean same speed:

Language }{ nnbaL

Acceptance Time

Standard machine

Two-tape machine

2n

n

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)

32

MultiDimensional Turing Machines

x

y

ab

c

Two-dimensional tape

HEADPosition: +2, -1

MOVES: L,R,U,D

U: up D: down

33

Multidimensional machinessimulate Standard machines

Just use one dimension

34

Standard machinessimulateMultidimensional machines

Standard machine:

Use a two track tape

Store symbols in track 1Store coordinates in track 2

35

x

y

ab

c

a1

b#

symbols

coordinates

Two-dimensional machine

Standard Machine

1 # 2 # 1c

# 1

1q

1q

36

Repeat for each transition

Update current symbolCompute coordinates of next positionGo to new position

Simulation:

37

Theorem:

MultiDimensional Machines have the same power with Turing Machines

38

NonDeterministic Turing Machines

Lba ,

Rca ,

1q

2q

3q

Non Deterministic Choice

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

40

Input is accepted if this a possible computation

w

yqxwq f

0

Initial configuration Final Configuration

Final state

41

NonDeterministic Machinessimulate Standard (deterministic) Machines

Every deterministic machine is also a nondeterministic machine

42

Deterministic machinessimulateNonDeterministic machines

Keeps track of all possible computations

Deterministic machine:

43

Non-Deterministic Choices

Computation 1

1q

2q

4q

3q

5q

6q 7q

44

Non-Deterministic Choices

Computation 2

1q

2q

4q

3q

5q

6q 7q

45

Keeps track of all possible computations

Deterministic machine:

Simulation

Stores computations in atwo-dimensional tape

46

a b c

1q

Lba ,

Rca ,

1q

2q

3q

TIME 0 NonDeterministic

Deterministic

a b c1q

# # # # ##### # #

##

# #

Computation 1

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

48

Repeat Execute a step in each computation:

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

49

Theorem: NonDeterministic Machines have the same power with deterministic machines

50

Remark:

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

51

Polynomial Time in NonDeterministic Machine

NP-Time

Polynomial Time in Deterministic Machine

P-Time

Fundamental Problem: P = NP ?