The Turing Machine • Motivating idea – Build a theoretical a “human computer” Computability – Likened to a human with a paper and pencil that can solve problems in an algorithmic way – The theoretical machine provides a means to determine: • If an algorithm or procedure exists for a given problem • What that algorithm or procedure looks like • How long would it take to run this algorithm or procedure. Theory Hall of Fame The Church-Turing Thesis (1936) • Alan Turing • Any algorithmic procedure that can be – 1912 – 1954 carried out by a human or group of humans – b. London, England. can be carried out by some Turing Machine” – PhD – Princeton (1938) – Research – Equating algorithm with running on a TM • Cambridge and Manchester U. – Turing Machine is still a valid computational • National Physical Lab, UK model for most modern computers. – Creator of the Turing Test Theory Hall of Fame Undecidability • Alonso Church • Informally, a problem is called unsolvable – 1903 -- 1995 or undecidable if there no algorithm exists – b. Washington D.C. that solves the problem. • Algorithm – PhD – Princeton (1927) – Implies a TM that computes a solution for the – Mathematics Prof (1927 – problem 1967) • Solves – Advisor to both Turing and – Implies will always give an answer Kleene 1
Decision Problem Decision Problems • Let’s formalize this a bit • For regular languages 1. Is the language empty? – A decision problem is a problem that has a yes/no answer 2. Is the language finite? 3. Is a given string in the language? 4. Given 2 languages, are there strings that are in both? – Example: 5. Is the language a subset of another regular language? • Is a given string x a palindrome (Is x ∈ pal?) 6. Is the language the same as another regular language? • Is a given context free language empty? Decision Problems Decision Problems • For Context Free Languages • For recursively enumerable languages 1. Is a given string in the language? 1. Is the language accepted by a TM empty? 2. Is the language empty? 2. Is the language accepted by a TM finite? 3. Is the language finite? 3. Is the language accepted by a TM regular? 4. Is the language accepted by a TM context free? 5. Is the language accepted by 1 TM a subset of or equal to the language accepted by another? Decision Problem Decision Problem • Running a decision problem on a TM. • Running a decision problem on a TM. – Once encoded, the encoded instance in provided as – The problem must first be encoded input to a TM. – Example: – The TM must then • Is a given string x a palindrome (Is x ∈ pal?) • Determine if the input is a valid encoding • Run, halt, – x is an instance of the problem – Place 1 on the tape if the answer for the input is yes • Is a given context free language empty? – Place 0 on the tape if the answer for the input is no – Instance of a problem is a CFG…must be encoded. – If such a TM exists for a given decision problem, the problem is decidable or solvable. Otherwise the problem is called undecidable or unsolvable. 2
Solvability Universal Language • In other words, a problem is solvable if the • Universal Language (L u ) – Set of all strings w i such that w i ∈ L(M i ) language of all of its encoded “yes” instances is recursive. – All strings w that are accepted by the TM with w as it’s encoding. – There is a TM that recognizes the language. – All encodings for TMs that do accept their encoding when input • We showed that L u is not recursive. An unsolvable problem Reducing one language to another • L u corresponds to the “yes encodings” of • One method of showing whether a given the decision problem: decision problem is unsolvable is to convert the encoding of the problem into another – Given a Turing Machine M, does it accept it’s that we know to be either solvable or own encoding. (Self-accepting) unsolvable. • This is called reducing one language to • Since L u is not recursive, this problem is another. unsolvable. Reducing one language to another Reducing one language to another • Formally, • Informally, – Let L 1 and L 2 be languages over Σ 1 and Σ 2 – We can take any encoded instance of one problem – We say L 1 is reducible to L 2 if • Use a TM to compute a corresponding encoded • There exists a Turning computable function * → Σ 2 instance of another problem. • f: Σ 1 * such that • If this other problem has a TM that recognizes the set of “yes encodings”, we can run that TM to solve • x ∈ L 1 iff f(x) ∈ L 2 the first problem. 3
Reducing one language to another Reducing one language to another • Key facts: – If L 1 is reducible to L 2 then Instance • If L 2 is recursive then L 1 is also recursive Corresponding Conversion of P 1 TM • If L 1 is not recursive then L 2 is not recursive. TM Instance of P 2 recognizing – If P 1 and P 2 are decision problems with L 1 and L 2 L 2 the languages of “yes encodings” respectively and if L 1 is reducible to L 2 then • If P 2 is solvable then P 1 is also solvable • If P 1 is unsolvable then P 2 is also unsolvable YES NO Reducing one language to another The halting problem – If L 1 is reducible to L 2 then • Let’s consider a more general problem about TMs. • If L 1 is not recursive then L 2 is not recursive. – Given a TM, M, and a string w, is w ∈ T(M)? – Proof – Given a TM, M and a string w • Assume L 2 recursive • Will M halt and accept on input w? • Consider x 1 ∈ L 1 – Note: original TM only halted when accepted • Consider x 2 ∉ L 1 • We found a TM for recognizing L 1 • Contradiction! – We simply cannot just run the string on the TM since if w ∉ L(M), M might go into an infinite loop. • L 2 is not recursive The halting problem The halting problem • If L 1 is reducible to L 2 then • The halting problem is unsolvable • If L 2 is recursive then L 1 is also recursive • If L 1 is not recursive then L 2 is not recursive. • Proof: – We can use an argument similar to that used to • Let’s show that Self-Accepting can be show that L u is not recursive. reduced to the halting problem. – Instead, let’s use reduction – L 1 = Self Accepting – L 2 = Halting 4
The halting problem Reducing one language to another • Let’s show that Self-Accepting can be reduced to the halting problem. Instance – For an encoding of an instance of SA, I, we can Corresponding Conversion of SA TM define a function TM Instance of HALT recognizing • f(I) = I’ HALT • Such that I’ is an encoding of an instance of Halt and • I will be self-accepting iff I’ halts/accepts. YES NO The halting problem The halting problem • f(x) = (x, e(x)) • Instance of SA = (T) an encoded TM, T • Instance of halt = (T’, w) an encoded TM T’ • Does this meet our requirement? and encoded string w to run on the TM – If x is an encoding for a TM that self-accepts, – Then x will certainly accept e(x) as specified by f. • We want T to accept e(T) iff T’ accepts w – If x is not an encoding for a TM that self-accepts then – Instance of halt: either: • x is a bogus encoding or • f(x) = (x, e(x)) • x is an encoding for a TM that will not accept it’s own encoding. • In either case (x, e(x)) will not be in halt. The halting problem The halting problem • We showed that L 1 is reducible to L 2 where • Practical considerations: – L 1 is the set of encodings for “yes instances” of – Since the halting problem is unsolvable, there is the self-accepting problem no algorithm to determine: – L 2 is the set of encodings for “yes instances” of • Given a computer program the halting problem. • Will this program always finish? – Alternately will it ever enter an infinite loop. – We know that the self-accepting problem is unsolvable, thus, the halting problem is unsolvable. 5
Reducing one language to another • Important observations – Reduction operates on strings from languages • Reducing encodings of different problems – If L 1 is reducible to L 2 then • If L 2 is recursive then L 1 is also recursive • If L 1 is not recursive then L 2 is not recursive. – Questions? 6
Recommend
More recommend