Theory of Computation Chapter 2: Turing Machines

Similar documents
CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

Notes on Complexity Theory Last updated: August, Lecture 1

3515ICT Theory of Computation Turing Machines

CAs and Turing Machines. The Basis for Universal Computation

Computability Theory

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

1 Definition of a Turing machine

Welcome to... Problem Analysis and Complexity Theory , 3 VU

Turing Machines: An Introduction

24 Uses of Turing Machines

Computational Models Lecture 8, Spring 2009

CS 3719 (Theory of Computation and Algorithms) Lecture 4

Notes on Complexity Theory Last updated: August, Lecture 1

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

The Halting Problem is Undecidable

Turing Machines, Part I

Automata and Computability. Solutions to Exercises

Lecture 2: Universality

The P versus NP Solution

NP-Completeness and Cook s Theorem

Introduction to Turing Machines

Deterministic Finite Automata

Complexity Classes P and NP

Implementation of Recursively Enumerable Languages using Universal Turing Machine in JFLAP

Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

Introduction to NP-Completeness Written and copyright c by Jie Wang 1

Finite Automata. Reading: Chapter 2

Informatique Fondamentale IMA S8

Reading 13 : Finite State Automata and Regular Expressions

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

Complexity of Algorithms

Chapter 1. Computation theory

Universality in the theory of algorithms and computer science

Theoretical Computer Science (Bridging Course) Complexity

How To Compare A Markov Algorithm To A Turing Machine

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Universal Turing Machine: A Model for all Computational Problems

Outline 2. 1 Turing Machines. 2 Coding and Universality. 3 The Busy Beaver Problem. 4 Wolfram Prize. 5 Church-Turing Thesis.

The Classes P and NP

Chapter 7 Uncomputability

Polarization codes and the rate of polarization

Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar

1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

Finite Automata. Reading: Chapter 2

The Ergodic Theorem and randomness

6.080/6.089 GITCS Feb 12, Lecture 3

Regular Expressions and Automata using Haskell

Algebraic Computation Models. Algebraic Computation Models

MapReduce and Distributed Data Analysis. Sergei Vassilvitskii Google Research

Lecture 36: Turing Machines [Fa 14]

4.6 The Primitive Recursive Functions

MATHEMATICS: CONCEPTS, AND FOUNDATIONS Vol. III - Logic and Computer Science - Phokion G. Kolaitis

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

An example of a computable

Regular Languages and Finite Automata

Lecture 7: NP-Complete Problems

Automata and Formal Languages

Efficiency of algorithms. Algorithms. Efficiency of algorithms. Binary search and linear search. Best, worst and average case.

T Reactive Systems: Introduction and Finite State Automata

ML for the Working Programmer

Testing LTL Formula Translation into Büchi Automata

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

Turing Machines and Understanding Computational Complexity

6.2 Permutations continued

Implementation of DNA Pattern Recognition in Turing Machines

Regular Languages and Finite State Machines

CS5236 Advanced Automata Theory

THEORY of COMPUTATION

GENERIC COMPUTABILITY, TURING DEGREES, AND ASYMPTOTIC DENSITY

Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, School of Informatics University of Edinburgh als@inf.ed.ac.

How To Understand The Theory Of Computer Science

Finite Automata and Regular Languages

The Model Checker SPIN

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Computer Science Theory. From the course description:

FINITE STATE AND TURING MACHINES

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new

NUMBER SYSTEMS. William Stallings

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

On the Unique Games Conjecture

Mathematical Induction. Lecture 10-11

Fixed-Point Logics and Computation

Lecture 3: Finding integer solutions to systems of linear equations

Recursive Algorithms. Recursion. Motivating Example Factorial Recall the factorial function. { 1 if n = 1 n! = n (n 1)! if n > 1

Models of Sequential Computation

Computer Architecture Syllabus of Qualifying Examination

Classification - Examples

WE write string to mean a finite binary string. Other. Information Distance

Hypercomputation: computing more than the Turing machine

Simulation-Based Security with Inexhaustible Interactive Turing Machines

On the Structure of Turing Universe: The Non-Linear Ordering of Turing Degrees

Transcription:

Theory of Computation Chapter 2: Turing Machines Guan-Shieng Huang Feb. 24, 2003 Feb. 19, 2006 0-0

Turing Machine δ K 0111000a 01bb 1

Definition of TMs A Turing Machine is a quadruple M = (K, Σ, δ, s), where 1. K is a finite set of states; (line numbers) 2. Σ is a finite set of symbols including and ; (alphabet) 3. δ : K Σ (K {h, yes, no }) Σ {,, }, a transition function; (instructions) 4. s K, the initial state. (starting point) 2

h: halt, yes :accept, no : reject (terminate the execution) : move right, : move left, : stay (move the head) : blank, : the boundary symbol 3

δ(q, σ) = (p, ρ, D) While reading σ at line q, go to line p and write out ρ on the tape. Move the head according to the direction of D. δ(q, ) = (p, ρ, ), to avoid crash. 4

Example 2.1 5

Remark x: input of M M(x) = yes no y if M entered h if M never terminates 6

Example 2.2 (n) 2 (n + 1) 2 if no overflow happens. 7

Example 2.3 Palindrome 8

Turing Machines as Algorithms L (Σ {, }), a language A TM M decides L if for all string x, x L M(x) = yes x L M(x) = no. A TM M accepts L if for all string x, x L M(x) = yes x L M(x) =. 9

If L is decided by some TM, we say L is recursive. If L is accepted by some TM, we say L is recursively enumerable. 10

Proposition 2.1 If L is recursive, then it is recursively enumerable. 11

Representation of mathematical objects: (data structure) 1. graphs, sets, numbers,... 2. All acceptable encodings are polynomially related. (a) binary, ternary (b) adjacency matrix, adjacency list However, unary representation of numbers is an exception. 12

k-string Turing Machines A k-string Turing machine is a quadruple (K, Σ, δ, s) where 1. K, Σ, s are exactly as in ordinary Turing machines; 2. δ : K Σ k (K {h, yes, no }) (Σ {,, }) k ; 13

An Example 14

1. If for a k-string Turing machine M and input x we have (s,, x,, ɛ,...,, ɛ) Mt (H, w 1, u 1,...,w k, u k ) for some H {h, yes, no }, then the time required by M on input x is t. 2. If for any input string x of length x, M terminates on input x within time f( x ), we say f(n) is a time bound for M. (worst case analysis) 15

TIME(f(n)): the set of all languages that can be decided by TMs in time f(n). Theorem 2.1 Given any k-string TM M operating within time f(n), we can construct a TM M operating within time O(f(n) 2 ) and such that, for any input x, M(x) = M (x). (by simulation) 16

Linear Speedup Theorem 2.2 Let L TIME(f(n)). Then, for any ɛ > 0, L TIME(f (n)), where f (n) = ɛ f(n) + n + 2. Definition P = k 1 TIME(nk ). 17

Space Bounds A k-string TM with input and output is an ordinary k-string TM such that 1. the first tape is read-only; (Input cannot be modified.) 2. the last tape is write-only. (Output cannot be wound back.) 18

Proposition For any k-string TM M operating with time bound f(n) there is a (k + 2)-string TM M with input and output, which operates within time bound O(f(n)). 19

Space Bound for TM Suppose that, for a k-string TM M and input x, (s,,x,...,, ɛ) M (H, w 1, u 1,...,w k,u k ) where H {h, yes, no } is a halting state. 1. The space required by M on input x is k i=1 w iu i. 2. If M is a machine with input and output, then the space required by M on input x is k 1 i=2 w iu i. 20

1. We say that Turing machine M operates within space bound f(n) if, for any input x, M requires space at most f( x ). 2. A language L is in the space complexity class SPACE(f(n)) if there is a TM with I/O that decides L and operates within space bound f(n). 3. Define L = SPACE(lg(n)). 21

Theorem 2.3 Let L be a language in SPACE(f(n)). Then, for any ɛ > 0, L SPACE(2 + ɛ f(n)). 22

Random Access Machines Input: (i 1, i 2,...,i n ) Output: r 0 (accumulator) Memory: r 0, r 1, r 2,... (infinite memory) k: program counter Three address modes: (for x) 1. j: direct; 2. j: indirect; 3. = j: immediate. (arbitrary large number) 23

24

Theorem 2.5 If a RAM program Π computes a function φ in time f(n), then there is a 7-string TM which computes φ in time O(f(n) 3 ). (by simulation) 25

Nondeterministic Machines A nondeterministic TM is a quadruple N = (K,Σ,, s), where 1. K, Σ, s are as in ordinary TM; 2. (K Σ) [(K {h, yes, no }) Σ {,, }]. 26

27

1. N decides a language L if for any x Σ, x L if and only if (s,, x) N ( yes, w, u) for some strings w and u. 2. An input is accepted if there is some sequence of nondeterministic choice that results in yes. 28

N decides L in time f(n) if 1. N decides L; 2. for any x Σ, if (s,, x) Nk ( yes, w, u), then k f( x ). Let NTIME(f(n)) be the set of languages decided by NTMs within time f. 29

Let N P = k 1 NTIME(nk ). We have P N P. 30

TSP(D) N P Example 2.9 1. Write out arbitrary permutation of 1,..., n. 2. Check whether the tour indicated by this permutation is less than the distance bound. 31

Theorem 2.6 Suppose that language L is decided by an NTM N in time f(n). Then it is decided by a 3-string DTM M in time O(c f(n) ), where c > 1 is some constant depending on N. (NTIME(f(n)) c 1 TIME(cf(n) ).) 32

Example 2.10 Reachability NSPACE(lg n) (This is easy.) Reachability SPACE((lg n) 2 ) (In Chapter 7.) 33

Why employ nondeterminism? 34

Exercises 2.8.1, 2.8.4, 2.8.6, 2.8.7, 2.8.8, 2.8.9, 2.8.10, 2.8.11 35