Noncomputable Sets: Computable

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

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 halting.1 Albert R Meyer, March 4, 2015 halting.2

{ASCII}* is countable Noncomputable strings in {0,1}ω


Only countably many finite So only countably many computable
ASCII strings. (List them in infinite binary strings.
order of length.) But {0,1}ω is uncountable, so
Procedures can be expressed in there must be noncomputable
strings in {0,1}ω
ASCII, so only —in fact, uncountably many!
countably many procedures.
Albert R Meyer, March 4, 2015 halting.3 Albert R Meyer, March 4, 2015 halting.4

1
The Halting Problem The Halting Problem

There is no test procedure for


String procedure P takes a String

halting of arbitrary procedures.


argument:

The Halting Problem


P("no") returns 2

is not decidable
P("albert") returns "meyer"

by computational procedures
P("&&%99!!") causes an error

P("what now?") runs forever.

Albert R Meyer, March 4, 2015 Albert R Meyer, March 4, 2013 halting.6


halting.5

The Halting Problem The Halting Problem

Let s be an ASCII string


Suppose there was a
defining Ps.
procedure Q that decided
Say s HALTS iff
HALTS:
Ps(s) returns something.
Q(s) returns "yes” if s HALTS
returns " no” otherwise
Albert R Meyer, March 4, 2013 halting.7 Albert R Meyer, March 4, 2013 halting.8

2
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 halting.9 Albert R Meyer, March 4, 2013 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 halting.11 Albert R Meyer, March 4, 2013 halting.12

3
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 halting.13 Albert R Meyer, March 4, 2013 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 halting.15 Albert R Meyer, March 4, 2013 halting.16

4
The Type-checking Problem No run-time properties

are decidable

H solves the Halting The same reasoning shows


Problem, a contradiction. that there is no perfect
So C must not error check checker for essentially any
property of procedure
correctly.
outcomes.

Albert R Meyer, March 4, 2013 halting.18 Albert R Meyer, March 4, 2013 halting.19

5
MIT OpenCourseWare
https://ocw.mit.edu

6.042J / 18.062J Mathematics for Computer Science


Spring 2015

For information about citing these materials or our Terms of Use, visit: https://ocw.mit.edu/terms.

You might also like