BU CS 332 – Theory of Computation
Lecture 16:• Mapping Reducibility Reading:
Sipser Ch 5.3
Mark BunMarch 25, 2020
Problems in language theory
3/30/2020 CS332 ‐ Theory of Computation 2
𝐃𝐅𝐀decidable
𝐂𝐅𝐆decidable
𝐃𝐅𝐀decidable
𝐂𝐅𝐆decidable
𝐃𝐅𝐀decidable
𝐓𝐌undecidable
𝐓𝐌undecidable
𝐓𝐌?
𝐂𝐅𝐆?
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/30/2020 CS332 ‐ Theory of Computation 3
Reminder: Using reductions to prove undecidability
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/30/2020 CS332 ‐ Theory of Computation 4
Equality 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 TMs , as follows:
2. Run on input 3. If accepts, accept. Otherwise, reject.
This is a reduction from to 3/30/2020 CS332 ‐ Theory of Computation 5
Equality 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 TMs , as follows:
= =
2. Run on input 3. If accepts, accept. Otherwise, reject.
This is a reduction from to 3/30/2020 CS332 ‐ Theory of Computation 6
Problems in language theory
3/30/2020 CS332 ‐ Theory of Computation 7
𝐃𝐅𝐀decidable
𝐂𝐅𝐆decidable
𝐃𝐅𝐀decidable
𝐂𝐅𝐆decidable
𝐃𝐅𝐀decidable
𝐓𝐌undecidable
𝐓𝐌undecidable
𝐓𝐌undecidable
𝐂𝐅𝐆?
Context‐free 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 accepts, accept. Otherwise, reject
This is a reduction from to 3/30/2020 CS332 ‐ Theory of Computation 8
Context‐free 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:
= “On input ,1. If accept2. Run TM on input 3. If accepts, accept.”
2. Run on input 3. If accepts, accept. Otherwise, reject
This is a reduction from to 3/30/2020 CS332 ‐ Theory of Computation 9
Mapping Reductions
3/30/2020 CS332 ‐ Theory of Computation 10
What’s wrong with the following “proof”?Bogus “Theorem”: is not Turing‐recognizableBogus “Proof”: Suppose for contradiction that there exists arecognizer for . We construct a recognizer for :
On input :1. Run on input 2. If accepts, reject. Otherwise, accept.
This sure looks like a reduction from to 3/30/2020 CS332 ‐ Theory of Computation 11
🚩🚩Warning🚩🚩
Mapping Reductions: Motivation
1. How do we formalize the notion of a reduction?2. How do we use reductions to show that languages are
unrecognizable?3. How do we protect ourselves from accidentally
“proving” bogus theorems about recognizability?
3/30/2020 CS332 ‐ Theory of Computation 12
Computable FunctionsDefinition:A function ∗ ∗ is computable if there is a TM which, given as input any ∗, halts with only on its tape.
Example 1:
Example 2: = where is a TM, is a string, and is a TM that ignores its input and simulates running on
3/30/2020 CS332 ‐ Theory of Computation 13
Mapping ReductionsDefinition:Language is mapping reducible to language , written
if there is a computable function ∗ ∗ such that for all strings ∗, we have
3/30/2020 CS332 ‐ Theory of Computation 14
DecidabilityTheorem: If and is decidable, then is also decidable
Proof: Let be a decider for and let ∗ ∗ be a mapping reduction from to . Construct a decider for as follows:
On input :1. Compute 2. Run on input 3. If accepts, accept. Otherwise, reject.
3/30/2020 CS332 ‐ Theory of Computation 15
Undecidability
Theorem: If and is decidable, then is also decidable
Corollary: If and is undecidable, then is also undecidable
3/30/2020 CS332 ‐ Theory of Computation 16
Old Proof: Equality 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 TMs , as follows:
= “On input 𝑥, = “On input 𝑥,1. Ignore 𝑥 1. Ignore 𝑥 and accept”2. Run 𝑀 on input 𝑤3. If 𝑀 accepts, accept.
Otherwise, reject.”2. Run on input 3. If accepts, accept. Otherwise, reject.
This is a reduction from to 3/30/2020 CS332 ‐ Theory of Computation 17
New Proof: Equality Testing for TMs
Theorem: hence is undecidableProof: The following TM computes the reduction:
On input :1. Construct TMs , as follows:
= “On input 𝑥, = “On input 𝑥,1. Ignore 𝑥 1. Ignore 𝑥 and accept”2. Run 𝑀 on input 𝑤3. If 𝑀 accepts, accept.
Otherwise, reject.”2. Output
3/30/2020 CS332 ‐ Theory of Computation 18
Mapping Reductions: Recognizability
3/30/2020 CS332 ‐ Theory of Computation 19
Theorem: If and is recognizable, then is also recognizable
Proof: Let be a recognizer for and let ∗ ∗ be a mapping reduction from to . Construct a recognizerfor as follows:
On input :1. Compute 2. Run on input 3. If accepts, accept. Otherwise, reject.
Unrecognizability
Theorem: If and is recognizable, then is also recognizable
Corollary: If and is unrecognizable, then is also unrecognizable
Corollary: If , then is unrecognizable
3/30/2020 CS332 ‐ Theory of Computation 20
Recognizability and
3/30/2020 CS332 ‐ Theory of Computation 21
Consequences of
1. Since is undecidable, is also undecidable
2. implies Since is unrecognizable, is unrecognizable
3/30/2020 CS332 ‐ Theory of Computation 22
itself is also unrecognizable
3/30/2020 CS332 ‐ Theory of Computation 23
Theorem: 𝐴 hence is unrecognizableProof: The following TM computes the reduction:
On input :1. Construct TMs , as follows:
= “On input 𝑥, = “On input 𝑥,1. Ignore 𝑥 1. Ignore 𝑥 and accept”2. Run 𝑀 on input 𝑤3. If 𝑀 accepts, accept.
Otherwise, reject.”2. Output
More on Reductions and Undecidability
3/30/2020 CS332 ‐ Theory of Computation 24
Problems in language theory
3/30/2020 CS332 ‐ Theory of Computation 25
𝐃𝐅𝐀decidable
𝐂𝐅𝐆decidable
𝐃𝐅𝐀decidable
𝐂𝐅𝐆decidable
𝐃𝐅𝐀decidable
𝐓𝐌undecidable
𝐓𝐌undecidable
𝐓𝐌undecidable
𝐂𝐅𝐆?
is undecidable
∗
Theorem: hence is undecidableProof idea: “Computation history method”On input :1. Construct a CFG such that:
∗ does not accept
2. Output3/30/2020 CS332 ‐ Theory of Computation 26
Problems in language theory
3/30/2020 CS332 ‐ Theory of Computation 27
𝐃𝐅𝐀decidable
𝐂𝐅𝐆decidable
𝐃𝐅𝐀decidable
𝐂𝐅𝐆decidable
𝐃𝐅𝐀decidable
𝐓𝐌undecidable
𝐓𝐌undecidable
𝐓𝐌undecidable
𝐂𝐅𝐆undecidable
Undecidable problems outside language theoryPost Correspondence Problem (PCP):
3/30/2020 CS332 ‐ Theory of Computation 28
Domino: . Top and bottom are strings.Input: Collection of dominos.
Match: List of some of the input dominos (repetitions allowed) where top = bottom
Problem: Does a match exist? This is undecidable