CSE 311 Foundations of Computing I Lecture 30 Computability: Other Undecidable Problems Autumn 2012 CSE 3111.

Slides:



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

Lecture 19. Reduction: More Undecidable problems
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.
CSE115/ENGR160 Discrete Mathematics 02/28/12
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
CSE115/ENGR160 Discrete Mathematics 03/03/11 Ming-Hsuan Yang UC Merced 1.
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 19 Instructor: Paul Beame.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 18 Instructor: Paul Beame.
Theory of Computing Lecture 20 MAS 714 Hartmut Klauck.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
Halting Problem. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have a tool that would warn us.
04/25/13 Halting Problem Discrete Structures (CS 173) Derek Hoiem, University of Illinois 1
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
MA/CSSE 474 Theory of Computation More Reduction Examples Non-SD Reductions.
Great Theoretical Ideas in Computer Science for Some.
1 L= { u u R where u  {a, b}* } Last class we designed a TM which accepts this language (that is, it halts if the input is in L and hangs or computes.
Halting Problem Introduction to Computing Science and Programming I.
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
Great Theoretical Ideas in Computer Science.
Halting Problem and TSP Wednesday, Week 8. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have.
CSE 311 Foundations of Computing I Lecture 27 FSM Limits, Pattern Matching Autumn 2012 CSE
CS 3813: Introduction to Formal Languages and Automata Chapter 12 Limits of Algorithmic Computation These class notes are based on material from our textbook,
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Computability Universal Turing Machine. Countability. Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural.
CSE 311 Foundations of Computing I Lecture 26 Cardinality, Countability & Computability Autumn 2011 CSE 3111.
Computation Motivating questions: What does “computation” mean? What are the similarities and differences between computation in computers and in natural.
Turing -Recognizable vs. -Decidable
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
Lecture 25 Undecidability Topics: Recursively Enumerable Languages Recursive languages The halting problem Post Correspondence Problem Problem reductions.
CSE 311: Foundations of Computing Fall 2014 Lecture 27: Cardinality.
Recursively Enumerable and Recursive Languages
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 4 Decidability Some slides are in courtesy.
Undecidability and The Halting Problem
CompSci Today’s Topics Computer Science Noncomputability Upcoming Special Topic: Enabled by Computer -- Decoding the Human Genome Reading Great.
Fall 2014 Lecture 29: Turing machines and more decidability CSE 311: Foundations of Computing.
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
1 Recursively Enumerable and Recursive Languages.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
CSE 311: Foundations of Computing Fall 2014 Lecture 28: Undecidability.
Complexity nschank Source: xkcd.com/1425.
Introduction to Computing Science and Programming I
CSE 311 Foundations of Computing I
CS154, Lecture 11: Self Reference, Foundation of Mathematics
Reducibility The Chinese University of Hong Kong Fall 2010
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CSE 105 theory of computation
CS154, Lecture 8: Undecidability, Mapping Reductions
CSCE 411 Design and Analysis of Algorithms
CS154, Lecture 10: Rice’s Theorem, Oracle Machines
CS154, Lecture 8: Undecidability, Mapping Reductions
CSE 311 Foundations of Computing I
Halting Problem.
CSE 311: Foundations of Computing
Instructor: Aaron Roth
CS154, Lecture 11: Self Reference, Foundation of Mathematics
CSE 311: Foundations of Computing
CSE 105 theory of computation
Algorithms CSCI 235, Spring 2019 Lecture 37 The Halting Problem
Presentation transcript:

CSE 311 Foundations of Computing I Lecture 30 Computability: Other Undecidable Problems Autumn 2012 CSE 3111

Announcements Reading – 7th edition: p. 201 and 13.5 – 6th edition: p. 177 and 12.5 – 5th edition: p. 222 and 11.5 Topic list and sample final exam problems have been posted Comprehensive final, roughly 67% of material post midterm Review session, Saturday, December 8, 10 am – noon, EEB 125 Final exam, Monday, December 10 – 2:30-4:20 pm or 4:30-6:20 pm, Kane 220. Autumn 2012CSE 3112

Last lecture highlights Autumn 2012CSE 3113 __11011__ _01 s1s1 (1,s 3 )(1,s 2 )(0,s 2 ) s2s2 (H,s 3 )(R,s 1 ) s3s3 (H,s 3 )(R,s 3 ) Finite Control: program P Recording Medium __01011__ …… input x __001001_ Turing machine = Finite control + Recording Medium + Focus of attention output

Last lecture highlights The Universal Turing Machine U – Takes as input: (,x) where is the code of a program and x is an input string – Simulates P on input x Same as a Program Interpreter Autumn 2012CSE 3114 P input x output P(x) U x output P(x) PP

Last lecture highlights Autumn 2012CSE 3115 __11011__ _01 s1s1 (1,s 3 )(1,s 2 )(0,s 2 ) s2s2 (H,s 3 )(R,s 1 ) s3s3 (H,s 3 )(R,s 3 ) Program P input x _01()s23… s1s1 s2s2 … Universal TM U (1,s3)( __ input xProgram code (1,s3)( _ output

Programs about Program Properties The Universal TM takes a program code as input, and an input x, and interprets P on x – Step by step by step by step… Can we write a TM that takes a program code as input and checks some property of the program? – Does P ever return the output “ERROR”? – Does P always return the output “ERROR”? – Does P halt on input x? Autumn 2012CSE 3116

7 Halting Problem Given: the code of a program P and an input x for P, i.e. given (,x) Output: 1 if P halts on input x 0 if P does not halt on input x Theorem (Turing): There is no program that solves the halting problem “The halting problem is undecidable” Autumn 2012CSE 311

Proof by contradiction Suppose that H is a Turing machine that solves the Halting problem Function D(x): if H(x,x)=1 then – while (true); /* loop forever */ else – no-op; /* do nothing and halt */ endif What does D do on input ? – Does it halt? Autumn 2012CSE 3118

Autumn 2012CSE 3119 D halts on input ⇔ H outputs 1 on input (, ) [since H solves the halting problem and so H(,x) outputs 1 iff D halts on input x] ⇔ D runs forever on input [since D goes into an infinite loop on x iff H(x,x)=1] Function D(x): if H(x,x)=1 then – while (true); /* loop forever */ else – no-op; /* do nothing and halt */ endif Does D halt on input ?

10 That’s it! We proved that there is no computer program that can solve the Halting Problem. This tells us that there is no compiler that can check our programs and guarantee to find any infinite loops they might have Autumn 2012CSE 311

SCOOPING THE LOOP SNOOPER A proof that the Halting Problem is undecidable by Geoffrey K. Pullum (U. Edinburgh) Autumn 2012CSE No general procedure for bug checks succeeds. Now, I won’t just assert that, I’ll show where it leads: I will prove that although you might work till you drop, you cannot tell if computation will stop. For imagine we have a procedure called P that for specified input permits you to see whether specified source code, with all of its faults, defines a routine that eventually halts. You feed in your program, with suitable data, and P gets to work, and a little while later (in finite compute time) correctly infers whether infinite looping behavior occurs...

SCOOPING THE LOOP SNOOPER Autumn 2012CSE Here’s the trick that I’ll use -- and it’s simple to do. I’ll define a procedure, which I will call Q, that will use P’s predictions of halting success to stir up a terrible logical mess.... And this program called Q wouldn’t stay on the shelf; I would ask it to forecast its run on itself. When it reads its own source code, just what will it do? What’s the looping behavior of Q run on Q?... Full poem at:

Halting Problem Autumn 2012CSE H x 1 if P(x) halts 0 if P(x) does not halt PP

14 The “Always Halting” problem Given:, the code of a program Q Output: 1 if Q halts on every input 0 if not. Claim: the “always halts” problem is undecidable Proof idea: – Show we could solve the Halting Problem if we had a solution for the “always halts” problem. – No program solving for Halting Problem exists  no program solving the “always halts” problem exists Autumn 2012CSE 311

The “Always Halting” problem Autumn 2012CSE H x 1 if P(x) halts 0 if P(x) does not halt PP HALT Suppose we had a TM A for the Always Halting problem Program Q(x’) … ignore x’ … run P on x x PP A QQ 1 if P(x) halts 0 if P(x) does not halt

16 The “Always ERROR” problem Given:, the code of a program R Output: 1 if R always prints ERROR 0 if R does not always print ERROR Autumn 2012CSE 311

The “Always ERROR” problem Autumn 2012CSE A 1 if Q always halts 0 if Q does not always halt QQ HALT Suppose we had a TM E for the ERROR problem Program R(x) Run Q on x Print “ERROR” Halt QQ E RR 1 if Q always halts 0 if Q does not always halt

Pitfalls Not every problem on programs is undecidable! Which of these is decidable? Input and x Output: 1 if P prints “ERROR” on x after less than 100 steps 0 otherwise Input and x Output: 1 if P prints “ERROR” on x after more than 100 steps 0 otherwise Autumn 2012CSE 31118