noncomputable
play

Noncomputable procedure computes its digits . Sets (Procedure - PowerPoint PPT Presentation

MathematicsforComputerScience Computablestringsin{0,1} MIT 6.042J/18.062J An infinite string s in {0,1} is computable iff some Noncomputable procedure computes its digits . Sets (Procedure applied to argument n returns nth digit


  1. Mathematics for Computer Science Computable strings in {0,1} ω MIT 6.042J/18.062J An infinite string s in {0,1} ω is computable iff some Noncomputable procedure computes its digits . Sets (Procedure applied to argument n returns nth digit of s.) Albert R Meyer, March 4, 2015 Albert R Meyer, March 4, 2015 halting.1 halting.2 {ASCII}* is countable N oncomputable strings in {0,1} ω Only countably many finite So only countably many computable infinite binary strings. (List them in ASCII strings. But {0,1} ω is uncountable, so order of length.) there must be noncomputable Procedures can be expressed in strings in {0,1} ω ASCII, so only —in fact, uncountably many! countably many procedures. Albert R Meyer, March 4, 2015 Albert R Meyer, March 4, 2015 halting.3 halting.4 1

  2. The Halting Problem The Halting Problem There is no test procedure for String procedure P takes a String halting of arbitrary procedures. argument: P("no") returns 2 The Halting Problem P("albert") returns "meyer" is not decidable P("&&%99!!") causes an error by computational procedures P("what now?") runs forever. Albert R Meyer, March 4, 2013 halting.6 Albert R Meyer, March 4, 2015 halting.5 The Halting Problem The Halting Problem Suppose there was a Let s be an ASCII string procedure Q that decided defining P s . HALTS: Say s HALTS iff Q(s) returns "yes” if s HALTS P s (s) returns something. returns "no” otherwise Albert R Meyer, March 4, 2013 Albert R Meyer, March 4, 2013 halting.7 halting.8 2

  3. The Halting Problem The Halting Problem Modify Q to Q': So Q'(s) returns "yes” s HALTS iff if Q(s) returns "no" Q'(s) returns nothing Q'(s) returns nothing if Q(s) returns "yes” Albert R Meyer, March 4, 2013 Albert R Meyer, March 4, 2013 halting.9 halting.10 The Halting Problem The Halting Problem CONTRADICTION: Let t be the text for Q’ t HALTS iff NOT ( t HALTS) So by def of HALTS: There can't be such a Q: t HALTS iff Q'( t ) returns it is impossible to write a and by def of Q’: procedure that decides Q'( t ) returns iff NOT ( t HALTS) whether strings HALT Albert R Meyer, March 4, 2013 Albert R Meyer, March 4, 2013 halting.11 halting.12 3

  4. The Type-checking Problem The Type-checking Problem There is no string procedure that Use C to get a HALTS Tester H: type-checks perfectly, because: to compute H(s), construct a Suppose C was a type-checking new program text, s’, that procedure: for program text s acts like a slightly modified C(s) returns “yes” if s would cause interpreter for s. Namely: a run-time type error returns “no” otherwise. Albert R Meyer, March 4, 2013 Albert R Meyer, March 4, 2013 halting.13 halting.14 The Type-checking Problem The Type-checking Problem • s’ skips any command that Then compute C(s’) and would cause s to make a return the same value. run-time type error. So s HALTS • s’ purposely makes a type- iff s’ makes run-time type error error when it finds that s iff C(s’) = “yes” HALTS. iff H(s) = “yes” Albert R Meyer, March 4, 2013 Albert R Meyer, March 4, 2013 halting.15 halting.16 4

  5. No run-time properties The Type-checking Problem are decidable H solves the Halting The same reasoning shows that there is no perfect Problem, a contradiction. checker for essentially any So C must not error check property of procedure correctly. outcomes. Albert R Meyer, March 4, 2013 Albert R Meyer, March 4, 2013 halting.18 halting.19 5

  6. MIT OpenCourseWare http s ://ocw.mit.edu 6.042J / 18.062J Mathematics for Computer Science Spring 20 15 For information about citing these materials or our Terms of Use, visit: http s ://ocw.mit.edu/terms.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend