+ All Categories
Home > Documents > CS310 : Automata Theory 2019

CS310 : Automata Theory 2019

Date post: 02-Nov-2021
Category:
Upload: others
View: 12 times
Download: 0 times
Share this document with a friend
42
cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 1 CS310 : Automata Theory 2019 Lecture 29: Reductions contd. Instructor: S. Akshay IITB, India 18-03-2019
Transcript
Page 1: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 1

CS310 : Automata Theory 2019

Lecture 29: Reductions contd.

Instructor: S. Akshay

IITB, India

18-03-2019

Page 2: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 2

Pop-Quiz

Which is easier: Emptiness or non-emptiness?

I Le = {〈M〉 | L(M) = ∅}I Lne = {〈M〉 | L(M) 6= ∅}

Page 3: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 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

Page 4: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 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

5. Undecidability and a proof technique by diagonalizationI A universal TM lang LATM = {〈M,w〉 | M is a TM and M accepts w}

Page 5: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 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

5. Undecidability and a proof technique by diagonalizationI A universal TM lang LATM = {〈M,w〉 | M is a TM and M accepts w}

Regular ( Decidable ( Recursively Enumerable ( All languages

DFA/NFA < Algorithms/Halting TM < Semi-algorithms/TM

Page 6: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 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

5. Undecidability and a proof technique by diagonalizationI A universal TM lang LATM = {〈M,w〉 | M is a TM and M accepts w}

6. Reductions.

Page 7: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 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

5. Undecidability and a proof technique by diagonalizationI A universal TM lang LATM = {〈M,w〉 | M is a TM and M accepts w}

6. Reductions.

7. Today: Reductions and moar undecidability!

Page 8: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 4

The principle of reduction

(Many-to-one) Reduction

I An algorithm (halting TM!) to convert instances of a problem P1 toanother P2 such that,I answer is yes for P1 iff answer is yes for P2

I answer is no for P1 iff answer is no for P2

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 as P1, i.e.,)

I if P1 is undecidable, then so is P2

I if P1 is not r.e., then so is P2.

Page 9: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 4

The principle of reduction

(Many-to-one) Reduction

I An algorithm (halting TM!) to convert instances of a problem P1 toanother P2 such that,I answer is yes for P1 iff answer is yes for P2

I answer is no for P1 iff answer is no for P2

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 as P1, i.e.,)

I if P1 is undecidable, then so is P2

I if P1 is not r.e., then so is P2.

Page 10: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 4

The principle of reduction

(Many-to-one) Reduction

I An algorithm (halting TM!) to convert instances of a problem P1 toanother P2 such that,I answer is yes for P1 iff answer is yes for P2

I answer is no for P1 iff answer is no for P2

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 as P1, i.e.,)

I if P1 is undecidable, then so is P2

I if P1 is not r.e., then so is P2.

Page 11: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 4

The principle of reduction

(Many-to-one) Reduction

I An algorithm (halting TM!) to convert instances of a problem P1 toanother P2 such that,I answer is yes for P1 iff answer is yes for P2

I answer is no for P1 iff answer is no for P2

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 as P1, i.e.,)

I if P1 is undecidable, then so is P2

I if P1 is not r.e., then so is P2.

Page 12: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 5

The halting problem

The halting problem for Turing Machines is undecidable

Does a given Turing machine halt on a given input?

I LHALTTM = {〈M,w〉 | M is a TM and M halts on input w}.

Proof: Suppose there exists TM H deciding LHALTTM , then construct a TM D

s.t., on input 〈M,w〉:I runs TM H on input 〈M,w〉I if H rejects then reject.

I if H accepts, then simulate M on w until it halts.

I if at halting M has accepted w , accept, else reject.

But D decides LATM which is undecidable. A contradiction.

This proof strategy is called a reduction.

Page 13: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 5

The halting problem

The halting problem for Turing Machines is undecidable

Does a given Turing machine halt on a given input?

I LHALTTM = {〈M,w〉 | M is a TM and M halts on input w}.

Proof: Suppose there exists TM H deciding LHALTTM , then construct a TM Ds.t., on input 〈M,w〉:I runs TM H on input 〈M,w〉I if H rejects then reject.

I if H accepts, then simulate M on w until it halts.

I if at halting M has accepted w , accept, else reject.

But D decides LATM which is undecidable. A contradiction.

This proof strategy is called a reduction.

Page 14: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 5

The halting problem

The halting problem for Turing Machines is undecidable

Does a given Turing machine halt on a given input?

I LHALTTM = {〈M,w〉 | M is a TM and M halts on input w}.

Proof: Suppose there exists TM H deciding LHALTTM , then construct a TM Ds.t., on input 〈M,w〉:I runs TM H on input 〈M,w〉I if H rejects then reject.

I if H accepts, then simulate M on w until it halts.

I if at halting M has accepted w , accept, else reject.

But D decides LATM which is undecidable. A contradiction.

This proof strategy is called a reduction.

Page 15: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 6

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 = {〈M,w〉 | M is a TM and M halts on input w}.

〈M,w〉 H

M

Acc w

RejRej

RejRej

AccAcc

Page 16: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 7

Some more undecidable problems

The emptiness problem for TMs

Does a given Turing machine accept any word?

I L∅TM = {〈M〉 | M is a TM and L(M) = ∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.I Define M1 which on input x ,

I if x 6= w , it rejectsI if x = w , run M on w and accept if M accepts.

I Construct S which decides ATM : Given input 〈M,w〉,I Construct M1 on tape from M and w ,I Run R on input 〈M1〉.I If R accepts, reject; if R rejects then accept.

Page 17: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 7

Some more undecidable problems

The emptiness problem for TMs is undecidable

Does a given Turing machine accept any word?

I L∅TM = {〈M〉 | M is a TM and L(M) = ∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.

I Define M1 which on input x ,I if x 6= w , it rejectsI if x = w , run M on w and accept if M accepts.

I Construct S which decides ATM : Given input 〈M,w〉,I Construct M1 on tape from M and w ,I Run R on input 〈M1〉.I If R accepts, reject; if R rejects then accept.

Page 18: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 7

Some more undecidable problems

The emptiness problem for TMs is undecidable

Does a given Turing machine accept any word?

I L∅TM = {〈M〉 | M is a TM and L(M) = ∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.I Define M1 which on input x ,

I if x 6= w , it rejectsI if x = w , run M on w and accept if M accepts.

I Construct S which decides ATM : Given input 〈M,w〉,I Construct M1 on tape from M and w ,I Run R on input 〈M1〉.I If R accepts, reject; if R rejects then accept.

Page 19: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 7

Some more undecidable problems

The emptiness problem for TMs is undecidable

Does a given Turing machine accept any word?

I L∅TM = {〈M〉 | M is a TM and L(M) = ∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.I Define M1 which on input x ,

I if x 6= w , it rejectsI if x = w , run M on w and accept if M accepts.

I Construct S which decides ATM : Given input 〈M,w〉,

I Construct M1 on tape from M and w ,I Run R on input 〈M1〉.I If R accepts, reject; if R rejects then accept.

Page 20: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 7

Some more undecidable problems

The emptiness problem for TMs is undecidable

Does a given Turing machine accept any word?

I L∅TM = {〈M〉 | M is a TM and L(M) = ∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.I Define M1 which on input x ,

I if x 6= w , it rejectsI if x = w , run M on w and accept if M accepts.

I Construct S which decides ATM : Given input 〈M,w〉,I Construct M1 on tape from M and w ,

I Run R on input 〈M1〉.I If R accepts, reject; if R rejects then accept.

Page 21: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 7

Some more undecidable problems

The emptiness problem for TMs is undecidable

Does a given Turing machine accept any word?

I L∅TM = {〈M〉 | M is a TM and L(M) = ∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.I Define M1 which on input x ,

I if x 6= w , it rejectsI if x = w , run M on w and accept if M accepts.

I Construct S which decides ATM : Given input 〈M,w〉,I Construct M1 on tape from M and w ,I Run R on input 〈M1〉.

I If R accepts, reject; if R rejects then accept.

Page 22: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 7

Some more undecidable problems

The emptiness problem for TMs is undecidable

Does a given Turing machine accept any word?

I L∅TM = {〈M〉 | M is a TM and L(M) = ∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.I Define M1 which on input x ,

I if x 6= w , it rejectsI if x = w , run M on w and accept if M accepts.

I Construct S which decides ATM : Given input 〈M,w〉,I Construct M1 on tape from M and w ,I Run R on input 〈M1〉.I If R accepts,

reject; if R rejects then accept.

Page 23: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 7

Some more undecidable problems

The emptiness problem for TMs is undecidable

Does a given Turing machine accept any word?

I L∅TM = {〈M〉 | M is a TM and L(M) = ∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.I Define M1 which on input x ,

I if x 6= w , it rejectsI if x = w , run M on w and accept if M accepts.

I Construct S which decides ATM : Given input 〈M,w〉,I Construct M1 on tape from M and w ,I Run R on input 〈M1〉.I If R accepts, reject; if R rejects then accept.

Page 24: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 8

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM = {〈M〉 | M is a TM and L(M) is a regular language }.

Proof: By contradiction, assume R decides Reg. We define SI S = On input 〈M,w〉;

I construct TM M2 as follows:M2 on input x does the foll:

I if x has the form 0n1n, accept.I If not, run M on w and accept if M accepts w .

I Run R on 〈M2〉.I If R accepts, accept; if R rejects, reject.

Page 25: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 8

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM = {〈M〉 | M is a TM and L(M) is a regular language }.

Proof: By contradiction, assume R decides Reg. We define S

I S = On input 〈M,w〉;I construct TM M2 as follows:

M2 on input x does the foll:I if x has the form 0n1n, accept.I If not, run M on w and accept if M accepts w .

I Run R on 〈M2〉.I If R accepts, accept; if R rejects, reject.

Page 26: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 8

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM = {〈M〉 | M is a TM and L(M) is a regular language }.

Proof: By contradiction, assume R decides Reg. We define SI S = On input 〈M,w〉;

I construct TM M2 as follows:

M2 on input x does the foll:I if x has the form 0n1n, accept.I If not, run M on w and accept if M accepts w .

I Run R on 〈M2〉.I If R accepts, accept; if R rejects, reject.

Page 27: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 8

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM = {〈M〉 | M is a TM and L(M) is a regular language }.

Proof: By contradiction, assume R decides Reg. We define SI S = On input 〈M,w〉;

I construct TM M2 as follows:M2 on input x does the foll:

I if x has the form 0n1n, accept.I If not, run M on w and accept if M accepts w .

I Run R on 〈M2〉.I If R accepts, accept; if R rejects, reject.

Page 28: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 8

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM = {〈M〉 | M is a TM and L(M) is a regular language }.

Proof: By contradiction, assume R decides Reg. We define SI S = On input 〈M,w〉;

I construct TM M2 as follows:M2 on input x does the foll:

I if x has the form 0n1n, accept.I If not, run M on w and accept if M accepts w .

I Run R on 〈M2〉.

I If R accepts, accept; if R rejects, reject.

Page 29: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 8

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM = {〈M〉 | M is a TM and L(M) is a regular language }.

Proof: By contradiction, assume R decides Reg. We define SI S = On input 〈M,w〉;

I construct TM M2 as follows:M2 on input x does the foll:

I if x has the form 0n1n, accept.I If not, run M on w and accept if M accepts w .

I Run R on 〈M2〉.I If R accepts, accept; if R rejects, reject.

Page 30: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 9

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LEQTM = {〈M1,M2〉 | M are TMs and L(M1) = L(M2)}.

Proof: Reduce to emptiness.

Page 31: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 9

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LEQTM = {〈M1,M2〉 | M are TMs and L(M1) = L(M2)}.

Proof: Reduce to emptiness.

Page 32: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 10

Which is easier: Emptiness or non-emptiness?

I Le = {〈M〉 | L(M) = ∅}I Lne = {〈M〉 | L(M) 6= ∅}

Page 33: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 11

Is everything about Turing machines undecidable?

1. {〈M〉 | L(M) = ∅}

2. {〈M〉 | L(M) is regular }3. {〈M〉 | L(M) is context-free }4. {〈M〉 | L(M) is finite }5. {〈M〉 | M has 5 states }6. {〈M〉 | L(M) is a language }7. {〈M〉 | M makes at least 5 moves on some input}

Rice’s TheoremAny “non-trivial” property of R.E languages is undecidable!

Page 34: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 11

Is everything about Turing machines undecidable?

1. {〈M〉 | L(M) = ∅}2. {〈M〉 | L(M) is regular }

3. {〈M〉 | L(M) is context-free }4. {〈M〉 | L(M) is finite }5. {〈M〉 | M has 5 states }6. {〈M〉 | L(M) is a language }7. {〈M〉 | M makes at least 5 moves on some input}

Rice’s TheoremAny “non-trivial” property of R.E languages is undecidable!

Page 35: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 11

Is everything about Turing machines undecidable?

1. {〈M〉 | L(M) = ∅}2. {〈M〉 | L(M) is regular }3. {〈M〉 | L(M) is context-free }

4. {〈M〉 | L(M) is finite }5. {〈M〉 | M has 5 states }6. {〈M〉 | L(M) is a language }7. {〈M〉 | M makes at least 5 moves on some input}

Rice’s TheoremAny “non-trivial” property of R.E languages is undecidable!

Page 36: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 11

Is everything about Turing machines undecidable?

1. {〈M〉 | L(M) = ∅}2. {〈M〉 | L(M) is regular }3. {〈M〉 | L(M) is context-free }4. {〈M〉 | L(M) is finite }

5. {〈M〉 | M has 5 states }6. {〈M〉 | L(M) is a language }7. {〈M〉 | M makes at least 5 moves on some input}

Rice’s TheoremAny “non-trivial” property of R.E languages is undecidable!

Page 37: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 11

Is everything about Turing machines undecidable?

1. {〈M〉 | L(M) = ∅}2. {〈M〉 | L(M) is regular }3. {〈M〉 | L(M) is context-free }4. {〈M〉 | L(M) is finite }5. {〈M〉 | M has 5 states }

6. {〈M〉 | L(M) is a language }7. {〈M〉 | M makes at least 5 moves on some input}

Rice’s TheoremAny “non-trivial” property of R.E languages is undecidable!

Page 38: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 11

Is everything about Turing machines undecidable?

1. {〈M〉 | L(M) = ∅}2. {〈M〉 | L(M) is regular }3. {〈M〉 | L(M) is context-free }4. {〈M〉 | L(M) is finite }5. {〈M〉 | M has 5 states }6. {〈M〉 | L(M) is a language }

7. {〈M〉 | M makes at least 5 moves on some input}

Rice’s TheoremAny “non-trivial” property of R.E languages is undecidable!

Page 39: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 11

Is everything about Turing machines undecidable?

1. {〈M〉 | L(M) = ∅}2. {〈M〉 | L(M) is regular }3. {〈M〉 | L(M) is context-free }4. {〈M〉 | L(M) is finite }5. {〈M〉 | M has 5 states }6. {〈M〉 | L(M) is a language }7. {〈M〉 | M makes at least 5 moves on some input}

Rice’s TheoremAny “non-trivial” property of R.E languages is undecidable!

Page 40: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 11

Is everything about Turing machines undecidable?

1. {〈M〉 | L(M) = ∅}2. {〈M〉 | L(M) is regular }3. {〈M〉 | L(M) is context-free }4. {〈M〉 | L(M) is finite }5. {〈M〉 | M has 5 states }6. {〈M〉 | L(M) is a language }7. {〈M〉 | M makes at least 5 moves on some input}

Rice’s Theorem

Any “non-trivial” property of R.E languages is undecidable!

Page 41: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 11

Is everything about Turing machines undecidable?

1. {〈M〉 | L(M) = ∅}2. {〈M〉 | L(M) is regular }3. {〈M〉 | L(M) is context-free }4. {〈M〉 | L(M) is finite }5. {〈M〉 | M has 5 states }6. {〈M〉 | L(M) is a language }7. {〈M〉 | M makes at least 5 moves on some input}

Rice’s TheoremAny “non-trivial” property of R.E languages is undecidable!

Page 42: CS310 : Automata Theory 2019

cbna CS310 : Automata Theory 2019 Instructor: S. Akshay IITB, India 12

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) satisfying P

I Property of r.e languages: membership of M in P depends only on thelanguage of M. If L(M) = L(M ′), then 〈M〉 ∈ P iff 〈M ′〉 ∈ P.

I Non-trivial: It holds for some but not all TMs.


Recommended