Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

Similar documents
7.1 The Origin of Computer Science

CS21 Decidability and Tractability

Computability Theory. CS215, Lecture 6,

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

Chapter 3: The Church-Turing Thesis

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CSE 105 THEORY OF COMPUTATION

More Turing Machines. CS154 Chris Pollett Mar 15, 2006.

CSCC63 Worksheet Turing Machines

Theory of Computation

Further discussion of Turing machines

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA

The Church-Turing Thesis

Lecture 12: Mapping Reductions

Turing Machines (TM) The Turing machine is the ultimate model of computation.

The Turing machine model of computation

Turing s thesis: (1930) Any computation carried out by mechanical means can be performed by a Turing Machine

CSE 105 THEORY OF COMPUTATION

Turing Machines Part II

Lecture 14: Recursive Languages

Turing Machine Variants

1 Showing Recognizability

Most General computer?

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

Foundations of

CS4026 Formal Models of Computation

Turing machines COMS Ashley Montanaro 21 March Department of Computer Science, University of Bristol Bristol, UK

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Chapter 8. Turing Machine (TMs)

Decidability and Undecidability

Busch Complexity Lectures: Turing s Thesis. Costas Busch - LSU 1

Turing Machines Part III

Lecture 13: Turing Machine

Turing Machines. Lecture 8

V Honors Theory of Computation

Introduction to Turing Machines

Introduction to Turing Machines. Reading: Chapters 8 & 9

Part I: Definitions and Properties

More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

CSE 105 THEORY OF COMPUTATION

Theory of Computation (IX) Yijia Chen Fudan University

1 Unrestricted Computation

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Harvard CS 121 and CSCI E-207 Lecture 10: Ambiguity, Pushdown Automata

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Computational Models Lecture 8 1

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

CSCI3390-Assignment 2 Solutions

Space Complexity. The space complexity of a program is how much memory it uses.

Computational Models Lecture 8 1

Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne) Turing Machines 9-0

Turing Machines. Wolfgang Schreiner

CS20a: Turing Machines (Oct 29, 2002)

Computational Models - Lecture 6

SCHEME FOR INTERNAL ASSESSMENT TEST 3

Computational Models Lecture 8 1

CpSc 421 Homework 9 Solution

Variants of Turing Machine (intro)

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

CPSC 421: Tutorial #1

Fundamentals of Computer Science

CS151 Complexity Theory. Lecture 1 April 3, 2017

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Turing Machines, diagonalization, the halting problem, reducibility

CSE 105 THEORY OF COMPUTATION

TURING MAHINES

Turing Machines Part II

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE

CSCE 551: Chin-Tser Huang. University of South Carolina

CS20a: Turing Machines (Oct 29, 2002)

Theory of Computation Lecture Notes. Problems and Algorithms. Class Information

Decidability (What, stuff is unsolvable?)

UNRESTRICTED GRAMMARS

COMPARATIVE ANALYSIS ON TURING MACHINE AND QUANTUM TURING MACHINE

Computability and Complexity

Turing Machines Part II

Turing Machine properties. Turing Machines. Alternate TM definitions. Alternate TM definitions. Alternate TM definitions. Alternate TM definitions

Automata Theory CS S-12 Turing Machine Modifications

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

Turing s original paper (1936)

UNIT-VIII COMPUTABILITY THEORY

Homework Assignment 6 Answers

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Turing Machines. The Language Hierarchy. Context-Free Languages. Regular Languages. Courtesy Costas Busch - RPI 1

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

CSE 105 THEORY OF COMPUTATION

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

Turing s Thesis. Fall Costas Busch - RPI!1

CpSc 421 Final Exam December 15, 2006

Decidability: Church-Turing Thesis

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Introduction to Languages and Computation

MA/CSSE 474 Theory of Computation

Final exam study sheet for CS3719 Turing machines and decidability.

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2. March 30, Please write your name in the upper corner of each page.

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Transcription:

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis Harry Lewis October 22, 2013 Reading: Sipser, 3.2, 3.3.

The Basic Turing Machine The Basic Turing Machine a a b a F.C. Head can both read and write, and move in both directions Tape has unbounded length is the blank symbol. All but a finite number of tape squares are blank. 1

Formal Definition of a TM A (deterministic) Turing Machine (TM) is a 7-tuple (Q, Σ, Γ, δ, q 0, q accept, q reject ), where: Q is a finite set of states, containing the start state q 0 the accept state q accept the reject state q reject ( q accept ) Σ is the input alphabet Γ is the tape alphabet Contains Σ Contains blank symbol Γ Σ 2

The transition function Q Γ Q Γ {L, R} L and R are move left and move right δ(q, σ) = (q, σ, R) Rewrite σ as σ in current cell Switch from state q to state q And move right δ(q, σ) = (q, σ, L) Same, but move left Unless at left end of tape, in which case stay put 3

Computation of TMs A configuration is uqv, where q Q, u, v Γ. Tape contents = uv followed by all blanks State = q Head on first symbol of v. Equivalent to uqv, where v = v. Start configuration = q 0 w, where w is input. One step of computation: uqσv yields uσ q v if δ(q, σ) = (q, σ, R). uτqσv yields uq τσ v if δ(q, σ) = (q, σ, L). qσv yields q σ v if δ(q, σ) = (q, σ, L). If q {q accept, q reject }, computation halts. 4

TMs and Language Membership M accepts w if there is a sequence of configurations C 1,..., C k such that 1. C 1 = q 0 w. 2. C i yields C i+1 for each i. 3. C k is an accepting configuration (i.e. state of M is q accept ). L(M) = {w : M accepts w}. L is Turing-recognizable if L = L(M) for some TM M, i.e. w L M halts on w in state q accept. w / L M halts on w in state q reject OR M never halts (it loops ). 5

Decidability, a.k.a. Recursiveness L is (Turing-)decidable if there is a TM M s.t. w L M halts on w in state q accept. w / L M halts on w in state q reject. Other common terminology Recursive = decidable Recursively enumerable (r.e.) = Turing-recognizable Because of alternate characterizations as sets that can be defined via certain systems of recursive (self-referential) equations. 6

Example Claim: L = {a n b n c n : n 0} is decidable. 7

Questions Does every TM recognize some language? Does every TM decide some language? How many Turing-recognizable languages are there? How many decidable languages are there? 8

Computability Defined in terms of Turing machines Computable = recursive/decidable (sets, functions, etc.) In fact an abstract, universal notion Many other computational models yield exactly the same classes of computable sets and functions Power of a model = what is computable using the model (extensional equivalence) Not programming convenience, speed (for now...), etc. All translations between models are constructive 9

Reading: Sipser, 3.2, 3.3. Harvard CS 121 & CSCI E-121 October 22, 2013 Reading: Sipser, 3.2, 3.3. TM Extensions That Do Not Increase Its Power TM Extensions That Do Not Increa TMs with a 2-way infinite tape, unbounded to left and right TMs TMwith Extensions a 2-way infinite Thattape Do Not Increase Its Powe a b a a TMs with a 2-way infinite tape a b a a Unbounded tape to left as well as right Proof that TMs with 2-way infinite tapes are no more powerful than the 1-way infinite tape variety: Claim: Any language recognizable (resp., decidable) by a Unbounded tape to left as well as right (resp., decidable) by some standard TM Claim: Any language recognizable (resp., decidable) by a 2-way infinite Proof: Simulation. Convert any 2-way infinite TM i (resp., decidable) by some standard TM of 2-way c a b a b a a Tape infinite TM M Proof: Simulation. 4 Convert 3 2 1any 0 2-way 1 2 3infinite 4 TM into an equiv of 2-way c a b a b a a 1 Tape 2 3 4 Corresponding b b infinite a ctm M 4 3 2 1 0 = 1 b, 2a 3 4 $ tape of 1-way a a b a a infinite TM M 1 2 3 4 0 Corresponding 1 2 3 4 b b a c = b, a $ tape of 1-way a We athink of b M a aas having infinite a 2-track TM M tape. Simulation. Convert any 2-way infinite TM into an equivalent 1-way infinite TM with a two-track tape. 0 1 2 3 4 Formally, Γ = (Γ Γ) {$}. We think of M as having a 2-track tape. 10

Recall the Formal Definition of a TM: A (deterministic) Turing Machine (TM) is a 7-tuple (Q, Σ, Γ, δ, q 0, q accept, q reject ), where: Q is a finite set of states, containing the start state q 0 the accept state q accept the reject state q reject ( q accept ) Σ is the input alphabet Γ is the tape alphabet Contains Σ Contains blank symbol Γ Σ δ : Q Γ Q Γ {L, R} is the transition function. 11

Formalization of the Simulation of 2-way infinite tape TM Formally, Γ = (Γ Γ) {$}. M includes, for every state q of M, two states: q, 1 q, but we are working on upper track q, 2 q, but we are working on lower track e.g. If δ M (q, a 1 ) = (p, b, L) then δ M ( q, 1, a 1, a 2 ) = ( p, 1, b, a 2, R). Also need transitions for: Lower track U-turn on hitting endmarker Formatting input into 2-tracks 12

Describing Turing Machines Formal Description 7-tuple or state diagram Most of the course so far Implementation Description Prose description of tape contents, head movements Omit details of states and transition functions (but do convince yourself that a TM can do what you re describing!) This lecture, next lecture, ps6 High-Level Description Starting in a couple of lectures... 13

More extensions More extensions Adding Adding multiple multiple tapes tapes does does not not increase increase power power of of TMs TMs a b c q a a b a 2-tape TM (Convention: First tape used for I/O, like standard TM; Second tape (Convention: First tape used for I/O, like standard TM; Second tape is available for scratch work) Simulate a k-tape TM by a one-tape TM whose tape is split (conce k tracks for tape symbols k tracks for head position markers (one in each track) a b c 14

a a Harvard CS 121 & CSCI E-121 October 22, 2013 Simulation of multiple tapes b Simulate a k-tape TM by a one-tape TM whose tape is split (conceptually) into 2k tracks: k tracks for tape symbols a (Convention: First tape used for I/O, like standard TM; Second tape is available Simulate a k-tape TM by a one-tape TM whose tape is split (conceptually) int k tracks for tape symbols k tracks for head position markers (one in each track) k tracks for head position markers (one in each track) a b c $ a a b a (Sipser does different simulation.) (Sipser does different simulation.) To simulate one move of the k-tape TM: 15

Simulation steps To simulate one move of the k-tape TM: 16

Speed of the Simulation Note that the equivalence in ability to compute functions or decide languages does not mean comparable speed. e.g. A standard TM can decide L = {w#w : w Σ } in time O( w 2 ). But there is an O( w )-time 2-tape decider. Let T M : Σ N measure the amount of time a decider M uses on an input. That is, T M (w) is the number of steps TM M takes to halt on input w. General fact about multitape to single-tape slowdown: Theorem: If M is a multitape TM that takes time T (w) when run on input w, then there is a 1-tape machine M and a constant c such that M simulates M and takes at most c T (w) 2 steps on input w. 17

Equivalent Formalisms Many other formalisms for computation are equivalent in power to the TM formalism: TMs with 2-dimensional tapes Random-access TMs General Grammars 2-stack PDAs, 2-counter machines Church s λ-calculus (µ-recursive functions) Markov algorithms Your favorite programming language (C, Python, OCaml,...) In any formalism, each formalized algorithm is expressible as a bit string, number,... 18

The Church-Turing Thesis The equivalence of each to the others is a mathematical theorem. That these formal models of algorithms capture our intuitive notion of algorithms is the Church Turing Thesis. Church s thesis = partial recursive functions, Turing s thesis = Turing machines The Church Turing Thesis is an extramathematical proposition, not subject to formal proof. 19

Nondeterministic TMs Like TMs, but δ : Q Γ P (Q Γ {L, R}) It mainly makes sense to think of NTMs as recognizers L(M) = {w : M has some accepting computation on input w} Example: NTM to recognize {w : w is the binary notation for a product of two integers 2} 20

NTMs recognize the same languages as TMs Given a NTM M, we must construct a TM M that determines, on input w, whether M has an accepting computation on input w. M systematically tries all one-step computations all two-step computations all three-step computations. 21

Enumerating Computations by Dovetailing There is a bounded number of k-step computations, for each k. (because for each configuration there is only a constant number of next configurations in one step) Ultimately M either: discovers an accepting computation of M, and accepts itself, or searches forever, and does not halt. 22

all two-step computations Harvard CS 121 & CSCI E-121 October 22, 2013 all three-step computations Dovetailing Details. Suppose that the maximum number of different transitions for a given (q, a) is C. Number those transitions 1,..., C (or less) Any computation of k steps is determined by a sequence of k numbers C (the nondeterministic choices ). How M works: 3 tapes In More Detail Suppose that the maximum number of different transitions for a given (q, a) i Number those transitions 1,..., b (or less) Any computation of k steps is determined by a sequence of k numbers b (the choices ). How M works: 3 tapes #1 Original input to M #2 #3 Simulated tape of M 1213 Nondeterministc choices for M 23

Simulating one step of M Each major phase of the simulation by M is to simulate one finite computation by M, using tape #3 to resolve nondeterministic ambiguities. Between major phases, M erases tape #2 and copies tape #1 to tape #2 Replaces string in {1,..., C} on tape #3 with the lexicographically next string to generate the next set of nondeterministic choices to follow. Claim: L(M ) = L(M) Q: Slowdown? 24