[an error occurred while processing this directive]

cs150: Notes 26

Assignments Due

Notes

Halting Problem

Input: a procedure specification P

Output: true if applying P would halt (finishes execution), false otherwise.

(define (halts? procedure) ...?...)
(define (paradox)
  (if (halts? 'paradox) 
      (infinite-loop)
      150))
What would it mean if (halts? 'paradox) evaluates to #t?







What would it mean if (halts? 'paradox) evaluates to #f?







Prove the halts? algorithm cannot exist.







Proof by Contradiction

  1. Show X is non-sensical.
  2. Show that if you have an A you can make X.
  3. Therefore, A cannot exist.




Evaluates-to-3

Input: A procedure specification P

Output: true if evaluating an application of P would result in 3; false otherwise.

Is the Evaluates-to-3 Problem computable?






cs1120: Computer Science
University of Virginia
weimer@virginia.edu
Using these Materials