CS310 : Automata Theory 2019
Lecture 29: Reductions contd.
Instructor: S. Akshay
IITB, India
18-03-2019
Pop-Quiz
Which is easier: Emptiness or non-emptiness?
I Le ={hMi |L(M) =∅}
I Lne ={hMi |L(M)6=∅}
Recap
Turing machines and computability
1. Definition of Turing machines: high level and low-level descriptions 2. Variants of Turing machines
3. Decidable and Turing recognizable languages
4. Church-Turing Hypothesis
Recap
Turing machines and computability
1. Definition of Turing machines: high level and low-level descriptions 2. Variants of Turing machines
3. Decidable and Turing recognizable languages 4. Church-Turing Hypothesis
5. Undecidability and a proof technique by diagonalization
I A universal TM langLATM ={hM,wi |M is a TM andM acceptsw}
Recap
Turing machines and computability
1. Definition of Turing machines: high level and low-level descriptions 2. Variants of Turing machines
3. Decidable and Turing recognizable languages 4. Church-Turing Hypothesis
5. Undecidability and a proof technique by diagonalization
I A universal TM langLATM ={hM,wi |M is a TM andM acceptsw}
Regular (Decidable (Recursively Enumerable( All languages DFA/NFA <Algorithms/Halting TM<Semi-algorithms/TM
Recap
Turing machines and computability
1. Definition of Turing machines: high level and low-level descriptions 2. Variants of Turing machines
3. Decidable and Turing recognizable languages 4. Church-Turing Hypothesis
5. Undecidability and a proof technique by diagonalization
I A universal TM langLATM ={hM,wi |M is a TM andM acceptsw} 6. Reductions.
Recap
Turing machines and computability
1. Definition of Turing machines: high level and low-level descriptions 2. Variants of Turing machines
3. Decidable and Turing recognizable languages 4. Church-Turing Hypothesis
5. Undecidability and a proof technique by diagonalization
I A universal TM langLATM ={hM,wi |M is a TM andM acceptsw} 6. Reductions.
7. Today:
Reductions and moar undecidability!
The principle of reduction
(Many-to-one) Reduction
I An algorithm (halting TM!) to convert instances of a problemP1 to anotherP2 such that,
I answer is yes forP1 iff answer is yes forP2
I answer is no forP1iff answer is no forP2
Note that every instance of P2 need not be covered!
Theorem: If there is a reduction fromP1 to P2, (thenP2 is at least as hard as P1, i.e.,)
I if P1 is undecidable, then so isP2 I if P1 is not r.e., then so isP2.
The principle of reduction
(Many-to-one) Reduction
I An algorithm (halting TM!) to convert instances of a problemP1 to anotherP2 such that,
I answer is yes forP1 iff answer is yes forP2
I answer is no forP1iff answer is no forP2
Note that every instance of P2 need not be covered!
Theorem: If there is a reduction from P1 to P2, (then P2 is at least as hard asP1, i.e.,)
I if P1 is undecidable, then so isP2 I if P1 is not r.e., then so isP2.
The principle of reduction
(Many-to-one) Reduction
I An algorithm (halting TM!) to convert instances of a problemP1 to anotherP2 such that,
I answer is yes forP1 iff answer is yes forP2
I answer is no forP1iff answer is no forP2
Note that every instance of P2 need not be covered!
Theorem: If there is a reduction from P1 to P2, (then P2 is at least as hard asP1, i.e.,)
I if P1 is undecidable, then so isP2
I if P1 is not r.e., then so isP2.
The principle of reduction
(Many-to-one) Reduction
I An algorithm (halting TM!) to convert instances of a problemP1 to anotherP2 such that,
I answer is yes forP1 iff answer is yes forP2
I answer is no forP1iff answer is no forP2
Note that every instance of P2 need not be covered!
Theorem: If there is a reduction from P1 to P2, (then P2 is at least as hard asP1, i.e.,)
I if P1 is undecidable, then so isP2
I if P1 is not r.e., then so isP2.
The halting problem
The halting problem for Turing Machines is undecidable Does a given Turing machine halt on a given input?
I LHALTTM ={hM,wi |M is a TM andM halts on inputw}.
Proof: Suppose there exists TMH deciding LHALTTM , then construct a TMD s.t., on inputhM,wi:
I runs TMH on inputhM,wi I if H rejects then reject.
I if H accepts, then simulate M onw until it halts. I if at halting M has acceptedw, accept, else reject. ButD decidesLATM which is undecidable. A contradiction. This proof strategy is called a reduction.
The halting problem
The halting problem for Turing Machines is undecidable Does a given Turing machine halt on a given input?
I LHALTTM ={hM,wi |M is a TM andM halts on inputw}.
Proof: Suppose there exists TM H decidingLHALTTM , then construct a TMD s.t., on inputhM,wi:
I runs TMH on inputhM,wi I if H rejects then reject.
I if H accepts, then simulate M onw until it halts.
I if at halting M has acceptedw, accept, else reject.
But D decidesLATM which is undecidable. A contradiction.
This proof strategy is called a reduction.
The halting problem
The halting problem for Turing Machines is undecidable Does a given Turing machine halt on a given input?
I LHALTTM ={hM,wi |M is a TM andM halts on inputw}.
Proof: Suppose there exists TM H decidingLHALTTM , then construct a TMD s.t., on inputhM,wi:
I runs TMH on inputhM,wi I if H rejects then reject.
I if H accepts, then simulate M onw until it halts.
I if at halting M has acceptedw, accept, else reject.
But D decidesLATM which is undecidable. A contradiction.
This proof strategy is called a reduction.
Reduction from the acceptance problem
The halting problem for Turing Machines is undecidable Does a given Turing machine halt on a given input?
I LHALTTM ={hM,wi |M is a TM andM halts on inputw}.
hM,wi H
M Acc w
Rej Rej
Rej Rej Acc Acc
Some more undecidable problems
The emptiness problem for TMs
Does a given Turing machine accept any word?
I L∅TM ={hMi |M is a TM andL(M) =∅}.
Proof:
I For contradiction, assume its decidable, say by TM R. I DefineM1 which on input x,
I ifx6=w, it rejects
I ifx=w, runM onw and accept ifM accepts. I ConstructS which decidesATM: Given inputhM,wi,
I ConstructM1on tape fromM andw, I RunR on inputhM1i.
I IfR accepts,reject; ifR rejects thenaccept.
Some more undecidable problems
The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?
I L∅TM ={hMi |M is a TM andL(M) =∅}.
Proof:
I For contradiction, assume its decidable, say by TM R.
I DefineM1 which on input x, I ifx6=w, it rejects
I ifx=w, runM onw and accept ifM accepts. I ConstructS which decidesATM: Given inputhM,wi,
I ConstructM1on tape fromM andw, I RunR on inputhM1i.
I IfR accepts,reject; ifR rejects thenaccept.
Some more undecidable problems
The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?
I L∅TM ={hMi |M is a TM andL(M) =∅}.
Proof:
I For contradiction, assume its decidable, say by TM R.
I DefineM1 which on input x, I ifx6=w, it rejects
I ifx=w, runM onw and accept ifM accepts.
I ConstructS which decidesATM: Given inputhM,wi, I ConstructM1on tape fromM andw,
I RunR on inputhM1i.
I IfR accepts,reject; ifR rejects thenaccept.
Some more undecidable problems
The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?
I L∅TM ={hMi |M is a TM andL(M) =∅}.
Proof:
I For contradiction, assume its decidable, say by TM R.
I DefineM1 which on input x, I ifx6=w, it rejects
I ifx=w, runM onw and accept ifM accepts.
I ConstructS which decidesATM: Given inputhM,wi,
I ConstructM1on tape fromM andw, I RunR on inputhM1i.
I IfR accepts,reject; ifR rejects thenaccept.
Some more undecidable problems
The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?
I L∅TM ={hMi |M is a TM andL(M) =∅}.
Proof:
I For contradiction, assume its decidable, say by TM R.
I DefineM1 which on input x, I ifx6=w, it rejects
I ifx=w, runM onw and accept ifM accepts.
I ConstructS which decidesATM: Given inputhM,wi, I ConstructM1on tape fromM andw,
I RunR on inputhM1i.
I IfR accepts,reject; ifR rejects thenaccept.
Some more undecidable problems
The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?
I L∅TM ={hMi |M is a TM andL(M) =∅}.
Proof:
I For contradiction, assume its decidable, say by TM R.
I DefineM1 which on input x, I ifx6=w, it rejects
I ifx=w, runM onw and accept ifM accepts.
I ConstructS which decidesATM: Given inputhM,wi, I ConstructM1on tape fromM andw,
I RunR on inputhM1i.
I IfR accepts,reject; ifR rejects thenaccept.
Some more undecidable problems
The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?
I L∅TM ={hMi |M is a TM andL(M) =∅}.
Proof:
I For contradiction, assume its decidable, say by TM R.
I DefineM1 which on input x, I ifx6=w, it rejects
I ifx=w, runM onw and accept ifM accepts.
I ConstructS which decidesATM: Given inputhM,wi, I ConstructM1on tape fromM andw,
I RunR on inputhM1i.
I IfRaccepts,
reject; ifR rejects thenaccept.
Some more undecidable problems
The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?
I L∅TM ={hMi |M is a TM andL(M) =∅}.
Proof:
I For contradiction, assume its decidable, say by TM R.
I DefineM1 which on input x, I ifx6=w, it rejects
I ifx=w, runM onw and accept ifM accepts.
I ConstructS which decidesATM: Given inputhM,wi, I ConstructM1on tape fromM andw,
I RunR on inputhM1i.
I IfRaccepts, reject; ifR rejects thenaccept.
Some more undecidable problems
The regularity problem for TMs
Does a given Turing machine accept a regular language?
I LREGTM ={hMi |M is a TM andL(M) is a regular language}.
Proof: By contradiction, assumeR decides Reg. We define S I S = On input hM,wi;
I construct TMM2as follows: M2on input x does the foll:
I ifx has the form 0n1n, accept.
I If not, runM onw and accept ifM acceptsw. I RunR onhM2i.
I IfR accepts,accept; ifR rejects,reject.
Some more undecidable problems
The regularity problem for TMs
Does a given Turing machine accept a regular language?
I LREGTM ={hMi |M is a TM andL(M) is a regular language}.
Proof: By contradiction, assume R decides Reg. We define S
I S = On input hM,wi;
I construct TMM2as follows: M2on input x does the foll:
I ifx has the form 0n1n, accept.
I If not, runM onw and accept ifM acceptsw. I RunR onhM2i.
I IfR accepts,accept; ifR rejects,reject.
Some more undecidable problems
The regularity problem for TMs
Does a given Turing machine accept a regular language?
I LREGTM ={hMi |M is a TM andL(M) is a regular language}.
Proof: By contradiction, assume R decides Reg. We define S I S = On input hM,wi;
I construct TMM2as follows:
M2on input x does the foll: I ifx has the form 0n1n, accept.
I If not, runM onw and accept ifM acceptsw. I RunR onhM2i.
I IfR accepts,accept; ifR rejects,reject.
Some more undecidable problems
The regularity problem for TMs
Does a given Turing machine accept a regular language?
I LREGTM ={hMi |M is a TM andL(M) is a regular language}.
Proof: By contradiction, assume R decides Reg. We define S I S = On input hM,wi;
I construct TMM2as follows:
M2on input x does the foll:
I ifx has the form 0n1n, accept.
I If not, runM onw and accept ifM acceptsw.
I RunR onhM2i.
I IfR accepts,accept; ifR rejects,reject.
Some more undecidable problems
The regularity problem for TMs
Does a given Turing machine accept a regular language?
I LREGTM ={hMi |M is a TM andL(M) is a regular language}.
Proof: By contradiction, assume R decides Reg. We define S I S = On input hM,wi;
I construct TMM2as follows:
M2on input x does the foll:
I ifx has the form 0n1n, accept.
I If not, runM onw and accept ifM acceptsw. I RunR onhM2i.
I IfR accepts,accept; ifR rejects,reject.
Some more undecidable problems
The regularity problem for TMs
Does a given Turing machine accept a regular language?
I LREGTM ={hMi |M is a TM andL(M) is a regular language}.
Proof: By contradiction, assume R decides Reg. We define S I S = On input hM,wi;
I construct TMM2as follows:
M2on input x does the foll:
I ifx has the form 0n1n, accept.
I If not, runM onw and accept ifM acceptsw. I RunR onhM2i.
I IfRaccepts, accept; ifR rejects,reject.
Some more undecidable problems
The regularity problem for TMs
Does a given Turing machine accept a regular language?
I LEQTM ={hM1,M2i |M are TMs andL(M1) =L(M2)}.
Proof: Reduce to emptiness.
Some more undecidable problems
The regularity problem for TMs
Does a given Turing machine accept a regular language?
I LEQTM ={hM1,M2i |M are TMs andL(M1) =L(M2)}.
Proof: Reduce to emptiness.
Which is easier: Emptiness or non-emptiness?
I Le ={hMi |L(M) =∅}
I Lne ={hMi |L(M)6=∅}
Is everything about Turing machines undecidable?
1. {hMi |L(M) =∅}
2. {hMi |L(M) is regular } 3. {hMi |L(M) is context-free} 4. {hMi |L(M) is finite } 5. {hMi |M has 5 states} 6. {hMi |L(M) is a language }
7. {hMi |M makes at least 5 moves on some input} Rice’s Theorem
Any “non-trivial” property of R.E languages is undecidable!
Is everything about Turing machines undecidable?
1. {hMi |L(M) =∅}
2. {hMi |L(M) is regular }
3. {hMi |L(M) is context-free} 4. {hMi |L(M) is finite } 5. {hMi |M has 5 states} 6. {hMi |L(M) is a language }
7. {hMi |M makes at least 5 moves on some input} Rice’s Theorem
Any “non-trivial” property of R.E languages is undecidable!
Is everything about Turing machines undecidable?
1. {hMi |L(M) =∅}
2. {hMi |L(M) is regular } 3. {hMi |L(M) is context-free}
4. {hMi |L(M) is finite } 5. {hMi |M has 5 states} 6. {hMi |L(M) is a language }
7. {hMi |M makes at least 5 moves on some input} Rice’s Theorem
Any “non-trivial” property of R.E languages is undecidable!
Is everything about Turing machines undecidable?
1. {hMi |L(M) =∅}
2. {hMi |L(M) is regular } 3. {hMi |L(M) is context-free} 4. {hMi |L(M) is finite}
5. {hMi |M has 5 states} 6. {hMi |L(M) is a language }
7. {hMi |M makes at least 5 moves on some input} Rice’s Theorem
Any “non-trivial” property of R.E languages is undecidable!
Is everything about Turing machines undecidable?
1. {hMi |L(M) =∅}
2. {hMi |L(M) is regular } 3. {hMi |L(M) is context-free} 4. {hMi |L(M) is finite} 5. {hMi |M has 5 states }
6. {hMi |L(M) is a language }
7. {hMi |M makes at least 5 moves on some input} Rice’s Theorem
Any “non-trivial” property of R.E languages is undecidable!
Is everything about Turing machines undecidable?
1. {hMi |L(M) =∅}
2. {hMi |L(M) is regular } 3. {hMi |L(M) is context-free} 4. {hMi |L(M) is finite} 5. {hMi |M has 5 states } 6. {hMi |L(M) is a language }
7. {hMi |M makes at least 5 moves on some input} Rice’s Theorem
Any “non-trivial” property of R.E languages is undecidable!
Is everything about Turing machines undecidable?
1. {hMi |L(M) =∅}
2. {hMi |L(M) is regular } 3. {hMi |L(M) is context-free} 4. {hMi |L(M) is finite} 5. {hMi |M has 5 states } 6. {hMi |L(M) is a language }
7. {hMi |M makes at least 5 moves on some input}
Rice’s Theorem
Any “non-trivial” property of R.E languages is undecidable!
Is everything about Turing machines undecidable?
1. {hMi |L(M) =∅}
2. {hMi |L(M) is regular } 3. {hMi |L(M) is context-free} 4. {hMi |L(M) is finite} 5. {hMi |M has 5 states } 6. {hMi |L(M) is a language }
7. {hMi |M makes at least 5 moves on some input}
Rice’s Theorem
Any “non-trivial” property of R.E languages is undecidable!
Is everything about Turing machines undecidable?
1. {hMi |L(M) =∅}
2. {hMi |L(M) is regular } 3. {hMi |L(M) is context-free} 4. {hMi |L(M) is finite} 5. {hMi |M has 5 states } 6. {hMi |L(M) is a language }
7. {hMi |M makes at least 5 moves on some input}
Rice’s Theorem
Any “non-trivial” property of R.E languages is undecidable!
Rice’s theorem
Rice’s theorem (1953)
Any non-trivial property of R.E languages is undecidable!
I Property P ≡set of languages (i.e., their TM encodings) satisfyingP I Property of r.e languages: membership of M in P depends only on the
language ofM. If L(M) =L(M0), then hMi ∈P iff hM0i ∈P. I Non-trivial: It holds for some but not all TMs.