Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as...

165
Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability . . . Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.1

Transcript of Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as...

Page 1: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Lecture 9We have already

Established Turing Machines as the gold standardof computers and computability . . .

seen examples of solvable problems . . .

and saw one problem, ATM, that iscomputationally unsolvable.

In this lecture, we look at other computationallyunsolvable problems, and establish the technique ofmapping reducibilities for prove that languages areundecidable/non-enumerable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.1

Page 2: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Lecture 9We have already

Established Turing Machines as the gold standardof computers and computability . . .

seen examples of solvable problems . . .

and saw one problem, ATM, that iscomputationally unsolvable.

In this lecture, we look at other computationallyunsolvable problems, and establish the technique ofmapping reducibilities for prove that languages areundecidable/non-enumerable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.1

Page 3: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Lecture 9We have already

Established Turing Machines as the gold standardof computers and computability . . .

seen examples of solvable problems . . .

and saw one problem, ATM, that iscomputationally unsolvable.

In this lecture, we look at other computationallyunsolvable problems, and establish the technique ofmapping reducibilities for prove that languages areundecidable/non-enumerable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.1

Page 4: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Lecture 9We have already

Established Turing Machines as the gold standardof computers and computability . . .

seen examples of solvable problems . . .

and saw one problem, ATM, that iscomputationally unsolvable.

In this lecture, we look at other computationallyunsolvable problems, and establish the technique ofmapping reducibilities for prove that languages areundecidable/non-enumerable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.1

Page 5: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Reducibility

Example:

Finding your way around a new city

reduces to . . .

obtaining a city map.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.2

Page 6: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Reducibility

Example:

Finding your way around a new city

reduces to . . .

obtaining a city map.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.2

Page 7: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Reducibility

Example:

Finding your way around a new city

reduces to . . .

obtaining a city map.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.2

Page 8: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Reducibility, In Our Context

Always involves two problems, A and B.

Desired Property: If A reduces to B, then any solutionof B can be used to find a solution of A.

Remark: This property says nothing about solving Aby itself or B by itself.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.3

Page 9: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Reducibility, In Our Context

Always involves two problems, A and B.

Desired Property: If A reduces to B, then any solutionof B can be used to find a solution of A.

Remark: This property says nothing about solving Aby itself or B by itself.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.3

Page 10: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Reducibility, In Our Context

Always involves two problems, A and B.

Desired Property: If A reduces to B, then any solutionof B can be used to find a solution of A.

Remark: This property says nothing about solving Aby itself or B by itself.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.3

Page 11: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Examples

Reductions:

Traveling from Boshton to Paris . . .

buying plane ticket . . .

earning the money for that ticket . . .

finding a job(or getting the $s from mom and dad. . . )

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.4

Page 12: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Examples

Reductions:

Traveling from Boshton to Paris . . .

buying plane ticket . . .

earning the money for that ticket . . .

finding a job(or getting the $s from mom and dad. . . )

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.4

Page 13: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Examples

Reductions:

Traveling from Boshton to Paris . . .

buying plane ticket . . .

earning the money for that ticket . . .

finding a job(or getting the $s from mom and dad. . . )

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.4

Page 14: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Examples

Reductions:

Traveling from Boshton to Paris . . .

buying plane ticket . . .

earning the money for that ticket . . .

finding a job(or getting the $s from mom and dad. . . )

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.4

Page 15: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Examples

Reductions:

Measuring area of rectangle . . .

measuring lengths of sides.

Also:

Solving a system of linear equations . . .

inverting a matrix.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.5

Page 16: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Examples

Reductions:

Measuring area of rectangle . . .

measuring lengths of sides.

Also:

Solving a system of linear equations . . .

inverting a matrix.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.5

Page 17: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Examples

Reductions:

Measuring area of rectangle . . .

measuring lengths of sides.

Also:

Solving a system of linear equations . . .

inverting a matrix.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.5

Page 18: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Examples

Reductions:

Measuring area of rectangle . . .

measuring lengths of sides.

Also:

Solving a system of linear equations . . .

inverting a matrix.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.5

Page 19: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Reducibility

If A is reducible to B, then

A cannot be harder than B

if B is decidable, so is A.

if A is undecidable and reducible to B,then B is undecidable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.6

Page 20: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Reducibility

If A is reducible to B, then

A cannot be harder than B

if B is decidable, so is A.

if A is undecidable and reducible to B,then B is undecidable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.6

Page 21: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Reducibility

If A is reducible to B, then

A cannot be harder than B

if B is decidable, so is A.

if A is undecidable and reducible to B,then B is undecidable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.6

Page 22: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable ProblemsWe have already established that ATM is undecidable.

Here is a related problem.

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

Clarification: How does HTM differ from ATM?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.7

Page 23: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems

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

Theorem: HTM is undecidable.

Proof idea:

By contradiction.

Assume HTM is decidable.

Let R be a TM that decides HTM.

Use R to construct S, a TM that decides ATM.

So ATM is reduced to HTM.

Since ATM is undecidable, so is HTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.8

Page 24: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems

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

Theorem: HTM is undecidable.

Proof idea:

By contradiction.

Assume HTM is decidable.

Let R be a TM that decides HTM.

Use R to construct S, a TM that decides ATM.

So ATM is reduced to HTM.

Since ATM is undecidable, so is HTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.8

Page 25: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems

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

Theorem: HTM is undecidable.

Proof idea:

By contradiction.

Assume HTM is decidable.

Let R be a TM that decides HTM.

Use R to construct S, a TM that decides ATM.

So ATM is reduced to HTM.

Since ATM is undecidable, so is HTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.8

Page 26: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems

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

Theorem: HTM is undecidable.

Proof idea:

By contradiction.

Assume HTM is decidable.

Let R be a TM that decides HTM.

Use R to construct S, a TM that decides ATM.

So ATM is reduced to HTM.

Since ATM is undecidable, so is HTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.8

Page 27: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems

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

Theorem: HTM is undecidable.

Proof idea:

By contradiction.

Assume HTM is decidable.

Let R be a TM that decides HTM.

Use R to construct S, a TM that decides ATM.

So ATM is reduced to HTM.

Since ATM is undecidable, so is HTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.8

Page 28: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems

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

Theorem: HTM is undecidable.

Proof idea:

By contradiction.

Assume HTM is decidable.

Let R be a TM that decides HTM.

Use R to construct S, a TM that decides ATM.

So ATM is reduced to HTM.

Since ATM is undecidable, so is HTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.8

Page 29: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable ProblemsTheorem: HTM is undecidable.

Proof: Assume, by way of contradiction, that TM Rdecides HTM. Define a new TM, S, as follows:

On input 〈M,w〉,

run R on 〈M,w〉.

If R rejects, reject.

If R accepts (meaning M halts on w), simulateM on w until it halts.

If M accepted, accept; otherwise reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.9

Page 30: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable ProblemsTheorem: HTM is undecidable.

Proof: Assume, by way of contradiction, that TM Rdecides HTM. Define a new TM, S, as follows:

On input 〈M,w〉,

run R on 〈M,w〉.

If R rejects, reject.

If R accepts (meaning M halts on w), simulateM on w until it halts.

If M accepted, accept; otherwise reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.9

Page 31: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable ProblemsTheorem: HTM is undecidable.

Proof: Assume, by way of contradiction, that TM Rdecides HTM. Define a new TM, S, as follows:

On input 〈M,w〉,

run R on 〈M,w〉.

If R rejects, reject.

If R accepts (meaning M halts on w), simulateM on w until it halts.

If M accepted, accept; otherwise reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.9

Page 32: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable ProblemsTheorem: HTM is undecidable.

Proof: Assume, by way of contradiction, that TM Rdecides HTM. Define a new TM, S, as follows:

On input 〈M,w〉,

run R on 〈M,w〉.

If R rejects, reject.

If R accepts (meaning M halts on w), simulateM on w until it halts.

If M accepted, accept; otherwise reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.9

Page 33: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable ProblemsTheorem: HTM is undecidable.

Proof: Assume, by way of contradiction, that TM Rdecides HTM. Define a new TM, S, as follows:

On input 〈M,w〉,

run R on 〈M,w〉.

If R rejects, reject.

If R accepts (meaning M halts on w), simulateM on w until it halts.

If M accepted, accept; otherwise reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.9

Page 34: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

Does a TM accept any string at all?

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

Theorem: ETM is undecidable.

Proof structure:

By contradiction.

Assume ETM is decidable.

Let R be a TM that decides ETM.

Use R to construct S, a TM that decides ATM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.10

Page 35: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

Does a TM accept any string at all?

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

Theorem: ETM is undecidable.

Proof structure:

By contradiction.

Assume ETM is decidable.

Let R be a TM that decides ETM.

Use R to construct S, a TM that decides ATM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.10

Page 36: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

Does a TM accept any string at all?

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

Theorem: ETM is undecidable.

Proof structure:

By contradiction.

Assume ETM is decidable.

Let R be a TM that decides ETM.

Use R to construct S, a TM that decides ATM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.10

Page 37: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

Does a TM accept any string at all?

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

Theorem: ETM is undecidable.

Proof structure:

By contradiction.

Assume ETM is decidable.

Let R be a TM that decides ETM.

Use R to construct S, a TM that decides ATM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.10

Page 38: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

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

First attempt: When S receives input 〈M,w〉, it callsR with input 〈M〉.

If R accepts, then reject, because M does notaccept any string, let alone w.

But what if R rejects?

Second attempt: Let’s modify M .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.11

Page 39: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

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

First attempt: When S receives input 〈M,w〉, it callsR with input 〈M〉.

If R accepts, then reject, because M does notaccept any string, let alone w.

But what if R rejects?

Second attempt: Let’s modify M .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.11

Page 40: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

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

First attempt: When S receives input 〈M,w〉, it callsR with input 〈M〉.

If R accepts, then reject, because M does notaccept any string, let alone w.

But what if R rejects?

Second attempt: Let’s modify M .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.11

Page 41: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

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

Define M1: on input x,

1. if x 6= w, reject.

2. if x = w, run M on w and accept if M does.

M1 either

accepts just w, or

accepts nothing.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.12

Page 42: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

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

Define M1: on input x,

1. if x 6= w, reject.

2. if x = w, run M on w and accept if M does.

M1 either

accepts just w, or

accepts nothing.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.12

Page 43: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

Machine M1: on input x,

1. if x 6= w, reject.

2. if x = w, run M on w and accept if M does.

Question: Can a TM construct M1 from M?

Answer: Yes, because we need only hardwire w, andadd a few extra states to perform the “x = w?′′ test.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.13

Page 44: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

Machine M1: on input x,

1. if x 6= w, reject.

2. if x = w, run M on w and accept if M does.

Question: Can a TM construct M1 from M?

Answer: Yes, because we need only hardwire w, andadd a few extra states to perform the “x = w?′′ test.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.13

Page 45: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

Machine M1: on input x,

1. if x 6= w, reject.

2. if x = w, run M on w and accept if M does.

Question: Can a TM construct M1 from M?

Answer: Yes, because we need only hardwire w, andadd a few extra states to perform the “x = w?′′ test.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.13

Page 46: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

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

Theorem: ETM is undecidable.

Define S as follows:

On input 〈M,w〉, where M is a TM and w a string,

Construct M1 from M and w.

Run R on input 〈M1〉,

if R accepts, reject; if R rejects, accept. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 47: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

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

Theorem: ETM is undecidable.

Define S as follows:

On input 〈M,w〉, where M is a TM and w a string,

Construct M1 from M and w.

Run R on input 〈M1〉,

if R accepts, reject; if R rejects, accept. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 48: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (2)

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

Theorem: ETM is undecidable.

Define S as follows:

On input 〈M,w〉, where M is a TM and w a string,

Construct M1 from M and w.

Run R on input 〈M1〉,

if R accepts, reject; if R rejects, accept. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.14

Page 49: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

Does a TM accept a regular language?

RTM = {〈M〉|M is a TM and L(M) is regular}

Theorem: RTM is undecidable.

Skeleton of Proof:

By contradiction.

Assume RTM is decidable.

Let R be a TM that decides RTM.

Use R to construct S, a TM that decides ATM.

But how?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.15

Page 50: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

Does a TM accept a regular language?

RTM = {〈M〉|M is a TM and L(M) is regular}

Theorem: RTM is undecidable.

Skeleton of Proof:

By contradiction.

Assume RTM is decidable.

Let R be a TM that decides RTM.

Use R to construct S, a TM that decides ATM.

But how?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.15

Page 51: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

Does a TM accept a regular language?

RTM = {〈M〉|M is a TM and L(M) is regular}

Theorem: RTM is undecidable.

Skeleton of Proof:

By contradiction.

Assume RTM is decidable.

Let R be a TM that decides RTM.

Use R to construct S, a TM that decides ATM.

But how?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.15

Page 52: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

Does a TM accept a regular language?

RTM = {〈M〉|M is a TM and L(M) is regular}

Theorem: RTM is undecidable.

Skeleton of Proof:

By contradiction.

Assume RTM is decidable.

Let R be a TM that decides RTM.

Use R to construct S, a TM that decides ATM.

But how?Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.15

Page 53: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

RTM = {〈M〉|M is a TM and L(M) is regular}

Modify M so that the resulting TM accepts a regularlanguage if and only if M accepts w.

Design M2 so that

if M does not accept w, then M2 accepts{0n1n|n ≥ 0} (non-regular)

if M accepts w, then M2 accepts Σ∗ (regular).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.16

Page 54: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

RTM = {〈M〉|M is a TM and L(M) is regular}

Modify M so that the resulting TM accepts a regularlanguage if and only if M accepts w.

Design M2 so that

if M does not accept w, then M2 accepts{0n1n|n ≥ 0} (non-regular)

if M accepts w, then M2 accepts Σ∗ (regular).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.16

Page 55: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

From M and w, define M2:

On input x,

1. If x has the form 0n1n, accept it.

2. Otherwise, run M on input w and accept x if Maccepts w.

Claim:

If M does not accept w, then M2 accepts{0n1n|n ≥ 0}.

If M accepts w, then M2 accepts Σ∗.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.17

Page 56: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

From M and w, define M2:

On input x,

1. If x has the form 0n1n, accept it.

2. Otherwise, run M on input w and accept x if Maccepts w.

Claim:

If M does not accept w, then M2 accepts{0n1n|n ≥ 0}.

If M accepts w, then M2 accepts Σ∗.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.17

Page 57: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

From M and w, define M2:

On input x,

1. If x has the form 0n1n, accept it.

2. Otherwise, run M on input w and accept x if Maccepts w.

Claim:

If M does not accept w, then M2 accepts{0n1n|n ≥ 0}.

If M accepts w, then M2 accepts Σ∗.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.17

Page 58: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

RTM = {〈M〉|M is a TM and L(M) is regular}

Theorem: RTM is undecidable.

Define S:

On input 〈M,w〉,

1. Construct M2 from M and w.

2. Run R on input 〈M2〉.

3. If R accepts, accept; if R rejects, reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.18

Page 59: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (3)

RTM = {〈M〉|M is a TM and L(M) is regular}

Theorem: RTM is undecidable.

Define S:

On input 〈M,w〉,

1. Construct M2 from M and w.

2. Run R on input 〈M2〉.

3. If R accepts, accept; if R rejects, reject. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.18

Page 60: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (4)

Are two TMs equivalent?

EQTM = {〈M1,M2〉 | M1,M2 are TMs and

L(M1) = L(M2)}

Theorem: EQTM is undecidable.

We are getting tired of reducing ATM to everything.

Let’s try instead a reduction from ETM to EQTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.19

Page 61: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (4)

Are two TMs equivalent?

EQTM = {〈M1,M2〉 | M1,M2 are TMs and

L(M1) = L(M2)}

Theorem: EQTM is undecidable.

We are getting tired of reducing ATM to everything.

Let’s try instead a reduction from ETM to EQTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.19

Page 62: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (4)

Are two TMs equivalent?

EQTM = {〈M1,M2〉 | M1,M2 are TMs and

L(M1) = L(M2)}

Theorem: EQTM is undecidable.

We are getting tired of reducing ATM to everything.

Let’s try instead a reduction from ETM to EQTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.19

Page 63: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (4)

EQTM = {〈M1,M2〉 | M1,M2 are TMs and

L(M1) = L(M2)}

Theorem: EQTM is undecidable.Idea:

ETM is the problem of testing whether a TMlanguage is empty.

EQTM is the problem of testing whether twoTM languages are the same.If one of these two TM languages happens to beempty, then we are back to ETM.So ETM is a special case of EQTM.

The rest is easy.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.20

Page 64: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (4)

EQTM = {〈M1,M2〉 | M1,M2 are TMs and

L(M1) = L(M2)}

Theorem: EQTM is undecidable.Idea:

ETM is the problem of testing whether a TMlanguage is empty.EQTM is the problem of testing whether two

TM languages are the same.

If one of these two TM languages happens to beempty, then we are back to ETM.So ETM is a special case of EQTM.

The rest is easy.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.20

Page 65: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (4)

EQTM = {〈M1,M2〉 | M1,M2 are TMs and

L(M1) = L(M2)}

Theorem: EQTM is undecidable.Idea:

ETM is the problem of testing whether a TMlanguage is empty.EQTM is the problem of testing whether two

TM languages are the same.If one of these two TM languages happens to beempty, then we are back to ETM.

So ETM is a special case of EQTM.

The rest is easy.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.20

Page 66: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (4)

EQTM = {〈M1,M2〉 | M1,M2 are TMs and

L(M1) = L(M2)}

Theorem: EQTM is undecidable.Idea:

ETM is the problem of testing whether a TMlanguage is empty.EQTM is the problem of testing whether two

TM languages are the same.If one of these two TM languages happens to beempty, then we are back to ETM.So ETM is a special case of EQTM.

The rest is easy.Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.20

Page 67: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (4)

EQTM = {〈M1,M2〉 | M1,M2 are TMs and

L(M1) = L(M2)}

Theorem: EQTM is undecidable.

Let MNO be the TM: On input x, reject.

Let R decide EQTM.

Let S be: On input 〈M〉:

1. Run R on input 〈M,MNO〉.

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

If R decides EQTM, then S decides ETM. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.21

Page 68: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (4)

EQTM = {〈M1,M2〉 | M1,M2 are TMs and

L(M1) = L(M2)}

Theorem: EQTM is undecidable.

Let MNO be the TM: On input x, reject.

Let R decide EQTM.

Let S be: On input 〈M〉:

1. Run R on input 〈M,MNO〉.

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

If R decides EQTM, then S decides ETM. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.21

Page 69: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Undecidable Problems (4)

EQTM = {〈M1,M2〉 | M1,M2 are TMs and

L(M1) = L(M2)}

Theorem: EQTM is undecidable.

Let MNO be the TM: On input x, reject.

Let R decide EQTM.

Let S be: On input 〈M〉:

1. Run R on input 〈M,MNO〉.

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

If R decides EQTM, then S decides ETM. ♣Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.21

Page 70: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Bucket of Undecidable ProblemsSame techniques prove undecidability of

Does a TM accept a decidable language?

Does a TM accept a enumerable language?

Does a TM accept a context-free language?

Does a TM accept a finite language?

Does a TM halt on all inputs?

Is there an input string that causes a TM totraverse all its states?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.22

Page 71: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Bucket of Undecidable ProblemsSame techniques prove undecidability of

Does a TM accept a decidable language?

Does a TM accept a enumerable language?

Does a TM accept a context-free language?

Does a TM accept a finite language?

Does a TM halt on all inputs?

Is there an input string that causes a TM totraverse all its states?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.22

Page 72: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Bucket of Undecidable ProblemsSame techniques prove undecidability of

Does a TM accept a decidable language?

Does a TM accept a enumerable language?

Does a TM accept a context-free language?

Does a TM accept a finite language?

Does a TM halt on all inputs?

Is there an input string that causes a TM totraverse all its states?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.22

Page 73: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Bucket of Undecidable ProblemsSame techniques prove undecidability of

Does a TM accept a decidable language?

Does a TM accept a enumerable language?

Does a TM accept a context-free language?

Does a TM accept a finite language?

Does a TM halt on all inputs?

Is there an input string that causes a TM totraverse all its states?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.22

Page 74: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Bucket of Undecidable ProblemsSame techniques prove undecidability of

Does a TM accept a decidable language?

Does a TM accept a enumerable language?

Does a TM accept a context-free language?

Does a TM accept a finite language?

Does a TM halt on all inputs?

Is there an input string that causes a TM totraverse all its states?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.22

Page 75: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Bucket of Undecidable ProblemsSame techniques prove undecidability of

Does a TM accept a decidable language?

Does a TM accept a enumerable language?

Does a TM accept a context-free language?

Does a TM accept a finite language?

Does a TM halt on all inputs?

Is there an input string that causes a TM totraverse all its states?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.22

Page 76: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Rice’s TheoremBy now, some of you may have become cynical andembittered.

Like, been there, done that, bought the T-shirt.

Looks like any non-trivial property of TMs isundecidable.

That is correct.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.23

Page 77: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Rice’s TheoremBy now, some of you may have become cynical andembittered.

Like, been there, done that, bought the T-shirt.

Looks like any non-trivial property of TMs isundecidable.

That is correct.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.23

Page 78: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Rice’s TheoremBy now, some of you may have become cynical andembittered.

Like, been there, done that, bought the T-shirt.

Looks like any non-trivial property of TMs isundecidable.

That is correct.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.23

Page 79: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Rice’s TheoremTheorem: If C is a proper non-empty subset of theset of enumerable languages, then it is undecidablewhether for a given TM, M , L(M) is in C.

Proof by reduction from HTM(does M halt on input x?).

Assume R decides if L(M) ∈ C.

Use R to implement S, which decides HTM.

Further details of proof not given at the moment . . .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.24

Page 80: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Rice’s TheoremTheorem: If C is a proper non-empty subset of theset of enumerable languages, then it is undecidablewhether for a given TM, M , L(M) is in C.

Proof by reduction from HTM(does M halt on input x?).

Assume R decides if L(M) ∈ C.

Use R to implement S, which decides HTM.

Further details of proof not given at the moment . . .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.24

Page 81: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Rice’s TheoremTheorem: If C is a proper non-empty subset of theset of enumerable languages, then it is undecidablewhether for a given TM, M , L(M) is in C.

Proof by reduction from HTM(does M halt on input x?).

Assume R decides if L(M) ∈ C.

Use R to implement S, which decides HTM.

Further details of proof not given at the moment . . .

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.24

Page 82: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Reducibility

So far, we have seen many examples of reductionsfrom one language to another, but the notion wasneither defined nor treated formally.

Reductions play an important role in

decidability theory

complexity theory (to come)

Time to get formal.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.25

Page 83: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

A TM computes a function

f : Σ∗ −→ Σ∗

if the TM

starts with input w, and

halts with only f(w) on tape.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.26

Page 84: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

A TM computes a function

f : Σ∗ −→ Σ∗

if the TM

starts with input w, and

halts with only f(w) on tape.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.26

Page 85: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

A TM computes a function

f : Σ∗ −→ Σ∗

if the TM

starts with input w, and

halts with only f(w) on tape.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.26

Page 86: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

Claim: All the usual arithmetic functions on integersare computable.

These include addition, subtraction, multiplication,division (quotient and remainder), exponentiation,roots (to a specified precision).

Even non-arithmetic functions, like logarithms andtrigonometric functions, can be computed (to aspecified precision), using Taylor expansion or othernumeric mathematic techniques.

Exercise: Design a TM that on input 〈m,n〉, haltswith 〈m + n〉 on tape.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.27

Page 87: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

Claim: All the usual arithmetic functions on integersare computable.

These include addition, subtraction, multiplication,division (quotient and remainder), exponentiation,roots (to a specified precision).

Even non-arithmetic functions, like logarithms andtrigonometric functions, can be computed (to aspecified precision), using Taylor expansion or othernumeric mathematic techniques.

Exercise: Design a TM that on input 〈m,n〉, haltswith 〈m + n〉 on tape.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.27

Page 88: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

Claim: All the usual arithmetic functions on integersare computable.

These include addition, subtraction, multiplication,division (quotient and remainder), exponentiation,roots (to a specified precision).

Even non-arithmetic functions, like logarithms andtrigonometric functions, can be computed (to aspecified precision), using Taylor expansion or othernumeric mathematic techniques.

Exercise: Design a TM that on input 〈m,n〉, haltswith 〈m + n〉 on tape.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.27

Page 89: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

Claim: All the usual arithmetic functions on integersare computable.

These include addition, subtraction, multiplication,division (quotient and remainder), exponentiation,roots (to a specified precision).

Even non-arithmetic functions, like logarithms andtrigonometric functions, can be computed (to aspecified precision), using Taylor expansion or othernumeric mathematic techniques.

Exercise: Design a TM that on input 〈m,n〉, haltswith 〈m + n〉 on tape.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.27

Page 90: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

A useful class of functions modifies TM descriptions.For example:

On input w:

if w = 〈M〉 for some TM,

construct 〈M ′〉, whereL(M ′) = L(M), butM ′ never tries to move off LHS of tape.

otherwise write ε and halt.

Left as an exercise.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 91: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

A useful class of functions modifies TM descriptions.For example:

On input w:

if w = 〈M〉 for some TM,construct 〈M ′〉, where

L(M ′) = L(M), butM ′ never tries to move off LHS of tape.

otherwise write ε and halt.

Left as an exercise.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 92: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

A useful class of functions modifies TM descriptions.For example:

On input w:

if w = 〈M〉 for some TM,construct 〈M ′〉, whereL(M ′) = L(M), but

M ′ never tries to move off LHS of tape.

otherwise write ε and halt.

Left as an exercise.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 93: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

A useful class of functions modifies TM descriptions.For example:

On input w:

if w = 〈M〉 for some TM,construct 〈M ′〉, whereL(M ′) = L(M), butM ′ never tries to move off LHS of tape.

otherwise write ε and halt.

Left as an exercise.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 94: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

A useful class of functions modifies TM descriptions.For example:

On input w:

if w = 〈M〉 for some TM,construct 〈M ′〉, whereL(M ′) = L(M), butM ′ never tries to move off LHS of tape.

otherwise write ε and halt.

Left as an exercise.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 95: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Computable Functions

A useful class of functions modifies TM descriptions.For example:

On input w:

if w = 〈M〉 for some TM,construct 〈M ′〉, whereL(M ′) = L(M), butM ′ never tries to move off LHS of tape.

otherwise write ε and halt.

Left as an exercise.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.28

Page 96: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Mapping Reductions

Definition: Let A and B be two languages. We saythat there is a mapping reduction from A to B, anddenote

A ≤m B

if there is a computable function

f : Σ∗ −→ Σ∗

such that, for every w,

w ∈ A⇐⇒f(w) ∈ B.

The function f is called the reduction from A to B.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.29

Page 97: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Mapping Reductions

Definition: Let A and B be two languages. We saythat there is a mapping reduction from A to B, anddenote

A ≤m B

if there is a computable function

f : Σ∗ −→ Σ∗

such that, for every w,

w ∈ A⇐⇒f(w) ∈ B.

The function f is called the reduction from A to B.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.29

Page 98: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Mapping Reductions

Definition: Let A and B be two languages. We saythat there is a mapping reduction from A to B, anddenote

A ≤m B

if there is a computable function

f : Σ∗ −→ Σ∗

such that, for every w,

w ∈ A⇐⇒f(w) ∈ B.

The function f is called the reduction from A to B.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.29

Page 99: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Mapping Reductions

f

f

A B

A mapping reduction converts questions about

membership in A to membership in B

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.30

Page 100: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Mapping Reductions

f

f

A B

A mapping reduction converts questions about

membership in A to membership in B

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.30

Page 101: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Mapping Reductions

Theorem: If A ≤mB and B is decidable, then A isdecidable.

Proof: Let

M be the decider for B, and

f the reduction from A to B.

Define N : On input w

1. compute f(w)

2. run M on input f(w) and output whatever Moutputs.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.31

Page 102: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Mapping Reductions

Theorem: If A ≤mB and B is decidable, then A isdecidable.

Proof: Let

M be the decider for B, and

f the reduction from A to B.

Define N : On input w

1. compute f(w)

2. run M on input f(w) and output whatever Moutputs.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.31

Page 103: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Mapping Reductions

Theorem: If A ≤mB and B is decidable, then A isdecidable.

Proof: Let

M be the decider for B, and

f the reduction from A to B.

Define N : On input w

1. compute f(w)

2. run M on input f(w) and output whatever Moutputs.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.31

Page 104: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Mapping Reductions

Corollary: If A ≤m B and A is undecidable, then B isundecidable.

In fact, this has been our principal tool for proving un-

decidability of languages other than ATM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.32

Page 105: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Mapping Reductions

Corollary: If A ≤m B and A is undecidable, then B isundecidable.

In fact, this has been our principal tool for proving un-

decidability of languages other than ATM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.32

Page 106: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Example: Halting

Recall that

ATM = {〈M,w〉|TM M accepts input w}

HTM = {〈M,w〉|TM M halts on input w}

Earlier we proved that

HTM undecidable

by (de facto) reduction from ATM.

Let’s reformulate this.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 107: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Example: Halting

Recall that

ATM = {〈M,w〉|TM M accepts input w}

HTM = {〈M,w〉|TM M halts on input w}

Earlier we proved that

HTM undecidable

by (de facto) reduction from ATM.

Let’s reformulate this.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.33

Page 108: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Example: Halting

Define a computable function, f :

input of form 〈M,w〉

output of form 〈M ′, w′〉

where 〈M,w〉 ∈ ATM ⇐⇒ 〈M ′, w′〉 ∈ HTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.34

Page 109: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Example: Halting

Define a computable function, f :

input of form 〈M,w〉

output of form 〈M ′, w′〉

where 〈M,w〉 ∈ ATM ⇐⇒ 〈M ′, w′〉 ∈ HTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.34

Page 110: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Example: Halting

Define a computable function, f :

input of form 〈M,w〉

output of form 〈M ′, w′〉

where 〈M,w〉 ∈ ATM ⇐⇒ 〈M ′, w′〉 ∈ HTM.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.34

Page 111: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Example: Halting

The following machine computes this function f .F = on input 〈M,w〉:

Construct the following machine M ′.M ′: on input x

run M on x

If M accepts, accept.if M rejects, enter a loop.

output 〈M ′, w〉

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.35

Page 112: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Example: Halting

The following machine computes this function f .F = on input 〈M,w〉:

Construct the following machine M ′.M ′: on input x

run M on x

If M accepts, accept.if M rejects, enter a loop.

output 〈M ′, w〉

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.35

Page 113: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Example: Halting

The following machine computes this function f .F = on input 〈M,w〉:

Construct the following machine M ′.M ′: on input x

run M on x

If M accepts, accept.

if M rejects, enter a loop.

output 〈M ′, w〉

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.35

Page 114: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Example: Halting

The following machine computes this function f .F = on input 〈M,w〉:

Construct the following machine M ′.M ′: on input x

run M on x

If M accepts, accept.if M rejects, enter a loop.

output 〈M ′, w〉

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.35

Page 115: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Example: Halting

The following machine computes this function f .F = on input 〈M,w〉:

Construct the following machine M ′.M ′: on input x

run M on x

If M accepts, accept.if M rejects, enter a loop.

output 〈M ′, w〉

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.35

Page 116: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Enumerability

Theorem: If A ≤m B and B is enumerable, then Ais enumerable.

Proof is same as before, using accepters instead ofdeciders.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.36

Page 117: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Enumerability

Corollary: If A ≤m B and A is not enumerable, thenB is not enumerable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.37

Page 118: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

Theorem: Both EQTM and its complement, EQTM,are not enumerable. Stated differently, EQTM isneither enumerable nor co-enumerable.

We show that ATM is reducible to EQTM. Thesame function is also a mapping reduction fromATM to EQTM, and thus EQTM is notenumerable.

We then show that ATM is reducible to EQTM.The new function is also a mapping reductionfrom ATM to EQTM, and thus EQTM is notenumerable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.38

Page 119: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

Theorem: Both EQTM and its complement, EQTM,are not enumerable. Stated differently, EQTM isneither enumerable nor co-enumerable.

We show that ATM is reducible to EQTM. Thesame function is also a mapping reduction fromATM to EQTM, and thus EQTM is notenumerable.

We then show that ATM is reducible to EQTM.The new function is also a mapping reductionfrom ATM to EQTM, and thus EQTM is notenumerable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.38

Page 120: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

Theorem: Both EQTM and its complement, EQTM,are not enumerable. Stated differently, EQTM isneither enumerable nor co-enumerable.

We show that ATM is reducible to EQTM. Thesame function is also a mapping reduction fromATM to EQTM, and thus EQTM is notenumerable.

We then show that ATM is reducible to EQTM.The new function is also a mapping reductionfrom ATM to EQTM, and thus EQTM is notenumerable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.38

Page 121: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

Claim: ATM is reducible to EQTM.

f : ATM −→ EQTM works as follows:

F : On input 〈M,w〉

Construct machine M1: on any input, reject.

Construct machine M2: on input x, run M on w.If it accepts, accept.

Output 〈M1,M2〉.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.39

Page 122: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

Claim: ATM is reducible to EQTM.

f : ATM −→ EQTM works as follows:

F : On input 〈M,w〉

Construct machine M1: on any input, reject.

Construct machine M2: on input x, run M on w.If it accepts, accept.

Output 〈M1,M2〉.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.39

Page 123: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

Claim: ATM is reducible to EQTM.

f : ATM −→ EQTM works as follows:

F : On input 〈M,w〉

Construct machine M1: on any input, reject.

Construct machine M2: on input x, run M on w.If it accepts, accept.

Output 〈M1,M2〉.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.39

Page 124: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

F : On input 〈M,w〉

Construct machine M1: on any input, reject.

Construct machine M2: on any input x, run M on w.

If it accepts, accept x.

Output 〈M1,M2〉.

Note

M1 accepts nothing

if M accepts w then M2 accepts everything,and otherwise nothing.

so 〈M,w〉 ∈ ATM ⇐⇒ 〈M1,M2〉 ∈ EQTM

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.40

Page 125: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

F : On input 〈M,w〉

Construct machine M1: on any input, reject.

Construct machine M2: on any input x, run M on w.

If it accepts, accept x.

Output 〈M1,M2〉.

Note

M1 accepts nothing

if M accepts w then M2 accepts everything,and otherwise nothing.

so 〈M,w〉 ∈ ATM ⇐⇒ 〈M1,M2〉 ∈ EQTM

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.40

Page 126: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

F : On input 〈M,w〉

Construct machine M1: on any input, reject.

Construct machine M2: on any input x, run M on w.

If it accepts, accept x.

Output 〈M1,M2〉.

Note

M1 accepts nothing

if M accepts w then M2 accepts everything,and otherwise nothing.

so 〈M,w〉 ∈ ATM ⇐⇒ 〈M1,M2〉 ∈ EQTM

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.40

Page 127: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

Claim: ATM is reducible to EQTM.

f : ATM −→ EQTM works as follows:

F : On input 〈M,w〉

Construct machine M1: on any input, accept.

Construct machine M2: on any input x, run M onw.

If it accepts, accept.

Output 〈M1,M2〉.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.41

Page 128: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

Claim: ATM is reducible to EQTM.

f : ATM −→ EQTM works as follows:

F : On input 〈M,w〉

Construct machine M1: on any input, accept.

Construct machine M2: on any input x, run M onw.

If it accepts, accept.

Output 〈M1,M2〉.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.41

Page 129: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

Claim: ATM is reducible to EQTM.

f : ATM −→ EQTM works as follows:

F : On input 〈M,w〉

Construct machine M1: on any input, accept.

Construct machine M2: on any input x, run M onw.

If it accepts, accept.

Output 〈M1,M2〉.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.41

Page 130: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

F : On input 〈M,w〉

Construct machine M1: on any input, accept.

Construct machine M2: on any input x, run M on w.

If it accepts, accept.

Output 〈M1,M2〉.

Note

M1 accepts everything

if M accepts w, then M2 accepts everything,and otherwise nothing.

〈M,w〉 ∈ ATM ⇐⇒ 〈M1,M2〉 ∈ EQTM.♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.42

Page 131: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

F : On input 〈M,w〉

Construct machine M1: on any input, accept.

Construct machine M2: on any input x, run M on w.

If it accepts, accept.

Output 〈M1,M2〉.

Note

M1 accepts everything

if M accepts w, then M2 accepts everything,and otherwise nothing.

〈M,w〉 ∈ ATM ⇐⇒ 〈M1,M2〉 ∈ EQTM.♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.42

Page 132: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

TM Equality

F : On input 〈M,w〉

Construct machine M1: on any input, accept.

Construct machine M2: on any input x, run M on w.

If it accepts, accept.

Output 〈M1,M2〉.

Note

M1 accepts everything

if M accepts w, then M2 accepts everything,and otherwise nothing.

〈M,w〉 ∈ ATM ⇐⇒ 〈M1,M2〉 ∈ EQTM.♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.42

Page 133: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

Two disjoint languages L1 and L2 are recursivelyinseparable if there is no decidable language D suchthat

L1 ∩D = ∅, and

L2 ⊂ D.

Example of recursively separable languages:

D

L12L

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.43

Page 134: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

Two disjoint languages L1 and L2 are recursivelyinseparable if there is no decidable language D suchthat

L1 ∩D = ∅, and

L2 ⊂ D.

Example of recursively separable languages:

D

L12L

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.43

Page 135: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

Two disjoint languages L1 and L2 are recursivelyinseparable if there is no decidable language D suchthat

L1 ∩D = ∅, and

L2 ⊂ D.

Example of recursively separable languages:

D

L12L

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.43

Page 136: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

ATM and ATM are a trivial example.

Why?

Are there non-trivial examples?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.44

Page 137: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

ATM and ATM are a trivial example.

Why?

Are there non-trivial examples?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.44

Page 138: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

ATM and ATM are a trivial example.

Why?

Are there non-trivial examples?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.44

Page 139: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

Define

Ayes = {〈M〉|M is a TM that accepts 〈M〉}

and

Ano = {〈M〉|M is a TM that halts and rejects 〈M〉}

Theorem: Ayes and Ano are recursivelyinseparable.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.45

Page 140: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 141: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 142: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 143: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 144: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 145: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 146: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes

〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 147: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 148: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 149: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 150: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano

〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 151: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 152: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof by ContradictionLet D be a decidable language that separates them.

Assume Ano ⊂ D and D ∩Ayes = ∅.

Let MD be the TM that decides D

What does MD do with input 〈MD〉?

It must halt. (why?)

If MD accepts 〈MD〉:

〈MD〉 ∈ Ayes〈MD〉 6∈ D

so MD rejects 〈MD〉.

If MD rejects 〈MD〉:

〈MD〉 ∈ Ano〈MD〉 ∈ D

so MD accepts 〈MD〉. ♣Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.46

Page 153: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

Define

Byes = {〈M〉|M is a TM that accepts ε}

and

Bno = {〈M〉|M is a TM that halts and rejects ε}

Theorem: Byes and Bno are recursivelyinseparable.

Proof by reduction and contradiction.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.47

Page 154: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

Theorem: Byes and Bno are recursivelyinseparable.By reduction and contradiction.

Assume Byes and Bno can be separated by E,decided by TM ME .

For TM M , define M ′: On any input,1. run M on input 〈M〉.2. if M accepts, accept; if M rejects, reject;

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.48

Page 155: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

Theorem: Byes and Bno are recursivelyinseparable.By reduction and contradiction.

Assume Byes and Bno can be separated by E,decided by TM ME .

For TM M , define M ′: On any input,

1. run M on input 〈M〉.2. if M accepts, accept; if M rejects, reject;

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.48

Page 156: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

Theorem: Byes and Bno are recursivelyinseparable.By reduction and contradiction.

Assume Byes and Bno can be separated by E,decided by TM ME .

For TM M , define M ′: On any input,1. run M on input 〈M〉.

2. if M accepts, accept; if M rejects, reject;

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.48

Page 157: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Recursive Inseparability

Theorem: Byes and Bno are recursivelyinseparable.By reduction and contradiction.

Assume Byes and Bno can be separated by E,decided by TM ME .

For TM M , define M ′: On any input,1. run M on input 〈M〉.2. if M accepts, accept; if M rejects, reject;

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.48

Page 158: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof (Concluded)

Define N : On input 〈M〉,

1. construct description of M ′.2. run ME on 〈M ′〉.3. if ME accepts, accept; if ME rejects, reject;

Claim:N is a decider. (why?)

So N decides a language D.D separates Ayes and Ano, contradiction. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.49

Page 159: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof (Concluded)

Define N : On input 〈M〉,1. construct description of M ′.

2. run ME on 〈M ′〉.3. if ME accepts, accept; if ME rejects, reject;

Claim:N is a decider. (why?)

So N decides a language D.D separates Ayes and Ano, contradiction. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.49

Page 160: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof (Concluded)

Define N : On input 〈M〉,1. construct description of M ′.2. run ME on 〈M ′〉.

3. if ME accepts, accept; if ME rejects, reject;

Claim:N is a decider. (why?)

So N decides a language D.D separates Ayes and Ano, contradiction. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.49

Page 161: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof (Concluded)

Define N : On input 〈M〉,1. construct description of M ′.2. run ME on 〈M ′〉.3. if ME accepts, accept; if ME rejects, reject;

Claim:N is a decider. (why?)

So N decides a language D.D separates Ayes and Ano, contradiction. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.49

Page 162: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof (Concluded)

Define N : On input 〈M〉,1. construct description of M ′.2. run ME on 〈M ′〉.3. if ME accepts, accept; if ME rejects, reject;

Claim:

N is a decider. (why?)So N decides a language D.D separates Ayes and Ano, contradiction. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.49

Page 163: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof (Concluded)

Define N : On input 〈M〉,1. construct description of M ′.2. run ME on 〈M ′〉.3. if ME accepts, accept; if ME rejects, reject;

Claim:N is a decider. (why?)

So N decides a language D.D separates Ayes and Ano, contradiction. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.49

Page 164: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof (Concluded)

Define N : On input 〈M〉,1. construct description of M ′.2. run ME on 〈M ′〉.3. if ME accepts, accept; if ME rejects, reject;

Claim:N is a decider. (why?)

So N decides a language D.

D separates Ayes and Ano, contradiction. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.49

Page 165: Lecture 9 - TAUbchor/CM/Compute9.pdf · Lecture 9 We have already Established Turing Machines as the gold standard of computers and computability ... seen examples of solvable problems

Proof (Concluded)

Define N : On input 〈M〉,1. construct description of M ′.2. run ME on 〈M ′〉.3. if ME accepts, accept; if ME rejects, reject;

Claim:N is a decider. (why?)

So N decides a language D.D separates Ayes and Ano, contradiction. ♣

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. – p.49