CSCE 411 Lecture 35

From Notes
Jump to navigation Jump to search
Lecture Slides

« previous | Monday, November 19, 2012 | next »


Cardinality

Alternate Proof of Uncountability

Seeking a contradiction, assume is countable.

Enumerate these function , , etc.

Obtain contradiction by defining using "diagonalization" that should be in set, but is not equal to any 's: Let .


The Halting Problem

Consider a function halt:

  • input: code for program and an input for
  • output: 1 if terminates (halts) when executed on input and 0 if doesn't terminate (goes into an infinite loop) when executed on input

By the way, a compiler is a program that takes as input the code for another program.

This problem would be the ultimate debugging tool of all time!, but... what if we give halt itself?

View halt as a function from to :

  • and can be represented in ASCII, which is a string of bits
  • Any string of bits can be interpreted as a natural number.

Suppose there is a program that computes halt.

Use as a subroutine in another program :

  • input: code for any program
  • constructs pair and calls on
  • returns same answer as .

Use as subroutine in another program :

  • input: code for any program
  • call on
  • if returns 1 (i.e. does not go into an infinite loop), then go into an infinite loop.
  • if returns 0 (i.e. goes into an infinite loop), then output 0.

In effect, does the opposite of what program does on input :

  • If halts when executed on input , then goes into an infinite loop
  • If does not halt when executed on input , then halts and outputs 0

What happens if is given its own code as input? It should either halt or not halt.

  • If halts when executed on input , then goes into an infinite loop.
  • If doesn't halt when executed on input , then halts.

contradiction!

What went wrong? Our assumption that there is an algorithm to compute halt was incorrect.


Undecidability

Analog of uncomputable function is an undecidable set.

Theory of what can and can't be computed focuses on identifying strings:

  • algorithm is required to "decide" if a gived input string is in the set of interest
  • similar to deciding if the input to some NPC problem is a YES or NO instance

Formal language is set of strings, assuming some encoding.

  • Analogous to halt is set of all strings that encode programs and an input such that halts when executed on
  • No program can determine whether a string is in or not


More reductions:

  • For NP-completeness, we were concerned with the time complexity of problems: reduction from to had to be in poly time
  • now concerned with computability of problems: reduction just has to be computable, no matter how slow it is.


Many-One Reduction

Similar to NPC reductions:

  • YES map to YES
  • NO map to NO
  • computable
  • notation: (think is at least as hard to compute as