SUNY Geneseo Department of Computer Science


The Halting Problem

{Date}

CSci 141, Fall 2004
Prof. Doug Baldwin

Return to List of Lectures

Previous Lecture


Misc

Homework 3 due Thursday

End of Semester Stuff

Questions?

Lists vs trees for homework

Unsolvable Problems

Sections 17.1 and 17.2

1st section

What's with 2nd section?

A Game

In each round of play....

Object: Correctly guess which coin I will give you

How well can you do in this game?

Variation: I show you the algorithm I will use to select a coin to give you. Can you always win?

My algorithm:

    get the guess
    if guess = pennny
        give dime
    else
        give penny

Barber of Seville example

Halting Demo

Problem to solve: Can an algorithm determine whether another algorithm halts?

Program that demonstrates this problem, consisting of a Main Class and a HaltingDetector Class

Halting question can't be answered for some programs (and inputs)

Therefore halting problem cannot be solved by any algorithm (because there are some inputs for which the question is unanswerable)

The halting problem is "undecidable"

Some (many) instances solvable

There are inherent limits to computer science

But they are identifiable by computer science

Other Undecidable Problems

Given the text of a program, P, and an input, I, does P run on I ever generate an exception?


Next Lecture