Mapping Reductions CS 154 Omer Reingold A Concrete

  • Slides: 21
Download presentation
Mapping Reductions CS 154, Omer Reingold

Mapping Reductions CS 154, Omer Reingold

A Concrete Undecidable Problem: The Acceptance Problem for TMs ATM = { (M, w)

A Concrete Undecidable Problem: The Acceptance Problem for TMs ATM = { (M, w) | M is a TM that accepts string w } Theorem [Turing ‘ 30 s]: ATM is recognizable but NOT decidable Corollary: ATM is not recognizable

The Halting Problem HALTTM = { (M, w) | M is a TM that

The Halting Problem HALTTM = { (M, w) | M is a TM that halts on string w } Theorem: HALTTM is undecidable Proof: Assume (for a contradiction) there is a TM H that decides HALTTM We use H to construct a TM M’ that decides ATM M’(M, w): Run H(M, w) If H rejects then reject If H accepts, run M on w until it halts: If M accepts, then accept If M rejects, then reject

(M, w) M’ H Does M halt on w? If M doesn’t halt: reject

(M, w) M’ H Does M halt on w? If M doesn’t halt: reject If M halts w M

Can often prove a language L is undecidable by proving: if L is decidable,

Can often prove a language L is undecidable by proving: if L is decidable, then so is ATM We reduce ATM to the language L ATM ≤m L

Mapping Reductions f : Σ* is a computable function if there is a Turing

Mapping Reductions f : Σ* is a computable function if there is a Turing machine M that halts with just f(w) written on its tape, for every input w A language A is mapping reducible to language B, written as A ≤m B, if there is a computable f : Σ* such that for every w, w A f(w) B f is called a mapping reduction (or many-one reduction) from A to B

Let f : Σ* be a computable function such that w A f(w) B

Let f : Σ* be a computable function such that w A f(w) B Σ* A f f Say: A is mapping reducible to B Write: A m B B Σ*

Theorem: If A m B and B m C, then A m C A

Theorem: If A m B and B m C, then A m C A f f B g g C

Theorem: If A m B and B is decidable, then A is decidable Proof:

Theorem: If A m B and B is decidable, then A is decidable Proof: Let M decide B. Let f be a mapping reduction from A to B To decide A, we build a machine M’ M’(w): 1. Compute f(w) 2. Run M on f(w), output its answer • w A f(w) B so w A ⇒ M’ accepts w • w ∉ A ⇒ M’ rejects w

Theorem: If A m B and B is recognizable, then A is recognizable Proof:

Theorem: If A m B and B is recognizable, then A is recognizable Proof: Let M recognize B. Let f be a mapping reduction from A to B To recognize A, we build a machine M’ M’(w): 1. Compute f(w) 2. Run M on f(w), output its answer if you ever receive one

Theorem: If A m B and B is decidable, then A is decidable Corollary:

Theorem: If A m B and B is decidable, then A is decidable Corollary: If A m B and A is undecidable, then B is undecidable Theorem: If A m B and B is recognizable, then A is recognizable Corollary: If A m B and A is unrecognizable, then B is unrecognizable

The proof that the Halting Problem is undecidable can be seen as constructing a

The proof that the Halting Problem is undecidable can be seen as constructing a mapping reduction from ATM to HALTTM Theorem: ATM ≤m HALTTM f(M, w) : = (M’, w) where “M’(w) = accepts if M(w) accepts else loops forever ” how? We have (M, w) ATM (M’, w) HALTTM

Theorem: ATM ≤m HALTTM Corollary: ATM ≤m HALTTM Proof? Corollary: HALTTM is unrecognizable! Proof:

Theorem: ATM ≤m HALTTM Corollary: ATM ≤m HALTTM Proof? Corollary: HALTTM is unrecognizable! Proof: If HALTTM were recognizable, then ATM would be recognizable…

Theorem: HALTTM m ATM Proof: Define the computable function f(M, w) : = (M’,

Theorem: HALTTM m ATM Proof: Define the computable function f(M, w) : = (M’, w) where “M’(w) accepts if M(w) halts else loop forever ” (how? ) Observe (M, w) HALTTM (M’, w) ATM

Corollary: HALTTM m ATM I can give you the magical power to either compute

Corollary: HALTTM m ATM I can give you the magical power to either compute the halting problem, or the acceptance problem. Which do you want? Surprise me

The Emptiness Problem EMPTYDFA = { M | M is a DFA such that

The Emptiness Problem EMPTYDFA = { M | M is a DFA such that L(M) = } Given a DFA, does it reject every input ? Theorem: EMPTYDFA is decidable Why? EMPTYNFA = { M | M is a NFA such that L(M) = } EMPTYREX = { R | R is a regexp such that L(R) = }

The Emptiness Problem for TMs EMPTYTM = { M | M is a TM

The Emptiness Problem for TMs EMPTYTM = { M | M is a TM such that L(M) = } Given a program, does it reject every input Theorem: EMPTYTM is not recognizable ?

The Regularity Problem for Turing Machines REGULARTM = { M | M is a

The Regularity Problem for Turing Machines REGULARTM = { M | M is a TM and L(M) is regular} Given a program, is it equivalent to some DFA? Theorem: REGULARTM is not recognizable Proof: Show that ¬ATM m REGULARTM f(M, w) : = M’: where M’ is a TM such that “M’(x) : = M(w) if (x = 0 n 1 n) else reject” (how? ) (M, w) ATM f(M, w) = M’ such that M’ accepts {0 n 1 n } (M, w) ATM f (M, w) = M’ such that M’ accepts nothing (M, w) ATM f(M, w) REGULARTM

The Equivalence Problem EQTM = {(M, N) | M, N are TMs and L(M)

The Equivalence Problem EQTM = {(M, N) | M, N are TMs and L(M) = L(N)} Do two programs compute the same function? Theorem: EQTM is unrecognizable Proof: Reduce EMPTYTM to EQTM Let M be a “dummy” TM with no path from start state to accept state Define f(M) : = (M, M ) M EMPTYTM L(M) = L(M ) = (M’, M ) EQTM

Post’s Correspondence Problem Given a collection of domino types, can we build up a

Post’s Correspondence Problem Given a collection of domino types, can we build up a match? PCP = { P | P is a set of dominos with a match } Theorem: PCP is undecidable!

Parting thoughts: Reductions for impossibilities. Analyzing programs is really hard.

Parting thoughts: Reductions for impossibilities. Analyzing programs is really hard.