1 / 26

CSCI 2670 Introduction to Theory of Computing

CSCI 2670 Introduction to Theory of Computing. September 29, 2005. Agenda. Yesterday Turing machines Today Continue Turing Machines. Announcements. Homework due Wednesday 3.2 c & e, 3.6, 3.8 b, 3.12, 3.13 I will accept homeworks until 11:00 Thursday Quiz Tuesday

lana
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 September 29, 2005

  2. Agenda • Yesterday • Turing machines • Today • Continue Turing Machines September 29, 2005

  3. Announcements • Homework due Wednesday • 3.2 c & e, 3.6, 3.8 b, 3.12, 3.13 • I will accept homeworks until 11:00 Thursday • Quiz Tuesday • Turing machine definition, calculation, and design • Tests will be returned next Tuesday • Ignore comment about tutorials being cancelled September 29, 2005

  4. 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, September 29, 2005

  5. 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 September 29, 2005

  6. 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! September 29, 2005

  7. 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! September 29, 2005

  8. 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 September 29, 2005

  9. Configuration C1 yields C2 • C1 yields C2 if the TM can legally go from C1 to C2 in one step • Assume a, b   and u, v  * • uaqibv yields uqkacv if (qi,b)=(qk,c,L) • uaqibv yields uacqkv if (qi,b)=(qk,c,R) September 29, 2005

  10. Configuration C1 yields C2 • Special cases if head is at beginning or end of tape • uaqibv yields uqjacv if (qi,b)=(qk,c,L) • uaqibv yields uacqkv if (qi,b)=(qk,c,R) • Special cases • qibv~ yields qjac~ if (qi,b)=(qk,c,L) and tape head is at beginning of tape • uaqi~ yields uacqk~ if (qi,b)=(qk,c,R) September 29, 2005

  11. Special configurations • Start configuration • q0w • Halting configurations • Accepting configuration: uqacceptv • Rejecting configuration: uqrejectv • u, v  * September 29, 2005

  12. Strings accepted by a TM • A Turing machine M accepts input sequence w if a sequence of configurations C1, C2, …, Ck exist, where • C1 is the start configuration of M on input w • each Ci yields Ci+1 for i = 1, 2, …, k-1 • Ck is an accepting configuration September 29, 2005

  13. Language of a TM • The language of M, denoted L(M), is • L(M) = {w | M accepts w} • A language is called Turing-recognizable if some Turing machine recognizes it September 29, 2005

  14. Deciders • A Turing machine is called a decider if every string in * is either accepted or rejected • A language is called Turing-decidable if some Turing machine decides it • These languages are often just called decidable September 29, 2005

  15. b  c, D qi qk Turing machine notation • (qi,b)=(qk,c,D), where D = L or R, is represented by the following transition • In the special case where (qi,b)=(qk,b,D), i.e., the tape is unchanged, the right-hand side will just display the direction September 29, 2005

  16. Example • Write a TM that accepts all strings of the form 101001000100001 … • Start with a 1 • End with a 1 • Progressively more 0’s between consecutive 1’s September 29, 2005

  17. Design • Check first symbol is a 1 • If not reject • Move right and check if second symbol is a 0 • If not reject • If so, replace with X and begin recursion September 29, 2005

  18. Recursion (high level) • Go back and forth on either side of each 1 • Replace 0’s on right side of 1 with an X • Replace X’s on left side of 1 with a Y • After all X’s on left side of 1 are replaced with Y’s, there should be exactly one on the right side that has not been X’ed • If not, reject • If so, repeat process (recursion step) September 29, 2005

  19. Exit condition • If you begin to look for the next group of 0’s and reach a ~ then accept September 29, 2005

  20. Have a wonderful weekend!

  21. Group project 1 • Design a Turing machine to accept any string in {a,b}* after making a copy of it on the tape • The tape will start with w • After TM processes the string, the tape should read ww September 29, 2005

  22. Group project 2 • Write a Turing machine that accepts the language {w  {a,b}* | |w| is even} September 29, 2005

  23. Group project 3 • Write a Turing machine that accepts the language {anbm | nm and nm} September 29, 2005

  24. Group project 4 • Write a Turing machine that accepts the language {anbman+m | n0 and m1} September 29, 2005

  25. Group project 5 • Write a Turing machine that accepts the language {wwR | w{a,b}*} September 29, 2005

  26. Group project 6 • Design a Turing machine that accepts the language {w{a,b}* | w has more a’s than b’s} September 29, 2005

More Related