230 likes | 395 Views
Undecidable Languages (Chapter 4.2). H éctor Muñoz-Avila. Undecidable Languages. We are going to make 2 proofs: An existence proof: We show that a language L must exist that cannot be decided/recognized with Turing machines without actually showing L A constructive proof
E N D
Undecidable Languages(Chapter 4.2) Héctor Muñoz-Avila
Undecidable Languages • We are going to make 2 proofs: • An existence proof: • We show that a language L must exist that cannot be decided/recognized with Turing machines without actually showing L • A constructive proof • We show that the halting is not decidable
Irrational number exist • Greek mathematicians • Deadly controversial • 6th century BC • Turing machines • Formal model of computation • Decidable languages and enumerability results • There are many more Real numbers than there are natural numbers • There are as many rational numbers as there are natural numbers • controversial • Late 1800’s • Cantor • Turing machines capture any algorithm • Some problems cannot be solved by computers • Gödel incompleteness theorem • Gödel numberings • 1930’s The Existence Proof: History
Comparing Sets • Two sets A and B have the same size if:
Comparing Sets • Two sets A and B have the same size if: • There is a function f: A B that is bijective
Comparing Sets • Two sets A and B have the same size if: • There is a function f: A B that is bijective
Countable Sets • The set of all Natural numbers: • N = {1, 2, …} • Set A is countable if it has the same size as N • Example: The set of all integers have the same size as N. The function f is bijective: • f(n) = -((n-1)/2) (if n is odd) • f(n) = (n/2) (if n is even)
Countable Sets • The set of all Natural numbers: • N = {1, 2, …} • It is easier to think of countable sets as those that can be enumerated with an enumerated Turing machine Program enumerateAllIntegers() n 1 while (true) { if odd(n) then print(-((n-1)/2)) else print(n/2) n n + 1 } Program enumerateAllNaturals() n 1 while (true) { print(n) n n + 1 }
The set of All Rational Numbers is Countable • Q = {p/q | p, q N} {0} • Perhaps easier than finding a function f: N Q that is bijective is to think of a Turing machine that enumerates Q • See blackboard for a description of the procedure • Same as described in Example 4.15
The Real Numbers • R= “the set of all real numbers” • We can show that R has the same size as (-/2,/2) by using: • f(x) = tan(x) • In general: R has the same size as (a,b) for any two real numbers with a < b • You studied this in Calc I
The Real Numbers are Not Countable • Proof: see blackboard • Same as Theorem 4.17
There Exists a Non-decidable l Language Three steps (Corollary 4.18): (1) M = “set of all binary encodings of Turing machines” is countable (2) L = “set of all binary sequences of languages” is not countable (3) Hence, there exists a language l, <l>L such that no Turing machine can decide it
Step 1: M is Countable • It is easy to construct a procedure that enumerates (choose one): • All Turing machines • All C++ programs • All Java programs • See blackboard for procedure • Homework for Monday asks you to reconstruct this procedure • Actual mathematical proof uses Godel numberings (not in the book)
Step 2: L is not countable • Assume = {0,1} (the proof works with any finite alphabet) • Consider * listed in Lexicographical Order • We define the characteristic sequence <L> for a language L • We define: • L = {<L>| L is a language in } • See blackboard for preliminaries • Homework for Monday asks you to finish the proof
Step 3 • Because: • M = “set of all Turing machines” is countable • L = “set of all languages” is not countable • We can now proof that there exists a language l in L such that no Turing machine can decide it
Does the following program halts? Source: http://faculty.orangecoastcollege.edu/sgilbert/CS170S09/u05/E.html
Does the following program halts? Source: http://snap.nlc.dcccd.edu/learn/fuller3/chap10/chap10.html
A Concrete Undecidable Language • The halting problem is not decidable • Formally, the following set is not decidable: • HALT = {<M,w> | M is a Turing machine, w *, M halts on input w} Kleene Gödel Church Barkley Rosser Turing
Note • Modern program editors detect instances of infinite loops • Does this contradict the statement that HALT is undecidable? Editor says: “Warning potential infinite loop here”
A Paradox “In Sevilla, Spain lives Pepe a barber who…”
Actual Proof • First: example of a situation where a write a program M and pass as parameter the binary encoding of <M> • i.e., call M(<M>) • Proof by contradiction: • Assume that HALT is decidable: • HALT = {<M,w> | M is a Turing machine, w *, M halts on input w} • Let H be a decider for HALT • Rest of the proof in the blackboard: (Theorem 4.11)