Anda di halaman 1dari 178

# F ORMAL L ANGUAGES , AUTOMATA AND

C OMPUTATION
P OST C ORRESPONDENCE P ROBLEM

## ( Lecture 17) Slides for 15-453 Spring 2011 1 / 28

R EVIEW OF D ECIDABILITY AND R EDUCTIONS

## ( Lecture 17) Slides for 15-453 Spring 2011 2 / 28

R EDUCIBILITY
A reduction is a way of converting one problem to another problem, so
that the solution to the second problem can be used to solve the first
problem.

## ( Lecture 17) Slides for 15-453 Spring 2011 3 / 28

R EDUCIBILITY
A reduction is a way of converting one problem to another problem, so
that the solution to the second problem can be used to solve the first
problem.
Finding the area of a rectangle, reduces to measuring its width and height

## ( Lecture 17) Slides for 15-453 Spring 2011 3 / 28

R EDUCIBILITY
A reduction is a way of converting one problem to another problem, so
that the solution to the second problem can be used to solve the first
problem.
Finding the area of a rectangle, reduces to measuring its width and height
Solving a set of linear equations, reduces to inverting a matrix.

## ( Lecture 17) Slides for 15-453 Spring 2011 3 / 28

R EDUCIBILITY
A reduction is a way of converting one problem to another problem, so
that the solution to the second problem can be used to solve the first
problem.
Finding the area of a rectangle, reduces to measuring its width and height
Solving a set of linear equations, reduces to inverting a matrix.
Reducibility involves two problems A and B.

## ( Lecture 17) Slides for 15-453 Spring 2011 3 / 28

R EDUCIBILITY
A reduction is a way of converting one problem to another problem, so
that the solution to the second problem can be used to solve the first
problem.
Finding the area of a rectangle, reduces to measuring its width and height
Solving a set of linear equations, reduces to inverting a matrix.
Reducibility involves two problems A and B.
If A reduces to B, you can use a solution to B to solve A

## ( Lecture 17) Slides for 15-453 Spring 2011 3 / 28

R EDUCIBILITY
A reduction is a way of converting one problem to another problem, so
that the solution to the second problem can be used to solve the first
problem.
Finding the area of a rectangle, reduces to measuring its width and height
Solving a set of linear equations, reduces to inverting a matrix.
Reducibility involves two problems A and B.
If A reduces to B, you can use a solution to B to solve A
When A is reducible to B, solving A can not be harder than solving B.

## ( Lecture 17) Slides for 15-453 Spring 2011 3 / 28

R EDUCIBILITY
A reduction is a way of converting one problem to another problem, so
that the solution to the second problem can be used to solve the first
problem.
Finding the area of a rectangle, reduces to measuring its width and height
Solving a set of linear equations, reduces to inverting a matrix.
Reducibility involves two problems A and B.
If A reduces to B, you can use a solution to B to solve A
When A is reducible to B, solving A can not be harder than solving B.
If A is reducible to B and B is decidable, then A is also decidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 3 / 28

R EDUCIBILITY
A reduction is a way of converting one problem to another problem, so
that the solution to the second problem can be used to solve the first
problem.
Finding the area of a rectangle, reduces to measuring its width and height
Solving a set of linear equations, reduces to inverting a matrix.
Reducibility involves two problems A and B.
If A reduces to B, you can use a solution to B to solve A
When A is reducible to B, solving A can not be harder than solving B.
If A is reducible to B and B is decidable, then A is also decidable.
If A is undecidable and reducible to B, then B is undecidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 3 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 4 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 4 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

## Suppose R decides ETM . We try to construct S to decide ATM using R.

Note that S takes hM, wi as input.

## ( Lecture 17) Slides for 15-453 Spring 2011 4 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

## Suppose R decides ETM . We try to construct S to decide ATM using R.

Note that S takes hM, wi as input.
One idea is to run R on hMi to check if M accepts some string or not
but that that does not tell us if M accepts w.

## ( Lecture 17) Slides for 15-453 Spring 2011 4 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

## Suppose R decides ETM . We try to construct S to decide ATM using R.

Note that S takes hM, wi as input.
One idea is to run R on hMi to check if M accepts some string or not
but that that does not tell us if M accepts w.
Instead we modify M to M1 . M1 rejects all strings other than w but on w,
it does what M does.

## ( Lecture 17) Slides for 15-453 Spring 2011 4 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

## Suppose R decides ETM . We try to construct S to decide ATM using R.

Note that S takes hM, wi as input.
One idea is to run R on hMi to check if M accepts some string or not
but that that does not tell us if M accepts w.
Instead we modify M to M1 . M1 rejects all strings other than w but on w,
it does what M does.
Now we can check if L(M1 ) = .

## ( Lecture 17) Slides for 15-453 Spring 2011 4 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 5 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

P ROOF

## ( Lecture 17) Slides for 15-453 Spring 2011 5 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

P ROOF
For any w define M1 as
M1 = On input x:

## ( Lecture 17) Slides for 15-453 Spring 2011 5 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

P ROOF
For any w define M1 as
M1 = On input x:
1 If x 6= w, reject.

## ( Lecture 17) Slides for 15-453 Spring 2011 5 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

P ROOF
For any w define M1 as
M1 = On input x:
1 6 w, reject.
If x =
2 If x = w, run M on input w and accept if M does.

## ( Lecture 17) Slides for 15-453 Spring 2011 5 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

T HEOREM 5.2
ETM = {hMi | M is a TM and L(M) = } is undecidable.

P ROOF
For any w define M1 as
M1 = On input x:
1 6 w, reject.
If x =
2 If x = w, run M on input w and accept if M does.
Note that M1 either accepts w only or nothing!

## ( Lecture 17) Slides for 15-453 Spring 2011 5 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

P ROOF CONTINUED

## ( Lecture 17) Slides for 15-453 Spring 2011 6 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

P ROOF CONTINUED
Assume R decides ETM

## ( Lecture 17) Slides for 15-453 Spring 2011 6 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

P ROOF CONTINUED
Assume R decides ETM
S defines below uses R to decide on ATM
S = On input hM, wi

## ( Lecture 17) Slides for 15-453 Spring 2011 6 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

P ROOF CONTINUED
Assume R decides ETM
S defines below uses R to decide on ATM
S = On input hM, wi
1 Use hM, wi to construct M1 above.

## ( Lecture 17) Slides for 15-453 Spring 2011 6 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

P ROOF CONTINUED
Assume R decides ETM
S defines below uses R to decide on ATM
S = On input hM, wi
1 Use hM, wi to construct M1 above.
2 Run R on input hM1 i

## ( Lecture 17) Slides for 15-453 Spring 2011 6 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

P ROOF CONTINUED
Assume R decides ETM
S defines below uses R to decide on ATM
S = On input hM, wi
1 Use hM, wi to construct M1 above.
2 Run R on input hM1 i
3 If R accepts, reject, if R rejects, accept.

## ( Lecture 17) Slides for 15-453 Spring 2011 6 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

P ROOF CONTINUED
Assume R decides ETM
S defines below uses R to decide on ATM
S = On input hM, wi
1 Use hM, wi to construct M1 above.
2 Run R on input hM1 i
3 If R accepts, reject, if R rejects, accept.
So, if R decides L(M1 ) is empty,

## ( Lecture 17) Slides for 15-453 Spring 2011 6 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

P ROOF CONTINUED
Assume R decides ETM
S defines below uses R to decide on ATM
S = On input hM, wi
1 Use hM, wi to construct M1 above.
2 Run R on input hM1 i
3 If R accepts, reject, if R rejects, accept.
So, if R decides L(M1 ) is empty,
then M does NOT accept w,

## ( Lecture 17) Slides for 15-453 Spring 2011 6 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

P ROOF CONTINUED
Assume R decides ETM
S defines below uses R to decide on ATM
S = On input hM, wi
1 Use hM, wi to construct M1 above.
2 Run R on input hM1 i
3 If R accepts, reject, if R rejects, accept.
So, if R decides L(M1 ) is empty,
then M does NOT accept w,
else M accepts w.

## ( Lecture 17) Slides for 15-453 Spring 2011 6 / 28

P ROVING U NDECIDABILITY VIA R EDUCTIONS

P ROOF CONTINUED
Assume R decides ETM
S defines below uses R to decide on ATM
S = On input hM, wi
1 Use hM, wi to construct M1 above.
2 Run R on input hM1 i
3 If R accepts, reject, if R rejects, accept.
So, if R decides L(M1 ) is empty,
then M does NOT accept w,
else M accepts w.
If R decides ETM then S decides ATM Contradiction.

## ( Lecture 17) Slides for 15-453 Spring 2011 6 / 28

R EDUCTIONS VIA C OMPUTATION H ISTORIES
An accepting computation history for a TM is a sequence of
configurations
C1 , C2 , . . . , Cl
such that

## ( Lecture 17) Slides for 15-453 Spring 2011 7 / 28

R EDUCTIONS VIA C OMPUTATION H ISTORIES
An accepting computation history for a TM is a sequence of
configurations
C1 , C2 , . . . , Cl
such that
C1 is the start configuration for input w

## ( Lecture 17) Slides for 15-453 Spring 2011 7 / 28

R EDUCTIONS VIA C OMPUTATION H ISTORIES
An accepting computation history for a TM is a sequence of
configurations
C1 , C2 , . . . , Cl
such that
C1 is the start configuration for input w
Cl is an accepting configuration, and

## ( Lecture 17) Slides for 15-453 Spring 2011 7 / 28

R EDUCTIONS VIA C OMPUTATION H ISTORIES
An accepting computation history for a TM is a sequence of
configurations
C1 , C2 , . . . , Cl
such that
C1 is the start configuration for input w
Cl is an accepting configuration, and
each Ci follows legally from the preceding configuration.

## ( Lecture 17) Slides for 15-453 Spring 2011 7 / 28

R EDUCTIONS VIA C OMPUTATION H ISTORIES
An accepting computation history for a TM is a sequence of
configurations
C1 , C2 , . . . , Cl
such that
C1 is the start configuration for input w
Cl is an accepting configuration, and
each Ci follows legally from the preceding configuration.
A rejecting computation history is defined similarly.

## ( Lecture 17) Slides for 15-453 Spring 2011 7 / 28

R EDUCTIONS VIA C OMPUTATION H ISTORIES
An accepting computation history for a TM is a sequence of
configurations
C1 , C2 , . . . , Cl
such that
C1 is the start configuration for input w
Cl is an accepting configuration, and
each Ci follows legally from the preceding configuration.
A rejecting computation history is defined similarly.
Computation histories are finite sequences if M does not halt on M,
there is no computation history.

## ( Lecture 17) Slides for 15-453 Spring 2011 7 / 28

R EDUCTIONS VIA C OMPUTATION H ISTORIES
An accepting computation history for a TM is a sequence of
configurations
C1 , C2 , . . . , Cl
such that
C1 is the start configuration for input w
Cl is an accepting configuration, and
each Ci follows legally from the preceding configuration.
A rejecting computation history is defined similarly.
Computation histories are finite sequences if M does not halt on M,
there is no computation history.
Deterministic v.s nondeterministic computation histories.

## ( Lecture 17) Slides for 15-453 Spring 2011 7 / 28

L INEAR B OUNDED AUTOMATON
Suppose we cripple a TM so that the head never moves outside the
boundaries of the input string.

## ( Lecture 17) Slides for 15-453 Spring 2011 8 / 28

L INEAR B OUNDED AUTOMATON
Suppose we cripple a TM so that the head never moves outside the
boundaries of the input string.
Such a TM is called a linear bounded automaton (LBA)

## ( Lecture 17) Slides for 15-453 Spring 2011 8 / 28

L INEAR B OUNDED AUTOMATON
Suppose we cripple a TM so that the head never moves outside the
boundaries of the input string.
Such a TM is called a linear bounded automaton (LBA)
Despite their memory limitation, LBAs are quite powerful.

## ( Lecture 17) Slides for 15-453 Spring 2011 8 / 28

L INEAR B OUNDED AUTOMATON
Suppose we cripple a TM so that the head never moves outside the
boundaries of the input string.
Such a TM is called a linear bounded automaton (LBA)
Despite their memory limitation, LBAs are quite powerful.

L EMMA
Let M be a LBA with q states, g symbols in the tape alphabet. There are
exactly qng n distinct configurations for a tape of length n.

## ( Lecture 17) Slides for 15-453 Spring 2011 8 / 28

L INEAR B OUNDED AUTOMATON
Suppose we cripple a TM so that the head never moves outside the
boundaries of the input string.
Such a TM is called a linear bounded automaton (LBA)
Despite their memory limitation, LBAs are quite powerful.

L EMMA
Let M be a LBA with q states, g symbols in the tape alphabet. There are
exactly qng n distinct configurations for a tape of length n.

P ROOF .

## ( Lecture 17) Slides for 15-453 Spring 2011 8 / 28

L INEAR B OUNDED AUTOMATON
Suppose we cripple a TM so that the head never moves outside the
boundaries of the input string.
Such a TM is called a linear bounded automaton (LBA)
Despite their memory limitation, LBAs are quite powerful.

L EMMA
Let M be a LBA with q states, g symbols in the tape alphabet. There are
exactly qng n distinct configurations for a tape of length n.

P ROOF .
The machine can be in one of q states.

## ( Lecture 17) Slides for 15-453 Spring 2011 8 / 28

L INEAR B OUNDED AUTOMATON
Suppose we cripple a TM so that the head never moves outside the
boundaries of the input string.
Such a TM is called a linear bounded automaton (LBA)
Despite their memory limitation, LBAs are quite powerful.

L EMMA
Let M be a LBA with q states, g symbols in the tape alphabet. There are
exactly qng n distinct configurations for a tape of length n.

P ROOF .
The machine can be in one of q states.
The head can be on one of the n cells.

## ( Lecture 17) Slides for 15-453 Spring 2011 8 / 28

L INEAR B OUNDED AUTOMATON
Suppose we cripple a TM so that the head never moves outside the
boundaries of the input string.
Such a TM is called a linear bounded automaton (LBA)
Despite their memory limitation, LBAs are quite powerful.

L EMMA
Let M be a LBA with q states, g symbols in the tape alphabet. There are
exactly qng n distinct configurations for a tape of length n.

P ROOF .
The machine can be in one of q states.
The head can be on one of the n cells.
At most g n distinct strings can occur on the tape.

## ( Lecture 17) Slides for 15-453 Spring 2011 8 / 28

L INEAR B OUNDED AUTOMATON
Suppose we cripple a TM so that the head never moves outside the
boundaries of the input string.
Such a TM is called a linear bounded automaton (LBA)
Despite their memory limitation, LBAs are quite powerful.

L EMMA
Let M be a LBA with q states, g symbols in the tape alphabet. There are
exactly qng n distinct configurations for a tape of length n.

P ROOF .
The machine can be in one of q states.
The head can be on one of the n cells.
At most g n distinct strings can occur on the tape.

T HEOREM 5.9
ALBA = {hM, wi | M is an LBA that accepts string w} is decidable.
( Lecture 17) Slides for 15-453 Spring 2011 8 / 28
C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!
Consider an accepting computation history of a TM M, C1 , C2 , . . . , Cl

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!
Consider an accepting computation history of a TM M, C1 , C2 , . . . , Cl
Note that each Ci is a string.

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!
Consider an accepting computation history of a TM M, C1 , C2 , . . . , Cl
Note that each Ci is a string.
Consider the string

C1 C2 C3 Cl

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!
Consider an accepting computation history of a TM M, C1 , C2 , . . . , Cl
Note that each Ci is a string.
Consider the string

C1 C2 C3 Cl

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!
Consider an accepting computation history of a TM M, C1 , C2 , . . . , Cl
Note that each Ci is a string.
Consider the string

C1 C2 C3 Cl

## The set of all valid accepting histories is also a language!!

This string has length m and an LBA B can check if this is a valid
computation history for a TM M accepting w.

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!
Consider an accepting computation history of a TM M, C1 , C2 , . . . , Cl
Note that each Ci is a string.
Consider the string

C1 C2 C3 Cl

## The set of all valid accepting histories is also a language!!

This string has length m and an LBA B can check if this is a valid
computation history for a TM M accepting w.
Check if C1 = q0 w1 w2 wn

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!
Consider an accepting computation history of a TM M, C1 , C2 , . . . , Cl
Note that each Ci is a string.
Consider the string

C1 C2 C3 Cl

## The set of all valid accepting histories is also a language!!

This string has length m and an LBA B can check if this is a valid
computation history for a TM M accepting w.
Check if C1 = q0 w1 w2 wn
Check if Cl = qaccept

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!
Consider an accepting computation history of a TM M, C1 , C2 , . . . , Cl
Note that each Ci is a string.
Consider the string

C1 C2 C3 Cl

## The set of all valid accepting histories is also a language!!

This string has length m and an LBA B can check if this is a valid
computation history for a TM M accepting w.
Check if C1 = q0 w1 w2 wn
Check if Cl = qaccept
Check if each Ci+1 follows from Ci legally.

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!
Consider an accepting computation history of a TM M, C1 , C2 , . . . , Cl
Note that each Ci is a string.
Consider the string

C1 C2 C3 Cl

## The set of all valid accepting histories is also a language!!

This string has length m and an LBA B can check if this is a valid
computation history for a TM M accepting w.
Check if C1 = q0 w1 w2 wn
Check if Cl = qaccept
Check if each Ci+1 follows from Ci legally.
Note that B is not constructed for the purpose of running it on any input!

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

C OMPUTATION OVER C OMPUTATION H ISTORIES
Now for a really wild and crazy idea!
Consider an accepting computation history of a TM M, C1 , C2 , . . . , Cl
Note that each Ci is a string.
Consider the string

C1 C2 C3 Cl

## The set of all valid accepting histories is also a language!!

This string has length m and an LBA B can check if this is a valid
computation history for a TM M accepting w.
Check if C1 = q0 w1 w2 wn
Check if Cl = qaccept
Check if each Ci+1 follows from Ci legally.
Note that B is not constructed for the purpose of running it on any input!
If L(B) 6= then M accepts w

## ( Lecture 17) Slides for 15-453 Spring 2011 9 / 28

P OST C ORRESPONDENCE P ROBLEM
Undecidability is not just confined to problems concerning automata and
languages.

## ( Lecture 17) Slides for 15-453 Spring 2011 10 / 28

P OST C ORRESPONDENCE P ROBLEM
Undecidability is not just confined to problems concerning automata and
languages.
There are other natural problems which can be proved undecidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 10 / 28

P OST C ORRESPONDENCE P ROBLEM
Undecidability is not just confined to problems concerning automata and
languages.
There are other natural problems which can be proved undecidable.
The Post correspondence problem (PCP) is a tiling problem over strings.

## ( Lecture 17) Slides for 15-453 Spring 2011 10 / 28

P OST C ORRESPONDENCE P ROBLEM
Undecidability is not just confined to problems concerning automata and
languages.
There are other natural problems which can be proved undecidable.
The Post correspondence problem (PCP) is a tiling problem over strings.
A tile or a domino contains two strings, t and b; e.g., ca
 
a .

## ( Lecture 17) Slides for 15-453 Spring 2011 10 / 28

P OST C ORRESPONDENCE P ROBLEM
Undecidability is not just confined to problems concerning automata and
languages.
There are other natural problems which can be proved undecidable.
The Post correspondence problem (PCP) is a tiling problem over strings.
A tile or a domino contains two strings, t and b; e.g., ca
 
a .
Suppose we have dominos
       
b a ca abc
, , ,
ca ab a c

## ( Lecture 17) Slides for 15-453 Spring 2011 10 / 28

P OST C ORRESPONDENCE P ROBLEM
Undecidability is not just confined to problems concerning automata and
languages.
There are other natural problems which can be proved undecidable.
The Post correspondence problem (PCP) is a tiling problem over strings.
A tile or a domino contains two strings, t and b; e.g., ca
 
a .
Suppose we have dominos
       
b a ca abc
, , ,
ca ab a c

A match is a list of these dominos so that when concatenated the top and
the bottom strings are identical. For example,
     
a b ca a abc abcaaabc
=
ab ca a ab c abcaaabc

## ( Lecture 17) Slides for 15-453 Spring 2011 10 / 28

P OST C ORRESPONDENCE P ROBLEM
Undecidability is not just confined to problems concerning automata and
languages.
There are other natural problems which can be proved undecidable.
The Post correspondence problem (PCP) is a tiling problem over strings.
A tile or a domino contains two strings, t and b; e.g., ca
 
a .
Suppose we have dominos
       
b a ca abc
, , ,
ca ab a c

A match is a list of these dominos so that when concatenated the top and
the bottom strings are identical. For example,
     
a b ca a abc abcaaabc
=
ab ca a ab c abcaaabc
      
abc ca acc
The set of dominos ab , a , ba , does not have a solution.

## ( Lecture 17) Slides for 15-453 Spring 2011 10 / 28

P OST C ORRESPONDENCE P ROBLEM

## A N INSTANCE OF THE PCP

A PCP instance over is a finite collection P of dominos
     
t1 t2 tk
P= , , ,
b1 b2 bk

## ( Lecture 17) Slides for 15-453 Spring 2011 11 / 28

P OST C ORRESPONDENCE P ROBLEM

## A N INSTANCE OF THE PCP

A PCP instance over is a finite collection P of dominos
     
t1 t2 tk
P= , , ,
b1 b2 bk

## where for all i, 1 i k, ti , bi .

M ATCH
Given a PCP instance P, a match is a nonempty sequence

i1 , i2 , . . . , i`

## of numbers from {1, 2, . . . , k } (with repetition) such that

ti1 ti2 ti` = bi1 bi2 bi`

## ( Lecture 17) Slides for 15-453 Spring 2011 11 / 28

P OST C ORRESPONDENCE P ROBLEM

Q UESTION :
Does a given PCP instance P have a match?

## ( Lecture 17) Slides for 15-453 Spring 2011 12 / 28

P OST C ORRESPONDENCE P ROBLEM

Q UESTION :
Does a given PCP instance P have a match?

L ANGUAGE FORMULATION :
PCP = {hPi | P is a PCP instance and it has a match}

## ( Lecture 17) Slides for 15-453 Spring 2011 12 / 28

P OST C ORRESPONDENCE P ROBLEM

Q UESTION :
Does a given PCP instance P have a match?

L ANGUAGE FORMULATION :
PCP = {hPi | P is a PCP instance and it has a match}

T HEOREM 5.15
PCP is undecidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 12 / 28

P OST C ORRESPONDENCE P ROBLEM

Q UESTION :
Does a given PCP instance P have a match?

L ANGUAGE FORMULATION :
PCP = {hPi | P is a PCP instance and it has a match}

T HEOREM 5.15
PCP is undecidable.
Proof: By reduction using computation histories. If PCP is decidable then so
is ATM . That is, if PCP has a match, then M accepts w.

## ( Lecture 17) Slides for 15-453 Spring 2011 12 / 28

PCP T HE S TRUCTURE OF THE U NDECIDABILITY
P ROOF
The reduction works in two steps:
1 We reduce ATM to Modified PCP (MPCP).

## ( Lecture 17) Slides for 15-453 Spring 2011 13 / 28

PCP T HE S TRUCTURE OF THE U NDECIDABILITY
P ROOF
The reduction works in two steps:
1 We reduce ATM to Modified PCP (MPCP).
2 We reduce MPCP to PCP.

## ( Lecture 17) Slides for 15-453 Spring 2011 13 / 28

PCP T HE S TRUCTURE OF THE U NDECIDABILITY
P ROOF
The reduction works in two steps:
1 We reduce ATM to Modified PCP (MPCP).
2 We reduce MPCP to PCP.

## MPCP AS A LANGUAGE PROBLEM

MPCP = {hPi | P is a PCP instance and it has a match which starts with
index 1}

## ( Lecture 17) Slides for 15-453 Spring 2011 13 / 28

PCP T HE S TRUCTURE OF THE U NDECIDABILITY
P ROOF
The reduction works in two steps:
1 We reduce ATM to Modified PCP (MPCP).
2 We reduce MPCP to PCP.

## MPCP AS A LANGUAGE PROBLEM

MPCP = {hPi | P is a PCP instance and it has a match which starts with
index 1}
 
t1
So the solution to MPCP starts with the domino b1 . We later remove

## ( Lecture 17) Slides for 15-453 Spring 2011 13 / 28

PCP T HE S TRUCTURE OF THE U NDECIDABILITY
P ROOF
The reduction works in two steps:
1 We reduce ATM to Modified PCP (MPCP).
2 We reduce MPCP to PCP.

## MPCP AS A LANGUAGE PROBLEM

MPCP = {hPi | P is a PCP instance and it has a match which starts with
index 1}
 
t1
So the solution to MPCP starts with the domino b1 . We later remove

## this restriction in the second part of the proof.

We also assume that the decider for M never moves its head to the left of
the input w.

## ( Lecture 17) Slides for 15-453 Spring 2011 13 / 28

PCP T HE P ROOF

For input hM, wi of ATM , construct an MPCP instance such that M accepts w
iff P 0 has a match starting with domino 1

## ( Lecture 17) Slides for 15-453 Spring 2011 14 / 28

PCP T HE P ROOF

For input hM, wi of ATM , construct an MPCP instance such that M accepts w
iff P 0 has a match starting with domino 1

The first part of the proof proceeds in 7 stages where we add different
types of dominos to P 0 depending on the TM
M = (Q, , , , q0 , qaccept , qreject ).

## ( Lecture 17) Slides for 15-453 Spring 2011 14 / 28

PCP T HE P ROOF

For input hM, wi of ATM , construct an MPCP instance such that M accepts w
iff P 0 has a match starting with domino 1

The first part of the proof proceeds in 7 stages where we add different
types of dominos to P 0 depending on the TM
M = (Q, , , , q0 , qaccept , qreject ).
Using the dominos, we try to construct an accepting computation history
for M accepting w.

## ( Lecture 17) Slides for 15-453 Spring 2011 14 / 28

PCP A DDING THE RIGHT KIND OF DOMINOS
1 The first domino kicks of the computation history
   
t1 #
= ,
b1 #q0 w1 w2 wn #

## ( Lecture 17) Slides for 15-453 Spring 2011 15 / 28

PCP A DDING THE RIGHT KIND OF DOMINOS
1 The first domino kicks of the computation history
   
t1 #
= ,
b1 #q0 w1 w2 wn #
2 Handle right moving transitions. For every a, b and every q, r Q
where q 6= qreject
 
qa
if (q, a) = (r , b, R), put into P 0
br

## ( Lecture 17) Slides for 15-453 Spring 2011 15 / 28

PCP A DDING THE RIGHT KIND OF DOMINOS
1 The first domino kicks of the computation history
   
t1 #
= ,
b1 #q0 w1 w2 wn #
2 Handle right moving transitions. For every a, b and every q, r Q
where q 6= qreject
 
qa
if (q, a) = (r , b, R), put into P 0
br
3 Handle left moving transitions. For every a, b, c and every q, r Q
where q 6= qreject
 
cqa
if (q, a) = (r , b, L), put into P 0
rcb

## ( Lecture 17) Slides for 15-453 Spring 2011 15 / 28

PCP A DDING THE RIGHT KIND OF DOMINOS
1 The first domino kicks of the computation history
   
t1 #
= ,
b1 #q0 w1 w2 wn #
2 Handle right moving transitions. For every a, b and every q, r Q
where q 6= qreject
 
qa
if (q, a) = (r , b, R), put into P 0
br
3 Handle left moving transitions. For every a, b, c and every q, r Q
where q 6= qreject
 
cqa
if (q, a) = (r , b, L), put into P 0
rcb
 
4 For every a put aa into P 0

## ( Lecture 17) Slides for 15-453 Spring 2011 15 / 28

PCP A DDING THE RIGHT KIND OF DOMINOS
1 The first domino kicks of the computation history
   
t1 #
= ,
b1 #q0 w1 w2 wn #
2 Handle right moving transitions. For every a, b and every q, r Q
where q 6= qreject
 
qa
if (q, a) = (r , b, R), put into P 0
br
3 Handle left moving transitions. For every a, b, c and every q, r Q
where q 6= qreject
 
cqa
if (q, a) = (r , b, L), put into P 0
rcb
 
4 For every a put aa into P 0
   
5 Put ## and #
t# into P .
0

## ( Lecture 17) Slides for 15-453 Spring 2011 15 / 28

PCP - H OW THE DOMINOS WORK
Let us assume = {0, 1, 2, t}, w = 0100 and that (q0 , 0) = (q7 , 2, R)

## ( Lecture 17) Slides for 15-453 Spring 2011 16 / 28

PCP - H OW THE DOMINOS WORK
Let us assume = {0, 1, 2, t}, w = 0100 and that (q0 , 0) = (q7 , 2, R)
Part 1 places the first domino and the match begins

#
# q0 0 1 0 0 #

## ( Lecture 17) Slides for 15-453 Spring 2011 16 / 28

PCP - H OW THE DOMINOS WORK
Let us assume = {0, 1, 2, t}, w = 0100 and that (q0 , 0) = (q7 , 2, R)
Part 1 places the first domino and the match begins

# q0 0
# q0 0 1 0 0 # 2 q7
 
q0 0
Part 2 places the domino 2q7

## ( Lecture 17) Slides for 15-453 Spring 2011 16 / 28

PCP - H OW THE DOMINOS WORK
Let us assume = {0, 1, 2, t}, w = 0100 and that (q0 , 0) = (q7 , 2, R)
Part 1 places the first domino and the match begins

# q0 0 1 0 0
# q0 0 1 0 0 # 2 q7 1 0 0
 
q0 0
Part 2 places the domino 2q7
     
0 1 2 t
Part 4 places the dominos 0 1 2 and t into P 0 so we can
extend the match.

## ( Lecture 17) Slides for 15-453 Spring 2011 16 / 28

PCP - H OW THE DOMINOS WORK
Let us assume = {0, 1, 2, t}, w = 0100 and that (q0 , 0) = (q7 , 2, R)
Part 1 places the first domino and the match begins

# q0 0 1 0 0 #
# q0 0 1 0 0 # 2 q7 1 0 0 #
 
q0 0
Part 2 places the domino 2q7
     
0 1 2 t
Part 4 places the dominos 0 1 2 and t into P 0 so we can
extend the match.  
#
Part 5 puts in the domino #

## ( Lecture 17) Slides for 15-453 Spring 2011 16 / 28

PCP - H OW THE DOMINOS WORK
Let us assume = {0, 1, 2, t}, w = 0100 and that (q0 , 0) = (q7 , 2, R)
Part 1 places the first domino and the match begins

# q0 0 1 0 0 #
# q0 0 1 0 0 # 2 q7 1 0 0 #
 
q0 0
Part 2 places the domino 2q7
     
0 1 2 t
Part 4 places the dominos 0 1 2 and t into P 0 so we can
extend the match.  
#
Part 5 puts in the domino #

## ( Lecture 17) Slides for 15-453 Spring 2011 16 / 28

PCP - H OW THE DOMINOS WORK
Let us assume = {0, 1, 2, t}, w = 0100 and that (q0 , 0) = (q7 , 2, R)
Part 1 places the first domino and the match begins

# q0 0 1 0 0 #
# q0 0 1 0 0 # 2 q7 1 0 0 #
 
q0 0
Part 2 places the domino 2q7
     
0 1 2 t
Part 4 places the dominos 0 1 2 and t into P 0 so we can
extend the match.  
#
Part 5 puts in the domino #

## What exactly is going on ?

We force the bottom string to create a copy on the top which is forced to
generate the next configuration on the bottom We are simulating M on
w!

## ( Lecture 17) Slides for 15-453 Spring 2011 16 / 28

PCP - H OW THE DOMINOS WORK
Let us assume = {0, 1, 2, t}, w = 0100 and that (q0 , 0) = (q7 , 2, R)
Part 1 places the first domino and the match begins

# q0 0 1 0 0 #
# q0 0 1 0 0 # 2 q7 1 0 0 #
 
q0 0
Part 2 places the domino 2q7
     
0 1 2 t
Part 4 places the dominos 0 1 2 and t into P 0 so we can
extend the match.  
#
Part 5 puts in the domino #

## What exactly is going on ?

We force the bottom string to create a copy on the top which is forced to
generate the next configuration on the bottom We are simulating M on
w!
The process continues until M reaches a halting state and we then pad
the upper string.
( Lecture 17) Slides for 15-453 Spring 2011 16 / 28
PCP M ORE DOMINO TYPES
6 For every a ,
   
aqaccept qaccept a
put and into P 0
qaccept qaccept
These dominos clean-up by adding any symbols to the top string while
adding just the state symbol to the lower string.

## ( Lecture 17) Slides for 15-453 Spring 2011 17 / 28

PCP M ORE DOMINO TYPES
6 For every a ,
   
aqaccept qaccept a
put and into P 0
qaccept qaccept
These dominos clean-up by adding any symbols to the top string while
adding just the state symbol to the lower string.

Just before these apply the upper and lower strings are like
... #
. . . # 2 1 qaccept 0 2 #

## ( Lecture 17) Slides for 15-453 Spring 2011 17 / 28

PCP M ORE DOMINO TYPES
6 For every a ,
   
aqaccept qaccept a
put and into P 0
qaccept qaccept
These dominos clean-up by adding any symbols to the top string while
adding just the state symbol to the lower string.

Just before these apply the upper and lower strings are like
... #
. . . # 2 1 qaccept 0 2 #
After using these dominos, we end up with
... #
. . . # qaccept #

## ( Lecture 17) Slides for 15-453 Spring 2011 17 / 28

PCP M ORE DOMINO TYPES
6 For every a ,
   
aqaccept qaccept a
put and into P 0
qaccept qaccept
These dominos clean-up by adding any symbols to the top string while
adding just the state symbol to the lower string.

Just before these apply the upper and lower strings are like
... #
. . . # 2 1 qaccept 0 2 #
After using these dominos, we end up with
... #
. . . # qaccept #
7 Finally we add the domino
 
qaccept ##
#
to complete the match.
( Lecture 17) Slides for 15-453 Spring 2011 17 / 28
PCP P ROOF S UMMARY OF PART 1
This concludes the construction of P 0 .

## ( Lecture 17) Slides for 15-453 Spring 2011 18 / 28

PCP P ROOF S UMMARY OF PART 1
This concludes the construction of P 0 .
Thus if M accepts w, the set of MPCP dominos constructed have a
solution to the MPCP problem.

## ( Lecture 17) Slides for 15-453 Spring 2011 18 / 28

PCP P ROOF S UMMARY OF PART 1
This concludes the construction of P 0 .
Thus if M accepts w, the set of MPCP dominos constructed have a
solution to the MPCP problem.
But not yet to the PCP problem.

## ( Lecture 17) Slides for 15-453 Spring 2011 18 / 28

PCP P ROOF PART 2
Suppose we have the MPCP instance
     
t1 t2 tk
P0 = , , ,
b1 b2 bk

## ( Lecture 17) Slides for 15-453 Spring 2011 19 / 28

PCP P ROOF PART 2
Suppose we have the MPCP instance
     
t1 t2 tk
P0 = , , ,
b1 b2 bk

## We let P be the collection

      
?t1 ?t2 ?tk ?
P= , , ,
?b1 ? b2 ? bk ? 

## ( Lecture 17) Slides for 15-453 Spring 2011 19 / 28

PCP P ROOF PART 2
Suppose we have the MPCP instance
     
t1 t2 tk
P0 = , , ,
b1 b2 bk

## We let P be the collection

      
?t1 ?t2 ?tk ?
P= , , ,
?b1 ? b2 ? bk ? 

The only domino that could possibly start a match is the first one!

## ( Lecture 17) Slides for 15-453 Spring 2011 19 / 28

PCP P ROOF PART 2
Suppose we have the MPCP instance
     
t1 t2 tk
P0 = , , ,
b1 b2 bk

## We let P be the collection

      
?t1 ?t2 ?tk ?
P= , , ,
?b1 ? b2 ? bk ? 

The only domino that could possibly start a match is the first one!
The last domino just adds the missing ? at the end of the match.

## ( Lecture 17) Slides for 15-453 Spring 2011 19 / 28

PCP P ROOF PART 2
Suppose we have the MPCP instance
     
t1 t2 tk
P0 = , , ,
b1 b2 bk

## We let P be the collection

      
?t1 ?t2 ?tk ?
P= , , ,
?b1 ? b2 ? bk ? 

The only domino that could possibly start a match is the first one!
The last domino just adds the missing ? at the end of the match.

C ONCLUSION
PCP is undecidable!

## ( Lecture 17) Slides for 15-453 Spring 2011 19 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

MA = On input hIA i

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

MA = On input hIA i
1. Algorithmically construct an input hIB i for MB , such that

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

MA = On input hIA i
1. Algorithmically construct an input hIB i for MB , such that

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

MA = On input hIA i
1. Algorithmically construct an input hIB i for MB , such that
a) Either

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

MA = On input hIA i
1. Algorithmically construct an input hIB i for MB , such that
a) Either

## If hIA i A then hIB i B

If hIA i 6 A then hIB i 6 B

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

MA = On input hIA i
1. Algorithmically construct an input hIB i for MB , such that
a) Either b) or

## If hIA i A then hIB i B

If hIA i 6 A then hIB i 6 B

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

MA = On input hIA i
1. Algorithmically construct an input hIB i for MB , such that
a) Either b) or

## If hIA i A then hIB i B If hIA i A then hIB i 6 B

If hIA i 6 A then hIB i 6 B If hIA i 6 A then hIB i B

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

MA = On input hIA i
1. Algorithmically construct an input hIB i for MB , such that
a) Either b) or

## If hIA i A then hIB i B If hIA i A then hIB i 6 B

If hIA i 6 A then hIB i 6 B If hIA i 6 A then hIB i B

## 2. Run the decider MB on hIB i for MB

Case a): MA accepts if MB accepts, and rejects if MB rejects
Case b): MA rejects if MB accepts, and accepts if MB reject.

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

MA = On input hIA i
1. Algorithmically construct an input hIB i for MB , such that
a) Either b) or

## If hIA i A then hIB i B If hIA i A then hIB i 6 B

If hIA i 6 A then hIB i 6 B If hIA i 6 A then hIB i B

## 2. Run the decider MB on hIB i for MB

Case a): MA accepts if MB accepts, and rejects if MB rejects
Case b): MA rejects if MB accepts, and accepts if MB reject.

## ( Lecture 17) Slides for 15-453 Spring 2011 20 / 28

S UMMARY OF R EDUCIBILITY

## We know that language A is undecidable. By reducing A to B we want to show

that the language B is also undecidable.

## 1 Assume that we have a decider MB for B.

2 Using MB we construct a decider MA for the language A:

MA = On input hIA i
1. Algorithmically construct an input hIB i for MB , such that
a) Either b) or

## If hIA i A then hIB i B If hIA i A then hIB i 6 B

If hIA i 6 A then hIB i 6 B If hIA i 6 A then hIB i B

## 2. Run the decider MB on hIB i for MB

Case a): MA accepts if MB accepts, and rejects if MB rejects
Case b): MA rejects if MB accepts, and accepts if MB reject.

## 3 We know MA can not exist so MB can not exist.

4 B is undecidable.
( Lecture 17) Slides for 15-453 Spring 2011 20 / 28
C OMPUTABLE F UNCTIONS

I DEA
Turing Machines can also compute function f : .

## ( Lecture 17) Slides for 15-453 Spring 2011 21 / 28

C OMPUTABLE F UNCTIONS

I DEA
Turing Machines can also compute function f : .

C OMPUTABLE F UNCTION
A function f : is a computable function if and only if there exists a
TM Mf , which on any given input w

## ( Lecture 17) Slides for 15-453 Spring 2011 21 / 28

C OMPUTABLE F UNCTIONS

I DEA
Turing Machines can also compute function f : .

C OMPUTABLE F UNCTION
A function f : is a computable function if and only if there exists a
TM Mf , which on any given input w
always halts, and

## ( Lecture 17) Slides for 15-453 Spring 2011 21 / 28

C OMPUTABLE F UNCTIONS

I DEA
Turing Machines can also compute function f : .

C OMPUTABLE F UNCTION
A function f : is a computable function if and only if there exists a
TM Mf , which on any given input w
always halts, and
leaves just f (w) on its tape.

## ( Lecture 17) Slides for 15-453 Spring 2011 21 / 28

C OMPUTABLE F UNCTIONS

I DEA
Turing Machines can also compute function f : .

C OMPUTABLE F UNCTION
A function f : is a computable function if and only if there exists a
TM Mf , which on any given input w
always halts, and
leaves just f (w) on its tape.

Examples:
def
Let f (w) = ww be a function. Then f is computable.

## ( Lecture 17) Slides for 15-453 Spring 2011 21 / 28

C OMPUTABLE F UNCTIONS

I DEA
Turing Machines can also compute function f : .

C OMPUTABLE F UNCTION
A function f : is a computable function if and only if there exists a
TM Mf , which on any given input w
always halts, and
leaves just f (w) on its tape.

Examples:
def
Let f (w) = ww be a function. Then f is computable.
def
Let f (hn1 , n2 i) = hni where n1 and n2 are integers and n = n1 n2 . Then
f is computable.

## ( Lecture 17) Slides for 15-453 Spring 2011 21 / 28

M APPING R EDUCIBILITY
D EFINITION
Let A, B . We say that language A is mapping reducible to language B,
written A <m B, if and only if

## ( Lecture 17) Slides for 15-453 Spring 2011 22 / 28

M APPING R EDUCIBILITY
D EFINITION
Let A, B . We say that language A is mapping reducible to language B,
written A <m B, if and only if
1 There is a computable function f : such that

## ( Lecture 17) Slides for 15-453 Spring 2011 22 / 28

M APPING R EDUCIBILITY
D EFINITION
Let A, B . We say that language A is mapping reducible to language B,
written A <m B, if and only if
1 There is a computable function f : such that
2 For every w , w A if and only if f (w) B.

## ( Lecture 17) Slides for 15-453 Spring 2011 22 / 28

M APPING R EDUCIBILITY
D EFINITION
Let A, B . We say that language A is mapping reducible to language B,
written A <m B, if and only if
1 There is a computable function f : such that
2 For every w , w A if and only if f (w) B.
The function f is called a reduction of A to B.

T HEOREM 5.22
If A <m B and B is decidable, then A is decidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 22 / 28

M APPING R EDUCIBILITY
D EFINITION
Let A, B . We say that language A is mapping reducible to language B,
written A <m B, if and only if
1 There is a computable function f : such that
2 For every w , w A if and only if f (w) B.
The function f is called a reduction of A to B.

T HEOREM 5.22
If A <m B and B is decidable, then A is decidable.

P ROOF
Let M be a decider for B and f be a mapping from A to B. Then N decides A.
N = On input w

## ( Lecture 17) Slides for 15-453 Spring 2011 22 / 28

M APPING R EDUCIBILITY
D EFINITION
Let A, B . We say that language A is mapping reducible to language B,
written A <m B, if and only if
1 There is a computable function f : such that
2 For every w , w A if and only if f (w) B.
The function f is called a reduction of A to B.

T HEOREM 5.22
If A <m B and B is decidable, then A is decidable.

P ROOF
Let M be a decider for B and f be a mapping from A to B. Then N decides A.
N = On input w
1 Compute f (w)

## ( Lecture 17) Slides for 15-453 Spring 2011 22 / 28

M APPING R EDUCIBILITY
D EFINITION
Let A, B . We say that language A is mapping reducible to language B,
written A <m B, if and only if
1 There is a computable function f : such that
2 For every w , w A if and only if f (w) B.
The function f is called a reduction of A to B.

T HEOREM 5.22
If A <m B and B is decidable, then A is decidable.

P ROOF
Let M be a decider for B and f be a mapping from A to B. Then N decides A.
N = On input w
1 Compute f (w)
2 Run M on input f (w) and output whatever M outputs.

## ( Lecture 17) Slides for 15-453 Spring 2011 22 / 28

M APPING R EDUCIBILITY
D EFINITION
Let A, B . We say that language A is mapping reducible to language B,
written A <m B, if and only if
1 There is a computable function f : such that
2 For every w , w A if and only if f (w) B.
The function f is called a reduction of A to B.

T HEOREM 5.22
If A <m B and B is decidable, then A is decidable.

P ROOF
Let M be a decider for B and f be a mapping from A to B. Then N decides A.
N = On input w
1 Compute f (w)
2 Run M on input f (w) and output whatever M outputs.

## ( Lecture 17) Slides for 15-453 Spring 2011 22 / 28

M APPING R EDUCIBILITY
D EFINITION
Let A, B . We say that language A is mapping reducible to language B,
written A <m B, if and only if
1 There is a computable function f : such that
2 For every w , w A if and only if f (w) B.
The function f is called a reduction of A to B.

T HEOREM 5.22
If A <m B and B is decidable, then A is decidable.

P ROOF
Let M be a decider for B and f be a mapping from A to B. Then N decides A.
N = On input w
1 Compute f (w)
2 Run M on input f (w) and output whatever M outputs.

## If A <m B and A is undecidable, then B is undecidable.

( Lecture 17) Slides for 15-453 Spring 2011 22 / 28
M APPING R EDUCIBILITY

T HEOREM
ATM <m HALTTM

## ( Lecture 17) Slides for 15-453 Spring 2011 23 / 28

M APPING R EDUCIBILITY

T HEOREM
ATM <m HALTTM

P ROOF .
Construct a computable function f which maps hM, wi to hM 0 , w 0 i such that

## hM, wi ATM if and only if hM 0 , w 0 i HALTTM

Mf = On input hM, wi

## ( Lecture 17) Slides for 15-453 Spring 2011 23 / 28

M APPING R EDUCIBILITY

T HEOREM
ATM <m HALTTM

P ROOF .
Construct a computable function f which maps hM, wi to hM 0 , w 0 i such that

## hM, wi ATM if and only if hM 0 , w 0 i HALTTM

Mf = On input hM, wi
1. Construct the following machine M 0 :
M 0 = On input x

## ( Lecture 17) Slides for 15-453 Spring 2011 23 / 28

M APPING R EDUCIBILITY

T HEOREM
ATM <m HALTTM

P ROOF .
Construct a computable function f which maps hM, wi to hM 0 , w 0 i such that

## hM, wi ATM if and only if hM 0 , w 0 i HALTTM

Mf = On input hM, wi
1. Construct the following machine M 0 :
M 0 = On input x
1. Run M on x.

## ( Lecture 17) Slides for 15-453 Spring 2011 23 / 28

M APPING R EDUCIBILITY

T HEOREM
ATM <m HALTTM

P ROOF .
Construct a computable function f which maps hM, wi to hM 0 , w 0 i such that

## hM, wi ATM if and only if hM 0 , w 0 i HALTTM

Mf = On input hM, wi
1. Construct the following machine M 0 :
M 0 = On input x
1. Run M on x.
2. If M accepts accept

## ( Lecture 17) Slides for 15-453 Spring 2011 23 / 28

M APPING R EDUCIBILITY

T HEOREM
ATM <m HALTTM

P ROOF .
Construct a computable function f which maps hM, wi to hM 0 , w 0 i such that

## hM, wi ATM if and only if hM 0 , w 0 i HALTTM

Mf = On input hM, wi
1. Construct the following machine M 0 :
M 0 = On input x
1. Run M on x.
2. If M accepts accept
3. If M rejects enter a loop.

## ( Lecture 17) Slides for 15-453 Spring 2011 23 / 28

M APPING R EDUCIBILITY

T HEOREM
ATM <m HALTTM

P ROOF .
Construct a computable function f which maps hM, wi to hM 0 , w 0 i such that

## hM, wi ATM if and only if hM 0 , w 0 i HALTTM

Mf = On input hM, wi
1. Construct the following machine M 0 :
M 0 = On input x
1. Run M on x.
2. If M accepts accept
3. If M rejects enter a loop.
2. Output hM 0 , wi.

## ( Lecture 17) Slides for 15-453 Spring 2011 23 / 28

M ORE EXAMPLES OF M APPING R EDUCIBILITY
Earlier we showed

## ( Lecture 17) Slides for 15-453 Spring 2011 24 / 28

M ORE EXAMPLES OF M APPING R EDUCIBILITY
Earlier we showed
ATM <m MPCP

## ( Lecture 17) Slides for 15-453 Spring 2011 24 / 28

M ORE EXAMPLES OF M APPING R EDUCIBILITY
Earlier we showed
ATM <m MPCP
MPCP <m PCP

## ( Lecture 17) Slides for 15-453 Spring 2011 24 / 28

M ORE EXAMPLES OF M APPING R EDUCIBILITY
Earlier we showed
ATM <m MPCP
MPCP <m PCP
In Theorem 5.4 we showed ETM <m EQTM . The reduction f maps from
hMi to the output hM, M1 i where M1 is the machine that rejects all inputs.

## ( Lecture 17) Slides for 15-453 Spring 2011 24 / 28

M ORE EXAMPLES OF M APPING R EDUCIBILITY
Earlier we showed
ATM <m MPCP
MPCP <m PCP
In Theorem 5.4 we showed ETM <m EQTM . The reduction f maps from
hMi to the output hM, M1 i where M1 is the machine that rejects all inputs.

T HEOREM 5.24
If A <m B and B is Turing-recognizable, then A is Turing-recognizable.

## ( Lecture 17) Slides for 15-453 Spring 2011 24 / 28

M ORE EXAMPLES OF M APPING R EDUCIBILITY
Earlier we showed
ATM <m MPCP
MPCP <m PCP
In Theorem 5.4 we showed ETM <m EQTM . The reduction f maps from
hMi to the output hM, M1 i where M1 is the machine that rejects all inputs.

T HEOREM 5.24
If A <m B and B is Turing-recognizable, then A is Turing-recognizable.

P ROOF
Essentially the same as the previous proof.

## ( Lecture 17) Slides for 15-453 Spring 2011 24 / 28

S UMMARY OF M APPING R EDUCIBILITY R ESULTS

S UMMARY OF T HEOREMS
Assume that A <m B. Then

## ( Lecture 17) Slides for 15-453 Spring 2011 25 / 28

S UMMARY OF M APPING R EDUCIBILITY R ESULTS

S UMMARY OF T HEOREMS
Assume that A <m B. Then
1 If B is decidable then A is decidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 25 / 28

S UMMARY OF M APPING R EDUCIBILITY R ESULTS

S UMMARY OF T HEOREMS
Assume that A <m B. Then
1 If B is decidable then A is decidable.
2 If A is undecidable then B is undecidable.

## ( Lecture 17) Slides for 15-453 Spring 2011 25 / 28

S UMMARY OF M APPING R EDUCIBILITY R ESULTS

S UMMARY OF T HEOREMS
Assume that A <m B. Then
1 If B is decidable then A is decidable.
2 If A is undecidable then B is undecidable.
3 If B is Turing-recognizable then A is Turing-recognizable.

## ( Lecture 17) Slides for 15-453 Spring 2011 25 / 28

S UMMARY OF M APPING R EDUCIBILITY R ESULTS

S UMMARY OF T HEOREMS
Assume that A <m B. Then
1 If B is decidable then A is decidable.
2 If A is undecidable then B is undecidable.
3 If B is Turing-recognizable then A is Turing-recognizable.
4 If A is not Turing-recognizable then B is not Turing-recognizable.

## ( Lecture 17) Slides for 15-453 Spring 2011 25 / 28

S UMMARY OF M APPING R EDUCIBILITY R ESULTS

S UMMARY OF T HEOREMS
Assume that A <m B. Then
1 If B is decidable then A is decidable.
2 If A is undecidable then B is undecidable.
3 If B is Turing-recognizable then A is Turing-recognizable.
4 If A is not Turing-recognizable then B is not Turing-recognizable.
5 A <m B

## ( Lecture 17) Slides for 15-453 Spring 2011 25 / 28

S UMMARY OF M APPING R EDUCIBILITY R ESULTS

S UMMARY OF T HEOREMS
Assume that A <m B. Then
1 If B is decidable then A is decidable.
2 If A is undecidable then B is undecidable.
3 If B is Turing-recognizable then A is Turing-recognizable.
4 If A is not Turing-recognizable then B is not Turing-recognizable.
5 A <m B

Useful observation:
Suppose you can show ATM <m B

## ( Lecture 17) Slides for 15-453 Spring 2011 25 / 28

S UMMARY OF M APPING R EDUCIBILITY R ESULTS

S UMMARY OF T HEOREMS
Assume that A <m B. Then
1 If B is decidable then A is decidable.
2 If A is undecidable then B is undecidable.
3 If B is Turing-recognizable then A is Turing-recognizable.
4 If A is not Turing-recognizable then B is not Turing-recognizable.
5 A <m B

Useful observation:
Suppose you can show ATM <m B
This means ATM <m B

## ( Lecture 17) Slides for 15-453 Spring 2011 25 / 28

S UMMARY OF M APPING R EDUCIBILITY R ESULTS

S UMMARY OF T HEOREMS
Assume that A <m B. Then
1 If B is decidable then A is decidable.
2 If A is undecidable then B is undecidable.
3 If B is Turing-recognizable then A is Turing-recognizable.
4 If A is not Turing-recognizable then B is not Turing-recognizable.
5 A <m B

Useful observation:
Suppose you can show ATM <m B
This means ATM <m B
Since ATM is Turing-unrecognizable then B is Turing-unrecognizable.

## ( Lecture 17) Slides for 15-453 Spring 2011 25 / 28

E XAMPLE OF U SE

T HEOREM 5.30
EQTM = {hM1 , M2 i | M1 and M2 are TMs and L(M1 ) = L(M2 )} is neither Turing
recognizable nor co-Turing-recognizable.

## ( Lecture 17) Slides for 15-453 Spring 2011 26 / 28

E XAMPLE OF U SE

T HEOREM 5.30
EQTM = {hM1 , M2 i | M1 and M2 are TMs and L(M1 ) = L(M2 )} is neither Turing
recognizable nor co-Turing-recognizable.

P ROOF I DEA
We show

## ( Lecture 17) Slides for 15-453 Spring 2011 26 / 28

E XAMPLE OF U SE

T HEOREM 5.30
EQTM = {hM1 , M2 i | M1 and M2 are TMs and L(M1 ) = L(M2 )} is neither Turing
recognizable nor co-Turing-recognizable.

P ROOF I DEA
We show
ATM <m EQTM

## ( Lecture 17) Slides for 15-453 Spring 2011 26 / 28

E XAMPLE OF U SE

T HEOREM 5.30
EQTM = {hM1 , M2 i | M1 and M2 are TMs and L(M1 ) = L(M2 )} is neither Turing
recognizable nor co-Turing-recognizable.

P ROOF I DEA
We show
ATM <m EQTM
ATM <m EQTM

## ( Lecture 17) Slides for 15-453 Spring 2011 26 / 28

E XAMPLE OF U SE

T HEOREM 5.30
EQTM = {hM1 , M2 i | M1 and M2 are TMs and L(M1 ) = L(M2 )} is neither Turing
recognizable nor co-Turing-recognizable.

P ROOF I DEA
We show
ATM <m EQTM
ATM <m EQTM
These then imply the theorem.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following f :

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following f :

## F = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following f :

## F = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Reject

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following f :

## F = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Reject
M2 = On any input:
1. Run M on w. If it accepts, accept.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following f :

## F = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Reject
M2 = On any input:
1. Run M on w. If it accepts, accept.
2. Output hM1 , M2 i.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following f :

## F = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Reject
M2 = On any input:
1. Run M on w. If it accepts, accept.
2. Output hM1 , M2 i.
M1 accepts nothing.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following f :

## F = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Reject
M2 = On any input:
1. Run M on w. If it accepts, accept.
2. Output hM1 , M2 i.
M1 accepts nothing.
If M accepts w then M2 accepts everything. So M1 and M2 are not
equivalent.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following f :

## F = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Reject
M2 = On any input:
1. Run M on w. If it accepts, accept.
2. Output hM1 , M2 i.
M1 accepts nothing.
If M accepts w then M2 accepts everything. So M1 and M2 are not
equivalent.
If M does not accept w then M2 accepts nothing. So M1 and M2 are
equivalent.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following f :

## F = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Reject
M2 = On any input:
1. Run M on w. If it accepts, accept.
2. Output hM1 , M2 i.
M1 accepts nothing.
If M accepts w then M2 accepts everything. So M1 and M2 are not
equivalent.
If M does not accept w then M2 accepts nothing. So M1 and M2 are
equivalent.
So ATM <m EQTM (and hence ATM <m EQTM )
( Lecture 17) Slides for 15-453 Spring 2011 27 / 28
E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following g:

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following g:

## G = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following g:

## G = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Accept

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following g:

## G = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Accept
M2 = On any input:
1. Run M on w. If it accepts, accept.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following g:

## G = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Accept
M2 = On any input:
1. Run M on w. If it accepts, accept.
2. Output hM1 , M2 i.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following g:

## G = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Accept
M2 = On any input:
1. Run M on w. If it accepts, accept.
2. Output hM1 , M2 i.
M1 accepts everything.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following g:

## G = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Accept
M2 = On any input:
1. Run M on w. If it accepts, accept.
2. Output hM1 , M2 i.
M1 accepts everything.
If M accepts w then M2 accepts everything. So M1 and M2 are equivalent.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following g:

## G = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Accept
M2 = On any input:
1. Run M on w. If it accepts, accept.
2. Output hM1 , M2 i.
M1 accepts everything.
If M accepts w then M2 accepts everything. So M1 and M2 are equivalent.
If M does not accept w then M2 accepts nothing. So M1 and M2 are not
equivalent.

E XAMPLE OF U SE

## P ROOF FOR ATM <m EQTM

We show ATM <m EQTM (and hence ATM <m EQTM ) with the following g:

## G = On input hM, wi where M is a TM and w is a string:

1. Construct the following two machines M1 and M2
M1 = On any input:
1. Accept
M2 = On any input:
1. Run M on w. If it accepts, accept.
2. Output hM1 , M2 i.
M1 accepts everything.
If M accepts w then M2 accepts everything. So M1 and M2 are equivalent.
If M does not accept w then M2 accepts nothing. So M1 and M2 are not
equivalent.
So ATM <m EQTM (and hence ATM <m EQTM )