enhanced turing machines - hampden-sydney...

21
Enhanced Turing Machines Lecture 28 Sections 10.1 - 10.2 Robb T. Koether Hampden-Sydney College Wed, Nov 2, 2016 Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 1 / 21

Upload: others

Post on 10-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Enhanced Turing MachinesLecture 28

Sections 10.1 - 10.2

Robb T. Koether

Hampden-Sydney College

Wed, Nov 2, 2016

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 1 / 21

Page 2: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

1 Variants of Turing MachinesA Stay OptionOne-Way Infinite TapeMultiple TapesExamples

2 Assignment

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 2 / 21

Page 3: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Outline

1 Variants of Turing MachinesA Stay OptionOne-Way Infinite TapeMultiple TapesExamples

2 Assignment

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 3 / 21

Page 4: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Increasing the Power of a Turing Machine

It is hard to believe that something as simple as a Turing machinecould be powerful enough to solve complicated problems.We can imagine a number of improvements.

A Stay optionMultiple tapesOne-way infinite tapeTwo-dimensional tape (n-dimensional tape)Addressable memoryNondeterminismetc.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 4 / 21

Page 5: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Outline

1 Variants of Turing MachinesA Stay OptionOne-Way Infinite TapeMultiple TapesExamples

2 Assignment

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 5 / 21

Page 6: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

A Stay Option

Rather more left or right on every transition, we could allow theTuring machine to stay at its current tape position.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 6 / 21

Page 7: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

A Stay Option

TheoremAny Turing machine with a Stay option is equivalent to some standardTuring machine.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 7 / 21

Page 8: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Outline

1 Variants of Turing MachinesA Stay OptionOne-Way Infinite TapeMultiple TapesExamples

2 Assignment

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 8 / 21

Page 9: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

One-way Infinite Tape

Would a Turing machine with a one-way infinite tape be morepowerful than a standard Turing machine?

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 9 / 21

Page 10: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

One-way Infinite Tape

TheoremAny Turing machine with a one-way infinite tape is equivalent to astandard Turing machine.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 10 / 21

Page 11: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

One-way Infinite Tape

We can use a one-tape machine to simulate the two-way infinitetape.Establish a tape position that marks the left “edge” of the one-waytape.Symbols that would be to the right of that mark will occupy the oddpositions.Symbols that would be to the left of that mark will occupy the evenpositions.Modity the transitions accordingly.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 11 / 21

Page 12: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Outline

1 Variants of Turing MachinesA Stay OptionOne-Way Infinite TapeMultiple TapesExamples

2 Assignment

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 12 / 21

Page 13: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Multiple Tapes

Would a Turing machine with k tapes, k > 1, be more powerfulthan a standard Turing machine?Each tape could be processed independently of the others.In other words, each transition would read each tape, write toeach tape, and move left or right independently on each tape.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 13 / 21

Page 14: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Multiple Tapes

TheoremAny language that is accepted by a multitape Turing machine is alsoaccepted by a standard Turing machine.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 14 / 21

Page 15: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Multiple Tapes

Proof (sketch):Let the tape contents be:

Tape 1: x11x12x13 . . . x1n1

Tape 2: x21x22x23 . . . x2n2...

...Tape k : xk1xk2xk3 . . . xknk

Then we would write on a single tape

#x11x12 . . . x1n1#x21x22 . . . x2n2# . . .#xk1xk2 . . . xknk#.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 15 / 21

Page 16: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Multiple Tapes

Proof (sketch):To show the current location on each tape, put a special markon one of that tape’s symbols:

#x11x12 . . . x1n1#x21x22 . . . x2n2# . . .#xk1xk2 . . . xknk#

Begin with#x11x12 . . . x1n1# t# . . .# t#

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 16 / 21

Page 17: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Multiple Tapes

Proof (sketch):The Turing machine scans the tape, locating the current symbolon each “tape.”It then makes the appropriate transition.

Write a symbol in each of the current positions.Move the location of the current symbol one space left or right foreach tape.

Of course, the devil is in the details.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 17 / 21

Page 18: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Outline

1 Variants of Turing MachinesA Stay OptionOne-Way Infinite TapeMultiple TapesExamples

2 Assignment

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 18 / 21

Page 19: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Binary Addition

Example (Binary Addition)Binary addition is much simpler if we have a three-tape machine.Write x on tape 1 and write y on tape 2.Write the sum on tape 3.For simplicity, assume fixed-length integers.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 19 / 21

Page 20: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Outline

1 Variants of Turing MachinesA Stay OptionOne-Way Infinite TapeMultiple TapesExamples

2 Assignment

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 20 / 21

Page 21: Enhanced Turing Machines - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Coms461/Lectures... · 2016-11-01 · 1 Variants of Turing Machines A Stay Option One-Way Infinite

Assignment

HomeworkUse JFLAP to do the following:

Design a 3-tape machine that will do subtraction of fixed-lengthintegers. Allow the results to “wrap around.” That is, if y > x , thenthe result of x − y will be 2n + (x − y).Design a 3-tape machine that will accept the language

{anbncn | n ≥ 0}.

Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 21 / 21