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

Similar documents
FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Theory of Computation (IX) Yijia Chen Fudan University

Turing machines COMS Ashley Montanaro 21 March Department of Computer Science, University of Bristol Bristol, UK

ACS2: Decidability Decidability

CSCI3390-Lecture 6: An Undecidable Problem

Reducability. Sipser, pages

Computational complexity

Lecture Notes: The Halting Problem; Reductions

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

Turing Machines Part III

Theory of Computation

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

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

V Honors Theory of Computation

Introduction to Turing Machines. Reading: Chapters 8 & 9

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

A non-turing-recognizable language

CPSC 421: Tutorial #1

Turing Machine Recap

Theory of Computation

CSE 105 THEORY OF COMPUTATION

acs-07: Decidability Decidability Andreas Karwath und Malte Helmert Informatik Theorie II (A) WS2009/10

UNIT-VIII COMPUTABILITY THEORY

Intro to Theory of Computation

CSE 105 THEORY OF COMPUTATION

Decidability: Church-Turing Thesis

Languages, regular languages, finite automata

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Undecidable Problems and Reducibility

Undecidability. Almost all Languages are undecidable. Question: Is it just weird languages that no one would care about which are undecidable?

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Section 14.1 Computability then else

Final exam study sheet for CS3719 Turing machines and decidability.

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Computability, Undeciability and the Halting Problem

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

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

TURING MAHINES

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

CS3719 Theory of Computation and Algorithms

Intro to Theory of Computation

CS6901: review of Theory of Computation and Algorithms

CP405 Theory of Computation

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

1 Showing Recognizability

Decidability (What, stuff is unsolvable?)

CSE 105 THEORY OF COMPUTATION

Decidability and Undecidability

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

Computational Models Lecture 7, Spring 2009

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

The Unsolvability of the Halting Problem. Chapter 19

Computability and Complexity

Theory of Computation

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

The Turing Machine. Computability. The Church-Turing Thesis (1936) Theory Hall of Fame. Theory Hall of Fame. Undecidability

CSCE 551 Final Exam, Spring 2004 Answer Key

Decidable and undecidable languages

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

Decidability (intro.)

Introduction to Languages and Computation

Computational Models Lecture 8 1

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Computational Models Lecture 8 1

Chap. 4,5 Review. Algorithms created in proofs from prior chapters

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

Theory of Computation p.1/?? Theory of Computation p.2/?? We develop examples of languages that are decidable

Decidable Languages - relationship with other classes.

Theory Bridge Exam Example Questions

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

17.1 The Halting Problem

Lecture 12: Mapping Reductions

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

CSE 105 THEORY OF COMPUTATION

3130CIT Theory of Computation

Advanced Undecidability Proofs

Computational Models Lecture 8 1

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

DM17. Beregnelighed. Jacob Aae Mikkelsen

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

CS5371 Theory of Computation. Lecture 15: Computability VI (Post s Problem, Reducibility)

Theory of Computation Turing Machine and Pushdown Automata

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Introduction to the Theory of Computing

1 Computational Problems

CS 361 Meeting 26 11/10/17

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Lecture 16: Time Complexity and P vs NP

Turing Machines Part II

CSE 105 THEORY OF COMPUTATION

Notes for Lecture Notes 2

CSE 105 THEORY OF COMPUTATION

Transcription:

COMS11700 Undecidability Department of Computer Science, University of Bristol Bristol, UK 4 April 2014 COMS11700: Undecidability Slide 1/29

Decidability We are particularly interested in Turing machines which halt on all inputs. Such a machine is called a decider. COMS11700: Undecidability Slide 2/29

Decidability We are particularly interested in Turing machines which halt on all inputs. Such a machine is called a decider. We say that M decides a language L if M is a decider and M recognises L. L is said to be decidable if some Turing machine decides it. Otherwise, L is said to be undecidable. For example, we have seen already that the language is decidable. L EQ = {w#w w {0, 1} }. COMS11700: Undecidability Slide 2/29

Undecidable problems Is it the case that the Turing machine model can compute anything? More specifically, is every language L decidable? COMS11700: Undecidability Slide 3/29

Undecidable problems Is it the case that the Turing machine model can compute anything? More specifically, is every language L decidable? We will see that the answer is unfortunately (?) no. Assuming that the Church-Turing thesis is true, this implies that there are problems which we cannot solve by any mechanical means! COMS11700: Undecidability Slide 3/29

An undecidable problem Let L U be the following language: L U = {x {0, 1} x = M, where M is a TM that does not accept x} That is, L U is the language of (descriptions of) Turing machines that do not accept when given their own descriptions as input. This means that on this input they either reject, or run forever. COMS11700: Undecidability Slide 4/29

An undecidable problem Let L U be the following language: L U = {x {0, 1} x = M, where M is a TM that does not accept x} That is, L U is the language of (descriptions of) Turing machines that do not accept when given their own descriptions as input. This means that on this input they either reject, or run forever. Lemma L U is undecidable. COMS11700: Undecidability Slide 4/29

L U = {x {0, 1} x = M, where M is a TM that does not accept x} Claim: L U is undecidable. Proof The proof is by contradiction. COMS11700: Undecidability Slide 5/29

L U = {x {0, 1} x = M, where M is a TM that does not accept x} Claim: L U is undecidable. Proof The proof is by contradiction. Assume there is a Turing machine N which decides L U. COMS11700: Undecidability Slide 5/29

L U = {x {0, 1} x = M, where M is a TM that does not accept x} Claim: L U is undecidable. Proof The proof is by contradiction. Assume there is a Turing machine N which decides L U. Then, for all y {0, 1}, N accepts if and only if y L U. COMS11700: Undecidability Slide 5/29

L U = {x {0, 1} x = M, where M is a TM that does not accept x} Claim: L U is undecidable. Proof The proof is by contradiction. Assume there is a Turing machine N which decides L U. Then, for all y {0, 1}, N accepts if and only if y L U. In particular, N accepts N if and only if N L U. COMS11700: Undecidability Slide 5/29

L U = {x {0, 1} x = M, where M is a TM that does not accept x} Claim: L U is undecidable. Proof The proof is by contradiction. Assume there is a Turing machine N which decides L U. Then, for all y {0, 1}, N accepts if and only if y L U. In particular, N accepts N if and only if N L U. But by the definition of L U, N L U if and only if N does not accept N. Contradiction. COMS11700: Undecidability Slide 5/29

L U = {x {0, 1} x = M, where M is a TM that does not accept x} Claim: L U is undecidable. Proof The proof is by contradiction. Assume there is a Turing machine N which decides L U. Then, for all y {0, 1}, N accepts if and only if y L U. In particular, N accepts N if and only if N L U. But by the definition of L U, N L U if and only if N does not accept N. Contradiction. Intuition: The barber paradox A man from Seville is shaved by the Barber of Seville if and only if he does not shave himself. Does the barber shave himself? COMS11700: Undecidability Slide 5/29

Diagonalisation Another way to view this argument is as follows. We write down an infinite table M whose rows and columns are indexed by bit-strings x, y {0, 1}. Rows represent TMs, columns represent inputs. 0 1 00 01... y 0 0 1 0 0 1 0 1 0 1 00 1 1 1 0 01 0 1 0 0.... x We fill in entry (x, y) of this table with 1 if the TM with description x accepts input y, and 0 otherwise. COMS11700: Undecidability Slide 6/29

Diagonalisation 0 1 00 01... y 0 0 1 0 0 1 0 1 0 1 00 1 1 1 0 01 0 1 0 0.... x Now consider the bit-string u {0, 1} whose i th bit is equal to the negation of the i th entry on the diagonal of M (so here u would start 1001... ) COMS11700: Undecidability Slide 7/29

Diagonalisation 0 1 00 01... y 0 0 1 0 0 1 0 1 0 1 00 1 1 1 0 01 0 1 0 0.... x Now consider the bit-string u {0, 1} whose i th bit is equal to the negation of the i th entry on the diagonal of M (so here u would start 1001... ) u differs from the first row of M in the first position, the second row in the second position,... COMS11700: Undecidability Slide 7/29

Diagonalisation 0 1 00 01... y 0 0 1 0 0 1 0 1 0 1 00 1 1 1 0 01 0 1 0 0.... x Now consider the bit-string u {0, 1} whose i th bit is equal to the negation of the i th entry on the diagonal of M (so here u would start 1001... ) u differs from the first row of M in the first position, the second row in the second position,... So u is not equal to any of the rows of M. COMS11700: Undecidability Slide 7/29

Diagonalisation 0 1 00 01... y 0 0 1 0 0 1 0 1 0 1 00 1 1 1 0 01 0 1 0 0.... x Now consider the bit-string u {0, 1} whose i th bit is equal to the negation of the i th entry on the diagonal of M (so here u would start 1001... ) u differs from the first row of M in the first position, the second row in the second position,... So u is not equal to any of the rows of M. So there is no TM which accepts the language of strings y such that u y = 1. COMS11700: Undecidability Slide 7/29

The halting problem We have shown that the language L U = {x {0, 1} x = M, where M is a TM that does not accept x} is undecidable. But what if we don t care about deciding this language? COMS11700: Undecidability Slide 8/29

The halting problem We have shown that the language L U = {x {0, 1} x = M, where M is a TM that does not accept x} is undecidable. But what if we don t care about deciding this language? It turns out that many decision problems which we care about in practice are also undecidable. A classic example is the halting problem: given a program, and an input, does it terminate on that input? COMS11700: Undecidability Slide 8/29

The halting problem We have shown that the language L U = {x {0, 1} x = M, where M is a TM that does not accept x} is undecidable. But what if we don t care about deciding this language? It turns out that many decision problems which we care about in practice are also undecidable. A classic example is the halting problem: given a program, and an input, does it terminate on that input? Put another way, given a Turing machine M and an input x, does M halt on input x? More formally, the language L HALT = { M, x M is a TM that halts on input x} COMS11700: Undecidability Slide 8/29

The halting problem Claim L HALT is undecidable. Proof Suppose there exists a TM M deciding L HALT. COMS11700: Undecidability Slide 9/29

The halting problem Claim L HALT is undecidable. Proof Suppose there exists a TM M deciding L HALT. We will show there exists a machine M which decides L U. COMS11700: Undecidability Slide 9/29

The halting problem Claim L HALT is undecidable. Proof Suppose there exists a TM M deciding L HALT. We will show there exists a machine M which decides L U. On input x = N, M simulates M to determine whether N halts on input N. COMS11700: Undecidability Slide 9/29

The halting problem Claim L HALT is undecidable. Proof Suppose there exists a TM M deciding L HALT. We will show there exists a machine M which decides L U. On input x = N, M simulates M to determine whether N halts on input N. If M says no, M accepts. COMS11700: Undecidability Slide 9/29

The halting problem Claim L HALT is undecidable. Proof Suppose there exists a TM M deciding L HALT. We will show there exists a machine M which decides L U. On input x = N, M simulates M to determine whether N halts on input N. If M says no, M accepts. Otherwise, M simulates N on input N and accepts if and only if N rejects (this can be done in finite time because we know that N halts). COMS11700: Undecidability Slide 9/29

The halting problem Claim L HALT is undecidable. Proof Suppose there exists a TM M deciding L HALT. We will show there exists a machine M which decides L U. On input x = N, M simulates M to determine whether N halts on input N. If M says no, M accepts. Otherwise, M simulates N on input N and accepts if and only if N rejects (this can be done in finite time because we know that N halts). Thus M can decide L U. Contradiction! COMS11700: Undecidability Slide 9/29

The halting problem in practice Informally, we have shown that it is impossible to determine whether a program terminates. Is this an important problem? For some very simple programs, we don t know whether they halt: int f(int n) { if (n <= 1) return 0; else if (even(n)) return f(n/2); else return f(3*n+1); } Determining whether f(n) terminates for all n is known as the Collatz conjecture and has been an open problem for over 70 years! Tools exist to solve special cases of the halting problem (e.g. Microsoft Terminator project). COMS11700: Undecidability Slide 10/29

Reductions This proof illustrates a key concept in proving hardness: reductions. A reduction from A to B is a computable function f (x) such that x A if and only if f (x) B. COMS11700: Undecidability Slide 11/29

Reductions This proof illustrates a key concept in proving hardness: reductions. A reduction from A to B is a computable function f (x) such that x A if and only if f (x) B. Imagine we know that language A is undecidable, and we want to prove that language B is undecidable. We can achieve this by showing that, if we could decide B, we could decide A. Therefore, B must be undecidable! COMS11700: Undecidability Slide 11/29

Reductions This proof illustrates a key concept in proving hardness: reductions. A reduction from A to B is a computable function f (x) such that x A if and only if f (x) B. Imagine we know that language A is undecidable, and we want to prove that language B is undecidable. We can achieve this by showing that, if we could decide B, we could decide A. Therefore, B must be undecidable! Decider for A x x A? COMS11700: Undecidability Slide 11/29

Reductions This proof illustrates a key concept in proving hardness: reductions. A reduction from A to B is a computable function f (x) such that x A if and only if f (x) B. Imagine we know that language A is undecidable, and we want to prove that language B is undecidable. We can achieve this by showing that, if we could decide B, we could decide A. Therefore, B must be undecidable! Decider for A x f (x) Decider for B x A? COMS11700: Undecidability Slide 11/29

Reductions: another example Problem Show that the following language is undecidable. L 1 = { M M accepts 1} Solution We give a reduction from L HALT to L 1. COMS11700: Undecidability Slide 12/29

Reductions: another example Problem Show that the following language is undecidable. L 1 = { M M accepts 1} Solution We give a reduction from L HALT to L 1. Given M, x, the reduction outputs the description of a TM N. COMS11700: Undecidability Slide 12/29

Reductions: another example Problem Show that the following language is undecidable. L 1 = { M M accepts 1} Solution We give a reduction from L HALT to L 1. Given M, x, the reduction outputs the description of a TM N. N begins by checking whether the input is equal to 1. If not, it rejects. Otherwise, it writes x to the tape and then simulates the operation of M. If M halts, N accepts. COMS11700: Undecidability Slide 12/29

Reductions: another example Problem Show that the following language is undecidable. L 1 = { M M accepts 1} Solution We give a reduction from L HALT to L 1. Given M, x, the reduction outputs the description of a TM N. N begins by checking whether the input is equal to 1. If not, it rejects. Otherwise, it writes x to the tape and then simulates the operation of M. If M halts, N accepts. Thus N accepts 1 if and only if M halts on input x. COMS11700: Undecidability Slide 12/29

Reductions: another example Problem Show that the following language is undecidable. L 1 = { M M accepts 1} Solution We give a reduction from L HALT to L 1. Given M, x, the reduction outputs the description of a TM N. N begins by checking whether the input is equal to 1. If not, it rejects. Otherwise, it writes x to the tape and then simulates the operation of M. If M halts, N accepts. Thus N accepts 1 if and only if M halts on input x. So, if we can decide the language L 1, we can decide L HALT. COMS11700: Undecidability Slide 12/29

Reductions: another example Problem Show that the following language is undecidable. L 1 = { M M accepts 1} Solution We give a reduction from L HALT to L 1. Given M, x, the reduction outputs the description of a TM N. N begins by checking whether the input is equal to 1. If not, it rejects. Otherwise, it writes x to the tape and then simulates the operation of M. If M halts, N accepts. Thus N accepts 1 if and only if M halts on input x. So, if we can decide the language L 1, we can decide L HALT. So L 1 is undecidable! COMS11700: Undecidability Slide 12/29

Countability There is a connection between diagonalisation and a beautiful argument used to show that the real numbers R are not countable. A set is said to be countable if it has the same cardinality (size) as some subset of N = {1, 2, 3,... }. This means that we can associate each element in the set with a unique natural number its position in the set. COMS11700: Undecidability Slide 13/29

Countability There is a connection between diagonalisation and a beautiful argument used to show that the real numbers R are not countable. A set is said to be countable if it has the same cardinality (size) as some subset of N = {1, 2, 3,... }. This means that we can associate each element in the set with a unique natural number its position in the set. For example, {red, green, blue} is countable because we can assign red 1, green 2, blue 3. COMS11700: Undecidability Slide 13/29

Countability There is a connection between diagonalisation and a beautiful argument used to show that the real numbers R are not countable. A set is said to be countable if it has the same cardinality (size) as some subset of N = {1, 2, 3,... }. This means that we can associate each element in the set with a unique natural number its position in the set. For example, {red, green, blue} is countable because we can assign red 1, green 2, blue 3. Any finite set is countable, but the question of whether infinite sets are countable is more interesting. For example, consider the integers Z = {..., 3, 2, 1, 0, 1, 2, 3,... } COMS11700: Undecidability Slide 13/29

Countability There are intuitively twice as many integers as natural numbers. But the integers are nevertheless a countable set! COMS11700: Undecidability Slide 14/29

Countability There are intuitively twice as many integers as natural numbers. But the integers are nevertheless a countable set! Write them in the order Z = {0, 1, 1, 2, 2, 3, 3,... }. COMS11700: Undecidability Slide 14/29

Countability There are intuitively twice as many integers as natural numbers. But the integers are nevertheless a countable set! Write them in the order Z = {0, 1, 1, 2, 2, 3, 3,... }. Then we can associate each z Z with the natural number { 2z 1 if z > 0 φ(z) = 2z if z 0 This is a one-to-one mapping (check this!), so Z is countable. COMS11700: Undecidability Slide 14/29

Countability There are intuitively twice as many integers as natural numbers. But the integers are nevertheless a countable set! Write them in the order Z = {0, 1, 1, 2, 2, 3, 3,... }. Then we can associate each z Z with the natural number { 2z 1 if z > 0 φ(z) = 2z if z 0 This is a one-to-one mapping (check this!), so Z is countable. What about the real numbers R? COMS11700: Undecidability Slide 14/29

The real numbers are not countable We can prove that R is not countable using the same diagonalisation argument as before. COMS11700: Undecidability Slide 15/29

The real numbers are not countable We can prove that R is not countable using the same diagonalisation argument as before. Assume that R is countable. Then we can associate each x R with a unique natural number φ(x) N. Write down a table whose n th row is the digits of the real number corresponding to n N, for example: 0 2. 7 8 1 8... 1 13. 0 0 0 0... 2 0. 1 1 9 3... 3 6. 6 6 6 6....... n COMS11700: Undecidability Slide 15/29

The real numbers are not countable For each row i, we take the i th digit after the decimal point and add 1 to it: 0 2. 7 8 8 1 8... 1 13. 0 0 1 0 0... 2 0. 1 1 9 0 3... 3 6. 6 6 6 6 7....... n COMS11700: Undecidability Slide 16/29

The real numbers are not countable For each row i, we take the i th digit after the decimal point and add 1 to it: 0 2. 7 8 8 1 8... 1 13. 0 0 1 0 0... 2 0. 1 1 9 0 3... 3 6. 6 6 6 6 7....... n Consider the real number x formed by making the i th digit after the decimal point equal to the resulting number. COMS11700: Undecidability Slide 16/29

The real numbers are not countable For each row i, we take the i th digit after the decimal point and add 1 to it: 0 2. 7 8 8 1 8... 1 13. 0 0 1 0 0... 2 0. 1 1 9 0 3... 3 6. 6 6 6 6 7....... n Consider the real number x formed by making the i th digit after the decimal point equal to the resulting number. For each i, the i th digit of x differs from the real number in row i. COMS11700: Undecidability Slide 16/29

The real numbers are not countable For each row i, we take the i th digit after the decimal point and add 1 to it: 0 2. 7 8 8 1 8... 1 13. 0 0 1 0 0... 2 0. 1 1 9 0 3... 3 6. 6 6 6 6 7....... n Consider the real number x formed by making the i th digit after the decimal point equal to the resulting number. For each i, the i th digit of x differs from the real number in row i. So x cannot appear in the table. COMS11700: Undecidability Slide 16/29

The real numbers are not countable For each row i, we take the i th digit after the decimal point and add 1 to it: 0 2. 7 8 8 1 8... 1 13. 0 0 1 0 0... 2 0. 1 1 9 0 3... 3 6. 6 6 6 6 7....... n Consider the real number x formed by making the i th digit after the decimal point equal to the resulting number. For each i, the i th digit of x differs from the real number in row i. So x cannot appear in the table. So R is not countable! COMS11700: Undecidability Slide 16/29

Decidability of proofs The Turing machine model has another connection to the foundations of mathematics itself. Imagine we would like to prove logical statements about the natural numbers, like Fermat s Last Theorem: a, b, c, n N [(a, b, c > 0 n > 2) a n + b n c n ] The Entscheidungsproblem ( decision problem ) of Hilbert asked whether there was a mechanical procedure to prove such claims. COMS11700: Undecidability Slide 17/29

Decidability of proofs The Turing machine model has another connection to the foundations of mathematics itself. Imagine we would like to prove logical statements about the natural numbers, like Fermat s Last Theorem: a, b, c, n N [(a, b, c > 0 n > 2) a n + b n c n ] The Entscheidungsproblem ( decision problem ) of Hilbert asked whether there was a mechanical procedure to prove such claims. Claim (informal, see Sipser 6.2) Let L MATHS be the language of true mathematical statements about the natural numbers. Then L MATHS is undecidable. The basic idea: encode the operation of a Turing machine in terms of constraints on some numbers, and write down a logical statement about these numbers which is true if and only if the machine accepts its input. COMS11700: Undecidability Slide 17/29

Other undecidable problems There are a vast number of interesting problems which turn out to be undecidable, some of which are apparently completely unrelated to Turing machines. Given a multivariate polynomial with integer coefficients, does it evaluate to 0 at some integer point? e.g. f (x, y, z) = 5x 2 y + 3xyz 7xy + z 3 + 2 has f (1, 3, 1) = 0. This is known as Hilbert s tenth problem. Pic: Wikipedia/David Hilbert COMS11700: Undecidability Slide 18/29

Other undecidable problems The Post correspondence problem: We are given a collection S of dominos, each containing two strings from some alphabet Σ (one on the top half of the domino, one on the bottom). For example, S = {[ ] a, ab [ ] b, a [ ]} abc. c COMS11700: Undecidability Slide 19/29

Other undecidable problems The Post correspondence problem: We are given a collection S of dominos, each containing two strings from some alphabet Σ (one on the top half of the domino, one on the bottom). For example, S = {[ ] a, ab [ ] b, a [ ]} abc. c The problem is to determine whether, by lining up dominos from S (with repetitions allowed) we can make the concatenated strings on the top of the dominos equal to the concatenated strings on the bottom. COMS11700: Undecidability Slide 19/29

Other undecidable problems The Post correspondence problem: We are given a collection S of dominos, each containing two strings from some alphabet Σ (one on the top half of the domino, one on the bottom). For example, S = {[ ] a, ab [ ] b, a [ ]} abc. c The problem is to determine whether, by lining up dominos from S (with repetitions allowed) we can make the concatenated strings on the top of the dominos equal to the concatenated strings on the bottom. For example, would be a valid solution. [ ] [ ] [ ] [ ] a b a abc ab a ab c COMS11700: Undecidability Slide 19/29

Other undecidable problems A Wang tile is a unit square with coloured edges. Given a set S of Wang tiles, the problem is to determine whether tiles picked from S (without rotations or reflections) can be arranged edge-to-edge to tile the plane, such that adjoining edges of adjacent tiles have the same colour. For example, the following set S does satisfy this property: Pics: Wikipedia/Wang tile COMS11700: Undecidability Slide 20/29

Decidability of problems related to automata Turing machines are intuitively at least as powerful as the models of automata we have studied previously. We can formalise this by showing that any language that can be recognised by an automaton in one of these models can be decided by a Turing machine. For example: L DFA = { A, x A is a DFA that accepts input string x}. L PDA = { A, x A is a PDA that accepts input string x}. COMS11700: Undecidability Slide 21/29

Decidability of problems related to automata Turing machines are intuitively at least as powerful as the models of automata we have studied previously. We can formalise this by showing that any language that can be recognised by an automaton in one of these models can be decided by a Turing machine. For example: L DFA = { A, x A is a DFA that accepts input string x}. L PDA = { A, x A is a PDA that accepts input string x}. Claim L DFA and L PDA are decidable. COMS11700: Undecidability Slide 21/29

Decidability of problems related to automata Claim L PDA is decidable. We prove the claim by giving an algorithm for deciding L PDA. Proof On input A, w, where A is a PDA and w is a string: 1. Find a CFG G corresponding to A; COMS11700: Undecidability Slide 22/29

Decidability of problems related to automata Claim L PDA is decidable. We prove the claim by giving an algorithm for deciding L PDA. Proof On input A, w, where A is a PDA and w is a string: 1. Find a CFG G corresponding to A; 2. Convert G into Chomsky normal form; COMS11700: Undecidability Slide 22/29

Decidability of problems related to automata Claim L PDA is decidable. We prove the claim by giving an algorithm for deciding L PDA. Proof On input A, w, where A is a PDA and w is a string: 1. Find a CFG G corresponding to A; 2. Convert G into Chomsky normal form; 3. If w 1, loop through all derivations with 2 w 1 steps. Otherwise, loop through all derivations with 1 step; COMS11700: Undecidability Slide 22/29

Decidability of problems related to automata Claim L PDA is decidable. We prove the claim by giving an algorithm for deciding L PDA. Proof On input A, w, where A is a PDA and w is a string: 1. Find a CFG G corresponding to A; 2. Convert G into Chomsky normal form; 3. If w 1, loop through all derivations with 2 w 1 steps. Otherwise, loop through all derivations with 1 step; 4. Accept if any of the derivations generates w; otherwise reject. The CYK algorithm you saw in Programming and Algorithms is another, more efficient way of solving the same problem. COMS11700: Undecidability Slide 22/29

A hierarchy of languages Recall that L HALT = { M, x M is a TM that halts on input x} We have seen that L HALT is undecidable. But is L HALT Turing-recognisable? COMS11700: Undecidability Slide 23/29

A hierarchy of languages Recall that L HALT = { M, x M is a TM that halts on input x} We have seen that L HALT is undecidable. But is L HALT Turing-recognisable? Yes! We can use the universal TM to simulate the TM it was given as input and accept if the TM halts. If it does not halt, this process will run forever. So the set of decidable languages is strictly smaller than the set of Turing-recognisable languages. COMS11700: Undecidability Slide 23/29

A hierarchy of languages Turing-recognisable Decidable L HALT {a n b n c n n 0} Context-free Regular {a n b n n 0} {a 7 b n n 0} COMS11700: Undecidability Slide 24/29

There is another level in this hierarchy which we haven t yet seen: Turing-recognisable Decidable Context-sensitive Context-free Regular L HALT {a n b n c n n 0} {a n b n n 0} {a 7 b n n 0} COMS11700: Undecidability Slide 25/29

Context-sensitive languages A context-sensitive language is generated by a context-sensitive grammar. This is a grammar with rules of the form α β, where α and β are strings (of terminals and non-terminals) such that α β. If the start variable S does not appear on the right-hand side of any rules, we also allow the rule S ε. COMS11700: Undecidability Slide 26/29

Context-sensitive languages A context-sensitive language is generated by a context-sensitive grammar. This is a grammar with rules of the form α β, where α and β are strings (of terminals and non-terminals) such that α β. If the start variable S does not appear on the right-hand side of any rules, we also allow the rule S ε. The name context-sensitive comes from the fact that such grammars have a normal form where all rules are of the form αaβ αγβ; so the rule applied to A can depend on the surrounding symbols. COMS11700: Undecidability Slide 26/29

Context-sensitive languages A context-sensitive language is generated by a context-sensitive grammar. This is a grammar with rules of the form α β, where α and β are strings (of terminals and non-terminals) such that α β. If the start variable S does not appear on the right-hand side of any rules, we also allow the rule S ε. The name context-sensitive comes from the fact that such grammars have a normal form where all rules are of the form αaβ αγβ; so the rule applied to A can depend on the surrounding symbols. For example, {a n b n c n n 1} is generated by the grammar S ast c abc ct T c bt bb COMS11700: Undecidability Slide 26/29

Context-sensitive languages Just as with the other classes of languages we have met, context-sensitive languages are recognised by a corresponding class of automata: linear bounded automata. COMS11700: Undecidability Slide 27/29

Context-sensitive languages Just as with the other classes of languages we have met, context-sensitive languages are recognised by a corresponding class of automata: linear bounded automata. A linear bounded automaton is a nondeterministic Turing machine which is not allowed to move off the tape to the right of the input. That is, there is a barrier to the right of the last input symbol which the machine cannot move beyond. Other than this, the machine behaves exactly like a normal NDTM. It can be shown using diagonalisation that there exist decidable languages which are not context-sensitive. COMS11700: Undecidability Slide 27/29

The Chomsky hierarchy We can summarise (some of) these types of languages as follows: Languages Automaton Production rules Regular DFA / NFA A a or A ab Context-free PDA A α Context-sensitive Linear bounded automaton αaβ αγβ Turing-recognisable Turing machine α β Here α, β, γ are arbitrary strings of terminals and non-terminals. This classification is called the Chomsky hierarchy. Pic: Wikipedia/Noam Chomsky COMS11700: Undecidability Slide 28/29

Summary and further reading To summarise: There are languages which cannot be decided by any Turing machine. A specific and important example of such a language is the halting problem. An important way of proving that a language is undecidable is the use of reductions. COMS11700: Undecidability Slide 29/29

Summary and further reading To summarise: There are languages which cannot be decided by any Turing machine. A specific and important example of such a language is the halting problem. An important way of proving that a language is undecidable is the use of reductions. Some additional references: The barber paradox can be formalised as Russell s paradox. Further reading: Sipser 4.1, 4.2 Also Computation: Finite and Infinite Machines by Minsky A nice selection of undecidable problems: http://math.mit.edu/~poonen/papers/sampler.pdf COMS11700: Undecidability Slide 29/29