{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Module07 - Module 7 Halting Problem Fundamental program...

Info icon This 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
Image of page 1

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

View Full Document Right 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
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
Image of page 3

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

View Full Document Right Arrow Icon
4 Three key definitions
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)
Image of page 5

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern