CSE 105 THEORY OF COMPUTATION Fall 2016 - - PowerPoint PPT Presentation

cse 105
SMART_READER_LITE
LIVE PREVIEW

CSE 105 THEORY OF COMPUTATION Fall 2016 - - PowerPoint PPT Presentation

CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ Today's learning goals Sipser Sec 3.2, 4.1 Use diagonalization in a proof of undecidability. Trace TMs whose inputs are representations of other TMs


slide-1
SLIDE 1

CSE 105

THEORY OF COMPUTATION

Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/

slide-2
SLIDE 2

Today's learning goals Sipser Sec 3.2, 4.1

  • Use diagonalization in a proof of undecidability.
  • Trace TMs whose inputs are representations of other TMs
  • Define and explain core example of decision problems:

ADFA, EDFA, EQDFA, ATM, HALTTM

slide-3
SLIDE 3

Each T-recognizable language is recognized by at least one TM so there are no more recognizable languages than there are TMs. Therefore: there are countably many T-recognizable sets. The collection of all languages is the power set of the set Σ*. Since Σ* is countable, the diagonal argument shows that its power set is uncountable.

All languages

Counting arguments

Turing-recognizable languages Countable Uncountable

slide-4
SLIDE 4

Satisfied?

  • Maybe not …
  • What's a specific example of a language that is not

Turing-recognizable? or not Turing-decidable?

  • Idea: consider set that, were it to be Turing-decidable,

would have to "talk" about itself.

slide-5
SLIDE 5

ATM

Recall ADFA = {<B,w> | B is a DFA and w is in L(B) } ATM = {<M,w> | M is a TM and w is in L(M) }

What is ATM ?

  • A. A Turing machine whose input is codes of TMs and

strings.

  • B. A set of pairs of TMs and strings.
  • C. A set of strings that encode TMs and strings.
  • D. Not well defined.
  • E. I don't know.
slide-6
SLIDE 6

ATM

ATM = {<M,w> | M is a TM and w is in L(M) } Define the TM N = "On input <M,w>:

  • 1. Simulate M on w.
  • 2. If M accepts, accept. If M rejects, reject."
slide-7
SLIDE 7

ATM

ATM = {<M,w> | M is a TM and w is in L(M) } Define the TM N = "On input <M,w>:

  • 1. Simulate M on w.
  • 2. If M accepts, accept. If M rejects, reject."

What is L(N)?

  • A. ATM
  • B. Some superset of ATM
  • C. {<M,w> | M is a TM and w is a string}
  • D. I don't know.
slide-8
SLIDE 8

ATM

ATM = {<M,w> | M is a TM and w is in L(M) } Define the TM N = "On input <M,w>:

  • 1. Simulate M on w.
  • 2. If M accepts, accept. If M rejects, reject."

Which statement is true?

  • A. N decides ATM
  • B. N recognizes ATM
  • C. N always halts
  • D. I don't know.
slide-9
SLIDE 9

ATM

ATM = {<M,w> | M is a TM and w is in L(M) } Define the TM N = "On input <M,w>:

  • 1. Simulate M on w.
  • 2. If M accepts, accept. If M rejects, reject."

Conclude: ATM is Turing-recognizable. Is it decidable?

slide-10
SLIDE 10

Diagonalization proof: ATM not decidable Sipser 4.11

Assume, towards a contradiction, that it is. I.e. let MATM be a Turing machine such that for every TM M and every string w,

  • Computation of MATM on <M,w> halts and accepts if w is in

L(M).

  • Computation of MATM on <M,w> halts and rejects if w is

not in L(M).

slide-11
SLIDE 11

Diagonalization proof: ATM not decidable Sipser 4.11

Assume, towards a contradiction, that it is. I.e. let MATM be a Turing machine such that for every TM M and every string w,

  • Computation of MATM on <M,w> halts and accepts if w is in

L(M).

  • Computation of MATM on <M,w> halts and rejects if w is

not in L(M).

If M1 is TM with L(M1) = { w | w starts with 0 } and M1 does not halt on all strings not in L(M1), what is the result of the computation of MATM on <M1, 11>?

  • A. MATM halts and accepts.
  • B. MATM halts and rejects.
  • C. MATM loops.
  • D. I don't know.
slide-12
SLIDE 12

Diagonalization proof: ATM not decidable Sipser 4.11

Assume, towards a contradiction, that MATM decides ATM Define the TM D = "On input <M>:

  • 1. Run MATM on <M, <M>>.
  • 2. If MATM accepts, reject; if MATM rejects, accept."
slide-13
SLIDE 13

Diagonalization proof: ATM not decidable Sipser 4.11

Assume, towards a contradiction, that MATM decides ATM Define the TM D = "On input <M>:

  • 1. Run MATM on <M, <M>>.
  • 2. If MATM accepts, reject; if MATM rejects, accept."

Is D a decider?

  • A. Yes: it's a TM that always halts.
  • B. No: it’s a well-defined TM but may loop.
  • C. No: it's not even a well-defined TM.
  • D. I don't know.
slide-14
SLIDE 14

Diagonalization proof: ATM not decidable Sipser 4.11

Assume, towards a contradiction, that MATM decides ATM Define the TM D = "On input <M>:

  • 1. Run MATM on <M, <M>>.
  • 2. If MATM accepts, reject; if MATM rejects, accept."

If M0 is a TM with L(M0) = Ø, what is result of computation of D with input <M0>?

  • A. Halt and accept.
  • B. Halt and reject.
  • C. Loop.
  • D. I don't know.
slide-15
SLIDE 15

Diagonalization proof: ATM not decidable Sipser 4.11

Assume, towards a contradiction, that MATM decides ATM Define the TM D = "On input <M>:

  • 1. Run MATM on <M, <M>>.
  • 2. If MATM accepts, reject; if MATM rejects, accept."

If M1 is a TM with L(M1) = Σ*, what is result of computation of D with input <M1>?

  • A. Halt and accept.
  • B. Halt and reject.
  • C. Loop.
  • D. I don't know.
slide-16
SLIDE 16

Diagonalization proof: ATM not decidable Sipser 4.11

Assume, towards a contradiction, that MATM decides ATM Define the TM D = "On input <M>:

1.

Run MATM on <M, <M>>.

2.

If MATM accepts, reject; if MATM rejects, accept." Consider running D on input <D>. Because D is a decider:

Ø either computation halts and accepts … Ø or computation halts and rejects …

slide-17
SLIDE 17

Diagonalization proof: ATM not decidable Sipser 4.11

Assume, towards a contradiction, that MATM decides ATM Define the TM D = "On input <M>:

1.

Run MATM on <M, <M>>.

2.

If MATM accepts, reject; if MATM rejects, accept." Consider running D on input <D>. Because D is a decider:

Ø either computation halts and accepts … Ø or computation halts and rejects …

Diagonalization??? Self-reference "Is <D> an element of L(D)?"

slide-18
SLIDE 18

Regular Context- Free Decidable Turing- Recognizable {anbn | n ≥ 0} {anbnan | n ≥ 0} ATM ??

slide-19
SLIDE 19

So far

Decidable Recognizable (and not decidable) Co-recognizable (and not decidable) ADFA ATM ATM

C

EDFA EQDFA

slide-20
SLIDE 20

Is there an unrecognizable set?

  • Unsatisfying answer:
  • "Yes, because of counting arguments"
  • How do we prove that a set is not Turing-recognizable?

Later… First, let's get more comfortable with undecidability

slide-21
SLIDE 21

So far

Decidable Recognizable (and not decidable) Not recognizable ADFA ATM ?? EDFA EQDFA Give algorithm! Diagonalization

slide-22
SLIDE 22

Do we have to diagonalize?

  • Turning subroutines on their head …

HALTTM = { <M,w> | M is a TM and M halts on input w} ATM = { <M,w> | M is a TM and w is in L(M)}

slide-23
SLIDE 23

Do we have to diagonalize?

  • Turning subroutines on their head …

HALTTM = { <M,w> | M is a TM and M halts on input w} ATM = { <M,w> | M is a TM and w is in L(M)} Claim: HALTTM is undecidable.

How is HALTTM related to ATM ?

  • A. They're the same set.
  • B. One is a subset of the other.
  • C. They have the same type of

elements but no other relation.

  • D. I don't know.
slide-24
SLIDE 24

Claim: HALTTM is undecidable.

  • Proof by contradiction …
slide-25
SLIDE 25

Claim: HALTTM is undecidable.

  • Proof by contradiction …
  • Assume we have a machine R that decides HALTTM
  • Build an algorithm that uses R as a subroutine that decides ATM
  • This is impossible!
slide-26
SLIDE 26

Claim: HALTTM is undecidable.

  • Proof: Assume, towards a contradiction, that HALTTM is

decidable and that TM R decides it. Construct a new TM MATM by: "On input <M,w>"

1.

Run R on input <M,w>.

2.

If R rejects, then reject; else, run M on w.

a.

If this computation accepts, accept.

b.

If this computation rejects, reject."

Which of the machines in this proof are deciders?

  • A. All of them: R, MATM, M
  • B. Definitely R and MATM; M may or may not be.
  • C. Definitely R; MATM and M may or may not be.
  • D. None of them has to be.
  • E. I don't know.
slide-27
SLIDE 27

Claim: HALTTM is undecidable.

  • Proof: Assume, towards a contradiction, that HALTTM is

decidable and that TM R decides it. Construct a new TM MATM by: "On input <M,w>"

1.

Run R on input <M,w>.

2.

If R rejects, then reject; else, run M on w.

a.

If this computation accepts, accept.

b.

If this computation rejects, reject."

Lemma: MATM decides ATM. (Proof of correctness of construction.) Therefore, ATM is decidable, a contradiction with our earlier work.

slide-28
SLIDE 28

SCOOPING THE LOOP SNOOPER A proof that the Halting Problem is undecidable Geoffrey K. Pullum (http://www.lel.ed.ac.uk/~gpullum/ loopsnoop.html) No general procedure for bug checks will do. Now, I won’t just assert that, I’ll prove it to you. I will prove that although you might work till you drop, you cannot tell if computation will stop. For imagine we have a procedure called P that for specified input permits you to see whether specified source code, with all of its faults, defines a routine that eventually halts. You feed in your program, with suitable data, and P gets to work, and a little while later (in finite compute time) correctly infers whether infinite looping behavior occurs. If there will be no looping, then P prints out ‘Good.’ That means work on this input will halt, as it should. But if it detects an unstoppable loop, then P reports ‘Bad!’ — which means you’re in the soup. Well, the truth is that P cannot possibly be, because if you wrote it and gave it to me, I could use it to set up a logical bind that would shatter your reason and scramble your mind. Here’s the trick that I’ll use — and it’s simple to do. I’ll define a procedure, which I will call Q, that will use P’s predictions of halting success to stir up a terrible logical mess. For a specified program, say A, one supplies, the first step of this program called Q I devise is to find out from P what’s the right thing to say

  • f the looping behavior of A run on A.

If P’s answer is ‘Bad!’, Q will suddenly stop. But otherwise, Q will go back to the top, and start off again, looping endlessly back, till the universe dies and turns frozen and black. And this program called Q wouldn’t stay on the shelf; I would ask it to forecast its run on itself. When it reads its own source code, just what will it do? What’s the looping behavior of Q run on Q? If P warns of infinite loops, Q will quit; yet P is supposed to speak truly of it! And if Q’s going to quit, then P should say ‘Good.’ Which makes Q start to loop! (P denied that it would.) No matter how P might perform, Q will scoop it: Q uses P’s output to make P look stupid. Whatever P says, it cannot predict Q: P is right when it’s wrong, and is false when it’s true! I’ve created a paradox, neat as can be — and simply by using your putative P. When you posited P you stepped into a snare; Your assumption has led you right into my lair. So where can this argument possibly go? I don’t have to tell you; I’m sure you must know. A reductio: There cannot possibly be a procedure that acts like the mythical P. You can never find general mechanical means for predicting the acts of computing machines; it’s something that cannot be done. So we users must find our own bugs. Our computers are losers!

slide-29
SLIDE 29

So far

Decidable Recognizable (and not decidable) Not recognizable ADFA ATM ?? EDFA HALTTM EQDFA Give algorithm! Diagonalization OR reduction

slide-30
SLIDE 30

Reduction?

A problem P1 reduces to a problem P2 if any solution for P2 can be used to solve P1. In other words: using a solution for P2 as a subroutine gives a solution for P1. In our example: we used a solution for HALTTM to get a solution for ATM. This means that ATM reduces to HALTTM.