Definition: A_tm = { : M is a Turing machine and M accepts w } /* * Reminder: means the encoding of the TM M and * and its input w. Think of the encoding of a TM, , * as, for example, a C++ program. Think of the encoding of * its input, , as, say, an ASCII string representing a * file which you input to the program . * I'll assume that = -- ie, the * encoding of a program plus its input is the encoding of * the program followed by (concatenated with) the encoding of * its input. */ ===================================== = THEOREM: A_tm is NOT decidable. = ===================================== PROOF: Suppose for contradiction that A_tm IS decidable. // Understand and be able Let M_tm be a TM which DECIDES A_tm. // to recreate the proof!! ------------------- * if M ACCEPTS w ==> M_tm ACCEPTS | | | * if M does NOT ACCEPT w ==> M_tm REJECTS ------------------- (i.e., it rejects or loops) Now construct a machine M'_tm which: copies its input once, to the right of its input; moves its head back to the left edge; then acts just like M_tm. This machine's behavior on input is: ------------------ * if M ACCEPTS ==> M'_tm ACCEPTS | | * if M does NOT ACCEPT ==> M'_tm REJECTS ------------------ Now construct a machine M''_tm which: behaves just like M'_tm except: every time M'_tm was going to accept, have M''_tm reject. And every time M'_tm was going to reject, have M''_tm accept. ------------------- * if M ACCEPTS ==> M''_tm REJECTS | | * if M does NOT ACCEPT ==> M''_tm ACCEPTS ------------------- Now for the punchline. M''_tm is a machine, like any other, so it has an encoding, . Let's consider what M''_tm does if we give it input of ----------------- * if M''_tm ACCEPTS ==> M''_tm REJECTS | | * if M''_tm does NOT ACCEPT ==> M''_tm ACCEPTS ----------------- (i.e., it rejects or loops) What nonsense!: if the machine accepts a certain input than it rejects that input; if the machine does not accept that input (i.e., it rejects or loops on that input) then, in fact, it accepts that input. This is absurd; we have found our contradiction. We conclude that a M_tm can't exist-- A_tm is UNDECIDABLE.