1 / 18

CSCI 2670 Introduction to Theory of Computing

CSCI 2670 Introduction to Theory of Computing. October 5, 2004. Agenda. This week Turing machines Read section 3.1. Announcements. Tests will be returned tomorrow Tutorial sessions are suspended until further notice Extended office hours while tutorials are suspended Monday 11:00 – 12:00

donald
Download Presentation

CSCI 2670 Introduction to Theory of Computing

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. CSCI 2670Introduction to Theory of Computing October 5, 2004

  2. Agenda • This week • Turing machines • Read section 3.1 October 5, 2004

  3. Announcements • Tests will be returned tomorrow • Tutorial sessions are suspended until further notice • Extended office hours while tutorials are suspended • Monday 11:00 – 12:00 • Tuesday 3:00 – 4:00 • Wednesday 3:00 – 5:00 October 5, 2004

  4. Recap to date • Finite automata (both deterministic and nondeterministic) machines accept regular languages • Weakness: no memory • Pushdown automata accept context-free grammars • Add memory in the form of a stack • Weakness: stack is restrictive October 5, 2004

  5. Turing machines • Similar to a finite automaton • Unrestricted memory in the form of a tape • Can do anything a real computer can do! • Still cannot solve some problems October 5, 2004

  6. Control a b a ~ Touring machine schematic • Initially tape contains the input string • Blanks everywhere else (denoted ~ in class … different symbol in book) • Machine may write information on the tape October 5, 2004

  7. Control a b a ~ Touring machine schematic • Can move tape head to read information written to tape • Continues computing until output produced • Output values accept or reject October 5, 2004

  8. Control a b a ~ Touring machine schematic • Turing machine results • Accept • Reject • Never halts October 5, 2004

  9. Differences between TM and FA • TM has tape you can read from and write to • Read-write head can be moved in either direction • Tape is infinite • Accept and reject states take immediate effect October 5, 2004

  10. Example • How can we design a Turing machine to find the middle of a string? • If string length is odd, return middle symbol • If string length is even, reject string • Make multiple passes over string Xing out symbols at end until only middle remains October 5, 2004

  11. Processing input • Check if string is empty • If so, return reject • Write X over first and last non-X symbols • After this, the head will be at the second X • Move left one symbol • If symbol is an X, return reject (string is even in length) • Move left one symbol • If symbol is an X, return accept (string is even in length) • Go to step 2 October 5, 2004

  12. Example • 00110~ • First check if string is empty • X first and last non-X symbols • X011X~ • Move left one symbol • X011X~ • Is symbol an X? No • Move left one symbol • X011X~ • Is symbol an X? No • Write X over first and last non-X symbols October 5, 2004

  13. Example • XX1XX~ • Move left one symbol • XX1XX~ • Is symbol an X? No • Move left one symbol • XX1XX~ • Is symbol an X? Yes • Return accept October 5, 2004

  14. Formal definition of a TM Definition: A Turing machine is a 7-tuple (Q,,,,q0,qaccept,qreject), where Q, , and  are finite sets and • Q is the set of states, •  is the input alphabet not containing the special blank symbol ~ •  is the tape alphabet, where ~ and , • : QQ{L,R} is the transition function, October 5, 2004

  15. Formal definition of a TM Definition: A Turing machine is a 7-tuple (Q,,,,q0,qaccept,qreject), where Q, , and  are finite sets and • q0Q is the start state, • qacceptQ is the accept state, and • qrejectQ is the reject state, where qrejectqaccept October 5, 2004

  16. Computing with a TM • M receives input w = w1w2…wn* on leftmost n squares of tape • Rest of tape is blank (all ~ symbols) • Head position begins at leftmost square of tape • Computation follows rules of  • Head never moves left of leftmost square of the tape • If  says to move L, head stays put! October 5, 2004

  17. Completing computation • Continue following  transition rules until M reaches qaccept or qreject • Halt at these states • May never halt if the machine never transitions to one of these states! October 5, 2004

  18. TM configurations • The configuration of a Turing machine is the current setting • Current state • Current tape contents • Current tape location • Notation uqv • Current state = q • Current tape contents = uv • Only ~ symbols after last symbol of v • Current tape location = first symbol of v October 5, 2004

More Related