Lecture 18 Various TMs. Allow the head not move Theorem. If the head is allowed to stay at the cell in each move, then every function computed by the.

Slides:



Advertisements
Similar presentations
Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
Advertisements

Lecture 3 Universal TM. Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction,
Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
Variants of Turing machines
The Recursion Theorem Sipser – pages Self replication Living things are machines Living things can self-reproduce Machines cannot self reproduce.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Computability and Complexity 4-1 Existence of Undecidable Problems Computability and Complexity Andrei Bulatov.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
More Turing Machines Sipser 3.2 (pages ). CS 311 Fall Multitape Turing Machines Formally, we need only change the transition function to.
More Turing Machines Sipser 3.2 (pages ).
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
P, NP, PS, and NPS By Muhannad Harrim. Class P P is the complexity class containing decision problems which can be solved by a Deterministic Turing machine.
Reducibility A reduction is a way of converting one problem into another problem in such a way that a solution to the second problem can be used to solve.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
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.
Lecture 5 Turing Machines
Theory of Computing Lecture 20 MAS 714 Hartmut Klauck.
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
Lecture 27UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27.
CS21 Decidability and Tractability
February 4, 2015CS21 Lecture 131 CS21 Decidability and Tractability Lecture 13 February 4, 2015.
Chapter 9 Turing Machine (TMs).
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Ding-Zhu Du Office: ECSS 3-611, M 3:15-4:30 Lecture: ECSS 2.311, MW 12:30-1:45.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
MA/CSSE 474 Theory of Computation More Reduction Examples Non-SD Reductions.
1 Undecidability Reading: Chapter 8 & 9. 2 Decidability vs. Undecidability There are two types of TMs (based on halting): (Recursive) TMs that always.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
MA/CSSE 474 Theory of Computation Enumerability Reduction.
Great Theoretical Ideas in Computer Science about AWESOME Some Generating Functions Probability Infinity Computability With Alan! (not Turing) Mind-
A Universal Turing Machine
Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Lecture 21 Reducibility. Many-one reducibility For two sets A c Σ* and B c Γ*, A ≤ m B if there exists a Turing-computable function f: Σ* → Γ* such that.
Chapter 15 P, NP, and Cook’s Theorem. 2 Computability Theory n Establishes whether decision problems are (only) theoretically decidable, i.e., decides.
Recursively Enumerable and Recursive Languages
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Lecture 24UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 24.
Decidability Decidable/Undecidable problems. Jaruloj Chongstitvatana Decidability2 Accepting: Definition Let T = (Q, , , , s) be a TM. T accepts.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY * Read chapter 4 of the book for next time * Lecture9x.ppt.
 2005 SDU Lecture14 Mapping Reducibility, Complexity.
Chapters 11 and 12 Decision Problems and Undecidability.
Lecture 1-4 Recursive Functions
Recursively Enumerable and Recursive Languages
Part VI NP-Hardness.
Lecture12 The Halting Problem
CS154, Lecture 7: Turing Machines.
MCC 2093 Advanced Theoretical Computer Science
Turing Machines Acceptors; Enumerators
COSC 3340: Introduction to Theory of Computation
Decidable Languages Costas Busch - LSU.
Decidability and Undecidability
Lecture 1-4 Recursive Functions
CS21 Decidability and Tractability
Proposed in Turing’s 1936 paper
CS154, Lecture 12: Time Complexity
Part II Theory of Nondeterministic Computation
CS21 Decidability and Tractability
Lecture 1-4 Recursive Functions
Instructor: Aaron Roth
Variants of Turing machines
Instructor: Aaron Roth
CS6382 Theory of Computation
Presentation transcript:

Lecture 18 Various TMs

Allow the head not move Theorem. If the head is allowed to stay at the cell in each move, then every function computed by the DTM is still Turing- computable. Proof. Consider DTM M=(Q,Σ,Γ,δ,s) where δ: Q x Γ → Q x Γ x {R, L, H} and H means that the head stays at the current cell. We construct M’=(Q U Q’, Σ, Γ, δ’,s) as follows:

Q’ = {q’ | q ε Q} For q ε Q, δ’(q, a) = (p, b, R) if δ(q, a) = (p, b, R) δ’(q, a) = (p, b, L) if δ(q, a) = (p, b, L) δ’(q, a) = (p’, b, R) if δ(q, a) = (p, b, H) For p’ ε Q’, δ’(p’, a) = (p, a, L). M and M’ compute the same function.

Corollary. A language is accepted by a DTM, which allows the head not to move, iff it is Turing-acceptable. Why this is a corollary? Because every language accepted by a DTM is the definition domain of a function computable by a DTM of the same type. Corollary. A language is decided by a DTM, which allows the head not to move, iff it is Turing-decidable.

Two-way DTM 123ab

Theorem. Every function computed by a two- way DTM is Turing-computable. $ 123 ab

Consider a two-way DTM M=(Q, Σ, Γ, δ,s). Construct a DTM M’ = (Q U Q’,Σ’,Γ’,δ’,s) to simulate M as follows: Q’={q’ | q ε Q} Γ’ ={(a, b) | a, b ε Γ } U { (B, $) } Σ’ ={(a, B) | a ε Σ} For q ε Q, δ’(q, $) = (q’,$,R) δ’(q, (a, c)) = (p,(b,c),D) if δ(q,a)=(p,b,D)

For q’ ε Q’, δ’(q’, $) = (q, $, R) δ’(q’,(c,a)) = (p’,(c,b),R) if δ(q,a)=(p,b,L) δ’(q’,(c,a)) = (p’,(c,b),L) if δ(q,a)=(p,b,R) δ’(q’,(c,a)) = (p’,(c,b),H) if δ(q,a)=(p,b,H)

Multi-tape DTM Input tape (read only) Storage tapes Output tape (possibly, write only)

Theorem. A function can be computed by a multitape DTM iff it isTuring-computable. Proof. tape head tape head tape head X X X

To simulate a move of the multitape DTM, the one- tape DTM needs two trips: Trip 1: read all symbols at heads. Trip 2: erase and write at cells scaned by heads. Questions: How many moves does one-tape DTM needs to simulate t moves of a multitape DTM? How many states does one-tape DTM needs to simulate a multitape DTM?

Nondeterministic TM (NTM) There are multiple choices for each transition. For each input x, the NTM may have more than one computation paths. An input x is accepted if at least one computation path leads to the final state. L(M) is the set of all accepted inputs.

A function f(x) is computed by an NTM M if for every x ε L(M), M gives output f(x) whenever it reaches the final state. Theorem. A function can be computed by an NTM iff it is Turing-computable. Proof. Idea: Enumerate all possible computation paths of certain length from small to large. Implement: set a tape to do the enumeration.

Suppose for each transition, there are at most c choices. Then on the enumeration tape, the DTM enumerate all strings on alphabet {a 1, a 2, …, a c }: ε, a 1, a 2, …, a c, a 1 a 2, a 1 a 3, …. When a string a i 1 a i 2 ∙∙∙a i m is written on the enumeration tape, the DTM simulates the NTM by making the i j –th choice at the j-th move. DTM halts iff it found a computation path of NTM which halts.

Question: How many moves does a DMT needs to simulate t moves of a NTM? O(c ) t

Church-Turing Thesis Any reasonably computable function is a Turing-computable function.

Theorem. A language A is Turing-decidable iff both A and its complement A are Turing-acceptable. Proof. The forward direction is easy. For the backward direction, suppose one-tape DTMs M and M’ accept A and A respectively. Construct 4-tape DTM M* as follows: Use a storage tape to simulate M and another storage tape to simulate M’. M* halts iff M or M’ halts. If M halts, then M* outputs 1. If M’ halts, then M* outputs 0.

Lecture 19 Recursive Functions

Initial Functions Zero function ζ(n) = 0. Successor σ(n) = n+1, for n ε N. Projection π i (n 1,…,n k ) = n i. k

Composition Let m, k be two integers. Given functions g: N → N and h i : N → N for I = 1, 2, …, m, define f: N → by f(n 1,…,n k ) = g(h 1 (n 1,…,n k ),…,h m (n 1,…,n k ) f is called the composition of g and h 1, …, h m. f = g o (h 1,…,h m ) mk k

Primitive Recursion Let k > 0. Given g: N → N and h: N → N, (when k=0, g is a constant), define f : N → N by f(n 1,…n k,0) = g(n 1,…,n k ) f(n 1,…,n k,m+1) = h(n 1,…,n k,m,f(n 1,…n k,m) kk+2 k+1

Primitive Recursive Functions All initial functions are primitive recursive. If g and h 1, …, h m are primitive recursive, so is g o (h 1, …, h k ). If g and h are primitive recursive, so is f obtained from g and h by primitive recursion. Nothing else is primitive recursive.

Add(m, n) = m+n Add(m,0) = π 1 (m) Add(m, n+1) = σ( π 3 (m,n, add(m, n))) 1 3

mult(m, n) = mn mult(m, 0) = ζ(m) Mult(m, n+1) = add(π 1 (m,n,mult(m,n)), π 3 (m, n, mult(m,n)) 33

minus(m,n)= m-n if m > n; 0 if m<n pred(m) = minus(m,1) pred(0) = ζ(0) pred(m+1) = m = π 1 (m, pred(m)) minus(m,0) = π 1 (m) minus(m, n+1) = pred(π 3 (m,n,minus(m, n)) 2 1 3

Pairing Function A function f: N → N is a pairing function if it satisfies the following conditions: (1) f is 1-to-1 and onto; (2) f is primitive recursive; (3) f(i, j) < f(i+1, j), f(i, j) < f(i, j+1). For example, 2

Two “inverse” functions i = g(f(i,j)) and j = h(f(i, j)) are also primitive recursive

Bounded minimization Given g: N → N, define f by f(n 1, …, n k, m) = min {i | g(n 1, …, n k, i)=1} if there exists i < m such that g(n 1, …, n k, i) =1; = 0, otherwise. If g is primitive recursive, so is f. K+1

Unbounded minimization Given g: N → N, define f by f(n 1, …, n k ) = min {i | g(n 1, …, n k, i)=1} if there exists i such that g(n 1, …, n k, i) =1; = ↑, otherwise. f may not be primitive recursive, even if g is. K+1

Partial Recursive Functions All initial functions are partial recursive. If g is a total recursive function, then f obtained from g by unbounded minimization is partial recursive. If g and h 1,…, h k are partial recursive, so is g o (h 1,…,h k ). If g and h are partial recursive, so is f obtained from g and h by primitive recursion.

Over Σ* Zero function ζ(x) = ε. Successor σ a (x) = xa for a in Σ. Projection (no change) Composition (no change) Primitive recursion (need a change, m+1 is replaced by ma) Unbounded minimization (need to give a linear ordering of Σ*)

From Σ* to Γ* for Σ* c Γ* Zero function ζ(x) = ε. Successor σ a (x) = xa for a in Γ. N can be considered as a subset of {0, 1}* if we represent n by 1…1 n

Theorem A function is partial recursive iff it is Turing-computable.

Theorem The following are equivalent: A is r.e. A is Turing-acceptable. A is the range of a primitive recursive function. A is the domain of a partial recursive function.

Pairing function on Σ* Let π(i, j) be a pairing function on N. Let φ be a 1-to-1 onto mapping from N to Σ*. Let μ be a 1-to-1 onto mapping from Σ* to N. Then p(x, y) = φ(π(μ(x), μ(y)) is a pairing function on Σ*.

Lecture 20 Universal TM

Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction, and each symbol into a natural number (code(B) = 0, code(R) =1, code(L) = 2, code(s)=3, code(h)=4,... ). Then encode each transition δ(q, a) = (p, b, D) into a string qapbD

The code of M is obtained by combining all codes code i of transitions together: 111code 1 11code 2 11∙∙∙11code m 111. Remark: Each TM has many codes. All codes of TMs form a Turing-decidable language.

Universal DTM One can design a three-tape DTM M* which behaves as follows: On input, M* first decodes M on the second tape and then simulates M on the output tape. Clearly, L(M*) = { | x ε L(M)}. Thus, Theorem 1. { | x ε L(M)} is Turing- acceptable.

Next, we prove Theorem 2. { | x ε L(M)} isn't Turing-decidable. To do so, we consider A = { M | M accepts M} and prove Lemma. A isn't Turing-decidable.

Barber cuts his own hair Class 1: {Barber | he can cut his own hair} Class 2: {Barber | he cannot cut own hair} Question: Is there a barber who cuts hair of everybody in class 2, but not cut hair of anybody in class 1. Answer: No!!! Proof. Suppose such a barber exists. If he cuts his own hair, then he is in class 1 and hence he cannot cut his own hair, a contradiction.

If he cannot cut his own hair, then he belongs to class 2 and hence he can cut his own hair, a contradiction. This argument is called diagonalization. hair barber

Example. There exists an irrational number. Proof. Consider all rational numbers in (0,1). They are countable, a1, a2, …. Now, we construct a number such that its i-th digit is different from the i-th digit of ai. Then this number is not rational. a1 a2 digits

Proof. For contradiction, suppose that A is accepted by a one-tape DTM M’. We look at M’ on input M’. If M’ accepts M’, then M’ is in A, which means that M’ rejects M’, a contradiction. If M’ rejects M’, then M’ isn’t in A which means that M’ accepts M’, a contradiction.

Many-one reduction Consider two sets A ε Σ* and B ε Γ*. If there exists a Turing-computable total function f : Σ* → Γ* such that x ε A iff f(x) ε B, then we say that A is many-one reducible to B, and write A ≤ m B.

A = { M | M accepts M} B = { | M accepts x} Claim. A ≤ m B. Proof. Define f(M) =. M ε A iff M accepts M iff ε B

Theorem. A ≤ m B, B ≤ m C imply A ≤ m C. (This means that ≤ m is a partial ordering.) Theorem. If A ≤ m B and B is Turing- decidable, then A is Turing-decidable. By this theorem, { | M accepts x} isn’t Turing-decidable.