INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

Slides:



Advertisements
Similar presentations
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 17: ProvingUndecidability.
Advertisements

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Lecture 3 Universal TM. Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction,
CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
Turing -Recognizable vs. -Decidable
1 CSC3130 Formal Languages and Automata Theory Tutorial 9 Undecidable Problem KN Hung SHB 1026.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 Introduction to Computability Theory Lecture14: Recap Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Reducibility Sipser 5.1 (pages ). CS 311 Fall Reducibility.
1 Introduction to Computability Theory Lecture13: Mapping Reductions Prof. Amos Israeli.
Mapping Reducibility Sipser 5.3 (pages ). CS 311 Fall Computable functions Definition 5.17: A function f:Σ*→Σ* is a computable function.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
Reducibility A reduction is a way of converting one problem into another problem in such a way that a solution to the second problem can be used to solve.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Rules have form String of variables and terminals String of variables and terminals.
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
Linear Bounded Automata LBAs
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Theory of Computing Lecture 20 MAS 714 Hartmut Klauck.
Prof. Busch - LSU1 Reductions. Prof. Busch - LSU2 Problem is reduced to problem If we can solve problem then we can solve problem.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
CSCI 2670 Introduction to Theory of Computing November 4, 2004.
MA/CSSE 474 Theory of Computation More Reduction Examples Non-SD Reductions.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 7 Undecidability cont. Jan Maluszynski, IDA, 2007
Turing -Recognizable vs. -Decidable
Decidability and Undecidability Proofs Sections 21.1 – 21.3.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
Recursively Enumerable and Recursive Languages
Decidability Decidable/Undecidable problems. Jaruloj Chongstitvatana Decidability2 Accepting: Definition Let T = (Q, , , , s) be a TM. T accepts.
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Productions String of variables and terminals String of variables and terminals.
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 5 Reducibility Some slides are in courtesy.
THE HALTING PROBLEM - PROOF. Review  What makes a problem decidable?  3 properties of an efficient algorithm?  What is the meaning of “complete”, “mechanistic”,
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability and Undecidability Proofs
CSCI 2670 Introduction to Theory of Computing
Busch Complexity Lectures: Reductions
Linear Bounded Automata LBAs
Undecidable Problems Costas Busch - LSU.
CSCI 2670 Introduction to Theory of Computing
Reductions Costas Busch - LSU.
CS154, Lecture 10: Rice’s Theorem, Oracle Machines
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
Turing acceptable languages and Enumerators
CS154, Lecture 8: Undecidability, Mapping Reductions
CS154, Lecture 10: Rice’s Theorem, Oracle Machines
CS154, Lecture 8: Undecidability, Mapping Reductions
CSCI 2670 Introduction to Theory of Computing
Decidable Languages Costas Busch - LSU.
Turing acceptable languages and Enumerators
Undecidable problems:
Computability and Complexity
CSCI 2670 Introduction to Theory of Computing
Theory of Computability
Theory of Computability
Turing -Recognizable vs. -Decidable
CSCI 2670 Introduction to Theory of Computing
Theory of Computability
More Undecidable Problems
Turing -Recognizable vs. -Decidable
Presentation transcript:

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

UN DECIDABILITY A language is a set of strings. It is a mathematical way of expressing a problem: given an input, is it in the set L? If a language is decidable, there is a computer program (TM) that can always solve the problem correctly – it terminates and has the right answer. If a language is undecidable, then no matter how smart you are, and no matter how long you give it, you cannot program a computer to always solve the problem correctly.

UNDECIDABLE PROBLEMS D TM = { 〈 M 〉 | M is a TM that does not accept 〈 M 〉 } Theorem. D TM is undecidable. Proof. Suppose machine N decides D TM. Then N accepts 〈 N 〉 ⇔ 〈 N 〉  D TM ⇔ N does not accept 〈 N 〉 A TM = { 〈 M,w 〉 | M is a TM that accepts on input w } Theorem. If A TM is decidable, so is D TM. Proof. If ¬A TM is decided by the program nAccept we can decide D TM by calling nAccept(M, 〈 M 〉 ). Theorem. If HALT TM is decidable, then so is A TM. HALT TM = { 〈 M,w 〉 | M is a TM that halts on input w }

In most cases, we will show that a language is undecidable by showing that if it is decidable, then so is A TM We reduce deciding A TM to deciding the language in question

MAPPING REDUCTIONS ƒ : Σ*  Σ* is a computable function if there is a TM that on input w, halts with ƒ(w) on its tape A  m B if there is a computable ƒ such that w  A  ƒ(w)  B ƒ is called a reduction from A to B

NET = { J | J is a java applet that opens a network connection } Theorem. A TM ≤ m NET. Proof. On input 〈 M,w 〉, output the Java applet: import cs4011.tools.TuringMachine; import java.net.*; public class OutputApplet extends Applet { public void start() { TuringMachine TM = new TuringMachine(“M”, “w”); TM.run(); if (TM.accepted()) { // open a network connection URL url = new URL(“ Object o = url.getContent(); }

import cs4011.tools.TuringMachine; import java.net.*; public class OutputApplet extends Applet { public void start() { TuringMachine TM = new TuringMachine(“M”, “w”); TM.run(); if (TM.accepted()) { // open a network connection URL url = new URL(“ Object o = url.getContent(); } If M accepts w: OutputApplet opens url. If M loops on w: OutputApplet never gets to url. If M rejects w: OutputApplet skips if {… } block. In both cases, OutputApplet ∉ NET. Thus OutputApplet ∈ NET.

What’s wrong with this reduction? On input 〈 M,w 〉 : Run M on w. if M accepts, output: public class OutputApplet extends Applet { public void start() { URL url = new URL(“ Object o = url.getContent(); } else output: public class OutputApplet extends Applet { public void start() { return; }

PROBLEMS ABOUT TMs

NE TM = { 〈 M 〉 | M is a TM and L(M)   } Theorem: A TM ≤ m NE TM. if s  w: reject if s = w: run M(w) P Mw (s): Let ƒ( 〈 M,w 〉 ) = P Mw defined as: Need to show that: 1.If 〈 M,w 〉 ∈ A TM then P Mw ∈ NE TM. 2. If 〈 M,w 〉  A TM then P Mw  NE TM. If M accepts w then L(P Mw ) = {w}  . If M does not accept w then L(P Mw ) = . Proof:

REG TM = { 〈 M 〉 | M is a TM and L(M) is regular} Theorem: REG TM is undecidable Proof: We show that A TM ≤ m REG TM. The reduction, on input 〈 M,w 〉 outputs the TM P Mw : If ∃ n.s = 0 n 1 n : accept else: return M(w) P Mw (s): If M accepts w, L(P Mw ) = Σ*, so P Mw  REG TM. If M does not accept w, then L(P Mw ) = { 0 n 1 n | n ≥ 0} so P Mw  REG TM.

A TM REG TM ƒ ƒ 〈 M,w 〉 L(P Mw ) =  * 〈 M,w 〉 L(P Mw ) = 0 n 1 n EXAMPLE: REG TM ƒ( 〈 M,w 〉 ) = P Mw.

EXAMPLE SINGLETON TM = { 〈 M 〉 | M is a TM that accepts exactly one string} Show that A TM ≤ m SINGLETON TM. ES TM = { 〈 M 〉 | M is a TM that accepts on input ε } Show that A TM ≤ m ES TM.

RICE ’ S THEOREM Let P be a language of Turing machine encodings. IF P satisfies the following properties: For all TMs M 1 and M 2, where L(M 1 ) = L(M 2 ), 〈 M 1 〉  P if and only if 〈 M 2 〉  P There exist TMs 〈 M IN 〉  P and 〈 M OUT 〉  P THEN P is undecidable EXTREMELY POWERFUL (i.e. P is a “nontrivial property of the r.e. languages.”)

Theorem: Let P be a nontrivial property of the r.e. languages. Then P is undecidable We show that either A TM ≤ m P or A TM ≤ m ¬PProof: Let S be whichever of P, ¬P does not contain the TM T Ø that accepts no strings, and let M IN  S. On input 〈 M,w 〉 our reduction outputs T Mw : if (M(w) and M IN (s)): accept else: reject T Mw (s):

〈 M,w 〉  A TM iff ƒ( 〈 M,w 〉 )  S: If M accepts w, then T Mw accepts whenever M IN does. Then L(T Mw ) = L(M IN ); since S is a “language property”, T Mw  S If M does not accept w, then T Mw doesn’t accept any strings. So L(T Mw ) =  and since T Ø  S, neither is T Mw. if (M(w) and M IN (s)): accept else: reject T Mw (s):

Let 2S TM = { 〈 M 〉 | M is a TM and |L(M)| = 2 }. Theorem: 2S TM is undecidable. Proof: Apply Rice’s Theorem: 1. If L(M 1 ) = L(M 2 ) then |L(M 1 )| = |L(M 2 )| so 〈 M 1 〉  2S TM ⇔ 〈 M 2 〉 in 2S TM. 2. Let M IN (s) = “If s = 0 or s = 1 then accept. else reject.” Let M OUT (s) = accept. Then 〈 M IN 〉  2S TM and 〈 M OUT 〉  2S TM.

EXAMPLES CF TM = { 〈 M 〉 | M is a TM and L(M) is context-free} A ε = { 〈 M 〉 | M is a TM and L(M) = {ε} } OL TM = { 〈 M 〉 | M is a TM and accepts only odd length strings} Use Rice’s Theorem to prove that A ε, CF TM, and OL TM are undecidable.

Let EH = { 〈 M 〉 | M is a TM and ∃ w. M(w) halts } Rice’s Theorem does not apply to EH: Then L(M 1 ) = L(M 2 ) but 〈 M 1 〉∈ EH and 〈 M 2 〉  EH. EH is undecidable. ƒ( 〈 M,w 〉 ) = “P Mw (s): if (s  w): loop forever. else: return M(s).” WITH GREAT POWER COMES GREAT RESPONSIBILITY! Proof: HALT TM ≤ m EH: Let M 1 (s) = “reject.”, M 2 (s) = “loop forever.”

GREAT RESPONSIBILITY WRITE-2-1s = { 〈 M 〉 | M is a TM that writes exactly two ones to its tape on some input} Prove that Rice’s Theorem does not apply to: Let UL TM = { 〈 M 〉 | M is a TM with a useless state } *state q is useless if for all s, M(s) is never in state q

EQ TM = { 〈 M 1,M 2 〉 | M 1,M 2 are TMs and L(M 1 ) = L(M 2 )} Prove EQ TM is undecidable Hint: reduce E TM to EQ TM. EXAMPLE