CS 3719 (Theory of Computation and Algorithms) Lecture 4

Similar documents
Computability Theory

Turing Machines: An Introduction

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

3515ICT Theory of Computation Turing Machines

Notes on Complexity Theory Last updated: August, Lecture 1

Computational Models Lecture 8, Spring 2009

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

Lecture 2: Universality

1 Definition of a Turing machine

Introduction to Turing Machines

Chapter 7 Uncomputability

The Halting Problem is Undecidable

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

CAs and Turing Machines. The Basis for Universal Computation

Automata and Computability. Solutions to Exercises

Turing Machines, Part I

Reading 13 : Finite State Automata and Regular Expressions

Regular Languages and Finite Automata

24 Uses of Turing Machines

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Automata and Formal Languages

Georg Cantor ( ):

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

4.6 The Primitive Recursive Functions

Introduction to Theory of Computation

NP-Completeness and Cook s Theorem

Theory of Computation Chapter 2: Turing Machines

This asserts two sets are equal iff they have the same elements, that is, a set is determined by its elements.

Georg Cantor and Set Theory

8 Primes and Modular Arithmetic

Models of Sequential Computation

MATH10040 Chapter 2: Prime and relatively prime numbers

This chapter is all about cardinality of sets. At first this looks like a

Set Theory Basic Concepts and Definitions

Introduction to computer science

How To Understand The Theory Of Computer Science

3. Mathematical Induction

Introduction to Automata Theory. Reading: Chapter 1

Lecture 16 : Relations and Functions DRAFT

Turing Machines and Understanding Computational Complexity

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

Cardinality. The set of all finite strings over the alphabet of lowercase letters is countable. The set of real numbers R is an uncountable set.

On the Structure of Turing Universe: The Non-Linear Ordering of Turing Degrees

Universality in the theory of algorithms and computer science

Deterministic Finite Automata

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

1. Prove that the empty set is a subset of every set.

11 Multivariate Polynomials

Follow links for Class Use and other Permissions. For more information send to:

Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

Handout #1: Mathematical Reasoning

Computation Beyond Turing Machines

6.080/6.089 GITCS Feb 12, Lecture 3

Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, School of Informatics University of Edinburgh als@inf.ed.ac.

C H A P T E R Regular Expressions regular expression

Outline 2. 1 Turing Machines. 2 Coding and Universality. 3 The Busy Beaver Problem. 4 Wolfram Prize. 5 Church-Turing Thesis.

Basic Concepts of Set Theory, Functions and Relations

Hypercomputation: computing more than the Turing machine

Today s Topics. Primes & Greatest Common Divisors

6.2 Permutations continued

1 Solving LPs: The Simplex Algorithm of George Dantzig

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

CS 301 Course Information

Page 331, 38.4 Suppose a is a positive integer and p is a prime. Prove that p a if and only if the prime factorization of a contains p.

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

Linear Programming Notes V Problem Transformations

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

Universal Turing Machine: A Model for all Computational Problems

Lecture 17 : Equivalence and Order Relations DRAFT

THE SEARCH FOR NATURAL DEFINABILITY IN THE TURING DEGREES

Turing Machines, Busy Beavers, and Big Questions about Computing

Triangle deletion. Ernie Croot. February 3, 2010

The last three chapters introduced three major proof techniques: direct,

Chapter 1. Computation theory

Chapter 11 Number Theory

Mathematical Induction

Hilberts Entscheidungsproblem, the 10th Problem and Turing Machines

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

8 Divisibility and prime numbers


Lecture 1. Basic Concepts of Set Theory, Functions and Relations

CHAPTER 2. Logic. 1. Logic Definitions. Notation: Variables are used to represent propositions. The most common variables used are p, q, and r.

Our Primitive Roots. Chris Lyons

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

NUMBER SYSTEMS. William Stallings

Math 4310 Handout - Quotient Vector Spaces

1 if 1 x 0 1 if 0 x 1

Automata on Infinite Words and Trees

Mathematical Induction. Lecture 10-11

Set theory as a foundation for mathematics

Lecture 36: Turing Machines [Fa 14]

Notes on Complexity Theory Last updated: August, Lecture 1

Just the Factors, Ma am

Transcription:

CS 3719 (Theory of Computation and Algorithms) Lecture 4 Antonina Kolokolova January 18, 2012 1 Undecidable languages 1.1 Church-Turing thesis Let s recap how it all started. In 1990, Hilbert stated a list of problems for mathematicians of the next century; some of these problems asked to devise a procedure ; two of those problems are devise a procedure for solving an equation over integers (Diophantine equations) that you have seen in the first lecture, and devise a procedure that, given a statement of mathematics, would decide if it is true or false. Alan Turing was working on Hilbert s problem that asked for an algorithm that for any statement of mathematics would state whether it is true or false; Gödel has shown (his famous Incompleteness Theorem) that there are statements of mathematics for which such answer cannot be given, but it remained open at that time whether there is such a procedure for statements for which that answer could be given. There were several mathematicians working on this problem at that time; notably, Alonco Church solved this problem (to give a negative answer) at about the same time, by inventing lambda-calculus. Turing s approach is somewhat more computational: he defined a model of computation which we now call the Turing machine, equivalent to Church s model in terms of power, and used it to show undecidability results, thus giving a negative answer to Hilbert s problem. Definition 13 (Church-Turing thesis). Anything computable by an algorithm of any kind (our intuitive notion of algorithm) is computable by a Turing machine. The material in this set of notes came from many sources, in particular Introduction to Theory of Computation by Sipser and course notes of U. of Toronto CS 364. Many thanks to Richard Bajona for taking notes! 1

Since this statement talks about an intuitive notion of algorithm we cannot really prove it; all we can do is that whenever we think of a natural notion of an algorithm, show that this can be done by a Turing machine. In this lecture we will show that even though Turing machines are considered to be as powerful as any algorithm we can think of, there are languages that are not computable by Turing machines. Thus, for these languages, it is likely that no algorithm we can think of would work. We will present two proofs of existence of undecidable languages. The first proof is nonconstructive, using Cantor s diagonalization. The second proof presents an actual language that is undecidable. 1.2 Diagonalization The Diagonalization method is used to prove that two (infinite) sets have different cardinalities, that is, a set A is larger than the set B. By definition of cardinalities, this means that there is no one-to-one correspondence between elements of the two set, so the elements of A cannot be enumerated by elements of B. The proof is by contradiction: assume that there is such a enumeration. Then, construct an element of A which is not in the list. In our case, the larger set A will be the set of all languages (for simplicity, over Σ = {0, 1}, but any alphabet with at least 2 symbols will work). And B will be the set of all Turing machines. First, let us say how we describe languages. Recall that a characteristic string of a set is an infinite string of 0s and 1s where, for a given order (usually lexicographic order) of elements in the set there is a 0 in i th position in the string if i th element in the order is not in the set and 1 if it is in the set. For example, for a set L = {1, 01} over {0, 1} the characteristic string would be 00101000...00..., since out of the lexicographic ordering {ɛ, 0, 1, 00, 01, 10, 11, 000,... } of {0, 1} only the 3rd and 5th elements are in L. Thus, for every language over {0, 1} (or any alphabet with at least 2 elements) there is a (unique) characteristic string describing this language. Now, we need to describe Turing machines and state how to enumerate them (show that the set of all Turing machines is countable). For that, we show that every Turing machine can be encoded by a distinct finite binary string (and is thus a subset of all finite binary strings, which is countable since every string can be treated as a binary number with the leading 1 missing). To encode a Turing machine, it is sufficient to write, in binary, the tuple (Q, Σ, Γ, δ, q 0, q accept, q reject ). However, we are not interested in specific names of symbols in Q, Σ, Γ; we are just interested in how many symbols are in each. A Turing machine which accepts all even-length strings over {a, b} operates exactly the same way as a Turing machine accepting all even-length strings over {0, 1}, with a changed to 0 and b changed to 1 everywhere in its description. 2

We assign an order to elements of Q, Σ and Γ, and refer to elements as 1st symbol of Σ, 5th state in Q and so on. So all we need to write is the number of states in Q (for simplicity, we can even rename states to have q 0 be the first state in the list, q accept second and q reject third, since every Turing machine will have these three states), number of symbols in Σ and Γ (say Γ consists of Σ followed by followed by possible extra symbols). Finally, we need to write out δ, using the indices of symbols in Q, Σ and Γ in the description of transitions. Here is one way of doing the description. We can start by writing Q 1s, then a 0, then Σ 1s, then another 0, then Γ 1s, and a 0 again. We could also write all elements of δ in unary (since it is finite), but we can also do so in binary, by introducing a special separator symbol, into Σ. If we have to stick to Σ = {0, 1}, then we can still write δ in binary as follows: associate 11 with,, 00 with 0 and 01 with 1. For example, say we want to encode a transition (q 3, a) (q 4, b, L). With separators, it can be coded in binary as 11, 0, 100, 1, 0 (here, code L by 0 and R by 1). Using the transformation to encode the transition in binary obtain 010111001101000011011100. Note that this method of coding allows us to talk about all sorts of objects as an input to a Turing machine, be it Java code or descriptions of graphs. Notation 1. We will use the notation M to mean a binary string encoding of a Turing machine M. We can use the same notation to talk about encodings of other objects, e.g. M, w encodes a pair Turing machine M and a string w; N encoding a NFA N, G for a graph G and so on, Now, notice that for every Turing machine there is a finite binary description. Treating this description as a binary number, obtain an enumeration (by a subset of N of all Turing machines. Finally, we can do the diagonalization argument. Start by assuming that it is possible to enumerate all languages by Turing machines. Write elements of characteristic strings as columns, and Turing machine descriptions as rows. Put a 1 in cell (i, j) if the i th Turing machine M i accepts string number j in the enumeration, and 0 if it does not accept this string. We obtain a table as in the following example (for different enumerations of Turing machines the 0s and 1s would be different), and use diagonalization argument to construct a language not recognized by any Turing machine. Indeed, if that language were recognized by some Turing machine, say M k, it would be the string in the k th row of the table; however, it differs from the diagonal language in k th element. M 1 0 0 1 1 0 1 1 0 1... M 2 1 1 1 1 1 0 0 1 1... M 3 1 0 0 0 0 1 1 1 1... M 4 1 1 0 1 1 0 0 1 1... M 5 0 0 1 1 1 1 1 0 0... ots.......... D 1 0 1 0 0 1 1 0 1... 3

1.3 Universal Turing machine and undecidability of A T M In this section we will present a specific, very natural problem and show that it is undecidable. It will lead us to a whole class of problems of similar complexity. Definition 14. The language A T M = { M, w M is a Turing machine and w is a string over the input alphabet of M and M accepts w} That is, the language A T M consists of all pairs M, w of Turing machine + a string in L(M). Theorem 15. A T M is semi-decidable, but not decidable. Proof. Let us first show that A T M is semi-decidable. That is, there exists a Turing machine M AT M accepting all and only strings in A T M. Note that if M does not halt on w, neither does M AT M on M, w M AT M : On input M, w Simulate M on w. If M accepts w, accept. If M rejects w, reject. Note that the above algorithm is essentially an interpreter; that is a program which takes as input both a program P and an input w to that program, and simulates P on input w. In this case the program P is given by a Turing machine M. In particular, the Turing machine interpreter M AT M is known under the name of a Universal Turing Machine. Turing described a universal Turing machine in some detail in his original 1936 paper, an ideal which paved the way for later interpreters operating on real computers. This is quite a meta-mathematical concept, though: a single Turing machine, and a simple one at that, that could do the job of any other Turing machine provided it is given the description of the TM it is supposed to simulate and a string to work on. Now, let us show that A T M is not decidable. Assume for the sake of contradiction that it is, so there is a Turing machine H that takes as an input M, w and halts either accepting (if M accepted w) or rejecting (if M did not accept w). Now, define the following language: Diag = { M M is a Turing machine and M / L(M)}. That is, Diag is a language of all descriptions of Turing machines that do not accept a string that is their own encoding. This is exactly the diagonal language from our diagonalization table. Now, notice that H deciding A T M can also be used to decide Diag: H( (M, M ) ) halts and accepts if M accepts its own encoding and rejects if M does not accept its own encoding. A decider H Diag for Diag would run H( (M, M ) ) and accept if H rejects, reject if H accepts. But what should it do on input H Diag? It cannot accept this input, since that would mean 4

that H Diag accepts its own encoding, so it should not be in Diag. And it cannot reject its own encoding, since it would make it a Turing machine not accepting its own encoding and thus it has to be in Diag. Contradiction. This contradiction is akin to Russell s paradox from logic, and other self-referential paradoxes of the form I am lying. 1.4 Closure properties of decidable and semi-decidable languages Now, here is a question. Suppose you are given two languages, L 1 and L 2. What can you say about a language L 1 L 2 = {x x L 1 or x L 2? For example, suppose you are interested in all strings either code Turing machines or are prime numbers when viewed as a binary number; in this case, your L 1 could be all encodings of Turing machines and L 2 all prime numbers. Similarly, you may want to ask about L 1 L 2 which contains strings which are in both languages (that is, encodings of TMs which are primes when viewed as binary numbers, in our example.) Suppose you know that L 1 and L 2 are both decidable, or both semi-decidable what does it tell you about decidability (semi-decidability) of their union and intersection? Theorem 16. The class of semi-decidable languages is closed under union and intersection operations. Proof. Let L 1 and L 2 be two semi-decidable languages, and let M 1, M 2 be Turing machines such that L(M 1 ) = L 1 and L(M 2 ) = L2. We will construct Turing machines M L1 L 2 and accepting union and intersection of L 1 and L 2, respectively. M L1 L 2 Consider the union operation first; intersection will be similar. Let x be the input for which we are trying to decide whether it is in L 1 L 2. The first idea could be to try to run M 1 on x, and if it does not accept, then run M 2 on x. But M 1 is not guaranteed to stop on x, and we would still like to accept x if M 2 accepts it. So the solution is to run M 1 and M 2 in parallel, switching between executing one or the other. If at some point in the computation either M 1 or M 2 accepts, we accept; if neither accepts, can run forever but this is OK, because if neither M 1 nor M 2 accepts x then x / L 1 L 2. So we define M L1 L 2 as follows: M L1 L 2 : On input x Fori = 1 to Run M 1 on x for i steps. If M 1 accepts, accept. Run M 2 on x for i steps. If M 2 accepts, accept. 5

The intersection, in this case, is very similar. The only difference is that we accept at stage i if not just one, but both M 1 and M 2 accepted in i st eps. Corollary 17. A T M is not semi-decidable. Moreover, complement of any semi-decidable, but undecidable language is not semi-decidable. Proof. Otherwise, running Turing machines M AT M and M AT M simultaneously, as in the proof above, we could decide A T M. Same holds for any semi-decidable, but undecidable language. This shows that the class of semi-decidable languages is different (incomparable) from the class of co-semi-decidable ones. Also, there are languages that are neither semi-decidable nor co-semi-decidable. For example, consider a simple language 0 1A tm = {< M, w > TM M accepts 01 and loops on 1w}. Intuitively, testing if < M, w > is in the language requires solving an A T M problem and a A T M problem. The first one makes it not co-semi-decidable, the second not semi-decidable. 6