Module07 - Module 7 Halting Problem Fundamental program...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Module 7 Halting Problem Fundamental program behavior problem A specific unsolvable problem Diagonalization technique revisited Proof more complex
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Definition Input Program P Assume the input to program P is a single nonnegative integer This assumption is not necessary, but it simplifies the following unsolvability proof To see the full generality of the halting problem, remove this assumption Nonnegative integer x , an input for program P Yes/No Question Does P halt when run on x ? Notation Use H as shorthand for halting problem when space is a constraint
Background image of page 2
3 Example Input * Program with one input of type unsigned bool main(unsigned Q) { int i=3; if ((Q = = 0) || (Q= = 1)) return false; while (i<Q) { if ((Q-i) = = 1) return (false); i--; } return (true); } Input x 5
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Three key definitions
Background image of page 4
5 Definition of list L * Σ P * is countably infinite where Σ P = {characters, digits, white space, punctuation} Type program will be type string with Σ P as the alphabet Define L to be the strings in Σ P * listed in enumeration order length 0 strings first length 1 strings next Every program is a string in Σ P For simplicity, consider only programs that have one input the type of this input is an unsigned Consider strings in Σ P * that are not legal programs to be programs that always crash (and thus halt on all inputs)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Definition of P H * If H is solvable, some program must solve H • Let P H be a procedure which solves H – We declare it as a procedure because we will use P H as a subroutine Declaration of P H – bool P H (program P, unsigned x) In general, the type of x should be the type of the input to P Comments – We do not know how P H works However, if H is solvable, we can build programs H
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/25/2008 for the course CSE 460 taught by Professor Torng during the Fall '07 term at Michigan State University.

Page1 / 26

Module07 - Module 7 Halting Problem Fundamental program...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online