computability chapter 5. overview turing machine (tm) considered to be the most general...

33
Computability Chapter 5

Upload: elmer-turner

Post on 29-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

ComputabilityChapter 5

Page 2: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Overview Turing Machine (TM) considered to be the most general

computational model that can be devised (Church-Turing thesis)

TMs are a litmus test for computational feasibility – If a task can be done on a Turing machine, it is feasible If it cannot, it is considered infeasible There are well-defined tasks, notwithstanding,

that cannot be done on a TM

Different flavors of TM have been devised Multi-tape, multi-head TMs Nondeterministic TMs All can be shown to be equally powerful vis-à-vis feasibility

Universal TM can be defined

Page 3: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

The Standard Turing Machine Model

Page 4: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

The Standard Turing Machine Model (cont.) Two modes of TM use vis-à-vis languages:

Page 5: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Programming the Turing Machine

Programs can be expressed as a functional table:

Or as a transition diagram:

Start

q1 h,

0,R1,R

Page 6: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Programming the Turing Machine (cont.)

Another program expressed as a functional table:

q1

Start

q2

q3

q4

q5

h

0,

1,

,

0,R 1,R,R

0,R1,R

,R

0,0

1,0

,0

0,11,1

,1

And as a transition diagram:

Page 7: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Extensions to the StandardTuring Machine Model

Double-ended tape Turing machine: tape is of indefinite length on both sides

Page 8: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Extensions to the StandardTuring Machine Model (cont.)

Can be simulated by a standard TM whose one, single-ended tape has two tracks: upper track recording right half of the double-ended tape and lower track recording left half

ControlUnit

Tape Unit

Page 9: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Extensions to the StandardTuring Machine Model (cont.)

THEOREM 5.2.0 For each double-ended Turing machine Md there is a standard Turing machine M such that a terminating T-step computation by Md can be simulated in O(T2) steps by M.

Proof (sketch): Simulate each move of the double-ended tape TM Md on a standard TM M by scanning the tape to determine the position of and symbol scanned by the head

of the double-ended TM Md O(T); and then simulating the operation to mimic what Md would do O(1)

ControlUnit

Tape Unit

Page 10: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Extensions to the StandardTuring Machine Model (cont.)

k-tape Turing machine: one control unit and k single-ended tapes of indefinite length

Page 11: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Extensions to the StandardTuring Machine Model (cont.)

k-tape Turing machine: can be simulated by a standard Turing machine whose one tape has k tracks and a large tape alphabet

ControlUnit

Page 12: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Extensions to the StandardTuring Machine Model (cont.)

Proof (sketch): Simulate each move of the k-tape TM on the standard TM by scanning its single tape and collecting information that the control unit of the k-

tape TM would “know” from each of its k tape heads O(T); and then simulating the move of the k-tape TM by altering its single tape at the

appropriate cell O(T)

ControlUnit

Page 13: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Extensions to the StandardTuring Machine Model (cont.)

Proof (sketch): Simulate the moves of the nondeterministic TM MND on input w with a standard TM MD by using three tapes one tape is read-only and contains the input w which is never altered; another tape is a “work tape” which is used to simulate MND

yet another tape contains the current “guess” or sequence of choices used in simulating MND

Start

1,1

1,R

Page 14: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Configuration Graphs

configuration allows for “reconstruction” of TM and its current state from a string representation

x1 x2 xj xnxj+1xj1

pstate

Page 15: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Configuration Graphs (cont.)

configuration allows for “reconstruction” of the k-tape TM and its current state from a string representation

x1

x2

xk

pstate

h1

h2

hk

Page 16: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Configuration Graphs (cont.)

initial stateconfiguration

final stateconfiguration

Page 17: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Phrase-Structure Languagesand Turing Machines

Page 18: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Phrase-Structure Languagesand Turing Machines (cont.)

Language generated by this grammar is

L(G) = {anbncn|n1}

Sample derivation

S aSBC aaBCBC aaBBCC aabBCC

aabbCC aabbcC aabbcc(a) (b) (c) (d)

(e) (f) (g)

Page 19: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Phrase-Structure Languagesand Turing Machines (cont.)

Proof: Design a phrase-structure grammar that would capture the (d)evolution of the acceptance of a string w by a TM. starting with the acceptance configuration of [h1], grammar rules will allow

us to trace backwards towards the start configuration of [s w1w2…wn] yet other grammar rules will then strip extraneous symbols such that only the

string w1w2…wn remains

establish that any string w accepted by some TM can be generated by a phrase-structure grammar establishing the theorem

[s w1w2…wn]

[h1]Configuration graph of TM acceptance of w

S [h1] … [s w1w2…wn]

… w1w2…wn

Page 20: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Phrase-Structure Languagesand Turing Machines (cont.)

Proof: Design a phrase-structure grammar that would capture the (d)evolution of the acceptance of a string w by a TM. Let deterministic TM be M = (,Q,,s,h) The desired grammar G = (N,T,R,s) is such that

N = Q {s,,[,]}T =

and the grammar rules are:

Page 21: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Phrase-Structure Languagesand Turing Machines (cont.)

Proof: Design a TM that would accept a string w if it is possible to generate it with the production rules of a phrase-structure grammar G and “hang” when it isn’t possible to do so TM will be a 2-tape nondeterministic TM One tape will hold the candidate string w; the other will be a “work” tape

w

w’ Control

Unit

input tape

work tape

TM nondeterministically simulates the production of string w’ by the phrase-structure grammar G on the work tape

If no production produces w, TM enters into an infinite loop

Page 22: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Universal Turing Machines

allows for the complete and accurate definition and description of a standard TM with a string

Page 23: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Universal Turing Machines (cont.)

Previous example would be encoded canonically as:

q1

Start

q2

q3

q4

q5

h

0,

1,

,

0,R 1,R,R

0,R1,R

,R

0,0

1,0

,0

0,11,1

,1

Page 24: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Universal Turing Machines (cont.)

A Universal Turing Machine (UTM) is capable of simulating an arbitrary Turing Machine M on an arbitrary input word w.

One possible UTM is a two-tape TM that may be described as: One tape is a work tape, starts out as containing w; Second tape is the program tape, starts out as containing (M), the

canonical encoding of M Tape symbol alphabet is:

w

(M) Control

Unit

work tape

program tape

Page 25: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Universal Turing Machines (cont.)

A Universal Turing Machine (UTM) is capable of simulating an arbitrary Turing Machine M on an arbitrary input word w.

One possible UTM is a two-tape TM that may be described as: The UTM simulates M by locating on the program tape the appropriate transition

given the current state of M and the symbol on the work tape being scanned by its head

When the transition is located, the UTM carries out the operation on the work tape There is a standard UTM equivalent to this two-tape UTM

w

(M) Control

Unit

work tape

program tape

Page 26: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Encoding of Strings and Turing Machines

Any set of strings can be arranged in lexicographic order based on the “order” of the symbols as listed in its alphabet set

= {,,} S: {,,,,} S’: {,,,,}

Turing machines can be listed in lexicographic order based on the “order” of their canonical encodings (strings over some alphabet)

Generating the jth Turing machine can be mechanized

TM Generator

j (Mj)

Page 27: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Limits on Language Acceptance

A language L is decidable (or recursive) if there is a TM that halts on all inputs and accepts just the strings of L

A language L is recursively enumerable if there is a TM that accepts just the strings of L, possibly not halting on strings not in L.

A language L is unsolvable if it is recursively enumerable but not decidable

Page 28: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Limits on Language Acceptance (cont.)

The following results identify three languages that are decidable:

The following result identifies a language that is not recursively enumerable:

Proof: By contradiction and use of diagonalization.

Page 29: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Limits on Language Acceptance (cont.)

The following results identify a language that is unsolvable (i.e., recursively enumerable but not decidable):

Proof: Reclassify states, switching accepting and non-accepting.

Proof: Using a Universal Turing machine, run Mi with input wi. This shows the language is recursively enumerable. Since its complement is not recursively enumerable, therefore not decidable, it cannot be itself decidable.

Page 30: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Reducibility andUnsolvability

Use the “traditional” technique of reduction to establish that other languages are unsolvable: By contradiction: assume that an algorithm A exists for candidate language L

then show we can use A to obtain an algorithm for a language previously known as unsolvable

A(solves L)

R(translates

L to A)

input to L input to A output

Algorithm for L

Page 31: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Reducibility andUnsolvability (cont.)

Existence of such a “reducing algorithm” means one can mechanize the acceptance of one language by using the mechanism of accepting the other language:

Page 32: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Reducibility andUnsolvability (cont.)

This lemma is useful in arriving at unsolvability results:

A(solves L2)

R(translates L1 to L2)

input to L1 input to L2 output

“Algorithm” for L1

Page 33: Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)

Reducibility andUnsolvability (cont.)

Use this reducibility lemma to establish that the following language is unsolvable (i.e., recursively enumerable but not decidable):

Proof: Use encoding of M and w as input to universal Turing machine and simulate M with w as input. This establishes recursive enumerability.

Use Lemma 5.8.1 to establish non-decidability by reducing L1 to LH . The “reducing algorithm” generates the ith input string and the ith Turing machine and uses those as input to “imaginary” machine deciding LH and then “reverses” the polarity of the output. This decides L1.