27
BU CS 332 – Theory of Computation Lecture 15: Undecidable and Unrecognizable Languages Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

BU CS 332 – Theory of Computation

Lecture 15:• Undecidable and Unrecognizable Languages• Reductions

Reading:Sipser Ch 4.2, 5.1

Mark BunMarch 23, 2020

Page 2: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

How can we compare sizes of infinite sets?Definition: Two sets have the same size if there is a correspondence (bijection) between them

A set is countable if• it is a finite set, or• it has the same size as  , the set of natural numbers

3/23/2020 CS332 ‐ Theory of Computation 2

Page 3: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

A general theorem about set sizesTheorem: Let  be a set. Then the power set  does not have the same size as  .

Proof: Assume for the sake of contradiction that there is a correspondence 

Goal: Use diagonalization to construct a set  that cannot be the output  for any 

3/23/2020 CS332 ‐ Theory of Computation 3

Page 4: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Undecidable Languages

3/23/2020 CS332 ‐ Theory of Computation 4

Page 5: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Problems in language theory

3/23/2020 CS332 ‐ Theory of Computation 5

𝐃𝐅𝐀decidable

𝐂𝐅𝐆decidable

𝐃𝐅𝐀decidable

𝐂𝐅𝐆decidable

𝐃𝐅𝐀decidable

𝐓𝐌?

𝐓𝐌?

𝐓𝐌?

𝐂𝐅𝐆?

Page 6: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

UndecidabilityThese natural computational questions about computational models are undecidable

I.e., computers cannot solve these problems no matter how much time they are given

3/23/2020 CS332 ‐ Theory of Computation 6

Page 7: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

An existential proofTheorem: There exists an undecidable language over Proof: A simplifying assumption: Every string in  ∗ is the encoding  of some Turing machine 

Set of all Turing machines:   ∗

Set of all languages over  :

There are more languages than there are TM deciders!

3/23/2020 CS332 ‐ Theory of Computation 7

all subsets of  ∗

Page 8: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

An existential proofTheorem: There exists an unrecognizable language over Proof: A simplifying assumption: Every string in  ∗ is the encoding  of some Turing machine 

Set of all Turing machines:   ∗

Set of all languages over  :

There are more languages than there are TM recognizers!

3/23/2020 CS332 ‐ Theory of Computation 8

all subsets of  ∗

Page 9: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

An explicit undecidable language

3/23/2020 CS332 ‐ Theory of Computation 9

TM 𝑀

𝑀

𝑀

𝑀

𝑀

Page 10: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

An explicit undecidable language

3/23/2020 CS332 ‐ Theory of Computation 10

TM 𝑀 𝑀 𝑀 ? 𝑀 𝑀 ? 𝑀 𝑀 ? 𝑀 𝑀 ?

𝑀 Y N Y Y𝑀 N N Y Y𝑀 Y Y Y N𝑀 N N Y N

Suppose  decides 

𝐷 𝐷 ?

𝐷

Page 11: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

An explicit undecidable languageTheorem:

is undecidableProof: Suppose for contradiction, that  decides 

Corollary:is undecidable3/23/2020 CS332 ‐ Theory of Computation 11

Page 12: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

A more useful undecidable language

Theorem: is undecidable

But first: is Turing‐recognizableThe following “universal TM”  recognizes

On input  :1. Simulate running  on input 2. If  accepts, accept. If  rejects, reject.

3/23/2020 CS332 ‐ Theory of Computation 12

Page 13: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

More on the Universal TM"It is possible to invent a single machine which can be used to compute any computable sequence. If this machine U is supplied with a tape on the beginning of which is written the S.D ["standard description"] of some computing machineM, then U will compute the same sequence asM.”

‐ Turing, “On Computable Numbers…” 1936

• Foreshadowed general‐purpose programmable computers• No need for specialized hardware: Virtual machines as software

3/23/2020 CS332 ‐ Theory of Computation 13

Harvard architecture: Separate instruction and data pathways

von Neumann architecture: Programs can be treated as data

Page 14: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

A more useful undecidable language

Theorem: is undecidableProof: Assume for the sake of contradiction that TM decides  :

Idea: Show that  can be used to decide the (undecidable) language  ‐‐ a contradiction. 

3/23/2020 CS332 ‐ Theory of Computation 14

Page 15: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

A more useful undecidable language

Suppose decides

Consider the following TM  .On input  where  is a TM:1. Run  on input 2. If  accepts, accept. If  rejects, reject.

Claim: decides 

…but this language is undecidable

3/23/2020 CS332 ‐ Theory of Computation 15

Page 16: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Unrecognizable LanguagesTheorem: A language  is decidable if and only if  and are both Turing‐recognizable.Proof:

3/23/2020 CS332 ‐ Theory of Computation 16

Page 17: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Classes of Languages

3/23/2020 CS332 ‐ Theory of Computation 17

context free

regular

recognizable

decidable

Page 18: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Reductions

3/23/2020 CS332 ‐ Theory of Computation 18

Page 19: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

A more useful undecidable language

Theorem: is undecidableProof: Assume for the sake of contradiction that TM decides  :

Idea: Show that  can be used to decide the (undecidable) language  ‐‐ a contradiction. 

“A reduction from  to  ”

3/23/2020 CS332 ‐ Theory of Computation 19

Page 20: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Scientists vs. EngineersA computer scientist and an engineer are stranded on a desert island. They find two palm trees with one coconut on each. The engineer climbs a tree, picks a coconut and eats.

The computer scientist climbs the second tree, picks a coconut, climbs down, climbs up the first tree and places it there, declaring success. “Now we’ve reduced the problem to one we’ve already solved.”

3/23/2020 CS332 ‐ Theory of Computation 20

Page 21: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Reductions

A reduction from problem  to problem  is an algorithm for problem  which uses an algorithm for problem  as a subroutine

If such a reduction exists, we say “ reduces to  ”

3/23/2020 CS332 ‐ Theory of Computation 21

Page 22: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Two uses of reductionsPositive uses: If  reduces to  and  is decidable, then is also decidable

3/23/2020 CS332 ‐ Theory of Computation 22

Theorem: is decidableProof: The following TM decides 

On input  , where  are DFAs:1. Construct a DFA  that recognizes the symmetric 

difference2. Run the decider for  on  and return its output

Page 23: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Two uses of reductionsNegative uses: If  reduces to  and  is undecidable, then  is also undecidable

3/23/2020 CS332 ‐ Theory of Computation 23

𝐴 𝑀,𝑤 𝑀 is a TM that accepts input 𝑤Suppose 𝐻 decides 𝐴

Consider the following TM 𝐷.On input  𝑀 where 𝑀 is a TM:1. Run 𝐻 on input  𝑀, 𝑀2. If 𝐻 accepts, accept. If 𝐻 rejects, reject.

Claim: 𝐷 decides 𝑆𝐴 𝑀 𝑀 is a TM that accepts on input 𝑀

Page 24: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Two uses of reductionsNegative uses: If  reduces to  and  is undecidable, then  is also undecidable

Proof template:1. Suppose to the contrary that  is decidable2. Using  as a subroutine, construct an algorithm 

deciding 3. But  is undecidable. Contradiction!

3/23/2020 CS332 ‐ Theory of Computation 24

Page 25: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Halting Problem

Theorem: is undecidableProof: Suppose for contradiction that there exists a decider for  . We construct a decider for  as follows:On input  :1. Run  on input 2. If  rejects, reject3. If  accepts, simulate  on 4. If  accepts, accept. Otherwise, reject

This is a reduction from  to 3/23/2020 CS332 ‐ Theory of Computation 25

Page 26: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Empty language testing for TMs

Theorem:  is undecidableProof: Suppose for contradiction that there exists a decider for  . We construct a decider for  as follows:On input  :1. Run  on input ???

This is a reduction from  to 3/23/2020 CS332 ‐ Theory of Computation 26

Page 27: Lecture 15 - Directory | CS-People by full nameLecture 15: • Undecidable and Unrecognizable Languages • Reductions Reading: Sipser Ch 4.2, 5.1 Mark Bun March 23, 2020

Empty language testing for TMs

Theorem:  is undecidableProof: Suppose for contradiction that there exists a decider for  . We construct a decider for  as follows:On input  :1. Construct a TM  as follows:

2. Run  on input 3. If  , accept. Otherwise, reject

This is a reduction from  to 3/23/2020 CS332 ‐ Theory of Computation 27