1 / 18

CSCI 2670 Introduction to Theory of Computing

CSCI 2670 Introduction to Theory of Computing. October 12, 2004. Agenda. Last week Turing machines This week Sections 3.2 & 3.3 Variants of Turing machines and the definition of algorithm. Announcements. Homework due next Tuesday 3.3, 3.8 a (low-level description), 3.9, 3.12, 3.13

jmusic
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 12, 2004 October 12, 2004

  2. Agenda • Last week • Turing machines • This week • Sections 3.2 & 3.3 • Variants of Turing machines and the definition of algorithm October 12, 2004

  3. Announcements • Homework due next Tuesday • 3.3, 3.8 a (low-level description), 3.9, 3.12, 3.13 • Tutorial sessions are back • Office hours return to normal • Tuesday 3:00 – 4:00 • Wednesday 3:00 – 4:00 October 12, 2004

  4. 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 October 12, 2004

  5. TM design • Read first symbol • If a, replace with x, move to end and write x • If b, replace with y, move to end and write y • Move left to first x or y • Move left to next x or y • If x, replace with a and move right • If y, replace with b and move right October 12, 2004

  6. TM design (cont.) • Read symbol at tape head • If x, replace with a and accept • If y, replace with b and accept • If neither, loop to beginning October 12, 2004

  7. States • Start state q1 • Move right • Write a at end, write b at end, write x at end, write y at end • Move left to first x or y • Move left to second x or y & replace with a or b • Replace a or b with x or y October 12, 2004

  8. qreject a → R b → R ~ → a,R a → L b → L ~ → L a → L b → L a,b,x,y → R a→ x,R ~ → x,R x → a,R y → b,R x → L y → L a → R b → R a→ x,R b→ y,R b→ y,R ~ → y,R a,b,x,y → R x → a,R y → b,R ~ → L ~ → b,R qaccept Copy machine October 12, 2004

  9. Variants of Turing machines • Robustness of model • Varying the model does not change the power • Example, making finite automata nondeterministic • Simple variant of TM model • Add “stay put” direction • Other variants • More tapes • Nondeterministic October 12, 2004

  10. Multitape Turing machines • Same as standard Turing machine, but have several tapes • TM definition changes only in definition of δ δ : Q × Гk→ Q× Гk × {L,R}k October 12, 2004

  11. Equivalence of machines Theorem: Every multitape Turing machine has an equivalent single tape Turing machine Proof method: construction October 12, 2004

  12. 0 1 ~ ~ ~ ~ ~ ~ a a a ~ ~ ~ ~ ~ M a b ~ ~ ~ ~ ~ ~ # 0 1 # a a a # a b # ~ ~ S Equivalent machines October 12, 2004

  13. Simulating k-tape behavior • Single tape start string is #w#~#...#~# • Each move proceeds as follows: • Start at leftmost slot • Scan right to (k+1)st # to find symbol at each virtual tape head • Make second pass making updates indicated by k-tape transition function • When a virtual head moves onto a #, shift string to right October 12, 2004

  14. Corollary Corollary: A language is Turing-recognizable if and only if some multitape Turing machine recognizes it. October 12, 2004

  15. Example • Using 2-tape Turing machine, write a copy machine • Copy tape 1 to tape 2 • Move tape 1 to beginning • Copy tape 1 to tape 2 • Accept October 12, 2004

  16. qreject {a,~}→ {a,a},{R,R} {b,~}→ {b,b},{R,R} {a,~}→ {L,S} {b,~}→ {L,S} {a,~}→ {a,a},{R,R} {b,~}→ {b,b},{R,R} {a,~}→ {x,a},{R,R} {b,~}→ {y,b},{R,R} ~,~ → {L,S} {x,~} → {a,a},{R,R} {y,~} → {b,b},{R,R} {~,~} → {L,L} {~, ,~}→ {R,R} qaccept Copy machine October 12, 2004

  17. Nondeterministic Turing machines • Same as standard Turing machines, but may have one of several choices at any point δ : Q × Г→ P(Q× Г × {L,R}) October 12, 2004

  18. Equivalence of machines Theorem: Every nondeterministic Turing machine has an equivalent deterministic Turing machine Proof method: construction Proof idea: Use a 3-tape Turing machine to deterministically simulate the nondeterministic TM. First tape keeps copy of input, second tape is computation tape, third tape keeps track of choices. October 12, 2004

More Related