The Halting Problem

Undecidable Problems From Language Theory

CS 133 : Automata Theory and Computability Turing Machines Henry N. Adorna Nestine Hope S. Hernandez Algorithms and Complexity Laboratory Department of Computer Science University of the Philippines, Diliman {hnadorna,nshernandez}@dcs.upd.edu.ph

LEC 11

The Halting Problem

Undecidable Problems From Language Theory

The Halting Problem

Undecidable Problems From Language Theory

AT M = {< M, w > | M is a TM and M accepts w}

The Halting Problem

Undecidable Problems From Language Theory

AT M = {< M, w > | M is a TM and M accepts w}

U = â&#x20AC;&#x153;On input < M, w >, where M is a TM and w is a string: 1. Simulate M on input w. 2. If M ever enters its accept state, accept; if M ever enters its reject state, reject.â&#x20AC;?

The Halting Problem

Undecidable Problems From Language Theory

AT M = {< M, w > | M is a TM and M accepts w}

U = â&#x20AC;&#x153;On input < M, w >, where M is a TM and w is a string: 1. Simulate M on input w. 2. If M ever enters its accept state, accept; if M ever enters its reject state, reject.â&#x20AC;? Note : This machine loops on input < M, w > if M loops on w. Hence, this machine does not decide AT M .

The Halting Problem

Undecidable Problems From Language Theory

AT M = {< M, w > | M is a TM and M accepts w}

U = â&#x20AC;&#x153;On input < M, w >, where M is a TM and w is a string: 1. Simulate M on input w. 2. If M ever enters its accept state, accept; if M ever enters its reject state, reject.â&#x20AC;? Note : This machine loops on input < M, w > if M loops on w. Hence, this machine does not decide AT M . If the algorithm had some way to determine that M was not halting on w, it could reject.

The Halting Problem

Undecidable Problems From Language Theory

AT M = {< M, w > | M is a TM and M accepts w}

U = â&#x20AC;&#x153;On input < M, w >, where M is a TM and w is a string: 1. Simulate M on input w. 2. If M ever enters its accept state, accept; if M ever enters its reject state, reject.â&#x20AC;? Note : This machine loops on input < M, w > if M loops on w. Hence, this machine does not decide AT M . If the algorithm had some way to determine that M was not halting on w, it could reject. Hence AT M is sometimes called the halting problem.

The Halting Problem

Undecidable Problems From Language Theory

AT M = {< M, w > | M is a TM and M accepts w}

U = â&#x20AC;&#x153;On input < M, w >, where M is a TM and w is a string: 1. Simulate M on input w. 2. If M ever enters its accept state, accept; if M ever enters its reject state, reject.â&#x20AC;? Note : This machine loops on input < M, w > if M loops on w. Hence, this machine does not decide AT M . If the algorithm had some way to determine that M was not halting on w, it could reject. Hence AT M is sometimes called the halting problem. This is an example of the universal Turing machine first proposed by Turing. It is called universal because it is capable of simulating any other Turing machine from the description of that machine.

The Halting Problem

Undecidable Problems From Language Theory

The halting problem is undecidable. AT M = {< M, w > | M is a TM and M accepts w}

Theorem AT M is undecidable.

The Halting Problem

Undecidable Problems From Language Theory

â&#x20AC;˘ Assume AT M is decidable and obtain a contradiction.

The Halting Problem

Undecidable Problems From Language Theory

â&#x20AC;˘ Assume AT M is decidable and obtain a contradiction. â&#x20AC;˘ Suppose that H is a decider for AT M .

 H(< M, w >) =

accept if M accepts w reject if M does not accept w

The Halting Problem

Undecidable Problems From Language Theory

• Assume AT M is decidable and obtain a contradiction. • Suppose that H is a decider for AT M .

 H(< M, w >) =

accept if M accepts w reject if M does not accept w

• Construct TM D with H as subroutine. D calls H to determine

what M does when the input to M is its own description < M >.

The Halting Problem

Undecidable Problems From Language Theory

• Assume AT M is decidable and obtain a contradiction. • Suppose that H is a decider for AT M .

 H(< M, w >) =

accept if M accepts w reject if M does not accept w

• Construct TM D with H as subroutine. D calls H to determine

what M does when the input to M is its own description < M >. D rejects if M accepts and D accepts if M does not. D = “On input <M>,where M is a TM: 1. Run H on input < M, < M >>. 2. If H accepts, reject; if it rejects, accept.”

The Halting Problem

Undecidable Problems From Language Theory

• Assume AT M is decidable and obtain a contradiction. • Suppose that H is a decider for AT M .

 H(< M, w >) =

accept if M accepts w reject if M does not accept w

• Construct TM D with H as subroutine. D calls H to determine

what M does when the input to M is its own description < M >. D rejects if M accepts and D accepts if M does not. D = “On input <M>,where M is a TM: 1. Run H on input < M, < M >>. 2. If H accepts, reject; if it rejects, accept.”

 D(< M >) =

accept reject

if M does not accept < M > if M accepts < M >

The Halting Problem

Undecidable Problems From Language Theory

• Assume AT M is decidable and obtain a contradiction. • Suppose that H is a decider for AT M .

 H(< M, w >) =

accept if M accepts w reject if M does not accept w

• Construct TM D with H as subroutine. D calls H to determine

what M does when the input to M is its own description < M >. D rejects if M accepts and D accepts if M does not. D = “On input <M>,where M is a TM: 1. Run H on input < M, < M >>. 2. If H accepts, reject; if it rejects, accept.”

 D(< M >) =

accept reject

if M does not accept < M > if M accepts < M >

• What happens when we run D with its own description < D > as

input.

The Halting Problem

Undecidable Problems From Language Theory

• Assume AT M is decidable and obtain a contradiction. • Suppose that H is a decider for AT M .

 H(< M, w >) =

accept if M accepts w reject if M does not accept w

• Construct TM D with H as subroutine. D calls H to determine

what M does when the input to M is its own description < M >. D rejects if M accepts and D accepts if M does not. D = “On input <M>,where M is a TM: 1. Run H on input < M, < M >>. 2. If H accepts, reject; if it rejects, accept.”

 D(< M >) =

accept reject

if M does not accept < M > if M accepts < M >

• What happens when we run D with its own description < D > as

input.  D(< D >) =

accept reject

if D does not accept < D > if D accepts < D >

The Halting Problem

Undecidable Problems From Language Theory

The Diagonalization Method

The Halting Problem

Undecidable Problems From Language Theory

The Diagonalization Method

Definition Assume that we have sets A and B and a function f from A to B. Say that f is 1 â&#x2C6;&#x2019; 1 if it never maps two different elements to the same place, that is, if f (a) 6= f (b) whenever a 6= b.

The Halting Problem

Undecidable Problems From Language Theory

The Diagonalization Method

Definition Assume that we have sets A and B and a function f from A to B. Say that f is 1 − 1 if it never maps two different elements to the same place, that is, if f (a) 6= f (b) whenever a 6= b. Say that f is onto if it hits every element of B, that is, if for every b ∈ B there is an a ∈ A such that f (a) = b.

The Halting Problem

Undecidable Problems From Language Theory

The Diagonalization Method

Definition Assume that we have sets A and B and a function f from A to B. Say that f is 1 − 1 if it never maps two different elements to the same place, that is, if f (a) 6= f (b) whenever a 6= b. Say that f is onto if it hits every element of B, that is, if for every b ∈ B there is an a ∈ A such that f (a) = b. Say that A and B are the same size if there is a 1 − 1, onto function f : A → B.

The Halting Problem

Undecidable Problems From Language Theory

The Diagonalization Method

Definition Assume that we have sets A and B and a function f from A to B. Say that f is 1 − 1 if it never maps two different elements to the same place, that is, if f (a) 6= f (b) whenever a 6= b. Say that f is onto if it hits every element of B, that is, if for every b ∈ B there is an a ∈ A such that f (a) = b. Say that A and B are the same size if there is a 1 − 1, onto function f : A → B. A function that is both 1-1 and onto is called a correspondence. In a correspondence every element of A maps to a unique element of B and each element of B has a unique element of A mapping to it.

The Halting Problem

Undecidable Problems From Language Theory

The Diagonalization Method

Definition Assume that we have sets A and B and a function f from A to B. Say that f is 1 − 1 if it never maps two different elements to the same place, that is, if f (a) 6= f (b) whenever a 6= b. Say that f is onto if it hits every element of B, that is, if for every b ∈ B there is an a ∈ A such that f (a) = b. Say that A and B are the same size if there is a 1 − 1, onto function f : A → B. A function that is both 1-1 and onto is called a correspondence. In a correspondence every element of A maps to a unique element of B and each element of B has a unique element of A mapping to it.

Example The set of natural numbers and the set of even natural numbers.

The Halting Problem

Undecidable Problems From Language Theory

Definition A set A is countable if either it is finite or it has the same size as N.

The Halting Problem

Undecidable Problems From Language Theory

Definition A set A is countable if either it is finite or it has the same size as N. Q+ , the set of positive rational numbers is countable.

The Halting Problem

Undecidable Problems From Language Theory

Definition A set A is countable if either it is finite or it has the same size as N. Q+ , the set of positive rational numbers is countable.

R is uncountable.

The Halting Problem

Undecidable Problems From Language Theory

Definition A set A is countable if either it is finite or it has the same size as N. Q+ , the set of positive rational numbers is countable.

R is uncountable. Proof: Suppose that a correspondence f exists between N and R.

The Halting Problem

Undecidable Problems From Language Theory

Definition A set A is countable if either it is finite or it has the same size as N. Q+ , the set of positive rational numbers is countable.

R is uncountable. Proof: Suppose that a correspondence f exists between N and R. Then f must pair all members of N will all members of R.

The Halting Problem

Undecidable Problems From Language Theory

Definition A set A is countable if either it is finite or it has the same size as N. Q+ , the set of positive rational numbers is countable.

R is uncountable. Proof: Suppose that a correspondence f exists between N and R. Then f must pair all members of N will all members of R. We need to find an x in R that is not paired with anything in N.

The Halting Problem

Undecidable Problems From Language Theory

Some languages are not Turing-recognizable.

The Halting Problem

Undecidable Problems From Language Theory

Some languages are not Turing-recognizable. • Σ∗ is countable, for any alphabet Σ. • With only finitely many strings of each length, we may form a list of Σ∗ by writing down all strings of length 0, length 1, length 2, and so on.

The Halting Problem

Undecidable Problems From Language Theory

Some languages are not Turing-recognizable. • Σ∗ is countable, for any alphabet Σ. • With only finitely many strings of each length, we may form a list of Σ∗ by writing down all strings of length 0, length 1, length 2, and so on. • The set of all Turing machines is countable. • Each Turing machine has an encoding into a string < M >.

Simply omit those strings that are not legal encodings of Turing machines, we can obtain a list of all Turing machines.

The Halting Problem

Undecidable Problems From Language Theory

Some languages are not Turing-recognizable. • Σ∗ is countable, for any alphabet Σ. • With only finitely many strings of each length, we may form a list of Σ∗ by writing down all strings of length 0, length 1, length 2, and so on. • The set of all Turing machines is countable. • Each Turing machine has an encoding into a string < M >.

Simply omit those strings that are not legal encodings of Turing machines, we can obtain a list of all Turing machines. • The set of all infinite binary sequences, B, is uncountable.

B is an unending sequence of 0s and 1s.

The Halting Problem

Undecidable Problems From Language Theory

Some languages are not Turing-recognizable. • Σ∗ is countable, for any alphabet Σ. • With only finitely many strings of each length, we may form a list of Σ∗ by writing down all strings of length 0, length 1, length 2, and so on. • The set of all Turing machines is countable. • Each Turing machine has an encoding into a string < M >.

Simply omit those strings that are not legal encodings of Turing machines, we can obtain a list of all Turing machines. • The set of all infinite binary sequences, B, is uncountable.

B is an unending sequence of 0s and 1s. • The set of all languages over alphabet Σ, L, is uncountable. • We show that there is a correspondence between L and B.

The Halting Problem

Undecidable Problems From Language Theory

Some languages are not Turing-recognizable. • Σ∗ is countable, for any alphabet Σ. • With only finitely many strings of each length, we may form a list of Σ∗ by writing down all strings of length 0, length 1, length 2, and so on. • The set of all Turing machines is countable. • Each Turing machine has an encoding into a string < M >.

Simply omit those strings that are not legal encodings of Turing machines, we can obtain a list of all Turing machines. • The set of all infinite binary sequences, B, is uncountable.

B is an unending sequence of 0s and 1s. • The set of all languages over alphabet Σ, L, is uncountable. • We show that there is a correspondence between L and B.

Σ∗ = { ε, A ={ χA = 0

0, 0, 1

1, 0

00, 00, 1

01, 01, 1

10,

11 ,

0

0

000, 000, 1

001, 001, 1

···} ; ···} ; ···

The Halting Problem

Undecidable Problems From Language Theory

• There are uncountably many languages. • Only countably many Turing machines. • Each Turing machine can recognize a single language. • There are more languages than Turing machines. • Some languages are not recognized by any Turing machine.

The Halting Problem

Undecidable Problems From Language Theory

A Turing-Unrecognizable Language

The Halting Problem

Undecidable Problems From Language Theory

A Turing-Unrecognizable Language

Theorem A language is decidable iff it is Turing-recognizable and co-Turing-recognizable.

The Halting Problem

Undecidable Problems From Language Theory

A Turing-Unrecognizable Language

Theorem A language is decidable iff it is Turing-recognizable and co-Turing-recognizable. That is, a language is decidable exactly when both it and its complement are Turing-recognizable.

The Halting Problem

Undecidable Problems From Language Theory

A Turing-Unrecognizable Language

Theorem A language is decidable iff it is Turing-recognizable and co-Turing-recognizable. That is, a language is decidable exactly when both it and its complement are Turing-recognizable. Proof: If A is decidable, then it is easy to show that the complement A is also decidable. Then A is Turing-recognizable and co-Turing-recognizable.

The Halting Problem

Undecidable Problems From Language Theory

A Turing-Unrecognizable Language

Theorem A language is decidable iff it is Turing-recognizable and co-Turing-recognizable. That is, a language is decidable exactly when both it and its complement are Turing-recognizable. Proof: If A is decidable, then it is easy to show that the complement A is also decidable. Then A is Turing-recognizable and co-Turing-recognizable. If both A and A are Turing-recognizable, we let M1 and M2 be recognizers for A and A respectively.

The Halting Problem

Undecidable Problems From Language Theory

A Turing-Unrecognizable Language

Theorem A language is decidable iff it is Turing-recognizable and co-Turing-recognizable. That is, a language is decidable exactly when both it and its complement are Turing-recognizable. Proof: If A is decidable, then it is easy to show that the complement A is also decidable. Then A is Turing-recognizable and co-Turing-recognizable. If both A and A are Turing-recognizable, we let M1 and M2 be recognizers for A and A respectively. The following machine M is a decider for A. M = â&#x20AC;&#x153;On input w: 1. Run both M1 and M2 on input w in parallel. 2. If M1 accepts, accept; if M2 accepts, reject.â&#x20AC;?

The Halting Problem

Undecidable Problems From Language Theory

A Turing-Unrecognizable Language

Corollary AT M is not Turing-recognizable.

The Halting Problem

Undecidable Problems From Language Theory

â&#x20AC;˘ We had established the Turing machine as our model of a general

purpose computer.

The Halting Problem

Undecidable Problems From Language Theory

â&#x20AC;˘ We had established the Turing machine as our model of a general

purpose computer. â&#x20AC;˘ We had several examples of problems that are solvable on a

Turing machine.

The Halting Problem

Undecidable Problems From Language Theory

• We had established the Turing machine as our model of a general

purpose computer. • We had several examples of problems that are solvable on a

Turing machine. • We also had an example of a problem, AT M , that is

computationally unsolvable.

The Halting Problem

Undecidable Problems From Language Theory

• We had established the Turing machine as our model of a general

purpose computer. • We had several examples of problems that are solvable on a

Turing machine. • We also had an example of a problem, AT M , that is

computationally unsolvable. • More unsolvable problems?

The Halting Problem

Undecidable Problems From Language Theory

• We had established the Turing machine as our model of a general

purpose computer. • We had several examples of problems that are solvable on a

Turing machine. • We also had an example of a problem, AT M , that is

computationally unsolvable. • More unsolvable problems? • primary method for proving that problems are computationally

unsolvable

The Halting Problem

Undecidable Problems From Language Theory

• We had established the Turing machine as our model of a general

purpose computer. • We had several examples of problems that are solvable on a

Turing machine. • We also had an example of a problem, AT M , that is

computationally unsolvable. • More unsolvable problems? • primary method for proving that problems are computationally

unsolvable ———— reducibility

The Halting Problem

Undecidable Problems From Language Theory

Reduction A reduction is a way of converting one problem to another problem in such a way that a solution to the second problem can be used to solve the first problem.

The Halting Problem

Undecidable Problems From Language Theory

Reduction A reduction is a way of converting one problem to another problem in such a way that a solution to the second problem can be used to solve the first problem. Reducibility always involves two problems, say A and B. If A reduces to B, we can use a solution to B to solve A.

The Halting Problem

Undecidable Problems From Language Theory

Reduction A reduction is a way of converting one problem to another problem in such a way that a solution to the second problem can be used to solve the first problem. Reducibility always involves two problems, say A and B. If A reduces to B, we can use a solution to B to solve A. That is, when A is reducible to B, solving A cannot be harder than solving B because a solution to B gives a solution to A.

The Halting Problem

Undecidable Problems From Language Theory

Reduction A reduction is a way of converting one problem to another problem in such a way that a solution to the second problem can be used to solve the first problem. Reducibility always involves two problems, say A and B. If A reduces to B, we can use a solution to B to solve A. That is, when A is reducible to B, solving A cannot be harder than solving B because a solution to B gives a solution to A. If A is reducible to B and B is decidable,

The Halting Problem

Undecidable Problems From Language Theory

Reduction A reduction is a way of converting one problem to another problem in such a way that a solution to the second problem can be used to solve the first problem. Reducibility always involves two problems, say A and B. If A reduces to B, we can use a solution to B to solve A. That is, when A is reducible to B, solving A cannot be harder than solving B because a solution to B gives a solution to A. If A is reducible to B and B is decidable, A is also decidable.

The Halting Problem

Undecidable Problems From Language Theory

Reduction A reduction is a way of converting one problem to another problem in such a way that a solution to the second problem can be used to solve the first problem. Reducibility always involves two problems, say A and B. If A reduces to B, we can use a solution to B to solve A. That is, when A is reducible to B, solving A cannot be harder than solving B because a solution to B gives a solution to A. If A is reducible to B and B is decidable, A is also decidable. If A is reducible to B and A is undecidable,

The Halting Problem

Undecidable Problems From Language Theory

Reduction A reduction is a way of converting one problem to another problem in such a way that a solution to the second problem can be used to solve the first problem. Reducibility always involves two problems, say A and B. If A reduces to B, we can use a solution to B to solve A. That is, when A is reducible to B, solving A cannot be harder than solving B because a solution to B gives a solution to A. If A is reducible to B and B is decidable, A is also decidable. If A is reducible to B and A is undecidable, B is undecidable.

The Halting Problem

Undecidable Problems From Language Theory

HALTT M = {< M, w > | M is a TM and M halts on input w}

The Halting Problem

Undecidable Problems From Language Theory

HALTT M = {< M, w > | M is a TM and M halts on input w}

Theorem HALTT M is undecidable.

The Halting Problem

Undecidable Problems From Language Theory

HALTT M = {< M, w > | M is a TM and M halts on input w}

Theorem HALTT M is undecidable. â&#x20AC;˘ Assume HALTT M is decidable and obtain a contradiction.

The Halting Problem

Undecidable Problems From Language Theory

HALTT M = {< M, w > | M is a TM and M halts on input w}

Theorem HALTT M is undecidable. • Assume HALTT M is decidable and obtain a contradiction. • Suppose that R is a decider for HALTT M .

The Halting Problem

Undecidable Problems From Language Theory

HALTT M = {< M, w > | M is a TM and M halts on input w}

Theorem HALTT M is undecidable. • Assume HALTT M is decidable and obtain a contradiction. • Suppose that R is a decider for HALTT M .

We construct TM S to decide AT M as follows: S = “On input < M, w >, an encoding of a TM M and a string w: 1. 2. 3. 4.

Run R on input < M, w >. If R rejects, reject. If R accepts, simulate M on w until it halts. If M has accepted, accept; if M has rejected, reject.”

The Halting Problem

Undecidable Problems From Language Theory

HALTT M = {< M, w > | M is a TM and M halts on input w}

Theorem HALTT M is undecidable. • Assume HALTT M is decidable and obtain a contradiction. • Suppose that R is a decider for HALTT M .

We construct TM S to decide AT M as follows: S = “On input < M, w >, an encoding of a TM M and a string w: 1. 2. 3. 4.

Run R on input < M, w >. If R rejects, reject. If R accepts, simulate M on w until it halts. If M has accepted, accept; if M has rejected, reject.”

• Clearly, if R decides HALTT M , then S decides AT M .

The Halting Problem

Undecidable Problems From Language Theory

HALTT M = {< M, w > | M is a TM and M halts on input w}

Theorem HALTT M is undecidable. • Assume HALTT M is decidable and obtain a contradiction. • Suppose that R is a decider for HALTT M .

We construct TM S to decide AT M as follows: S = “On input < M, w >, an encoding of a TM M and a string w: 1. 2. 3. 4.

Run R on input < M, w >. If R rejects, reject. If R accepts, simulate M on w until it halts. If M has accepted, accept; if M has rejected, reject.”

• Clearly, if R decides HALTT M , then S decides AT M . • Because AT M is undecidable, HALTT M also must be undecidable

The Halting Problem

Undecidable Problems From Language Theory

ET M = {< M > | M is a TM and L(M ) = â&#x2C6;&#x2026;}

The Halting Problem

Undecidable Problems From Language Theory

ET M = {< M > | M is a TM and L(M ) = â&#x2C6;&#x2026;}

Theorem ET M is undecidable.

The Halting Problem

Undecidable Problems From Language Theory

ET M = {< M > | M is a TM and L(M ) = â&#x2C6;&#x2026;}

Theorem ET M is undecidable. â&#x20AC;˘ Assume ET M is decidable and obtain a contradiction.

The Halting Problem

Undecidable Problems From Language Theory

ET M = {< M > | M is a TM and L(M ) = ∅}

Theorem ET M is undecidable. • Assume ET M is decidable and obtain a contradiction. • Suppose that R is a decider for ET M .

The Halting Problem

Undecidable Problems From Language Theory

ET M = {< M > | M is a TM and L(M ) = ∅}

Theorem ET M is undecidable. • Assume ET M is decidable and obtain a contradiction. • Suppose that R is a decider for ET M . • Instead of running R on < M > we run R on a modification of < M >. We modify < M > to guarantee that M rejects all strings except w, but on input w it works as usual.

The Halting Problem

Undecidable Problems From Language Theory

ET M = {< M > | M is a TM and L(M ) = ∅}

Theorem ET M is undecidable. • Assume ET M is decidable and obtain a contradiction. • Suppose that R is a decider for ET M . • Instead of running R on < M > we run R on a modification of < M >. We modify < M > to guarantee that M rejects all strings except w, but on input w it works as usual. That is, M1 = “On input x: 1. If x 6= w, reject. 2. If x = w, run M on w and accept if M does.”

The Halting Problem

Undecidable Problems From Language Theory

ET M = {< M > | M is a TM and L(M ) = ∅}

Theorem ET M is undecidable. • Assume ET M is decidable and obtain a contradiction. • Suppose that R is a decider for ET M . • Instead of running R on < M > we run R on a modification of < M >. We modify < M > to guarantee that M rejects all strings except w, but on input w it works as usual. That is, M1 = “On input x: 1. If x 6= w, reject. 2. If x = w, run M on w and accept if M does.” • We construct TM S to decide AT M as follows: S = “On input < M, w >, an encoding of a TM M and a string w: 1. Use the description of M and w to construct the TM M1 2. Run R on input < M1 >. 3. If R accepts, reject; if R rejects, accept.”

The Halting Problem

Undecidable Problems From Language Theory

ET M = {< M > | M is a TM and L(M ) = ∅}

Theorem ET M is undecidable. • Assume ET M is decidable and obtain a contradiction. • Suppose that R is a decider for ET M . • Instead of running R on < M > we run R on a modification of < M >. We modify < M > to guarantee that M rejects all strings except w, but on input w it works as usual. That is, M1 = “On input x: 1. If x 6= w, reject. 2. If x = w, run M on w and accept if M does.” • We construct TM S to decide AT M as follows: S = “On input < M, w >, an encoding of a TM M and a string w: 1. Use the description of M and w to construct the TM M1 2. Run R on input < M1 >. 3. If R accepts, reject; if R rejects, accept.” • If R were a decider for ET M , then S would be a decider for AT M .

The Halting Problem

Undecidable Problems From Language Theory

ET M = {< M > | M is a TM and L(M ) = ∅}

Theorem ET M is undecidable. • Assume ET M is decidable and obtain a contradiction. • Suppose that R is a decider for ET M . • Instead of running R on < M > we run R on a modification of < M >. We modify < M > to guarantee that M rejects all strings except w, but on input w it works as usual. That is, M1 = “On input x: 1. If x 6= w, reject. 2. If x = w, run M on w and accept if M does.” • We construct TM S to decide AT M as follows: S = “On input < M, w >, an encoding of a TM M and a string w: 1. Use the description of M and w to construct the TM M1 2. Run R on input < M1 >. 3. If R accepts, reject; if R rejects, accept.” • If R were a decider for ET M , then S would be a decider for AT M . • A decider for AT M cannot exist, so ET M must be undecidable.

The Halting Problem

Undecidable Problems From Language Theory

Let REGU LART M be the problem of determining whether a given Turing machine has an equivalent finite automaton.

The Halting Problem

Undecidable Problems From Language Theory

Let REGU LART M be the problem of determining whether a given Turing machine has an equivalent finite automaton. REGU LART M = {< M > | M is a TM and L(M ) is a regular language}

The Halting Problem

Undecidable Problems From Language Theory

Let REGU LART M be the problem of determining whether a given Turing machine has an equivalent finite automaton. REGU LART M = {< M > | M is a TM and L(M ) is a regular language}

Theorem REGU LART M is undecidable.

The Halting Problem

Undecidable Problems From Language Theory

Let REGU LART M be the problem of determining whether a given Turing machine has an equivalent finite automaton. REGU LART M = {< M > | M is a TM and L(M ) is a regular language}

Theorem REGU LART M is undecidable. â&#x20AC;˘ Assume REGU LART M is decidable and obtain a contradiction.

The Halting Problem

Undecidable Problems From Language Theory

Let REGU LART M be the problem of determining whether a given Turing machine has an equivalent finite automaton. REGU LART M = {< M > | M is a TM and L(M ) is a regular language}

Theorem REGU LART M is undecidable. â&#x20AC;˘ Assume REGU LART M is decidable and obtain a contradiction. â&#x20AC;˘ Let R be a decider for REGU LART M .

The Halting Problem

Undecidable Problems From Language Theory

Let REGU LART M be the problem of determining whether a given Turing machine has an equivalent finite automaton. REGU LART M = {< M > | M is a TM and L(M ) is a regular language}

Theorem REGU LART M is undecidable. • Assume REGU LART M is decidable and obtain a contradiction. • Let R be a decider for REGU LART M . We construct TM S to decide AT M as follows: S = “On input < M, w >, where M is a TM and w is a string: 1. Construct TM M2 . M2 = “On input x: 1.1 If x has the form 0n 1n , accept. 1.2 If x does not have this form, run M on input w and accepts if M accepts w.”

The Halting Problem

Undecidable Problems From Language Theory

Let REGU LART M be the problem of determining whether a given Turing machine has an equivalent finite automaton. REGU LART M = {< M > | M is a TM and L(M ) is a regular language}

Theorem REGU LART M is undecidable. • Assume REGU LART M is decidable and obtain a contradiction. • Let R be a decider for REGU LART M . We construct TM S to decide AT M as follows: S = “On input < M, w >, where M is a TM and w is a string: 1. Construct TM M2 . M2 = “On input x: 1.1 If x has the form 0n 1n , accept. 1.2 If x does not have this form, run M on input w and accepts if M accepts w.” We design M2 to recognize the nonregular language {0n 1n |n ≥ 0} if M does not accept w, and to recognize the regular language Σ∗ if M accepts w.

The Halting Problem

Undecidable Problems From Language Theory

Let REGU LART M be the problem of determining whether a given Turing machine has an equivalent finite automaton. REGU LART M = {< M > | M is a TM and L(M ) is a regular language}

Theorem REGU LART M is undecidable. • Assume REGU LART M is decidable and obtain a contradiction. • Let R be a decider for REGU LART M . We construct TM S to decide AT M as follows: S = “On input < M, w >, where M is a TM and w is a string: 1. Construct TM M2 . M2 = “On input x: 1.1 If x has the form 0n 1n , accept. 1.2 If x does not have this form, run M on input w and accepts if M accepts w.” We design M2 to recognize the nonregular language {0n 1n |n ≥ 0} if M does not accept w, and to recognize the regular language Σ∗ if M accepts w.

2. Run R on input < M2 >. 3. If R accept, accept; if R rejects, reject.”

The Halting Problem

Undecidable Problems From Language Theory

Let REGU LART M be the problem of determining whether a given Turing machine has an equivalent finite automaton. REGU LART M = {< M > | M is a TM and L(M ) is a regular language}

Theorem REGU LART M is undecidable. • Assume REGU LART M is decidable and obtain a contradiction. • Let R be a decider for REGU LART M . We construct TM S to decide AT M as follows: S = “On input < M, w >, where M is a TM and w is a string: 1. Construct TM M2 . M2 = “On input x: 1.1 If x has the form 0n 1n , accept. 1.2 If x does not have this form, run M on input w and accepts if M accepts w.” We design M2 to recognize the nonregular language {0n 1n |n ≥ 0} if M does not accept w, and to recognize the regular language Σ∗ if M accepts w.

2. Run R on input < M2 >. 3. If R accept, accept; if R rejects, reject.” • Clearly, if R decides REGU LART M , then S decides AT M .

The Halting Problem

Undecidable Problems From Language Theory

Let REGU LART M be the problem of determining whether a given Turing machine has an equivalent finite automaton. REGU LART M = {< M > | M is a TM and L(M ) is a regular language}

Theorem REGU LART M is undecidable. • Assume REGU LART M is decidable and obtain a contradiction. • Let R be a decider for REGU LART M . We construct TM S to decide AT M as follows: S = “On input < M, w >, where M is a TM and w is a string: 1. Construct TM M2 . M2 = “On input x: 1.1 If x has the form 0n 1n , accept. 1.2 If x does not have this form, run M on input w and accepts if M accepts w.” We design M2 to recognize the nonregular language {0n 1n |n ≥ 0} if M does not accept w, and to recognize the regular language Σ∗ if M accepts w.

2. Run R on input < M2 >. 3. If R accept, accept; if R rejects, reject.” • Clearly, if R decides REGU LART M , then S decides AT M . • Because AT M is undecidable, REGU LART M also must be undecidable

The Halting Problem

Undecidable Problems From Language Theory

EQT M = {< M1 , M2 > | M1 and M2 are TMs and L(M1 ) = L(M2 )}

The Halting Problem

Undecidable Problems From Language Theory

EQT M = {< M1 , M2 > | M1 and M2 are TMs and L(M1 ) = L(M2 )}

Theorem EQT M is undecidable.

The Halting Problem

Undecidable Problems From Language Theory

EQT M = {< M1 , M2 > | M1 and M2 are TMs and L(M1 ) = L(M2 )}

Theorem EQT M is undecidable. â&#x20AC;˘ Suppose that R is a decider for EQT M .

We construct TM S to decide ET M as follows: S = â&#x20AC;&#x153;On input < M >, where M is a TM: 1. Run R on input < M, M1 >, where M1 is a TM that rejects all inputs. 2. If R accepts, accept; if R rejects, reject.

The Halting Problem

Undecidable Problems From Language Theory

EQT M = {< M1 , M2 > | M1 and M2 are TMs and L(M1 ) = L(M2 )}

Theorem EQT M is undecidable. • Suppose that R is a decider for EQT M .

We construct TM S to decide ET M as follows: S = “On input < M >, where M is a TM: 1. Run R on input < M, M1 >, where M1 is a TM that rejects all inputs. 2. If R accepts, accept; if R rejects, reject. • If R decides EQT M , then S decides ET M .

The Halting Problem

Undecidable Problems From Language Theory

EQT M = {< M1 , M2 > | M1 and M2 are TMs and L(M1 ) = L(M2 )}

Theorem EQT M is undecidable. • Suppose that R is a decider for EQT M .

We construct TM S to decide ET M as follows: S = “On input < M >, where M is a TM: 1. Run R on input < M, M1 >, where M1 is a TM that rejects all inputs. 2. If R accepts, accept; if R rejects, reject. • If R decides EQT M , then S decides ET M . • But ET M is undecidable, so EQT M also must be undecidable

The Halting Problem

Undecidable Problems From Language Theory

Questions? See you next meeting!

Cs133 lec11
Read more
Read more
Similar to
Popular now
Just for you