[Note: this webpage last modified Friday, 04-Feb-2011 19:44:51 EST]
Today's attendance quiz.
Last time reviewed the prereq exam, and you should be working on the homework that is due next class.
In this first part of the course, we explore the P versus NP question and some related issues. We start by reviewing the "foundations" of computation and computability theory. The main results that we will talk about today are: (i) the Turing Machine model and the fact that it is roughly equivalent to standard computers, and (ii) that there are (many) uncomputable problems, e.g. the halting problem.
Definition and picture of a Turing machine.
It is known and not too hard to show that the Turing machine can simulate any other "reasonable" model of computation. The book gives as an example an "abstract RAM" (Random Access Machine) computer with an infinite number of memory cells that each hold integers (the first n of which hold the input, and "n" is given in a special register), finite number of registers, a program counter, a program that is a finite list of instructions from instruction set reset(r), inc(r), dec(r), load(r1, r2), store(r1, r2), cond-goto(r, l).
Draw a picture of this machine and a TM, and hand-waivy explanation of how TM can simulate this abstract RAM. The program of the RAM is encoded into the finite control of the TM. For convenience, we can describe a TM with 3 tapes rather than 1 (it can be shown tha t 1-tape TM can simulate k-tape machine for any constant k). One tape holds the input, another would hold the contents of the RAM's registers and memory cells, and another would be additional "work space". To simulate inc and dec, we would need to have the TM scan across it's work tape that stores the registers to appropriate register and modify values there locally (possibly also needing to shift all the data stored on the tape over by one to make room for a larger value in the register). load and store similarly would require scanning to an appropriate location on the TM tape holding the registers and memory cells. cond-goto would amount to much of the same - examining the value of a register, but then "jumping" to a different part of the finite control sequence of the TM.
So with our hand-waivy explanation, if we could program a TM to scan across its tape to appropriate locations, we would be done. This can be done, but we're not going to discuss it here.
An important point of the above - what is the loss in efficiency when the TM simulates the RAM? Consider the load/store. We may have to scan to some location on any part of the work-tapes we have used so far, and then will have to copy a number of bits back and forth. If the RAM runs in time t(n), the relevant portion of the work-tapes are of length O(t(n)). The values of the registers increase by at most one per instruction, so they will take up O(log(t(n))) bits. Then copying the bits back and forth takes O(log(t(n)) * t(n)) steps on the TM.
In general, an analysis can be done to show that a TM can simulate any other "reasonable" model of computation with some fixed polynomial blowup in time. For example a computer that executes in time t might be simulated by a TM that runs in time t2.
Note that the TM is simpler than the abstract RAM - it would be more cumbersome to program, but it is simpler to analyze.
Proof that there exist uncomputable problems - every computable problem corresponds to some TM, there are countably infinitely many TM's (each corresponds to a binary string that describes it), but there are uncountably infinitely many functions from the naturals to 0/1.
Proof that the halting problem is uncomputable. Proof by contradiction using "diagonalization". Halting problem (M, x) such that M halts on input x. Note that can encode the description of a TM as a binary string - e.g., take the text file describing its transition function and look at the binary representation of that text file.
Will show "diagonal" of the halting problem is not computable - d(M) = M(M) - run M with its own description as input. First, look at d' such that d'(M) = 1 if and only if M(M) halts and outputs 0. Suppose d' is computable by some machine Md' (halts on every input and computes the correct answer). So, what about Md'(Md')? If Md'(Md') halts and outputs 0, then by definition d'(Md') = 1, so to compute d', it should have been that Md'(Md') = 1. If Md'(Md') halts and outputs 1, then by definition d'(Md') = 0, so to compute d', it should have been that Md'(Md') = 0. So Md' cannot compute d' correctly, and d' is not computable/decidable.
So what about d now? We will use a reduction from d' to d - if we could solve d, then we could solve d', and we know that d' cannot be solved, so then we'll know d cannot be solved either (and also the halting problem because d is just a subcase of that). Suppose have algorithm A to solve d. Given an input M' to d', construct M'' such that M''(x) emulates M'(M') and (i) if M'(M') halts and =0, then M'' halts, (ii) if M' halts with non-zero output, then M'' infinite loops, and (iii) if M' does not halt, then neither does M''. So what is the output of d(M'')? d(M'')=1 if M''(M'') halts, and d(M'')=0 otherwise. M''(M'') halts if only if M'(M') halts and =0, do d(M'') = d'(M'). Then if we could solve d, we could also solve d', which we know cannot be solved.
The assigned reading for the next lecture, what we will talk about next time - definitions of P and NP, problems in P and NP.
The homework is due at the beginning of class next time, and I will not accept late assignments (I will grade them but you will get a 0).
If time allows, mention Rice's Theorem - for any nontrivial subset of the computable partial functions (neither empty nor containing every function) it is undecidable/uncomputable to determine whether TM's compute a function in the set.