1 Incomputable Languages Zeph Grunschlag. 2 Announcements HW Due Tuesday.

Slides:



Advertisements
Similar presentations
By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman
Advertisements

Formal Models of Computation Part III Computability & Complexity
Computing functions with Turing machines
Chapter 11: Models of Computation
Turing Machines.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 17: ProvingUndecidability.
Turing Machines Variants
Introduction to Computability Theory
Finite-state Recognizers
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
PSSA Preparation.
Introduction to Computability Theory
Lecture 3 Universal TM. Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction,
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
The Pumping Lemma for CFL’s
CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
1 Section 14.1 Computability Some problems cannot be solved by any machine/algorithm. To prove such statements we need to effectively describe all possible.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture13: Mapping Reductions Prof. Amos Israeli.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Decidable and undecidable problems deciding regular languages and CFL’s Undecidable problems.
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
CHAPTER 4 Decidability Contents Decidable Languages
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
CS 310 – Fall 2006 Pacific University CS310 The Halting Problem Section 4.2 November 15, 2006.
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
MA/CSSE 474 Theory of Computation More Reduction Examples Non-SD Reductions.
The Halting Problem – Undecidable Languages Lecture 31 Section 4.2 Wed, Oct 31, 2007.
1 Undecidability Reading: Chapter 8 & 9. 2 Decidability vs. Undecidability There are two types of TMs (based on halting): (Recursive) TMs that always.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Great Theoretical Ideas in Computer Science about AWESOME Some Generating Functions Probability Infinity Computability With Alan! (not Turing) Mind-
A Universal Turing Machine
CS 3813: Introduction to Formal Languages and Automata Chapter 12 Limits of Algorithmic Computation These class notes are based on material from our textbook,
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Computability Universal Turing Machine. Countability. Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural.
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.3, 7.4 and 7.5.
Recursively Enumerable and Recursive Languages
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 4 Decidability Some slides are in courtesy.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability.
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.
The Acceptance Problem for TMs
CS 461 – Nov. 2 Sets Prepare for ATM finite vs. infinite Infinite sets
This statement is false.
Busch Complexity Lectures: Reductions
Undecidable Problems Costas Busch - LSU.
Lecture12 The Halting Problem
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
Decidable Languages Costas Busch - LSU.
Formal Languages, Automata and Models of Computation
CS21 Decidability and Tractability
Cpt S 317: Spring 2009 Reading: Chapter 8 & 9
Instructor: Aaron Roth
Turing Machines Everything is an Integer
CIS Automata and Formal Languages – Pei Wang
Presentation transcript:

1 Incomputable Languages Zeph Grunschlag

2 Announcements HW Due Tuesday

3 Agenda Incomputable Languages Existence Proof Explicit undecidable language: A TM Unrecognizable Language Neither recognizable nor corecognizable Example of a “real world” unsolvable problem

4 Incomputable Languages Are there questions of a computational nature which cannot be answered methodically? We saw last time that the computability viewpoint is to encode algorithmic problems as formal languages and then ask: Are there undecidable languages? Are there languages which are not even recognizable? Can we construct a specific language that’s undecidable? Are there “useful” undecidable languages?

5 Incomputable Languages Existential Proof We start first with an indirect proof that an undecidable language exists. In fact, we can show that a language exists that is neither recognizable nor corecognizable: I.e., there is no TM which halts on all positive instances, and there is no TM which halts on all negative instances so we have no way of necessarily telling when an arbitrary string is or isn’t in the language. The proof is “existential” in that a counting argument is used to show that the language must exist, but we don’t know a priori what the language is.

6 Incomputable Languages Existence Proof The idea is simple: We show that there are many more languages than Turing machines. Every TM can be encoded in binary by some string. Consequently the cardinality 1 of the set of TM’s is no greater than that of {0,1}*. Recall the notion of countable : A set S is countable if there is a 1-to-1 function f : S  N from S to the natural numbers. Equivalently, an infinite set is countable if there is a bijection N  S. THM: The set of bit strings {0,1}* is countable.

7 Countability of {0,1}* Proof. Intuitively we can strike up the 1-to-1 correspondence f : N  {0,1}* by listing the strings in short-lex order:  … … Can even give recursive definition for f : Can then use induction to prove that f is 1-to-1 and onto.

8 Countability of {TM-Languages} Consequently, as every TM is described by a bit string, there can only be as many TM’s as bit strings. In particular, the following sets are countable: L 1 = {recognizable languages} L 2 = {corecognizable languages} DEF: A language L over the alphabet  is corecognizable if  *-L is recognizable.

9 Countability of {TM-Languages} Therefore, L 1  L 2 = {languages which are accepted or rejected by a TM} is a union of countable sets so is countable itself. However, next we will see that the power set P ({0,1}*) –the set of binary languages!– is uncountable. As a corollary, there must be strictly more binary languages than languages in L 1  L 2. Therefore: THM: A language of bit strings exists which is neither recognizable nor corecognizable. So let’s prove that P ({0,1}*) is uncountable:

10 Uncountability of P (  *) Notice that any subset T in P (  *) can be viewed as a function  *  {0,1}. This is done by making the function take the value 1 for elements in the set, and the value 0 for elements not in the set. EG: Consider the function f :  *  {0,1} defined by the following table: Q: What language does f represent? x  … f (x) …

11 Uncountability of P (  *) A: f represents pal. Suppose that P (  *) were countable. Thus it would be possible to find a bijection from N to P (  *) and hence list all binary languages as a sequence L 1, L 2, L 3, L 4, L 5, L 6, L 7, … supposedly containing every language of bit strings. The lists creates a table whose rows describe the associated function for each subset: x  … f (x) …

12 Uncountability of P (  *)  … L L L L L L L  strings in {0,1}* 

13 Uncountability of P (  *) Cantor’s Diabolical Diagonal Cantor’s diabolical diagonalization argument takes this supposed table, and creates a language L evil that’s not on the list. I.e., one uses the table to create a row that’s not there proving that the table cannot be comprehensive –contradicting the countability assumption and proving that P (  *) is not countable.

14 Uncountability of P (S*) Cantor’s Diabolical Diagonal L evil is created as follows: The j th column of L evil is the opposite of the j th column of the j th row L i. In other words, L evil is the anti- diagonal of the table. This guarantees that L evil disagrees with every listed language on some string: If the j th language contains the j th string, then L evil doesn’t, and if the j th language doesn’t contain the j th string, then L evil does. Let’s see how this works in practice:

15 Cantor Diagonalization  … L 1 L 2 L 3 L 4 L 5 L 6 L 7... L evil  strings in {0,1}* 

16 Cantor Diagonalization  … L L 2 L 3 L 4 L 5 L 6 L 7... L evil 0  strings in {0,1}* 

17 Cantor Diagonalization  … L L L 3 L 4 L 5 L 6 L 7... L evil 01  strings in {0,1}* 

18 Cantor Diagonalization  … L L L L 4 L 5 L 6 L 7... L evil 011  strings in {0,1}* 

19 Cantor Diagonalization  … L L L L L 5 L 6 L 7... L evil 0110  strings in {0,1}* 

20 Cantor Diagonalization  … L L L L L L 6 L 7... L evil  strings in {0,1}* 

21 Cantor Diagonalization  … L L L L L L L 7... L evil  strings in {0,1}* 

22 Cantor Diagonalization  … L L L L L L L L evil  strings in {0,1}* 

23 Specifically Undecidable Okay, so now we know that there exist unrecognizable language. In fact, most languages are unrecognizable as the cardinality of P (  *) is a bigger infinity than that of  *! However, the existential proof is not constructive. We would like an explicit example of such a language. THM: A TM is recognizable but undecidable.

24 A TM : Recognizable but Undecidable A TM is recognizable as follows: “On input : 1. Simulate the TM M running on input x 2. If M accepts, then ACCEPT” This algorithm tells us when strings are accepted, but for rejected strings, there is no output, and even worse, for infinite loops, the algorithm gets caught in its own infinite loop as it’s simulating M’s infinite loop.

25 A TM : Recognizable but Undecidable A TM is undecidable: Suppose for contradiction, that A TM were decidable. Then some TM exists, call it D which decides A TM. Consider the implicit encoding scheme M . Use D to construct an evil TM E (in the spirit of Cantor) which we’ll show cannot exist thus proving that A TM must not be decidable.

26 The Evil TM E = “On input w 1. If w doesn’t encode a TM, REJECT. 2. Else, let M be the TM encoded by w. Simulate the machine D running on input. 3. If D accepts, REJECT 4. If D rejects, ACCEPT” Since D is a decider, so is E.

27 The Evil TM The following nagging problem remains: Does E accept or reject the self-encoding ? CASE 1) Accepts. Then D rejected the input >. Therefore, by step 4 of E’s pseudocode, E must not accept. This contradicts the assumption of acceptance! CASE 2) Rejects. Then D accepted the input >. Therefore, by step 3 of E’s pseudocode, E must accept. This contradicts the assumption of rejection! Thus neither case happens so D doesn’t exist!

28 Java Consequences The undecidability of A TM has far reaching consequences. For example: THM (assumes Church-Turing thesis): There is no algorithm for telling if an arbitrary Java program halts. I.e. the language Halt Java = { compiled Java programs that eventually exit on their own } is undecidable.

29 Undecidability of Halt Java Why? Suppose that Halt Java were decidable. Note that there are TM-simulators written in Java. Such a simulator TMSimulate.java would run by, taking two arguments arg1, arg2 as input with arg1 a TM encoding and arg2 a string which the TM will be run on. More specifically, TMSimulate.java contains the method: public static boolean run(String arg1, String arg2) which returns true if and only if M accepts arg2.

30 Undecidability of Halt Java The upshot: The following program would then solve A TM which contradicts the fact that the problem is undecidable (assuming that TM’s can in turn, simulate Java –which follows from the Church-Turing thesis but can also be demonstrated directly).

31 Undecidability of Halt Java public class D{ public static void main(String[] args){ if(TMSimulate.run(args[0],args[1])) System.exit(0); else while(true); } So if an algorithm for telling when Java program halted existed, would be able to tell when TM’s accept by seeing when the program above halts!

32 Undecidability of E TM and EQ TM Recall that E TM is the emptiness problem for Turing machines: “Given a TM M does L(M) =  ?” And that EQ TM is the equality problem: “Given TM’s M and M’ does L(M) = L(M’ )?” Notice that EQ TM at least as hard as E TM since E TM is a special case of EQ TM. Q: Why?

33 Undecidability of E TM and EQ TM A: Just set the second TM M’ to be a TM which rejects all inputs! So to prove that EQ TM is undecidable it suffices to show that E TM is undecidable and we can kill two birds with one stone: THM: E TM is undecidable. Proof. Suppose E TM were decidable. Let F be a decider for E TM. We’ll use F to solve A TM by applying F to a class of TM’s whose purpose is to encode the acceptance problem as instances of the emptiness problem.

34 Undecidability of E TM and EQ TM Given any TM M and string w construct a TM K M,w whose language is nonempty iff w is accepted by M. The description of K M,w is as follows: “On input x 1. Erase x and replace by w. 2. Simulate M running on input w.” So if M accepts w, K M,w accepts every possible x ! On the other hand, if M doesn’t accept w, then K M,w either rejects every x or goes into an infinite loop on every x. Summarizing:

35 Undecidability of E TM and EQ TM If E TM were solvable, we could decide when L(K M,w ) is empty, and therefore decide when M accepts w because of the fact: This completes the proof that E TM and consequently EQ TM are undecidable. The above is a specific case of a general technique for showing that new problems are undecidable by using reductions from previously known undecidable problems.

36 Undecidability of ALL TM The same fact shows that the the problem of telling if a TM accepts all inputs is also undecidable. Formally: ALL TM = “Given a TM M. Does L(M) =  * ?” Q: Is E TM recognizable? Corecognizable? How about ALL TM ?

37 Further Look at E TM A: E TM is corecognizable but not recognizable: We can tell when a TM isn’t empty by simulating the TM on all inputs –by dovetailng– and then outputting NON-EMPTY when the TM accepts some string. E TM is not recognizable because knowing when to answer “YES” would mean that we would know when to answer “NO” for A TM –by the construction above. But this is precisely what we cannot do, since we do know how to answer “YES” for A TM, and being able to also answer “NO” would mean that A TM is decidable.

38 Further Look at ALL TM On the other hand, ALL TM is an example of a language that is neither recognizable nor corecognizable, so is the explicit example of the language proved to exist earlier by the cardinality argument. We cannot answer “NO” to ALL TM as the reverse of the above argument for EQ TM would imply that would be able to answer “NO” to A TM. Thus ALL TM is not corecognizable. Furthermore, ALL TM is also not recognizable as follows:

39 ALL TM : Neither Recognizable nor Corecognizable Suppose we could recognize ALL TM. As TM enumerators convert into TM acceptors, would be able to recognize when a TM enumerates all possible strings. For each TM-string pair (M,w) consider the enumerator E M,w : 1. Simulate M running on w in the background. 2. At the same time, print out  *. 3. If the background simulation accepts, STOP! 4. If it rejects, print out  * forever. By construction, L(E M,w ) =  * iff M doesn’t accept w. Answering “YES” to ALL TM means we can answer “NO” to A TM which is impossible!