Presentation is loading. Please wait.

Presentation is loading. Please wait.

Theory of Computation, NTUEE Theory of Computation Lecture 04 Undecidability Part of the materials are from Courtesy of Prof. Peter J. Downey Department.

Similar presentations


Presentation on theme: "Theory of Computation, NTUEE Theory of Computation Lecture 04 Undecidability Part of the materials are from Courtesy of Prof. Peter J. Downey Department."— Presentation transcript:

1 Theory of Computation, NTUEE Theory of Computation Lecture 04 Undecidability Part of the materials are from Courtesy of Prof. Peter J. Downey Department of Computer Science, University of Arizona

2 Theory of Computation, NTUEE 2 The Universal TM Any (hardware) TM M can be encoded as a formatted string (software) Encoding details below The UTM U reads and simulates the action of M on x The UTM U is one, fixed, finite machine, capable of simulating any TM (an interpreter) For example, U reads and gives the same result as for input We shall see that, whenever universality exists for a class of machines (like the TMs), unsolvability is an inevitable consequence

3 Theory of Computation, NTUEE 3 k-adic representation  base k n bin(n) 2-adic construction 0 0,00,000,… (defn; unique string) 1 1,01,001, …1 2 10,010,0010,… 2 3 11,011,0011, … 11 4 100,0100,… 12 5 101,0101, … 21 6 110,0110,… 22 7 111,0111, … 111 8 1000,01000,… 112 9 1001,01001, … 121 10 1010,01010,… 122

4 Theory of Computation, NTUEE 4 k-adic Representation If k -adic notation provides a bijection 1-to-1 and onto  unique in both directions Let A string x over  ``is’’ a natural number A natural number n ``is’’ a  -string Quotient-Remainder Algorithm

5 Theory of Computation, NTUEE 5 Canonical Encoding of TM M Let Encode over 9 symbol alphabet object in M encoding in

6 Theory of Computation, NTUEE 6 Canonical Encoding of TM M (cont.) String is a word over Identify these 9 symbols with So string is the 9-adic repn of number Final encoding is a 2-adic string over machine encoding in 2-adic over Notational convention: an encoding of a TM M ``is” (2-adic representation of) a natural number is called the Gödel number of M Conversely if e is a natural number, is the TM with that Gödel number If e is a syntactically invalid code, is a TM that halts and prints 0 on every input

7 Theory of Computation, NTUEE 7 Example Scan R erasing 0 until first blank. If encounter 1 loop forever. Valid encodings form a regular set over {1,2,…9}, so FSA can check syntax 1/1 */* 0/B B/- B

8 Theory of Computation, NTUEE 8 UTM Construction Use 4 tapes: input program with left endmarker B, state tape with left endmarker & worktape of M being simulated 1.Parse input, copying to program tape. If e is invalid, put [] on worktape and halt. Else copy x to worktape & put [] on state tape simulating state 2.While the state tape  [1] do { 1) If the state tape contains count over to tuples for that state in program e. Use the character a under scan on the worktape ( [],[1],… ) to scan to the correct 5-tuple 2) Overwrite the scanned character c(a) on the worktape by c(b) and move the head direction D on the worktape. 3) Copy the new state string from the program tape to the state tape (after erasing the previous state string) }

9 Theory of Computation, NTUEE 9 UTM Construction 4 tapes: eBx input to U, tape to hold e, tape to hold state of worktape of... BeBx B read-only input read-only program [[]1]B... worktape of M []2BBB... state of M Thus UTM is also a TM.

10 Theory of Computation, NTUEE 10 Turing Machine Index (Gödel Number) For each TM M, is the word encoding M Since every word in 2-adic is a number (and conversely), we may consider to be a natural number e e is called the Gödel number of M is the TM with Gödel number e A procedure that enumerates all TMs. for w:= 0, 1, 2, ……, do { if (w matches the syntax of TM), output w. } /* syntax checking is algorithmic. */

11 Theory of Computation, NTUEE 11 UTM halting problem is undecidable! Proof by contradiction. Assume that UTM halting problem is decidable (with an algorithm). Then we can construct the following table.  M0M0 M1M1 M2M2 M3M3 M4M4 M5M5 …… 00110111 11011110 20111101 31011000 …1000010  (Mi,j) = 1 iff Mi accepts j 0 iff Mi does not accept j

12 Theory of Computation, NTUEE 12 Digression: Pairing Functions k-tuples of can be encoded as single integers in by a computable bijection. Case k=2: (1,1) (0,2) (0,1) (0,0) (1,0) (2,0) 0 1 2 3 4 5 “antidiagonal” construction

13 Theory of Computation, NTUEE 13 PROGRAM TERMINATION (cont.) However, there is one language recognizer M that is not in the table. M accepts i iff Mi does not accept I.  M0M0 M1M1 M2M2 M3M3 M4M4 M5M5 …… 00 /acc 110111 11 11110 2011/rej1101 3101 000 …10000/acc10 Thus M cannot be a TM!

14 Theory of Computation, NTUEE 14 But M is a TM! According to our assumption that UTM halting problem is decidable, …… UTM(Mi,i) i i M halting non-halting halting Thus M is a TM!  A contradiction! Thus UTM halting problem is undecidable!

15 Theory of Computation, NTUEE 15 Arithmetic Hierarchy DEC=CE  co-CE For every class C, a class co-C C } Ladder of complexity CE co-CE DEC=Decidable Sets

16 Theory of Computation, NTUEE 16 Some undecidabilities … Two-stack machine halting problem is undecidable!

17 Theory of Computation, NTUEE 17 Counter machines

18 Theory of Computation, NTUEE 18 Some undecidabilities … 4-counter machine halting problem is undecidable! Assume the alphabet of a two-stack machine M is {0,1,.., k-1}. For stack configuration: One counter recording j=i m +ki m-1 +k 2 i m-2 +…+k m-1 i 1 imim i m-1 i m-2 … i1i1

19 Theory of Computation, NTUEE 19 Some decidabilities … 2-counter machine halting problem is undecidable! It suffices to show that two counters can simulate four counters. One counter holds 2 i 3 j 5 h 7 k The other one as workpad.


Download ppt "Theory of Computation, NTUEE Theory of Computation Lecture 04 Undecidability Part of the materials are from Courtesy of Prof. Peter J. Downey Department."

Similar presentations


Ads by Google