Impossible problems.

Slides:



Advertisements
Similar presentations
Week 5: Loops 1.  Repetition is the ability to do something over and over again  With repetition in the mix, we can solve practically any problem that.
Advertisements

Limitations. Limitations of Computation Hardware precision Hardware precision Software - we’re human Software - we’re human Problems Problems –complex.
1 CSC3130 Formal Languages and Automata Theory Tutorial 9 Undecidable Problem KN Hung SHB 1026.
CSE115/ENGR160 Discrete Mathematics 02/28/12
1 Section 14.1 Computability Some problems cannot be solved by any machine/algorithm. To prove such statements we need to effectively describe all possible.
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.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
Humans, Computers, and Computational Complexity J. Winters Brock Nathan Kaplan Jason Thompson.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
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.
Unsolvability and Infeasibility. Computability (Solvable) A problem is computable if it is possible to write a computer program to solve it. Can all problems.
Halting Problem Introduction to Computing Science and Programming I.
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.
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)
Russell’s Paradox and the Halting Problem Lecture 24 Section 5.4 Wed, Feb 23, 2005.
SNU OOPSLA Lab. 1 Great Ideas of CS with Java Part 1 WWW & Computer programming in the language Java Ch 1: The World Wide Web Ch 2: Watch out: Here comes.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
Fundamentals of Informatics Lecture 12 The Halting Problem Bas Luttik.
Very Hard Problems I am so not kidding about this. Please grab a handout.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Undecidability and The Halting Problem
CompSci Today’s Topics Computer Science Noncomputability Upcoming Special Topic: Enabled by Computer -- Decoding the Human Genome Reading Great.
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
1 Recursively Enumerable and Recursive Languages.
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.
CSE15 Discrete Mathematics 03/06/17
The Acceptance Problem for TMs
CS 461 – Nov. 2 Sets Prepare for ATM finite vs. infinite Infinite sets
Introduction to Computing Science and Programming I
Set Operations CS 202, Spring 2008 Epp, chapter 5.
Halting Problem Dr K R Bond 2009
Recursively Enumerable and Recursive Languages
Linear Bounded Automata LBAs
CSE 311 Foundations of Computing I
Undecidable Problems Costas Busch - LSU.
Unsolvable Problems December 4, 2017.
Thinking Like a Scientist
LIMITS OF ALGORITHMIC COMPUTATION
HIERARCHY THEOREMS Hu Rui Prof. Takahashi laboratory
Writing Functions( ) (Part 5)
A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 13 (Reed) - Conditional.
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CSE 105 theory of computation
CSCE 411 Design and Analysis of Algorithms
Repetition Structures
CSE 311 Foundations of Computing I
Decidable Languages Costas Busch - LSU.
Coding Concepts (Standards and Testing)
CS 425 / ECE 428 Distributed Systems Fall 2017 Indranil Gupta (Indy)
Halting Problem.
Formal Languages, Automata and Models of Computation
Class 24: Computability Halting Problems Hockey Team Logo
Tonga Institute of Higher Education IT 141: Information Systems
C. M. Overstreet Old Dominion University Spring 2006
Tonga Institute of Higher Education IT 141: Information Systems
CSE 311: Foundations of Computing
Arrays.
Computability and Undecidability
A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 13 (Reed) - Conditional.
CSE 105 theory of computation
C. M. Overstreet Old Dominion University Fall 2005
Algorithms CSCI 235, Spring 2019 Lecture 37 The Halting Problem
C. M. Overstreet Old Dominion University Fall 2007
This shows running the first guess number program which only allows one guess - I show the correct answer for testing purposes.
Presentation transcript:

Impossible problems

Semidecidable problems Question: Given this input data, will Program P ever halt, or will it run forever? Solution: Try running it If it halts, we know the answer If it hasn’t halted yet, we don’t know the answer How long do we have to wait? This problem is semidecidable—if it halts, we know the answer, but if it doesn’t, we don’t Can we do better? Program P Data for Program P

The Halting Problem Let’s write a program HaltChecker that accepts two inputs: A program, and The data for that program and determines whether the program (with that data) will halt This program will have one of two outputs: halts, and loops Program P Data for Program P HaltChecker halts loops (forever) HaltChecker reads another program as one of its inputs This is not unusual--compilers do it all the time

A modified HaltChecker We’ll make a slight change to HaltChecker--we will replace the halts output with an infinite loop Program P Data for Program P HaltChecker2 halts loops (forever) We call this new program HaltChecker2 HaltChecker2 behaves like this: If Program P would halt on its input data, HaltChecker2 goes into an infinite loop If Program P would go into an infinite loop on its data, HaltChecker2 halts (and reports its result) Thus, HaltChecker2 does the opposite of what Program P does

A problem HaltChecker2 has as input both a program and the input to that program What happens if we apply HaltChecker2 to itself (with itself as input)? HaltChecker2 halts loops (forever) A little thought (or maybe a lot of thought) should convince you that HaltChecker2 halts when applied to itself if and only if it doesn’t halt when applied to itself This is a contradiction Therefore, a program such as HaltChecker2 cannot exist However, we can easily modify HaltChecker to get HaltChecker2 Therefore, HaltChecker cannot exist

What have we proved? Clearly, for most programs we can determine whether or not they will halt We can write a HaltChecker-type program that can determine, for most programs, whether or not they will halt What we have proved is that we cannot write such a program that always works, for every program, for every input More generally, we have proved that some problems cannot be solved There are only a few such problems known (the Halting Problem is the most famous), but they are important

Consequences Can we prove that a certain statement in a program will never be executed? Replace the statement with an infinite loop The problem is now a Halting Problem Conclusion: You can’t always prove that a certain statement will or will not be executed But as usual, you can sometimes prove that it will or will not be executed Familiar consequence: Java warns you if you use a variable before it has been initialized Its algorithm for doing this is not perfect Could the algorithm be made 100% effective?

Why you should care Someday you may be asked to solve a problem that is equivalent to the Halting Problem It’s not too likely, but... ...it has happened to me If it happens, you can write a program that mostly works, but you cannot write one that always works Before you spend a lot of company money on the project, you need to educate your manager about what can be expected--or you’ll get blamed when it doesn’t work In my case, my manager decided the task wasn’t worth the effort :)

The End