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