CSE 4111/5111/6111 Computability Jeff Edmonds Assignment 3: Diagonalization & Halting Problem Due: One week after shown in slides

Similar documents
CSE 4111/5111/6111 Computability Jeff Edmonds Assignment 6: NP & Reductions Due: One week after shown in slides

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

1 Showing Recognizability

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Lecture Notes: The Halting Problem; Reductions

Turing Machine Recap

1 Reals are Uncountable

Introduction to Turing Machines. Reading: Chapters 8 & 9

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

Some. AWESOME Great Theoretical Ideas in Computer Science about Generating Functions Probability

1 Acceptance, Rejection, and I/O for Turing Machines

Warm-Up Problem. Please fill out your Teaching Evaluation Survey! Please comment on the warm-up problems if you haven t filled in your survey yet.

Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Computability, Undeciability and the Halting Problem

CSE 311: Foundations of Computing. Lecture 27: Undecidability

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Turing Machines Part III

CSE 105 THEORY OF COMPUTATION

Computational Models Lecture 8 1

A Universal Turing Machine

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CSE 105 THEORY OF COMPUTATION

CSCE 551: Chin-Tser Huang. University of South Carolina

Computational Models Lecture 8 1

CS6901: review of Theory of Computation and Algorithms

2 Computable and Computably Enumerable Sets

CS3719 Theory of Computation and Algorithms

CS 361 Meeting 26 11/10/17

Computational Models Lecture 8 1

CS 125 Section #10 (Un)decidability and Probability November 1, 2016

Complexity and NP-completeness

Computability Crib Sheet

CSCI3390-Lecture 6: An Undecidable Problem

Decidability. Linz 6 th, Chapter 12: Limits of Algorithmic Computation, page 309ff

Advanced topic: Space complexity

CSE 311: Foundations of Computing. Lecture 26: More on Limits of FSMs, Cardinality

CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010

Cardinality of Sets. P. Danziger

Chapter 1 Review of Equations and Inequalities

Foundations of Computer Science Lecture 23 Languages: What is Computation?

M. Smith. 6 September 2016 / GSAC

where Q is a finite set of states

(a) Definition of TMs. First Problem of URMs

CSE 105 Theory of Computation

CP405 Theory of Computation

CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems

CS154, Lecture 17: conp, Oracles again, Space Complexity

CPSC 421: Tutorial #1

Algorithms: Lecture 2

Languages, regular languages, finite automata

Turing Machines. Lecture 8

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 20. To Infinity And Beyond: Countability and Computability

Great Theoretical Ideas

1 Computational Problems

16.1 Countability. CS125 Lecture 16 Fall 2014

Turing Machines, diagonalization, the halting problem, reducibility

CSE 311: Foundations of Computing. Lecture 26: Cardinality, Uncomputability

ACS2: Decidability Decidability

Notes for Lecture Notes 2

Theory Bridge Exam Example Questions

Modern Algebra Prof. Manindra Agrawal Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

Midterm II : Formal Languages, Automata, and Computability

ON COMPUTAMBLE NUMBERS, WITH AN APPLICATION TO THE ENTSCHENIDUGSPROBLEM. Turing 1936

Theory of Computation

Great Theoretical Ideas in Computer Science. Lecture 5: Cantor s Legacy

CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb)

Preface These notes were prepared on the occasion of giving a guest lecture in David Harel's class on Advanced Topics in Computability. David's reques

1 Definition of a Turing machine

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Great Theoretical Ideas in Computer Science. Lecture 7: Introduction to Computational Complexity

Turing s thesis: (1930) Any computation carried out by mechanical means can be performed by a Turing Machine

Computability Theory

15-251: Great Theoretical Ideas in Computer Science Fall 2016 Lecture 6 September 15, Turing & the Uncomputable

One-to-one functions and onto functions

What is proof? Lesson 1

Reductions in Computability Theory

CSE 311: Foundations of Computing. Lecture 26: Cardinality

Part I: Definitions and Properties

V Honors Theory of Computation

CSE 311 Lecture 28: Undecidability of the Halting Problem. Emina Torlak and Kevin Zatloukal

Undecidable Problems and Reducibility

Undecidability and Rice s Theorem. Lecture 26, December 3 CS 374, Fall 2015

Homework 8. a b b a b a b. two-way, read/write

Decidability and Undecidability

Turing s 1935: my guess about his intellectual journey to On Co

Automata Theory CS S-FR2 Final Review

(2) Generalize De Morgan s laws for n sets and prove the laws by induction. 1

Countability. 1 Motivation. 2 Counting

CSCE 551 Final Exam, Spring 2004 Answer Key

6-1 Computational Complexity

Most General computer?

Computational Tasks and Models

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009

Transcription:

CSE 4111/5111/6111 Computability Jeff Edmonds Assignment 3: Diagonalization & Halting Problem Due: One week after shown in slides First Person: Second Person: Family Name: Family Name: Given Name: Given Name: Student #: Student #: Email: Email: Guidelines: You are strongly encouraged to work in groups of two. Do not get solutions from other pairs. Though you are to teach & learn from your partner, you are responsible to do and learn the work yourself. Write it up together. Proofread it. Please make your answers clear and succinct. helpful hints. Relevant Readings: 02-Computable Slides from the lectures Cooks (pg 71) notes This page should be the cover of your assignment. Problem Name Max Mark 1 Rationals 10 2 Power Sets 20 3 Describable Reals 10 Total 40

1. Rationals: (a) Each fraction has an infinite description, eg 1 3 = 0.33333... Didn t we say that this means the set of fractions Q is uncountable? Explain why or why not. (b) Study the prove that the set of real numbers is uncountable. Use the exact same proof to show that Q is uncountable. What if anything goes wrong in the proof? 2. Power Sets: Let U be a set of objects. In this question we will first have it be the set of positive integers and then be the set of positive reals less than one. The power set of U is the set of all subsets of U. If U is finite, then its power set has cardinality 2 U elements. Hence, power set of U is often denoted by 2 U = {s s U}. Similarly, denote 2 U finite = {s s U and s is finite}. We will consider the relative sizes of U, 2 U finite, and 2U. (a) Recall that we say 2 U finite U if a function F : 2U finite U such that s 2U finite,f(s) U and s,s 2 U finite, s s F(s) F(s ). A common way to prove s s F(s) F(s ) is to provided the inverse function F 1 and prove that s F 1 (F(s) = s. (Though I did want you think about this, I don t ask you to do it.) i. Let U = N denote the set of positive integers. Then 2 N finite denotes the set of finite subsets of N. Prove that 2 N finite is countable by defining a concrete function F(s) = u s mapping each finite subsets s of the positive integers to a unique integer u s. Use the ascii technique given in the slides. - If s = {24,8}, what is F(s)? - What happens if you don t encode the commas? - Does the fact that the integers in s can be put into different orders create a problem? - What two properties of s are key in proving that for every s 2 N finite, F(s) is a finite integer? - Look at the ASCII table. Why might I have gotten nervous about using the decimal code instead of the hex code? ii. Let R [0,1) denote the set of positive reals less than one. Let 2 R [0,1) finite denote the set of finite subsets of R [0,1). Let R denote the set of reals (possibly bigger than one). Prove that 2 R [0,1) finite has cardinality at most that of R by defining a concrete function F(s) = x s mapping each finite subsets s of the positive reals less than one to a unique real x s. Be as explicit as you can. Hint: Interweave the bits. Be sure (but don t prove) that for your construction, for every s 2 N finite, F(s) is valid real number and that if s and s 2 R finite are different then F(s) F(s ). (b) A Hierarchy of infinities. i. Prove that for every set U, the cardinality of 2 U is strictly bigger than that of U, i.e. 2 U > U. In our third definition of 2 U U, we argued that if each object u U is able to hit at most one element F 1 (u) = s 2 U and this process manages to hit every element s 2 U, then it follows that 2 U U. Conversely, we prove 2 U > U, by proving that inverse functions F 1 from U ideally to 2 U, s new 2 U, u U,F 1 (u) s new. Your proof should use the first order logic game between the adversary and the prover. Note unlike the proof that R > N, the set U might not be countable and hence can t be listed and hence the diagonal can be visualized. Hint: Woody Allen once said that he did not want to be a member of any club that would have him as a member. In this spirit, for each person, put him in the heaven club iff he is not in the club that is mapped to him. 2

ii. We can use the previous theorem that for every set U, 2 U > U to get many great results. For example, if U is the set of natural numbers N, then we get that 2 N > N giving that the set 2 N of subsets of N is uncountable. (We did not prove it, but 2 N has the same cardinality as the reals R.) As a second example, let U be the set of reals R, then we get that 2 R > R giving that the set 2 R of subsets of R is a bigger infinity than the number of reals. Prove by that there are a hierarchy of an infinite number of different sizes of infinity. 3. Computable and Describable Reals (a) A real number x is said to be computable if there is a Java program that on input zero prints out the decimal representation of x from left to right. Note that at no point in time will all of the digits of x be printed out, but for each digit of x, there will be an eventual time at which this digit will be printed out. Use the words taught in class to prove in one sentence whether or not all real numbers computable. (b) A real number x is said to be describable if it can be unambiguously denoted by a finite piece of English text. For example, x = 2 is described as Two and x = Π as The area of a circle of radius one. Use the words taught in class to prove in one sentence whether or not all real numbers describable. (c) Prove that every computable real is also describable. (d) Prove whether or not there a real number that can be described, but not computed? Let x be the smallest real number that is not computable is not a valid answer for the same real that Let x be the smallest real number that is bigger than zero is ill defined. Hint: Use a diagonalization proof. 4. Not recursive enumerable. A computational problem is recursive enumerable if there is a program such that on every yes instance the program halts with the answer yes and on every no instance it can either halt with a no or can run forever. The halting problem is recursively enumerable because on yes instances <x,i> the program phi_x does halt on input I and hence our program for the halting problem when simulating it can halt with a yes. On the other hand, the not-halting problem is not r.e. because here on yes instances <x,i> the program phi_x does NOT halt on input I and hence our program for the not-halting problem when simulating it must run for ever to know. Hence we prove that problem P is not r.e. by the reduction not-halting <= P. It is key that in this reduction that we do not switch the roles of yes and no, i.e. when the oracle says yes, we say yes too and when the oracle says no we say no too. 1a) A = { x : phi_x outputs exactly 5 distinct elements } eg for every input either outputs {1,2,3,4,5} or runs forever. This problem combines Halting and non-halting because when we say yes on instance x when \phi_x halts on I with output 1 and we say yes when 3

\phi_x does not halt on I. This means that A is neither r.e. or co-r.e. We will prove that not-halting <= A. Assume we have a quick algorithm for A. We design an Alg for Halting as follows. Let <x,i> be the input to the Halting. Let phi_x be the program that takes I as input if I in {1,2,3,4,5} then phi_x halts with output I. else phi_x simulates phi_x on I. then phi_x halts and outputs 6. We give x to our algorithm for A. If it says yes we say yes and if it says no than we say no. We now prove that this algorithm solves not-halting. If phi_x does not halt on I, then phi_x outputs {1,2,3,4,5} on {1,2,3,4,5} and other wise runs forever. Hence, x is in A and hence the oracle and we say yes. If phi_x does halt on I then phi_x outputs value 6 on other inputs. Hence, x is not in A and hence the oracle and we say no. This completes the reduction. We know that not-halting is neither recursive enumerable or recursive. Hence neither is A. 1b) D = { x : phi_x is the characteristic function of some set} = { x : exists a set S such that phi_x(i)=1 I in S phi_x(i)=0 I not in S. = { x : phi_x halts on every input and has range {0,1} } The difficulty in proving that D is not recursively enumerable is that the halting problem is recursively enumerable because on yes instances <x,i> the program phi_x does halt on input I and hence our program for the halting problem when simulating it can halt with a yes. More over, if D asked whether phi_x halted on say the first million inputs then this would also be r.e. because if the answer was yes, the program for D could wait until all million computations halted. But D asks whether an infinite number of computations halt. Suppose on the t^th input the computation runs for t time steps. Then a program for D would have to run forever to check that each of these computations halted. This is the motivation for the following reduction. Note that the not-halting problem is not r.e. because here on yes instances <x,i> the program phi_x does NOT halt on input I and hence our program for the not-halting problem when simulating it must run for ever to know. Hence we prove that D is not r.e. by the reduction not-halting <= D 4

We will prove that not-halting <= D. Assume we have a quick algorithm for D. We design an Alg for Halting as follows. Let <x,i> be the input to the Halting. Let x be the program that takes t as input if phi_x(t) runs at least t steps then * x halts and outputs 1. else x halts and outputs 6. We give x to our algorithm for D. If it says yes we say yes and if it says no than we say no. We now prove that this algorithm solves not-halting. If phi_x does not halt on I, then it run at least t steps for every t. then x for each input t halts and outputs 1. Hence, x is in D and hence the oracle and we say yes. If phi_x does halt on I after t time steps then x outputs value 6 on input t+1. Hence, x is not in D and hence the oracle and we say no. This completes the reduction. We know that not-halting is neither recursive enumerable or recursive. Hence neither is D. It is a little interesting that that this reduction for D also works for A but not visa versa. 1a) A = { x : phi_x outputs exactly 5 distinct elements } The proof can be exactly the same as for 1b except the line marked * is changed to * if t in {1,2,3,4,5} then x halts and outputs t else x halts and outputs 5. In this way if phi_x does not halt on I, then x halts on every input and its range is {1,2,3,4,5} else x also outputs 6. We know that not Halting is neither recursive enumerable or recursive. Hence neither is A. 5. Undecidability Threshold of xm(x) = 0 for Really Simple Machines M. The Halting Problem is undecidable (uncomputable) because the given Turing Machine M might run arbitrarily long on the one given input x. The statement of Rice s Theorem talks about the requirement for each of M s instances x, but its proof still relies only on the length of the computation on a single instance. But want if we force the machine to be a linear time, log space, read once automata, but we want to know what this machine does on every instance, for example xm(x) = 0 or x,y,m(x,y) = M(y,x). We prove that this too is undecidable if M is allowed (1+ǫ)n time and (1+o(1))log n space but is linear time decidable if it is allowed only n+o(1) time or only (1 o(1))log n space. Def n : Define a Deterministic t time s space Automata (DA(t,s)) A to be similar to a Deterministic 5

Finite State Automata (DFA) except that it uses t time and s space. It is a two binary tape Turing Machine. The input is read in one pass on the first tape, i.e. the head never goes left or writes. The second tape is a work tape that can only use t(n) time and s(n) cells on instances of length x = n. Thm 1: If is undecidable whether or not a DA((1+ǫ)n,(1+o(1))log n) A outputs zero on every instance x. Thm 2: If can be decided in linear time whether a DA(n+O(1), ) A outputs zero on every instance x. Thm 3: If can be decided in linear time whether a DA((,(1 o(1))log n) A outputs zero on every instance x. Intuition: This problem is hard because x can be arbitrarily long. We do a reduction to the halting problem, which is hard because M s computation might be arbitrarily long. Hence, we have x encode the length of M s computation. Def n : Given a Turing Machine M, define A M to be the following DA((1+ǫ )n,(1+o(1))log n). On instance x, A M first counts in binary every 1 ǫ bit of x on its first tape. This takes (1+2ǫ)n time and log( 1 ǫ n) space. Next A M counts the log( 1 ǫn) bits used on it second tape. It then knows the value log log( 1 ǫ n) because this is how much tape it uses for the second count. Then A M simulates M on the zero instance for this number of time steps. If it halts during this time, A M outputs one, otherwise it outputs zero. These last two steps each take o(1)n time and o(1)log(n) space. Proof of Thm 1: Clearly M halts on the zero instance if and only if it is not true that A M outputs zero on every instance x. The halting problem is undecidable and hence so is this problem. (Commutablity: The same proof works if the problem is not xa M (x) = 0, but is x,y,a M (x,y) = A M (y,x). A M will be designed at before using it s input x and ignoring its input y. If M does not halt, then x,y,a M (x,y) = 0 = A M (y,x). If M does halt then there is some sufficiently large instance x and sufficiently small instance y such that A M (x,y) = 1 and A M (y,x) = 0.) Lemma: If a DA A uses at most (1 o(1))log n space, then it uses at most O(1) space and hence is a DFA. Proof: Suppose it uses at most (1 o(1))log n space and has q states in it s finite automata. Then there must be a constant s such that A uses at most s space on every an instance x of length n = q2 s 1. With s space on the second tape, A has at most q2 s configurations. Hence, for each such instance x, there must have been at least two times as it moved its head right n times on the first tape, at which it was in the exact same configuration. Hence, on an arbitrarily long instance x extending x, A must cycle and hence use at almost s = O(1) space. Lemma: If a DA A uses at most n+o(1) time, then it uses at most O(1) space and hence is a DFA. Proof: If it uses at most n+o(1) time, then there must be a constant s such that for each instance x of length n = q2 s 1, either A devotes at most s time and hence s space on the second tape or A does not spend the required n time to read to the end of x on its input tape. Note that on different x, A could make a different choice here. In the first case, A cycles as before. In the second case, A does not know about the end of its input. Either way, such an x can be extended arbitrarily without A using more than O(1) space. Lemma: It can be decided in linear time whether or not a DFA A outputs zero on every instance x. Proof of Lemma and of Theorem 2 and 3: Given an n bit description of a DFA A, consider its transition graph through its at most n transition edges. It outputs a nonzero on some instance iff there 6

is a path in this graph from its start state to a state outputting such a value. This can be determined in O(n) time using depth first search. 7