Turing Machines Acceptors; Enumerators

Slides:



Advertisements
Similar presentations
Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
Advertisements

Variants of Turing machines
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata are like Turing Machines with a restriction: The working space of the tape is the space of the.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Recursively Enumerable and Recursive Languages
Fall 2004COMP 3351 Turing Machines. Fall 2004COMP 3352 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
Programming the TM qa  (,q) (,q) q1q1 0q1q1 R q1q1 1q1q1 R q1q1  h  Qa  (,q) (,q) q1q1 0q2q2  q1q1 1q3q3  q1q1  h  q2q2 0q4q4 R q2q2 1q4q4.
Fall 2004COMP 3351 Reducibility. Fall 2004COMP 3352 Problem is reduced to problem If we can solve problem then we can solve problem.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
Courtesy Costas Busch - RPI1 Reducibility. Courtesy Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
Chapter 9 Turing Machine (TMs).
1 Turing Machines. 2 A Turing Machine Tape Read-Write head Control Unit.
AUTOMATA THEORY VIII.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Turing Machines Recursive and Recursively Enumerable Languages
Ding-Zhu Du Office: ECSS 3-611, M 3:15-4:30 Lecture: ECSS 2.311, MW 12:30-1:45.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
1 More About Turing Machines “Programming Tricks” Restrictions Extensions Closure Properties.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata (LBAs) are the same as Turing Machines with one difference: The input string tape space is the.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Lecture 17 Undecidability Topics:  TM variations  Undecidability June 25, 2015 CSCE 355 Foundations of Computation.
Recursively Enumerable and Recursive Languages
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Lecture 24UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 24.
1 Introduction to Turing Machines
Turing Machines Sections 17.6 – The Universal Turing Machine Problem: All our machines so far are hardwired. ENIAC
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Universal Turing Machine
Chapter 5 Recursive and recursively enumerable functions Phrase-structure grammars.
1 Recursively Enumerable and Recursive Languages.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
1 A Universal Turing Machine. 2 Turing Machines are “hardwired” they execute only one program A limitation of Turing Machines: Real Computers are re-programmable.
Fall 2006Costas Busch - RPI1 RE languages and Enumerators.
Chapters 11 and 12 Decision Problems and Undecidability.
More About Turing Machines
A Universal Turing Machine
Recursively Enumerable and Recursive Languages
Busch Complexity Lectures: Turing Machines
Busch Complexity Lectures: Reductions
Reductions Costas Busch - LSU.
Turing Machines.
(Universal Turing Machine)
CSE 105 theory of computation
Turing Machines 2nd 2017 Lecture 9.
CSE 105 theory of computation
COSC 3340: Introduction to Theory of Computation
Decidability and Enumerability
Turing acceptable languages and Enumerators
Turing Machines (TM) Deterministic Turing Machine (DTM)
Decidable Languages Costas Busch - LSU.
Decidability and Undecidability
Turing acceptable languages and Enumerators
Formal Languages, Automata and Models of Computation
Recall last lecture and Nondeterministic TMs
Instructor: Aaron Roth
CSE 105 theory of computation
Instructor: Aaron Roth
Variants of Turing machines
Intro to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

Turing Machines Acceptors; Enumerators Chapter 4 Turing Machines Acceptors; Enumerators

Turing Machines Q: a finite set of states, and a halt state h ∉ Q initially input  Σ* Turing Machines tape: σ # … L ← → R read/write head Q: a finite set of states, and a halt state h ∉ Q s: the start state ∈ Q Σ: the tape alphabet, and a blank symbol # ∉ Σ δ: the transition function The head begins at the left end and crashes if it moves off the edge. δ : Q × (Σ ∪ {#}) → (Q ∪ {h}) × (Σ ∪ {#} ∪ {L, R}) It accepts by halting with a blank tape (infinite computations possible). finite control h halt state 9/22/2018 Theory of Computation: Chapter 4

Theory of Computation: Chapter 4 Simple Example h #, # q₀ Q = {q₀, q₁} Σ = {a} (erases all its input) δ(q₀, a) = (q₁, #) − erase a δ(q₀, #) = (h, #) − halt at end δ(q₁, a) = (q₀, a) − not used δ(q₁, #) = (q₀, R) − move right a, # #, R a, a q₁ δ(q, σ) σ = a σ = # q = q₀ (q₁, #) (h, #) q = q₁ (q₀, a) (q₀, R) 9/22/2018 Theory of Computation: Chapter 4

Instantaneous descriptions q α σ β # … α ∈ (Σ ∪ {#})* σ ∈ (Σ ∪ {#}) β ∈ (Σ ∪ {#})*Σ + ε (no unnecessary blanks) Before: After: Unless: LEFT MOVE δ(q, σ) = (q′, L) α = α′a σ β q q′ α′ a σ β If σ = # and β = ε then: # … WRITING δ(q, σ) = (q′, σ′) α σ β q q′ σ′ RIGHT MOVE δ(q, σ) = (q′, R) α σ bβ' = β q q′ ασ b β' If β = ε then: # … assumes head is not leftmost 9/22/2018 Theory of Computation: Chapter 4

L = {w  {a, b, c}* : |w|a = |w|b = |w|c} δ X a b c blank (#) → q∅ q∅, L q{a, b, c}, R (restart) q{a} q{a}, R q∅, X h, a (missing an “a”) q{b} q{b}, R h, b (missing a “b”) q{c} q{c}, R h, c (missing a “c”) q{a, b} q{a, b}, R q{b}, X q{a}, X h, c (extra “c”) q{b, c} q{b, c}, R q{c}, X h, a (extra “a”) q{a, c} q{a, c}, R h, b (extra “b”) q{a, b, c} q{a, b, c}, R q{b, c}, X q{a, c}, X q{a, b}, X h, # (accept) Idea: leftmost cell is blank; qs is looking for any symbol in s to X out. Accepts when tape contains only X’s and #’s (in halt state). Head ends up on blank square to the right of the input. 9/22/2018 Theory of Computation: Chapter 4

Acceptors A read-only input tape; assume read head always moves right Let Σ = input alphabet A read/write work tape; no restrictions on head movement Let Γ = work tape alphabet δ : Q × Σ × Γ → (Q ∪ {h}) × (Σ ∪ {L, R}) 9/22/2018 Theory of Computation: Chapter 4

Enumerators A read/write work tape; no restrictions on head movement Let Γ = work tape alphabet A write-only output tape; assume output head always moves right Let Σ = output alphabet, and # ∈ Σ be a separator on the output tape δ : Q × Γ → (Q ∪ {h}) × (Γ ∪ {L, R}) × (Σ ∪ {ε}) must be deterministic 9/22/2018 Theory of Computation: Chapter 4

Theory of Computation: Chapter 4 q₁ L = {0ⁿ1ⁿ : n ≥ 0} q₀ writing zeros _ X ……… writing ones Let _ be the blank on work tape Let # be the separator on output tape writes separator after head returns to left square scans right over X’s while writing 0’s on output scans left over X’s while writing 1’s on output _, R : # X, R : 0 δ _ X q₀ q₁, R, # q₀, L, 1 q₁ q₀, X, 0 q₁, R, 0 X, L : 1 q₀ q₁ H&U 7.8 _, X : 0 adds additional X on end of work tape 9/22/2018 Theory of Computation: Chapter 4

Non-deterministic Turing Machines Δ ⊆ (Q × Σ) × ((Q ∪ {h}) × (Σ ∪ {L, R})) Definition: A nondeterministic Turing machine (NTM) M accepts a string w iff there is some possible choice of moves that causes M to accept on input w (e.g. halting with an empty tape.) Let LM = {w : M accepts w}. Does it matter how we define termination for NTMs? Theorem: Every language accepted by an NTM is accepted by a DTM. 9/22/2018 Theory of Computation: Chapter 4

Theory of Computation: Chapter 4 Proof Let M be an NTM. We design a three tape DTM M' to simulate M. Idea: There are only finitely many choices for the next move of M. Holds the input w (so it doesn’t get erased) Enumerates all finite sequences of moves in length-increasing order A work tape to simulate the behavior of M, based on tape (2) After each finite sequence of moves is enumerated, copy (1) to (3) and simulate M on (3) using the deterministic choices on (2). If the simulation accepts then M′ halts. If not, M′ writes out the next sequence of moves to try on (2), and continue as before. 9/22/2018 Theory of Computation: Chapter 4

Termination and closure A machine must halt and answer yes in order to accept, but it might not always terminate. How does an NTM terminate? Does it matter? Call a language recursively enumerable if it is accepted by some TM, and call it recursive if it is accepted by an always terminating TM. Both classes are closed under the positive Boolean operations, union (concurrent) and intersection (sequential). What about complement? Theorem: If a language and its complement are recursively enumerable, then both are recursive. Proof: Alternate execution between the two machines (zig-zag). Discuss intersection and union, along with the subtlety of the halt state: does it have out-degree zero or does it have a self-loop? 9/22/2018 Theory of Computation: Chapter 4

Decidability and Generability Definitions: A language is decidable if it is accepted by a machine M that halts on all inputs. A language is generatable if it is printed by a machine M in length- increasing order, without duplicates. These two notions are equivalent! 9/22/2018 Theory of Computation: Chapter 4

Generatable ⇒ Decidable Generator M output in order Proof: Suppose M generates L. Let M' run M, storing its output on a work tape. After each string enumerated by M, compare it with the input w. If they match, accept. Otherwise, reject when output from M exceeds |w|. Note: How do we know that the output from M will eventually exceed |w|? run again M W.O. … w′ … |w′| > n ? n yes reject size no w = w′ ? input w R.O. yes accept no 9/22/2018 Theory of Computation: Chapter 4

Decidable ⇒ Generatable Decider accept reject input M Proof: Suppose M decides L. Construct M' by running M on all inputs enumerated in lexicographic order, printing on acceptance. Note: Why do strings come out in length-increasing without duplicates? generate next string print w w M no yes 9/22/2018 Theory of Computation: Chapter 4

Acceptability and Enumerability Definitions: A language is acceptable if it is accepted by a (input) Turing machine. A language is enumerable if it is printed by an (output) Turing machine. These two notions are equivalent! 9/22/2018 Theory of Computation: Chapter 4

Enumerable ⇒ Acceptable enumerator start M output Proof: Suppose M enumerates L. Construct M' to run M, comparing each output with its input. If they match, halt and accept. If not, continue. run M print one … # w # yes accept Input w = no 9/22/2018 Theory of Computation: Chapter 4

Acceptable ⇒ Enumerable acceptor input M yes Proof: Suppose M accepts L. Can’t construct a machine to enumerate L by running M on all strings and printing on acceptance. (Why?) Instead, enumerate all pairs consisting of a string and time bound (w, k) diagonally in lexicographic order, and run M on input w for only k steps. Observe: if accepted, w will print infinitely often. enumerate (w, k) run for k steps on input w M if accept, then print 9/22/2018 Theory of Computation: Chapter 4