{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Module07 - Module 7 Halting Problem Fundamental program...

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

1 Module 7 Halting Problem Fundamental program behavior problem A specific unsolvable problem Diagonalization technique revisited Proof more complex

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

View Full Document
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
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

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

View Full Document
4 Three key definitions
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)

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

View Full Document
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
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern