Reducibility 1 Problem A is reduced to problem If we can solve problem we can solve problem A B B then B A 2 Problem If If A A is reduced to problem B B is decidable then A is decidable is undecidable then B is undecidable 3 Example: the halting problem is reduced to the state-entry problem 4 The state-entry problem Inputs: •Turing Machine •State q •String w M Question: Does M enter state q on input w ? 5 Theorem: The state-entry problem is undecidable Proof: Reduce the halting problem to the state-entry problem 6 Suppose we have an algorithm (Turing Machine) that solves the state-entry problem We will construct an algorithm that solves the halting problem 7 Assume we have the state-entry algorithm: M w q Algorithm for state-entry problem YES M enters q NO doesn’t enter M q 8 We want to design the halting algorithm: M w Algorithm for Halting problem YES M halts on w NO doesn’t halt on M w 9 Modify input machine •Add new state M : q •From any halting state add transitions to q M M halting states q Single halt state 10 M halts if and only if M halts on state q 11 Algorithm for halting problem: Inputs: machine 1. Construct machine M and string w M with state q 2. Run algorithm for state-entry problem with inputs: M , q , w 12 Halting problem algorithm M Generate M M q State-entry w algorithm YES YES NO NO w 13 We reduced the halting problem to the state-entry problem Since the halting problem is undecidable, it must be that the state-entry problem is also undecidable END OF PROOF 14 Another example: the halting problem is reduced to the blank-tape halting problem 15 The blank-tape halting problem Input: Turing Machine Question: Does M M halt when started with a blank tape? 16 Theorem: The blank-tape halting problem is undecidable Proof: Reduce the halting problem to the blank-tape halting problem 17 Suppose we have an algorithm for the blank-tape halting problem We will construct an algorithm for the halting problem 18 Assume we have the blank-tape halting algorithm: YES M Algorithm for blank-tape halting problem NO M halts on blanks tape M doesn’t halt on blank tape 19 We want to design the halting algorithm: M w Algorithm for halting problem YES M halts on w NO doesn’t halt on M w 20 Construct a new machine Mw • On blank tape writes w • Then continues execution like M Mw step 1 if blank tape step2 execute M then write with input w w 21 M halts on input string w if and only if M w halts when started with blank tape 22 Algorithm for halting problem: Inputs: machine 1. Construct Mw M and string w 2. Run algorithm for , blank-tape halting, problem with input M w 23 M w Halting problem algorithm Generate Mw Mw blank-tape halting algorithm YES YES NO NO 24 We reduced the halting problem to the blank-tape halting problem Since the halting problem is undecidable, the blank-tape halting problem is also undecidable END OF PROOF 25 Summary of Undecidable Problems Halting Problem: Does machine M halt on input w ? Membership problem: Does machine M accept string In other words: Is a string w w? member of a recursively enumerable language L? 26 Blank-tape halting problem: Does machine M halt when starting on blank tape? State-entry Problem: Does machine on input w ? M enter state q 27 Uncomputable Functions 28 Uncomputable Functions Domain f Values region A function is uncomputable if it cannot be computed for all of its domain 29 An uncomputable function: f (n) maximum number of moves until any Turing machine with n states halts when started with the blank tape 30 Theorem: Function Proof: f (n) is uncomputable Assume for contradiction that f (n) is computable Then the blank-tape halting problem is decidable 31 Algorithm for blank-tape halting problem: Input: machine M 1. Count states of 2. Compute M: m f (m) 3. Simulate M for f (m) steps starting with empty tape If M halts then return YES otherwise return NO 32 Therefore, the blank-tape halting problem is decidable However, the blank-tape halting problem is undecidable Contradiction!!! 33 Therefore, function f (n) in uncomputable END OF PROOF 34 Rice’s Theorem 35 Definition: Non-trivial properties of recursively enumerable languages: any property possessed by some (not all) recursively enumerable languages 36 Some non-trivial properties of recursively enumerable languages: • L is empty • L is finite • L contains two different strings of the same length 37 Rice’s Theorem: Any non-trivial property of a recursively enumerable language is undecidable 38 We will prove some non-trivial properties without using Rice’s theorem 39 Theorem: For any recursively enumerable language it is undecidable to determine whether L is empty L Proof: We will reduce the membership problem to this problem 40 Let M be the machine that accepts L L( M ) L Assume we have the empty language algorithm: M Algorithm for empty language problem YES L(M ) empty NO L(M ) not empty 41 We will design the membership algorithm: M w Algorithm for membership problem YES NO M accepts w M rejects w 42 First construct machine M w: When M enters a final state, compare original input string with w Accept if original input is the same with w 43 w L if and only if L( M w ) is not empty L( M w ) {w} 44 Algorithm for membership problem: Inputs: machine 1. Construct M and string w Mw 2. Determine if L( M w ) is empty YES: then w L(M ) NO: then w L(M ) 45 Membership algorithm M w construct Mw Mw Check if YES NO NO YES L( M w ) is empty END OF PROOF 46