The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

Similar documents
Recursively Enumerable Languages, Turing Machines, and Decidability

Outline. Language Hierarchy

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Theory of Computation, Homework 3 Sample Solution


CS 44 Exam #2 February 14, 2001

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

Computability Summary

UNIT I PART A PART B

CS21 Decidability and Tractability

Computer Sciences Department

Rice s Theorem and Enumeration

1. [5 points each] True or False. If the question is currently open, write O or Open.

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

Decidable Problems. We examine the problems for which there is an algorithm.

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Elementary Recursive Function Theory

CSE 105 THEORY OF COMPUTATION

Formal languages and computation models

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Regular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal.

Problems, Languages, Machines, Computability, Complexity

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Multiple Choice Questions

Lecture 5: The Halting Problem. Michael Beeson

Homework. Context Free Languages. Before We Start. Announcements. Plan for today. Languages. Any questions? Recall. 1st half. 2nd half.

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Computable Sets. KR Chowdhary Professor & Head.

Equivalence of NTMs and TMs

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS

CpSc 421 Final Solutions

Theory Bridge Exam Example Questions Version of June 6, 2008

Recursive and Recursively Enumerable Languages

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

Lecture T4: Computability

CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I

14.1 Encoding for different models of computation

Post's Correspondence Problem. An undecidable, but RE, problem that. appears not to have anything to do with. TM's.

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

CT32 COMPUTER NETWORKS DEC 2015

(a) Give inductive definitions of the relations M N and M N of single-step and many-step β-reduction between λ-terms M and N. (You may assume the

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Reducibilities relations with applications to symbolic dynamics

CISC 4090 Theory of Computation

Examples of P vs NP: More Problems

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Final Course Review. Reading: Chapters 1-9

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5

Formal Languages and Automata

SECTION A (40 marks)

From Theorem 8.5, page 223, we have that the intersection of a context-free language with a regular language is context-free. Therefore, the language

Theory of Programming Languages COMP360

Introduction to Computers & Programming

Lecture 18: Turing Machines

What computers just cannot do. COS 116: 2/28/2008 Sanjeev Arora

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2

Variants of Turing Machines

Turing Machine Languages

Decision Properties for Context-free Languages

Specifying Syntax COMP360

AUTOMATA THEORY AND COMPUTABILITY

Theory of Computations Spring 2016 Practice Final

Context-Free Grammars

T.E. (Computer Engineering) (Semester I) Examination, 2013 THEORY OF COMPUTATION (2008 Course)

CSE Qualifying Exam, Spring February 2, 2008

AUBER (Models of Computation, Languages and Automata) EXERCISES

ECS 120 Lesson 16 Turing Machines, Pt. 2

Theory of Languages and Automata

Normal Forms for CFG s. Eliminating Useless Variables Removing Epsilon Removing Unit Productions Chomsky Normal Form

Theory of Computer Science

p x i 1 i n x, y, z = 2 x 3 y 5 z

Computation Engineering Applied Automata Theory and Logic. Ganesh Gopalakrishnan University of Utah. ^J Springer

On the Recursion-Theoretic Complexity of Relative Succinctness of Representations of Languages

QUESTION BANK. Formal Languages and Automata Theory(10CS56)

Actually talking about Turing machines this time

Reflection in the Chomsky Hierarchy

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability.

Theory of Computations Spring 2016 Practice Final Exam Solutions

CSCI 340: Computational Models. Turing Machines. Department of Computer Science

A Note on the Succinctness of Descriptions of Deterministic Languages

Formal Grammars and Abstract Machines. Sahar Al Seesi

Learn Smart and Grow with world

Derivations of a CFG. MACM 300 Formal Languages and Automata. Context-free Grammars. Derivations and parse trees

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is

Enumerations and Turing Machines

CP7201 Theoretical foundations of computer science QUESTION BANK

Context-Free Languages and Parse Trees

CSCI 270: Introduction to Algorithms and Theory of Computing Fall 2017 Prof: Leonard Adleman Scribe: Joseph Bebel

The Big Picture. Chapter 3

COMP 382: Reasoning about algorithms

Presented By : Abhinav Aggarwal CSI-IDD, V th yr Indian Institute of Technology Roorkee. Joint work with: Prof. Padam Kumar

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

Transcription:

The Turing Machine Unsolvable Problems Motivating idea Build a theoretical a human computer Likened to a human with a paper and pencil that can solve problems in an algorithmic way The theoretical machine provides a means to determine: If an algorithm or procedure exists for a given problem What that algorithm or procedure looks like How long would it take to run this algorithm or procedure. The Church-Turing Thesis (1936) Any algorithmic procedure that can be carried out by a human or group of humans can be carried out by some Turing Machine Equating algorithm with running on a TM Turing Machine is still a valid computational model for most modern computers. Undecidability Informally, a problem is called unsolvable or undecidable if there no algorithm exists that solves the problem. Algorithm Implies a TM that computes a solution for the problem Solves Implies will always give an answer Decision Problem Let s formalize this a bit A decision problem is a problem that has a yes/no answer Example: Is a given string x a palindrome (Is x pal?) Is a given context free language empty? Decision Problems For regular languages 1. Is the language empty? 2. Is the language finite? 3. Is a given string in the language? 4. Given 2 languages, are there strings that are in both? 5. Is the language a subset of another regular language? 6. Is the language the same as another regular language? 1

Decision Problems For Context Free Languages 1. Is a given string in the language? 2. Is the language empty? 3. Is the language finite? Decision Problems For recursively enumerable languages 1. Is the language accepted by a TM empty? 2. Is the language accepted by a TM finite? 3. Is the language accepted by a TM regular? 4. Is the language accepted by a TM context free? 5. Is the language accepted by 1 TM a subset of or equal to the language accepted by another? Decision Problem Running a decision problem on a TM. The problem must first be encoded Example: Is a given string x a palindrome (Is x pal?) x is an instance of the probkem Is a given context free language empty? Instance of a problem is a CFG must be encoded. Decision Problem Running a decision problem on a TM. Once encoded, the encoded instance in provided as input to a TM. The TM must then Determine if the input is a valid encoding Run, halt, Place 1 on the tape if the answer for the input is yes Place on the tape if the answer for the input is no If such a TM exists for a given decision problem, the problem is decidable or solvable. Otherwise the problem is called undecidable or unsolvable. Solvability In other words, a problem is solvable if the language of all of its encoded yes instances is recursive. There is a TM that recognizes the language. Universal Language Universal Language (L u ) Set of all strings w i such that w i L(M i ) All strings w that are accepted by the TM with w as it s encoding. All encodings for TMs that do accept their encoding when input We showed that L u is not recursive. 2

An unsolvable problem L u corresponds to the yes encodings of the decision problem: Given a Turing Machine M, does it accept it s own encoding. (Self-accepting) Since L u is not recursive, this problem is unsolvable. One method of showing whether a given decision problem is unsolvable is to convert the encoding of the problem into another that we know to be either solvable or unsolvable. This is called reducing one language to another. Formally, Let L 1 and L 2 be languages over Σ 1 and Σ 2 We say L 1 is reducible to L 2 (L 1 L 2 ) if There exists a Turning computable function f: Σ 1* Σ 2* such that x L 1 iff f(x) L 2 Informally, We can take any encoded instance of one problem Use a TM to compute a corresponding encoded instance of another problem. If this other problem has a TM that recognizes the set of yes encodings, we can run that TM to solve the first problem. Key facts: If L 1 L 2 then If L 2 is recursive then L 1 is also recursive If L 1 is not recursive then L 2 is not recursive. If P 1 and P 2 are decision problems with L 1 and L 2 the languages of yes encodings respectively and if L 1 L 2 then If P 2 is solvable then P 1 is also solvable If P 1 is unsolvable then P 2 is also unsolvable Let s consider a more general problem about TMs. Given a TM, M, and a string w, is w T(M)? We simply cannot just run the string on the TM since if w L(M), M might go into an infinite loop. 3

is unsolvable Proof: We can use an argument similar to that used to show that T u is not recursive. Instead, let s use reduction If L 1 L 2 then If L 2 is recursive then L 1 is also recursive If L 1 is not recursive then L 2 is not recursive. Let s show that Self-Accepting can be reduced to the halting problem. Let s show that Self-Accepting can be reduced to the halting problem. For an encoding of an instance of SA, I, we can define a function f(i) = I Such that I is an encoding of an instance of Halt and I will be self-accepting iff I halts. Instance of SA = (T) an encoded TM, T Instance of halt = (T, w) an encoded TM T and encoded string w to run on the TM We want T to accept e(t) iff T accepts w Let T =T and w = e(t) f(x) = (x, e(x)) f(x) = (x, e(x)) If x is an encoding for a TM that self-accepts, Then x will certainly accept e(x) as specified by f. If x is not an encoding for a TM that self-accepts then either: x is a bogus encoding or x is an encoding for a TM that will not accept it s own encoding. In either case (x, e(x)) will not be in halt. We showed that L 1 L 2 where L 1 is the set of encodings for yes instances of the self-accepting problem L 2 is the set of encodings for yes instances of the halting problem. We know that the self-accepting problem is unsolvable, thus, the halting problem is unsolvable. 4

Practical considerations: Since the halting problem is unsolvable, there is no algorithm to determine: Given a computer program Will this program always finish? Alternately will it ever enter an infinite loop. Important observations Reduction operates on strings from languages Reducing encodings of different problems If L 1 L 2 then If L 2 is recursive then L 1 is also recursive If L 1 is not recursive then L 2 is not recursive. Questions? To show a problem is unsolvable Find a problem known to be unsolvable Reduce this known unsolvable problem to the problem you wish to show is unsolvable. Only need one to start the ball rolling Self-accepting fits the bill. Decision Problems For recursively enumerable languages 1. Is the language accepted by a TM empty? 2. Is the language accepted by a TM finite? 3. Is the language accepted by a TM regular? 4. Is the language accepted by a TM context free? 5. Is the language accepted by 1 TM a subset of or equal to the language accepted by another? Rice s Theorem The Self-Accepting problem can be reduced to each one of these decision problems. Rice s Theorem Every non-trivial property of recursively enumerable languages is unsolvable. Where a non-trivial property is a property satisfied by any non-null subset of the set of recursively enumerable languages. Decision Problems For recursively enumerable languages All unsolvable. 1. Is the language accepted by a TM empty? 2. Is the language accepted by a TM finite? 3. Is the language accepted by a TM regular? 4. Is the language accepted by a TM context free? 5. Is the language accepted by 1 TM a subset of or equal to the language accepted by another? 5

Questions? Let s look at some more unsolvable problems: Post Correspondence Problem Given 2 lists of strings (each list with the same number of elements) can one pick a sequence of corresponding strings from the two lists and form the same string by concatenation. (PCP) Attributed to Emil Post (1946). List 1 List 2 Post Correspondence Problem Example: 1 11 1 1 1 1 1 1 2 3 4 5 6 Choose a sequence of indicies : 1,3,4 List1: 1 1 List 2: 11 1 1 Post Correspondence Problem Is there a set of indices such that both lists produce the same string List 1 List 2 1 11 1 1 1 1 1 1 2 3 4 5 6 Try 1, 4, 6 List 1: 11 List 2 :11 1 Post Correspondence Problem Recall: Parse trees There is a Modified version of the Post Correspondence Problem (MPCP) Requires that the index 1 appears as the first index in any solution. This can be shown to be unsolvable by reducing the halting problem to MPCP HALTING MPCP MPCP can be reduced to PCP HALTING MPCP PCP Since halting is unsolvable MPCP is unsolvable PCP is unsolvable. S S + S a S * S a a Same string, 2 derivations S S * S S + S a a a 6

A CFG is said to be ambiguous if there is at least 1 string in L(G) having two or more distinct derivations. We said many weeks ago that there is no algorithm to determine if a given CFG is ambiguous. Now we shall prove it Given a CFG, the problem of whether this grammar is ambiguous is unsolvable. Reduce PCP to Ambiguity. Meaning: Take an instance of PCP and convert it to a CGF G such that: G is ambiguous iff the instance of PCP has a solution. Instance of PCP 2 Lists of strings A & B, all strings Σ * A = (w 1, w 2,, w n ) B = (x 1, x 2,, x n ) Build a CFG, G with Terminal set that includes Σ plus special symbols { a 1, a 2, a n } which represent indicies into lists A & B Instance of PCP 2 Lists of strings A & B, all strings Σ * A = (w 1, w 2,, w n ) B = (x 1, x 2,, x n ) Productions of G A w 1 Aa 1 w 2 Aa 2 w n Aa n A w 1 a 1 w 2 a 2 w n a n B x 1 Ba 1 x 2 Ba 2 x n Ba n B x 1 a 1 x 2 a 2 x n a n S A B Must show that G is ambiguous iff PCP instance has a solution. Assume PCP has a solution (i1,i2,,im) Consider the derivations S w i1 Aa i1 w i1 w i2 Aa i2 a i1 w i1 w i2 w im A a im a i2 a i1 w i1 w i2 w im a im a i2 a i1 S x i1 Ba i1 x i1 x i2 Aa i2 a i1 x i1 x i2 x im A a im a i2 a i1 x i1 x i2 x im a im a i2 a i1 Since (i1,i2,,im) is a solution to PCP, w i1 w i2 w im will be the same as x i1 x i2 x im, thus we have 2 separate derivations for the same string. G is ambiguous. Must show that G is ambiguous iff PCP instance has a solution. Assume G is ambiguous A given string could have only 1 derivation starting from A and 1 starting from B If there are 2 derivations, one must derive from A and the other from B The string with 2 derivations will have the tail: a i1 a i2 a im for some m 1 On the A derivation the head will be w i1 w i2 w im On the B derivation the head will be x i1 x i2 x im w i1 w i2 w im = x i1 x i2 x im (i1, i2, im) is a solution to the PCP 7

Finally, Since PCP is unsolvable, so too is the problem of ambiguity. SA HALTING MPCP PCP ambiguity Summary Solvable vs Unsolvable problems An unsolvable problem Self-accepting Rice s Theorem Post Correspondence Problem Ambiguity of CFGs. Questions? The Turing Machine Motivating idea Build a theoretical a human computer Likened to a human with a paper and pencil that can solve problems in an algorithmic way The theoretical machine provides a means to determine: If an algorithm or procedure exists for a given problem What that algorithm or procedure looks like How long would it take to run this algorithm or procedure. Next Time Computational Complexity and Intractability. 8