41
1 Universal Models of Computation Zeph Grunschlag

Universal Models of Computation

  • Upload
    merton

  • View
    53

  • Download
    0

Embed Size (px)

DESCRIPTION

Universal Models of Computation. Zeph Grunschlag. Agenda. Universal Models of Computation Recursive vs. Recursively Enumerable TM  NTM  k -tape TM  k- track TM  TM, therefore, all universal TM  Queue-machine Exercise on HW8. Queue-machine  TM. Equivalence of TM Variants. - PowerPoint PPT Presentation

Citation preview

Page 1: Universal Models of Computation

1

Universal Models of ComputationZeph Grunschlag

Page 2: Universal Models of Computation

2

Agenda Universal Models of Computation Recursive vs. Recursively Enumerable TM NTM k-tape TM k-track TM TM, therefore, all universal TM Queue-machine Exercise on HW8. Queue-machine

TM

Page 3: Universal Models of Computation

3

Equivalence of TM Variants

FA’s universal: any system for generating strings with strictly finite memory can be simulated by an FA.PDA’s not as universal. CFG’s split up into following hierarchy:Deterministic CFL Unambiguous CFL CFLand much finer splittings are possible. TM’s give a very natural class. Every reasonable TM variant gives rise to same language class. (Church-Turing Thesis)

Page 4: Universal Models of Computation

4

Recursive and Recursively Enumerable

DEF: A language is recursively enumerable if it is recognized by some Turing Machine. A language is recursive if it is decided by some Turing Machine.

The terminology “recursively enumerable” comes from another TM model: a TM which never halts (when describing an infinite language) and writes one string of the language at a time on an auxiliary printer.

Page 5: Universal Models of Computation

5

Recursive EnumeratorExample

For example, at some point, the print-out of a recursive enumerator for pal might look like:

1. (empty string)2. a3. b4. aa5. bb6. aba7. bab8. aaa9. bbb

Page 6: Universal Models of Computation

6

Recursive EnumeratorExample

Recursive-enumerators are equivalent to TM recognizers because of the following intuition:

1) Enumerator TM: Given any input, you could simulate the enumerator. If the input ever appears on the list, accept.

2) TM Enumerator: Start with an enumerator for * and compose with the TM. Dovetail (i.e. multithread) trying to accept each element on the list. If any string accepted, write on enumerator’s output list.

See Sipser p. 140–141 for further details.

Page 7: Universal Models of Computation

7

Equivalence of k-tape vs. 1-tape

The argument that k-tape TM’s are universal, is fairly convincing. After all, the computers we use daily split their memory into several locations: RAM, Hard-Disc, Floppy, CD-ROM. It is plausible that each memory unit could be simulated by a separate tape. The following theorem implies that the computer could still function fully (though probably with a loss of efficiency) if all the memory was merged onto a single tape:

Page 8: Universal Models of Computation

8

Equivalence of k-tape vs. 1-tape

THM: Every k-tape TM can be simulated by a 1-tape TM, and vice versa.

Proof. It’s clear that every 1-tape TM can be simulated by a k-tape TM. Simply ignore tapes no. 2 through k.

On the other hand, to show that any k-tape TM can be simulated by a 1-tape TM, we’ll show two parts:

A) Any k-tape TM can be simulated by a 2k-track TM.

B) Any k-track TM can be simulated by a 1-tape TM.

Page 9: Universal Models of Computation

9

k-track TM’sA k-track machine contains a tape

whose cells are broken into k vertical sub-cells. As opposed to k-tape machines, there is only one reading head1, but it may read all k tracks and base its actions on these values.

EG. A 2-tape machine:vs. a 2-track machine:

$ 1 0 1 $ 1 0 1 1$ 1 0 1

$ 1 0 1 $ 1 0 1 1$ 1 0 1

Page 10: Universal Models of Computation

10

k-track TM’sA k-track machine contains a tape

whose cells are broken into k vertical sub-cells. As opposed to k-tape machines, there is only one reading head1, but it may read all k tracks and base its actions on these values.

EG. A 2-tape machine:vs. a 2-track machine:

$ 1 0 1 $ 1 0 1 1$ 1 0 1

$ 1 0 1 $ 1 0 1 1$ 1 0 1

Page 11: Universal Models of Computation

11

2k-tracks Simulating k-tapes

We can simulate any k-tape TM by a k-track TM as follows: Each tape of the k-tape TM is represented by one track. Each track representing a tape, is underneath a track which consists of all blanks, except for a single X which tells us which cells of the k-tape TM are active:

$ 1 0 1 $ 1 0 1 1$ 1 0 1

X$ 1 0 1 $ 1 0 1 1 X$ 1 0 1

Page 12: Universal Models of Computation

12

2k-tracks Simulating k-tapes

For each move of k-tape TM, the 2k-track TM sweeps to right and then to left. During right-sweep, 2k-track TM notes the current state of the k-tape machine as well as the symbols read by each head, keeping this information in its finite control. Head back when passed all X’s. During the left-sweep, every X encountered causes corresponding track active cell to change in accordance to the memorized configuration of the k-tape machine.

EG:

Page 13: Universal Models of Computation

13

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable:

X$ 1 0 1 $ 1 0 1 1 X$ 1 0 1

Page 14: Universal Models of Computation

14

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable:

X$ 1 0 1 $ 1 0 1 1 X$ 1 0 1

Page 15: Universal Models of Computation

15

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable:

X$ 1 0 1 $ 1 0 1 1 X$ 1 0 1

Page 16: Universal Models of Computation

16

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable:

X$ 1 0 1 $ 1 0 1 1 X$ 1 0 1

Page 17: Universal Models of Computation

17

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable:

X$ 1 0 1 $ 1 0 1 1 X$ 1 0 1

Page 18: Universal Models of Computation

18

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable: 2nd head

reads

X$ 1 0 1 $ 1 0 1 1 X$ 1 0 1

Page 19: Universal Models of Computation

19

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable:

X$ 1 0 1 $ 1 0 1 1 X$ 1 0 1

Page 20: Universal Models of Computation

20

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable: 1st head

reads 1 passed all X’s!

X$ 1 0 1 $ 1 0 1 1 X$ 1 0 1

Page 21: Universal Models of Computation

21

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable: 2nd

phase, on 1st tape: 13,R

$ 1 0 1 $ 1 0 3 1 X$ 1 0 1

Page 22: Universal Models of Computation

22

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable: 2nd

phase, on 1st tape: 13,R

X$ 1 0 1 $ 1 0 3 1 X$ 1 0 1

Page 23: Universal Models of Computation

23

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable:

X$ 1 0 1 $ 1 0 3 1 X$ 1 0 1

Page 24: Universal Models of Computation

24

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable: on 2nd tape: �2,L

X$ 1 0 1 $ 1 0 3 1 X$ 1 0 1

Page 25: Universal Models of Computation

25

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable: on 2nd tape: �2,L

X$ 1 0 1 $ 1 0 3 1 $ 1 0 1 2

Page 26: Universal Models of Computation

26

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable: on 2nd tape: �2,L

X$ 1 0 1 $ 1 0 3 1 X$ 1 0 1 2

Page 27: Universal Models of Computation

27

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable:

X$ 1 0 1 $ 1 0 3 1 X$ 1 0 1 2

Page 28: Universal Models of Computation

28

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable:

X$ 1 0 1 $ 1 0 3 1 X$ 1 0 1 2

Page 29: Universal Models of Computation

29

2k-tracks Simulating k-tapes

$ 1 0 1 $ 1 0 1 1$ 1 0 1

k-tape TM transition

$ 1 0 1 $ 1 0 3 1$ 1 0 1 2

Corresponding simulation sequence:

Notable:ready for next k-tape TM transition

X$ 1 0 1 $ 1 0 3 1 X$ 1 0 1 2

Page 30: Universal Models of Computation

30

1 tape simulating k-tracksFinally, convert the 2k-track

machine to a single tape machine. In a sense, we are already done, as there is only one head.

Q: How can the information about a column of tracks be recorded by a single cell?

1X

Page 31: Universal Models of Computation

31

1 tape simulating k-tracksA: Just expand the tape alphabet !

In this case, the expanded tape alphabet would consist of 4-tuples, and the 4-tuple (,1,X,) would � �represent the column on the right.

Thus a k-track TM is already a 1-tape TM if we look at it the right way. No further modifications are necessary.

This complete the simulation of k-tape TM’s by 1-tape TM’s. �

1X

Page 32: Universal Models of Computation

32

Determinizing NTM’sTHM: Every non-deterministic TM

recognizer (resp. decider) can be converted to an equivalent deterministic TM recognizer (resp. decider).

The idea of the proof is as follows:1) Simulate the NTM by a deterministic 3-

tape TM.2) Previous result guarantees that can then

convert to a 1-tape deterministic TM.

Page 33: Universal Models of Computation

33

Determinizing NTM’sConsider the following NTM decider

for (ab)*b(ab):

To see if a string is accepted, we need to look if any computation branches lead to a configuration containing the state “3”:

0 1 32

a|bRbR

a|bR �L

Page 34: Universal Models of Computation

34

Determinizing NTM’sababa is

accepted. 0 1 32

a|bRbR

a|bR �L0ababaa0baba

ab0aba ab1abaaba0ba

abab0a abab1aaba2ba

crash

ababa0

crash

ababa2

abab3a

Page 35: Universal Models of Computation

35

Determinizing NTM’sWhile abab should be rejected:

Q: How can you turn tree into an algorithm?

0 1 32

a|bRbR

a|bR �L0ababa0bab

ab0ab ab1ababa0b

abab0 abab1

aba2b

crash

crash crash

Page 36: Universal Models of Computation

36

Determinizing NTM’sA: Construct the computation tree of

the TM from starting configuration. Just see if an accept configuration occurs on some branch.

Q: Breadth first search or depth first search?

Page 37: Universal Models of Computation

37

Determinizing NTM’sA: Breadth first search! It the NTM

has infinite loops, could get caught on an infinite branch using depth first search. On the other hand, since each node has finitely many children, a BFS is guaranteed to reach an accept configuration, if it exists.

Page 38: Universal Models of Computation

38

Determinizing NTM’sConstruct BFS computation tree:

3-tape TM is usedFirst tape read only, contains inputSecond tape simulates computation on particular branch up to some depthLast tape contains branching instructions for current simulated branch of computation

Page 39: Universal Models of Computation

39

Determinizing NTM’sBranching Instructions

In this example, the computation tree was binary, as at most two choices at each step. Denote the first choice by 0, and the second by 1 obtaining unique branch id’s:

0ababa

a0baba

ab0aba ab1aba

aba0ba

abab0a abab1a

aba2ba

crash

ababa0

crash

ababa2

abab3a

0

10

0

0

0

0

1

0

000000

000100

010

Page 40: Universal Models of Computation

40

Determinizing NTM’sBranching Instructions

BFS would proceed as follows:1. Try 0, if accept configuration, accept.2. Try 1, if accept configuration, accept.3. Try 00, if accept configuration, accept.4. Try 01, if accept configuration, accept.5. Try 10, if accept configuration, accept.6. Try 11, if accept configuration, accept.7. Try 000, if accept configuration, accept.8. Try 001, if accept configuration, accept.… In our case, we would finally accept at:67.Try 000100, ACCEPT!

Page 41: Universal Models of Computation

41

Determinizing NTM’sFor recognizers, nothing needs to be

modified. For deciders. König’s Infinity Lemma

implies that computation tree is actually finite for every input, so can construct whole tree so can tell when a string is rejected after reading entire tree.