Presentation is loading. Please wait.

Presentation is loading. Please wait.

Turing Machines. The next level of Machine… PDAs improved on FSAs by adding memory. We make the memory more flexible to do more complicated tasks.

Similar presentations


Presentation on theme: "Turing Machines. The next level of Machine… PDAs improved on FSAs by adding memory. We make the memory more flexible to do more complicated tasks."— Presentation transcript:

1 Turing Machines

2 The next level of Machine… PDAs improved on FSAs by adding memory. We make the memory more flexible to do more complicated tasks.

3 Turing Machine Control Unit Read-Write Head Input/Output Tape

4 Computing with a TM Read-write head starts somewhere on the tape, and control unit is in the initial state. transition function takes state, tape symbol, and transitions to new state, writing a symbol on the tape, and moving one space left or right. a b c d b c State = q0 State = q1

5 Stopping the computation Since the tape (and therefore the input) is now unbounded, when do you stop? Stop in a halt state: any final or trap state

6 Standard TM The Standard Turing Machine that:  Has an unbounded tape in both directions  Is deterministic  Has no special input or output. The tape takes care of both.

7 Turing Machine that accepts a n b n : n>0 Idea: read an “a”, and replace it with “x” Then look for a “b” - replace the first “b” with a “y” Once a successful pair is made, go to next state. Go back to the next “a” and return to first state. If there aren’t any more a’s, check that there are also no more b’s. If that’s true, accept.

8 a n b n : n>0

9 Turing Machines as Transducers Input = initial tape that isn’t blank Output = final tape that isn’t blank A function is Turing-computable if there is a Turing machine that computes it. What kind of functions do you think are Turing-computable?

10 Computing x + y Suppose x and y are represented by some number of ones, and they are separated by a 0. RW head is at the start of x. At end, RW head is at the start of x+y. x+y is represented with ones, and there is a zero at the end of the input. How would you do it?

11 Design a TM that copies a string Start with the RW head at the beginning of a string of 1’s. Replace every 1 with an x. Replace the rightmost x with a 1. Go to the first blank and write a 1. Repeat 2 & 3 until there are no more x’s.

12 String copier (or times 2)

13 Design a Turing Machine that computes x >= y Start with unary notation, with 0 in between. Halt in qx if x >=y and qy if y >x. Use same idea as a n b n, but check if there are more on one side than another.


Download ppt "Turing Machines. The next level of Machine… PDAs improved on FSAs by adding memory. We make the memory more flexible to do more complicated tasks."

Similar presentations


Ads by Google