1 / 18

Turing Machines

Turing Machines. Reading: 9.1. The next level of Machine…. PDAs improved on FSAs by adding memory. We make the memory more flexible to do more complicated tasks. Turing Machine. Control Unit. Read-Write Head. Input/Output Tape. Turing Machine Formal Definition.

amadis
Download Presentation

Turing Machines

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Turing Machines Reading: 9.1

  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. Turing Machine Formal Definition • Turing Machine M = (Q,Σ, Γ, δ, q0, □, F) • Q is the set of states • Σ is the input alphabet, subset of the tape alphabet • Γ is the tape alphabet • δ is the transition function • □ is the blank, special character in the tape alphabet • q0 is the initial state • F is the set of final states

  5. 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. • δ(q0,a) = (q1, d, R) State = q0 a b c State = q1 d b c

  6. Stopping the computation • Since the tape (and therefore the input) is now unbounded, when do you stop? • Stop in a halt state: any machine configuration for which delta function is not defined. • Assume that all final states are also halt states.

  7. What does it do? • q0 initial, q1 final. • Transition Rules: δ(q0,a) =(q0,b,R) δ(q0,b) =(q0,b,R) δ(q0,□) =(q1, □,L)

  8. 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.

  9. Instantaneous Description of a TM • xqy is an instantaneous description of a turing machine. q is the current state, and the tape is y x

  10. Descriptions and Moves • Suppose there is a transition δ(q1,c) = (q2,e,R) • Then xq1cy ┝ xeq2y State = q1 □□ a b c d □□□ State = q2 □□ a b e d □□□

  11. Notation • xqy ┝* wq’z means there is some sequence of moves that puts the machine from the first description to the second. • Any sequence of moves leading to a halt state is called a computation. • xqy ┝* ∞ means the configuration leads to an infinite loop.

  12. Turing Machines as Acceptors • A turing machine accepts a string if the machine starts in q0 with the head at the start of the input, and ends in a final state. • Formally, L(M) = {w Σ+ : q0w┝* x1 qf x2 for some qf in F and x1, x2 in Γ }

  13. Design a Turing machine that accepts 00* (lambda not included in any TM language) δ(q0,0) = (q0,0,R) δ(q0,□) = (qf,□,R)

  14. Turing Machine that accepts anbn : 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.

  15. 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?

  16. 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?

  17. 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.

  18. 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 anbn, but check if there are more on one side than another.

More Related