cse 105
play

CSE 105 THEORY OF COMPUTATION Fall 2016 - PowerPoint PPT Presentation

CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ Today's learning goals Sipser Ch 3 Trace the computation of a Turing machine using its transition function and configurations. Recognize when a


  1. CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/

  2. Today's learning goals Sipser Ch 3 • Trace the computation of a Turing machine using its transition function and configurations. • Recognize when a Turing machine is a decider. • Describe several variants of Turing machines and informally explain why they are equally expressive. • Give high-level description for TMs (recognizers and enumerators) used in constructions • Prove properties of the classes of recognizable and decidable sets. • State and use the Church-Turing thesis.

  3. Context-free languages Regular languages

  4. Formal definition of TM q reject ≠ q accept

  5. Configurations of a TM Start configuration on w: q 0 w Accepting configuration: • Current state u q acc v • Current tape contents Rejecting configuration: u q rej v • Current location of read/write head Halting configuration : any u q v configuration that is either rejecting or halting. current state is q current tape contents are uv (and then all blanks) current head location is first symbol of v

  6. Transitioning between configurations q 0 w w is input, read/write head over the leftmost symbol of w u q v q' = δ (q, v 1 ) How does uv compare to u'v'? u' q' v'

  7. Language of a TM Sipser p. 144 L(M) = { w | M accepts w} = { w | there is a sequence of configurations of M where C 1 is start configuration of M on input w, each C i yields C i+1 and C k is accepting configuration} "The language of M" "The language recognized by M"

  8. Deciders and recognizers Sipser p. 144 Defs 3.5 and 3.6 • L is Turing-recognizable if some Turing machine recognizes it. • M is a decider TM if it halts on all inputs. • L is Turing-decidable if some Turing machine that is a decider recognizes it.

  9. An example L = { w#w | w is in {0,1} * } We already know that L is • not regular • not context-free We will prove that L is Turing-decidable and therefore also Turing-recognizable

  10. An example L = { w#w | w is in {0,1} * } Idea for Turing machine • Zig-zag across tape to corresponding positions on either side of '#' to check whether these positions agree. If they do not, or if there is no '#', reject . If they do, cross them off. • Once all symbols to the left of the '#' are crossed off, check for any symbols to the right of '#': if there are any, reject ; if there aren't, accept .

  11. Is this machine a decider ? An example A. Yes, because it reads the input string exactly once. B. Yes, because it will halt (and either accept or reject) no matter what the input is. L = { w#w | w is in {0,1} * } C. No, because it sometimes rejects the input string. D. No, because it will go in an infinite loop if there's no '#'. Idea for Turing machine E. I don't know. • Zig-zag across tape to corresponding positions on either side of '#' to check whether these positions agree. If they do not, or if there is no '#', reject . If they do, cross them off. • Once all symbols to the left of the '#' are crossed off, check for any symbols to the right of '#': if there are any, reject ; if there aren't, accept .

  12. Idea for Turing machine Zig-zag across tape to corresponding positions on either side of '#' to check whether these positions agree. If they do not, or if there is no '#', reject . If they do, cross them off. Once all symbols to the left of the '#' are crossed off, check for any symbols to the right of '#': if there are any, reject ; if there aren't, accept . 0 à ?, ? 1 à ?, ? q 1 # à ?, ? __ à ?, ?

  13. Q = Σ = Γ = *Some transitions omitted for readability* Fig 3.10 in Sipser

  14. Describing TMs Sipser p. 159 • Formal definition : set of states, input alphabet, tape alphabet, transition function, state state, accept state, reject state. • Implementation-level definition : English prose to describe Turing machine head movements relative to contents of tape. • High-level desciption : Description of algorithm, without implementation details of machine. As part of this description, can "call" and run another TM as a subroutine.

  15. Deciding vs. recognizing "If the input string is finite, then at some point, the TM has to be able to finish reading it. Therefore, infinite looping can only happen when the input takes up the whole TM tape (which is infinitely long)." A. True B. False C. I don't know.

  16. An example Which of the following is an implementation-level description of a TM which decides the empty set? M = "On input w: A. reject." B. sweep left across the tape until find a non-blank symbol. Then, reject." C. sweep right across the tape until find a non-blank symbol. Then, reject." D. If the first tape symbol is blank, accept. Otherwise, reject." E. I don't know.

  17. Closure Theorem : The class of decidable languages over fixed alphabet Σ is closed under union. Proof: Let … WTS …

  18. Closure Theorem : The class of decidable languages over fixed alphabet Σ is closed under union. Proof: Let L 1 and L 2 be languages and suppose M 1 and M 2 are TMs deciding these languages. We will define a new TM, M, via a high-level description. We will then show that L(M) = L 1 U L 2

  19. Closure Theorem : The class of decidable languages over fixed alphabet Σ is closed under union. Proof: Let L 1 and L 2 be languages and suppose M 1 and M 2 are TMs deciding these languages. Construct the TM M as "On input w, Run M 1 on input w. If M 1 accepts w, accept. Otherwise, go to 2. 1. Run M 2 on input w. If M 2 accepts w, accept. Otherwise, reject." 2. Proof of correctness soon, but first …

  20. Could the same construction give us a proof that the class of Closure recognizable languages is closed under union? A. Yes, just replace M 1 and M 2 by TMs (instead of deciders) Theorem : The class of decidable languages over fixed B. Yes, but need to consider the case of M 1 , M 2 rejecting w. C. No, but a different construction will work. alphabet Σ is closed under union. D. No, the class of recognizable languages is not closed under U. E. I don't know. Proof: Let L 1 and L 2 be languages and suppose M 1 and M 2 are TMs deciding these languages. Construct the TM M as "On input w, Run M 1 on input w. If M 1 accepts w, accept. Otherwise, go to 2. 1. Run M 2 on input w. If M 2 accepts w, accept. Otherwise, reject." 2.

  21. Closure Theorem : The class of decidable languages over fixed alphabet Σ is closed under union. Proof: Let L 1 and L 2 be languages and suppose M 1 and M 2 are TMs deciding these languages. Construct the TM M as "On input w, Run M 1 on input w. If M 1 accepts w, accept. Otherwise, go to 2. 1. Run M 2 on input w. If M 2 accepts w, accept. Otherwise, reject." 2. Correctness of construction: WTS L(M) = L 1 U L 2 and M is a decider.

  22. Variants of TMs • Scratch work, copy input, … Multiple tapes • Parallel computation Nondeterminism • Printing vs. accepting Enumerators • More flexible transition function • Can "stay put" • Can "get stuck" • lots of examples in exercises to Chapter 3

  23. "Equally expressive" Model 1 Model 2 Model 1 is equally expressive as Model 2 iff A. every language recognized by some machine in Model 1 is recognizable by some machine in Model 2, and B. every language recognized by some machine in Model 2 is recognizable by some machine in Model 1.

  24. Multitape TMs Sipser p. 150 • As part of construction of machine, declare some finite number of tapes that are available. • Input given on tape 1, rest of the tapes start blank. • Each tape has its own read/write head. • Transition function Q x Γ k à Q x Γ k x {L,R} k Sketch of proof of equivalence: A. Given TM, build multitape TM recognizing same language. B. Given k-tape TM, build (1- tape) TM recognizing same language.

  25. Nondeterministic TMs Sipser p. 152 • Transition function Q x Γ à P (Q x Γ x {L,R}) Sketch of proof of equivalence: A. Given TM, build nondeterminstic TM recognizing same language. B. Given nondeterministic TM, build (deterministic) TM recognizing same language. Idea : Try all possible branches of nondeterministic computation. 3 tapes: "read-only" input tape, simulation tape, tape tracking nondeterministic braching.

  26. Enumerators • What about machines that produce output rather than accept input? Computation proceeds according to transition function. Finite State At any point, machine may Control a b a b … . "send" a string to printer. Unlimited tape L(E) = { w | E eventually, in finite time, prints w}

  27. Enumerators Can L(E) be infinite? A. No, strings must be printed in finite time. • What about machines that produce output rather than B. No, strings must be all be finite length. C. Yes, it may happen if E does not halt. accept input? D. Yes, all L(E) are infinite. Computation proceeds E. I don't know. according to transition function. Finite State At any point, machine may Control a b a b … . "send" a string to printer. Unlimited tape L(E) = { w | E eventually, in finite time, prints w}

  28. Set of all strings "For each Σ , there is an enumerator whose language is the set of all strings over Σ ." A. True B. False C. Depends on Σ . D. I don't know.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend