Download presentation

Presentation is loading. Please wait.

Published byCadence True Modified over 2 years ago

1
Lecture 3 Universal TM

2
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 0 10 10 10 10 qapbD

3
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.

4
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.

5
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.

6
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.

7
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

8
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

9
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.

10
Many-one reduction Consider two sets A c Σ* and B c Γ*. 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.

11
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

12
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.

13
Complete in r. e. An r. e. set A is complete in r. e. if for every r. e. set B, B ≤ m A.

14
Halting problem Theorem. K = { | M accepts x } is complete in r. e.. Proof. (1) K is a r. e. set. (2) For any r. e. set A, there exists a DTM M A such that A = L(M A ). For every input x of M A, define f(x) =. Then x ε A iff f(x) ε K.

15
Halting problem Theorem. K = { | M accepts x } is complete in r. e.. Proof. (1) K is a r. e. set. (2) For any r. e. set A, there exists a DTM M A such that A = L(M A ). For every input x of M A, define f(x) =. Then x ε A iff f(x) ε K.

16
Nonempty Nonempty = {M | L(M) ≠ Φ } is complete in r. e. Proof. (1) Nonempty is a r. e. set. Construct a DTM M* as follows: For each M, we may try every input of M, one by one. If M accepts an input, then M is accepted by M*.

17
(2) K ≤ m Nonempty. Suppose M’ is a DTM accepting every input. For each input of K, we define f( ) = M where M is a DTM working as follows: on an input y, Step 1. M simulates M on input x. If M accepts x, then go to Step 2. Step 2. M simulates M’ on input y

18
Therefore, ε K => M accepts x => M accepts every input y => f( ) = M ε Nonempty not in K => M doesn’t halt on x => M doesn’t halt on y => L(M ) = Φ => f( ) not in Nonempty

19
r. e. –hard A set B is r. e.-hard if for every r. e. set A, A ≤ m B Remark Every complete set is r. e.-hard. However, not every r. e.-hard set is complete. Every r. e.-hard set is not recursive.

20
All = {M | M accepts all inputs} All is r. e. hard. All is not r. e. All is not complete.

21
All = {M | M accepts all inputs} All is r. e. hard. All is not r. e. All is not complete.

22
r. e. property A subset P of TM codes is called a r. e. property if M ε P and L(M’) = L(M) imply M’ ε P. e.g., Nonempty, Empty, All are r. e. properties. Question: Give an example which is a subsets of TM codes, but not a r. e. property.

23
Nontrivial A r. e. property is trivial if either it is empty or it contains all r. e. set.

24
Rice Theorem 1 Every nontrivial r. e. property is not recursive.

25
Proof Let P be a nontrivial r. e. property. For contradiction. Suppose P is a recursive set. So is its complement. Note that either P or its complement P does not contains the empty set. Without loss of generality, assume that P does not contains the empty set.

26
Since P is nontrivial, P contains a nonempty r. e. set A. Let Ma be a TM accepting A, i.e., A=L(Ma). We want to prove K ≤m P. For each input of K, we define f( ) = M where M is a DTM working as follows. For each input y of M, it first goes to Step 1.

27
Step 1. M simulates M on input x of M. If M accepts x, then go to Step 2. Step 2. M simulates Ma on y. If Ma accepts y, then M accepts y. Therefore, if ε K then L(M ) = L(Ma) = A ε P, and if not in K, then L(M ) = Φ not in P

28
Since K is not recursive and K ≤ m P, we obtain a contradiction. Recursive = {M | L(M) is recursive} is not recursive. RE = {M | L(M) is r. e.} is trivial.

29
Question: Is K an r. e. property? Is every r. e. property complete? Is it true that for any r. e. property, either it or its complement is complete?

30
Rice Theorem 2 A r. e. property P is r. e. iff the following three conditions hold: (1)If A ε P and A c B for some r. e. set B, then B ε P. (2) If A is an infinite set in P, then A has a finite subset in P. (3) The set of finite languages in P is enumerable, in the sense that there is a TM that generates the (possibly) infinite string code1#code2# …, where code i is a code for the ith finite languages in P.

31
The code for the finite language {w 1, w 2, …, w n } is [w 1,w 2,…,w n]. In other words, there exists an r. e. set B that is a subset of codes of finite languages in P such that for every finite language F in P, B contains at least one code of F.

32
Examples All is not r. e. because All does not satisfy condition (2). The complement of ALL is not r. e. because it does not satisfy condition (1). Empty is not r. e. because it does not satisfy (1) Nonempty is r. e. because it satisfies (1), (2) and (3).

33
Undecidable Problems

34
Given TMs M and M’, is it true that L(M)=L(M’)? This problem is undecidable, i.e., A = { | L(M) = L(M’)} is not recursive. Proof. Empty ≤ m A. Let M o be a fixed TM such that L(M o ) = Φ. Define f(M) =. Then, M ε Empty iff ε A.

35
Let A and B be two nonempty proper subsets of Σ*. If A B and B A are recursive, then A ≤ m B. Proof. Let y ε B and z ε B. Define y if x ε A B f(x) = z if x ε B A x, otherwise

36
Research Problem For a DFA M=(Q, Σ, δ, s, F), L(M) = L(M*) where M* = (Q, Σ, δ, s, Q-F). Given a DTM M, could we have an algorithm to compute a DTM M* such that L(M*) = L(M) when L(M) is regular, and M* will not halt when L(M) is not regular?

37
Proof of Hierarchy Theorems Diagonalization

38
Proof of Hierarchy Theorems

39
Space-constructible function s(n) is fully space-constructible if there exists a DTM M such that for sufficiently large n and any input x with |x|=n, Space M (x) = s(n).

40
Space Hierarchy If s 2 (n) is a fully space-constructible function, s 1 (n)/s 2 (n) → 0 as n → infinity, s 1 (n) > log n, then DSPACE(s 2 (n)) DSPACE(s 1 (n)) ≠ Φ

Similar presentations

OK

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.

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.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on college management system Ppt on area related to circle of class 10 Ppt on properties of solid liquid and gases Ppt on revolt of 1857 ppt Ppt on diode family video Ppt on bluetooth based smart sensor networks conferences Ppt on pricing policy pdf Non linear editing ppt on ipad Ppt on porter's five forces model example Ppt on fans and blowers