• No results found

CS310 : Automata Theory 2019

N/A
N/A
Protected

Academic year: 2022

Share "CS310 : Automata Theory 2019"

Copied!
42
0
0

Loading.... (view fulltext now)

Full text

(1)

CS310 : Automata Theory 2019

Lecture 29: Reductions contd.

Instructor: S. Akshay

IITB, India

18-03-2019

(2)

Pop-Quiz

Which is easier: Emptiness or non-emptiness?

I Le ={hMi |L(M) =∅}

I Lne ={hMi |L(M)6=∅}

(3)

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

(4)

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}

(5)

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

(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

5. Undecidability and a proof technique by diagonalization

I A universal TM langLATM ={hM,wi |M is a TM andM acceptsw} 6. Reductions.

(7)

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!

(8)

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.

(9)

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.

(10)

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.

(11)

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.

(12)

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.

(13)

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.

(14)

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.

(15)

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

(16)

Some more undecidable problems

The emptiness problem for TMs

Does a given Turing machine accept any word?

I LTM ={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.

(17)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={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.

(18)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={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.

(19)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={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.

(20)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={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.

(21)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={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.

(22)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={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.

(23)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={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.

(24)

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.

(25)

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.

(26)

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.

(27)

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.

(28)

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.

(29)

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.

(30)

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.

(31)

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.

(32)

Which is easier: Emptiness or non-emptiness?

I Le ={hMi |L(M) =∅}

I Lne ={hMi |L(M)6=∅}

(33)

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!

(34)

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!

(35)

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!

(36)

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!

(37)

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!

(38)

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!

(39)

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!

(40)

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!

(41)

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!

(42)

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.

References

Related documents

A language is decidable (or recursive) if there is a Turing machine accepting it, which has the additional property that it halts on all possible inputs... Variants of a Turing

A language is decidable (or recursive) if there is a Turing machine accepting it, which has the additional property that it halts on all possible inputs.. Every decidable language

Every Turing machine can be encoded as a string in {0, 1} ∗ I Just encode the description of the machine (in binary). I i.e., the 7-tuple: states, alphabet,

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 10.. CFGs

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 2.. Topic 8.1

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 2..

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 2.. Topic 13.1

Applications: showing (un)decidability of other problems (i) A string matching problem: Post’s Correspondance Problem (ii) A problem for compilers: Unambiguity of Context-free