Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 159

UNIT-5

UNDECIDABILITY
UNDECIDABILITY

There are two types of TMs (based on halting):


1. Halting TM : (Accepts Recursive languages) : TMs that always
halt, no matter accepting or or non-accepting (called as
decidable problems)
2. TM : (Accepts Recursively enumerable): TMs that are
guaranteed to halt only on acceptance. If non-accepting, it may
or may not halt (i.e., could loop forever). (Either decidable or
partially decidable).
UNDECIDABILITY

Recursive Language

A language ‘L’ is said to be recursive if there exists a Turing machine which


will accept all the strings in ‘L’ and reject all the string not in ‘L’. The turing
machine will halt every time and give an answer(accepted or rejected) for each
and every string input. A language ‘L’ is decidable if it is a recursive language.
All decidable languages are recursive languages and vice versa.
UNDECIDABILITY
Decidable Problem
● If there is a Turing machine that decides the problem, called as Decidable problem.
● A decision problem that can be solved by an algorithm that halts on all inputs in a
finite number of steps.
● A problem is decidable, if there is an algorithm that can answer either yes or no.
● A language for which membership can be decided by an algorithm that halts on all
inputs in a finite number of steps.
● Decidable problem is also called as totally decidable problem, algorithmically
solvable, recursively solvable.
UNDECIDABILITY
Undecidable Problem (Semi-decidable or Totally not decidable)
● A problem that cannot be solved for all cases by any algorithm whatsoever.
● Equivalent Language cannot be recognized by a Turing machine that halts for all inputs.
UNDECIDABILITY
The following problems are undecidable problems:
● Halting Problem: A halting problem is undecidable problem. There is no general method or
algorithm which can solve the halting problem for all possible inputs.
● Emptyness Problem: Whether a given TM accepts Empty?
● Finiteness Problem: Whether a given TM accepts Finite?
● Equivalence Problem: Whether Given two TM’s produce same language?. Is L(TM1) =
L(TM2) ?
● Is L(TM1) ⊆ L(TM2) ? (Subset Problem)
● Is L(TM1) Ո L(TM2) = CFL?
● Is L(TM1) = Σ* ? (Totality Problem)
● Is the complement of L(G1) context-free ?
NON RECURSIVELY ENUMERABLE
NON RECURSIVELY ENUMERABLE
Our long range goal is to prove undecidable the language consisting of pairs (M,w) such
that:

1. M is a Turing machine (suitably coded, in binary) with input alphabet {0,1}


2. w is a string of 0’s and 1’s, and
3. M accepts input w
NON RECURSIVELY ENUMERABLE

Enumerating the Binary Strings


● Need to assign integers to all the binary
strings so that each string corresponds to
one integer.
● That is, is the ∊is the first string, 0 is the
second, 1 the third, 00 the fourth, and 01
the fifth and so on
NON RECURSIVELY ENUMERABLE

Codes for Turing Machines


To represent a TM M = (
Q, {0,1},Г,δ,q1,B,F) as
a binary string
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
where consists of the rules
δ(q1,1)=(q3,0,R)
δ(q3,0)=(q3,1,R)
δ(q3,1)=(q2,0,R)
δ(q3,B)=(q31,L)
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
q1 0
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
q1 0, q2 00
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
q1 0, q2 00 ,q3 000
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
q1 0, q2 00 ,q3 000
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
q1 0, q2 00 ,q3 000
0 0
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
q1 0, q2 00 ,q3 000
0 0, 1 00
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
q1 0, q2 00 ,q3 000
0 0, 1 00, B 000
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
q1 0, q2 00 ,q3 000
0 0, 1 00, B 000
L 0, R 00
NON RECURSIVELY ENUMERABLE

Codes for Turing Machines


Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
where consists of the rules
δ(q1,1)=(q3,0,R)
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
where consists of the rules
δ(q1,1)=(q3,0,R) 0100100010100
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
where consists of the rules
δ(q1,1)=(q3,0,R) 0100100010100
δ(q3,0)=(q3,1,R)
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
where consists of the rules
δ(q1,1)=(q3,0,R) 0100100010100
δ(q3,0)=(q3,1,R) 000101000100100
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
where consists of the rules
δ(q1,1)=(q3,0,R) 0100100010100
δ(q3,0)=(q3,1,R) 000101000100100
δ(q3,1)=(q2,0,R)
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
where consists of the rules
δ(q1,1)=(q3,0,R) 0100100010100
δ(q3,0)=(q3,1,R) 000101000100100
δ(q3,1)=(q2,0,R) 00010010010100
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
where consists of the rules
δ(q1,1)=(q3,0,R) 0100100010100
δ(q3,0)=(q3,1,R) 000101000100100
δ(q3,1)=(q2,0,R) 00010010010100
δ(q3,B)=(q31,L)
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be
M = ({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2})
where consists of the rules
δ(q1,1)=(q3,0,R) 0100100010100
δ(q3,0)=(q3,1,R) 000101000100100
δ(q3,1)=(q2,0,R) 00010010010100
δ(q3,B)=(q31,L) 0001000100010010
NON RECURSIVELY ENUMERABLE

Codes for Turing Machines


To represent a TM M = ( Q,
{0,1},Г,δ,q1,B,F) as a binary string
First assign integers to the states,
tape symbols, and directions L and R
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
To represent a TM M = ( Q, {0,1},Г,δ,q1,B,F) as a binary
string First assign integers to the states, tape symbols, and
directions L and R

● Assume the states are q1,q2…,qr for some r. The start

state will always be q1 and q2will be the only accepting


state.
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
To represent a TM M = ( Q, {0,1},Г,δ,q1,B,F) as a binary string First
assign integers to the states, tape symbols, and directions L and R

● Assume the states are q1,q2…,qr for some r. The start state will

always be q1 and q2will be the only accepting state.

● Assume the tape symbols are X1,X2,...Xs for some s. X1 always

will be the symbol 0, X2 will be 1, and X3 will be B, the blank


NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
To represent a TM M = ( Q, {0,1},Г,δ,q1,B,F) as a binary string First
assign integers to the states, tape symbols, and directions L and R

● Assume the states are q1,q2…,qr for some r. The start state will always

be q1 and q2will be the only accepting state.

● Assume the tape symbols are X1,X2,...Xs for some s. X1 always will be

the symbol 0, X2 will be 1, and X3 will be B, the blank.

● Assume the direction L as D1 and direction R as D2.


NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
To represent a TM M = ( Q, {0,1},Г,δ,q1,B,F) as a binary string
Once we have established an integer to represent each state,
symbol, and direction. we can encode the transition function
Suppose one transition rule is

δ(qi,Xj)= (qk,Xl,Dm) ,for some integers i, j, k, l, and m

We shall codevthis rule by the string 0i10j10k10l10m


NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
A code for the entire TM M consists of all the codes for
the transitions, in some order, separated by pairs of 1’s

C111C211… Cn-111Cn

where each of the Cs is the code for one transition of


M
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Let the TM in question be M = ({q1,q2,q3},{0,1},{0,1,B}, δ, q1, B, {q2})
where consists of the rules
δ(q1,1)=(q3,0,R) 0100100010100
δ(q3,0)=(q3,1,R) 000101000100100
δ(q3,1)=(q2,0,R) 00010010010100
δ(q3,B)=(q31,L) 0001000100010010
0100010001010011000101000100100110001001001010011000100010010
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Need to code pairs consisting of a TM and a string, ( M,w) .
For this pair we use the code for M followed by 111 followed by w
NON RECURSIVELY ENUMERABLE
Codes for Turing Machines
Need to code pairs consisting of a TM and a string, ( M,w) .
For this pair we use the code for M followed by 111 followed by w
0100010001010011000101000100100110001001001010011000100010010111101
1
NON RECURSIVELY ENUMERABLE
The Diagonalization Language
There is now a concrete notion of M i, the ith Turing
machine that TM M whose code is w i the ith binary string

Many integers do not correspond to any TM at al l


NON RECURSIVELY ENUMERABLE

The Diagonalization Language


Many integers do not correspond to any TM at all.
For instance, 11001 does not begin with 0.
0010111010010100 is not valid
NON RECURSIVELY ENUMERABLE
The Diagonalization Language

If wi is not a valid TM code, we shall take Mi to be the TM with one state and no transitions.

That is, for these values of i, Mi is a Turing machine that immediately halts on any input.

Thus, L(Mi) is Ø, if wi fails to be a valid TM code


NON RECURSIVELY ENUMERABLE
The Diagonalization Language

The language Ld the diagonalization language, is the set of

strings wi such that wi is not in L(Mi).


NON RECURSIVELY ENUMERABLE

The Diagonalization Language


The diagonal values tell whether Mi accepts wi .
NON RECURSIVELY ENUMERABLE

Proof That Ld Is Not Recursively Enumerable

Theorem : Ld is not a recursively enumerable language

That is, there is no Turing machine that accepts Ld.


NON RECURSIVELY ENUMERABLE
Proof That Ld Is Not Recursively Enumerable

Theorem : Ld is not a recursively enumerable language That is, there is no Turing machine that accepts L d.

PROOF:
● Suppose Ld were L(M) for some TM M.

● Since Ld is a language over alphabet {0,1}, would be in the list of Turing machines we have

constructed, since it includes all TMs with input alphabet {0,1}.


Thus, there is at least one code for M, say i that is, M= Mi
NON RECURSIVELY ENUMERABLE
Proof That Ld Is Not Recursively Enumerable

Theorem : Ld is not a recursively enumerable language That is, there is no Turing machine that accepts Ld.

PROOF:

● If wi is in Ld, then Mi accepts wi. But then, by definition of Ld, wi is not in Ld, because Ld contains only

those wj such that Mj does not accept wj.

● Similarly, if wi is not in Ld, then Mi does not accept wi. Thus, by definition of Ld, wi is in Ld.

Since wi can neither be in Ld nor fail to be in Ld. we conclude that there is a contradiction of our assumption

that M exists. That is, Ld is not a recursively enumerable language,


AN UNDECIDABLE PROBLEM THAT IS RE
AN UNDECIDABLE PROBLEM THAT IS RE

1. Recursive language
2. Recursive Enumerable
language
3. Universal language
AN UNDECIDABLE PROBLEM THAT IS RE

Recursive language
A language L recursive if L = L(M) for some
Turing machine M such that:
1. If w is in L, then M accepts (and therefore
halts)
2. If w is not in L, then M eventually halts,
although it never enters an accepting state
AN UNDECIDABLE PROBLEM THAT IS RE

Recursive language
A language L recursive if L = L(M) for some
Turing machine M such that:
1. If w is in L, then M accepts (and therefore
halts)
2. If w is not in L, then M eventually halts,
although it never enters an accepting state
AN UNDECIDABLE PROBLEM THAT IS RE

Recursively enumerable language

TM : TMs that are guaranteed to halt are


guaranteed to halt only on acceptance. If non-
accepting, it may or may not halt (i.e., could loop
forever). (Either decidable or partially decidable).
AN UNDECIDABLE PROBLEM THAT IS RE

The relationship among three classes of


languages
● The recursive languages
● The languages that are recursively
enumerable but not recursive
● The non recursively enumerable
(nonRE) languages
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If L is a recursive language, so is L’ ( )
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If L is a recursive language, so is L’
PROOF:
● Let L= L(M) for some TM M that always halts.
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If L is a recursive language, so is L’
PROOF:
● Let L= L(M) for some TM M that always halts.
● We construct a TM M’ such that L’= L(M’) by the construction as
shown in figure.
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If L is a recursive language, so is L’
PROOF:
● Let L= L(M) for some TM M that always halts.
● We construct a TM M’ such that L’= L(M’) by the construction as
shown in figure.
AN UNDECIDABLE PROBLEM THAT IS RE

T heorem: If L is a recursive language, so is L’


PROOF:

1. The accepting states of M are made nonaccepting


states of M’ with no transitions, ie. in these states M
will halt without accepting
AN UNDECIDABLE PROBLEM THAT IS RE

T heorem: If L is a recursive language, so is L’


PROOF:

2. M has a new accepting state r, there are no


transitions from r.
AN UNDECIDABLE PROBLEM THAT IS RE

Theorem: If L is a recursive language, so is L’


PROOF:

3. For each combination of a nonaccepting state of M


and a tape symbol of M such that M has no transition, add
a transition to the accepting state r
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If L is a recursive language, so is L’ ( )
TM M = ( Q, ∑,Г,δ,q1,B,F ) then
M’=(Q, ∑,Г,δ’,q1,B,Q-F) that is
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If L is a recursive language, so is L’ ( )
TM M = ( Q, ∑,Г,δ,q1,B,F ) then M’=(Q, ∑,Г,δ’,q1,B,Q-F)
Since M is guaranteed to halt, we know that M’ is also guaranteed to
halt
Moreover, M’ accepts exactly those strings that M does not accept Thus
M,
accepts L’.
AN UNDECIDABLE PROBLEM THAT IS RE

Theorem: If both a language L and its complement are RE,


then L is recursive
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If both a language L and its complement are RE, then L is
recursive.
PROOF
● Let L=L(M1) and L’= L(M2).
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If both a language L and its complement are RE, then L is
recursive.
PROOF
● Let L=L(M1) and L’= L(M2).
● Both M1 and M2, are simulated in parallel by a TM M.
AN UNDECIDABLE PROBLEM THAT IS RE
heorem: If both a language L and its complement are RE, then
T

L is recursive.
PROOF

● Let L=L(M1) and L’= L(M2).

● Both M1 and M2, are simulated in parallel by a TM M.

● One tape of M simulates the tape of M1 while the other

tape of M simulates the tape of M2.


AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If both a language L and its complement are RE, then L is
recursive.
PROOF
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If both a language L and its complement are RE, then L is
recursive.
PROOF:
● If input w to M is in L, then M1 will eventually accept.
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If both a language L and its complement are RE, then L is
recursive.
PROOF:
● If input w to M is in L, then M1 will eventually accept.If so, M
accepts and halts
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If both a language L and its complement are RE, then L is
recursive.
PROOF:
● If input w to M is in L, then M1 will eventually accept.If so, M
accepts and halts
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If both a language L and its complement are RE, then L is
recursive.
PROOF:
● If w is not in L, then it is in L, so M2 will eventually accept. When
M2 accepts, M halts without accepting
AN UNDECIDABLE PROBLEM THAT IS RE
Theorem: If both a language L and its complement are RE, then L is
recursive.
PROOF: Thus, on all inputs, M halts, and L(M) is exactly L. Since M
always halts, and L(M)= L, we conclude that L is recursive
AN UNDECIDABLE PROBLEM THAT IS RE
AN UNDECIDABLE PROBLEM THAT IS RE

● Both L and L’ are


recursive ie, both are in
the inner ring.
AN UNDECIDABLE PROBLEM THAT IS RE

● Neither L nor L’ is RE
ie, both are in the outer
ring
AN UNDECIDABLE PROBLEM THAT IS RE

● L is RE but not
recursive, and L’ is not
RE ie, one is in the
middle ring and the
other is in the outer ring
AN UNDECIDABLE PROBLEM THAT IS RE

● L’ is RE but not
recursive, and L is not
RE; ie, the same as
above) but with L and L’
swapped.
The universal language
The Universal Language
A single TM can be used as a stored program computer, taking its program as
well as its data from one or more tapes on which input is placed
The Universal Language
● We define Lu, the universal language, to be the set of binary strings that
encode, in the notation of a pair (M,w), where M is a TM with the binary input
alphabet, and w is a string in (0+1)*, such that w is in LM.
● That is, Lu is the set of strings representing a TM and an input accepted by
that TM.
● We shall show that there is a TM U, often called the universal Turing machine,
such that Lu =L(U)
The Universal Language
It is easiest to describe U as a multitape Turing machine.

In the case of U, the transitions of M are stored initially on the first tape, along
with the string w.

A second tape will be used to hold the simulated tape of M, using the same
format as for the code of M.That is, tape symbol Xi of M will be represented by 0i,
and tape symbols will be separated by single 1’s.

The third tape of U holds the state of M, with state qi represented by i’s.
The Universal Language
The Universal Language
The operation of U can be summarized as follows

1. Examine the input to make sure that the code for M is a legitimate code for
some TM. If not, U halts without accepting. Since invalid codes are assumed
to represent the TM with no moves, and such a TM accepts no inputs, this
action is correct.
The Universal Language
The operation of U can be summarized as follows

2. Initialize the second tape to contain the input w, in its encoded form. That is, for
each 0 of w, place 10 on the second tape, and for each 1 of w, place 100 there.

Note that the blanks on the simulated tape of M, which are represented by 1000, will
not actually appear on that tape; all cells beyond those used for w will hold the blank of
U.

However, U knows that, should it look for a simulated symbol of M and find its own
blank, it must replace that blank by the sequence 1000 to simulate the blank of M
The Universal Language
The operation of U can be summarized as follows

3. Place 0, the start state of M, on the third tape, and move the head of U’s
second tape to the first simulated cell
The Universal Language
The operation of U can be summarized as follows

4. To simulate a move of M, U searches on its first tape for a transition 0 i0j0k0l0m,


such that 0i is the state on tape 3, and 0j is the tape symbol of M that begins at the
position on tape scanned by U .This transition is the one M would next make
The Universal Language
The operation of U can be summarized as follows

a) Change the contents of tape 3 to 0k; that is, simulate the state change of M
To do so, U first changes all the 0’s on tape 3 to blanks, and then copies 0 k
from tape 1 to tape 3.
b) Replace 0j on tape by 0l; that is, change the tape symbol of M. If more or less
space is needed (i.e., i ≠ l) , use the scratch tape and the shifting over
technique to manage the spacing.
c) Move the head on tape 2 to the position of the next 1 to the left or right,
respectively, depending on whether m =1 (move left) or m = 2 (move right).
Thus, U simulates the move of M to the left or to the right
The Universal Language
4. If M has no transition that matches the simulated state and tape symbol, then in
(4), no transition will be found Thus, M halts in the simulated configuration and U
must do likewise.

5. If M enters its accepting state, then U accepts


The Universal Language
Undecidability of the Universal Language

Theorem: Lu is RE but not recursive


The Universal Language
Undecidability of the Universal Language

Theorem: Lu is RE but not recursive

● Suppose Lu were recursive.


● Then by Theorem, the complement of Lu, would also be recursive.
● However, if we have a TM M to accept Lu, then we can construct a TM to
accept Ld (by a method explained below)
● Since we already know that Ld is not RE, we have a contradiction of our
assumption that Lu is recursive.
The Universal Language
Undecidability of the Universal Language
Theorem: Lu is RE but not recursive
Suppose L(M)=Lu’.
we can modify TM M into a TM M’ that accepts Ld as follows
1. Given string w on its input, M’ changes the input to w111w
2. M’ simulates M on the new input. Since M accepts Lu, it will accept if and only
if Mi does not accept wi ; iE., wi is in Ld
The Universal Language
Undecidability of the Universal Language

Theorem: Lu is RE but not recursive


The Universal Language
Undecidability of the Universal Language
Theorem: Lu is RE but not recursive
Suppose L(M)=Lu’.
we can modify TM M into a TM M’ that accepts Ld as follows
1. Given string w on its input, M’ changes the input to w111w
2. M’ simulates M on the new input. Since M accepts Lu, it will accept if and only
if Mi does not accept wi ; iE., wi is in Ld
Thus, M’ accepts w if and only if w is in Ld.

Ld is not a recursively enumerable language That is, there is no Turing machine that
accepts Ld. we conclude that Lu is not recursive
Undecidable Problems About Turing Machines
Reductions

In general, if we have an algorithm to convert instances of a problem P 1 to


instances of a problem P2, that have the same answer, then we say that P1
reduces to P2 .We can use this proof to show that P2, is at least as hard as P1.
Undecidable Problems About Turing Machines
Reductions

In general, if we have an algorithm to convert instances of a problem P 1 to


instances of a problem P2, that have the same answer, then we say that P1
reduces to P2 .We can use this proof to show that P2, is at least as hard as P1.
Undecidable Problems About Turing Machines
Reductions

Theorem:
If there is a reduction from P1 to P2, then:

a) If P1 is undecidable then so is P2.


b) If P1 is non-RE, then so is P2.
Undecidable Problems About Turing Machines
Turing Machines That Accept the Empty Language

If L(Mi) = Ø, that is, Mi does not accept any input, then w is in Le.

Thus, Le is the language consisting of all those encoded TM ‘s whose language is


empty.
Undecidable Problems About Turing Machines
Turing Machines That Accept the Empty Language

On the other hand, if L(Mi) is not the empty language, then w is in Lne.

Thus, Lne is the language of all codes for Turing machines that accept at least one
input string
Undecidable Problems About Turing Machines
Turing Machines That Accept the Empty Language

we may define the two languages just mentioned as

● Le = { M | L(M) = Ø}
● Lne = { M | L(M) ≠ Ø}

Notice that Le and Lne are both languages over the binary alphabet {0,1}.
Undecidable Problems About Turing Machines
Turing Machines That Accept the Empty Language
Theorem : Lne is recursively enumerable
PROOF:
We have only to exhibit a TM that accepts L ne.
The operation of M is as follows
1. M takes as input a TM code Mi.
2. Using its nondeterministic capability, M guesses an input w that M i might
accept.
3. M tests whether Mi accepts w.
4. If Mi accepts w, then M accepts its own input, which is M i
Undecidable Problems About Turing Machines
Turing Machines That Accept the Empty Language

Theorem : Lne is recursively enumerable


Undecidable Problems About Turing Machines
Turing Machines That Accept the Empty Language

Theorem : Lne is not recursive


Undecidable Problems About Turing Machines
Turing Machines That Accept the Empty Language

Theorem : Le is not RE
Undecidable Problems About Turing Machines
Turing Machines That Accept the Empty Language

A property is trivial if it is either empty (i.e., satisfied by no language at all), or is all


RE languages.Otherwise, it is nontrivial
Undecidable Problems About Turing Machines
Rice’s Theorem and Properties of the RE Languages

Theorem: (Rice’s Theorem) Every nontrivial property of the RE languages is


undecidable
Undecidable Problems About Turing Machines
Rice’s Theorem and Properties of the RE Languages

For instance, the following are undecidable

1. Whether the language accepted by a TM is empty.


2. Whether the language accepted by a TM is finite.
3. Whether the language accepted by a TM is a regular language.
4. Whether the language accepted by a TM is a context free language.
Post’s Correspondence Problem
Post’s Correspondence Problem
We shall prove PCP undecidable by reducing Lu to PCP
Post’s Correspondence Problem
Definition of Post’s Correspondence Problem
An instance of Post’s Correspondence Problem (PCP) consists of two lists of
strings over some alphabetΣ. the two lists must be of equal length. We generally
refer to the A and B lists,and write A=w1,w2,...,wk and B=x1,x2,...xk,
for some integer k. For each i, the pair (wi,xi) is said to be a corresponding
pair
Post’s Correspondence Problem
Give an instance of PCP, tell whether this instance has a solution.
Post’s Correspondence Problem
For instance, let m=4, i1=2,i2=1,i3=1 and i4=3
Post’s Correspondence Problem
For instance, let m=4, i1=2,i2=1,i3=1 and i4=3

That is w2w1w1w3=x2x1x1x3
Post’s Correspondence Problem
For instance, let m=4, i1=2,i2=1,i3=1 and i4=3

That is w2w1w1w3=x2x1x1x3

101111110
Post’s Correspondence Problem
For instance, let m=4, i1=2,i2=1,i3=1 and i4=3

That is w2w1w1w3=x2x1x1x3

101111110
Post’s Correspondence Problem
Give an instance of PCP, tell whether this instance has a solution.
Post’s Correspondence Problem
The Modified PCP

It is easier to reduce Lu to PCP , if we first introduce an intermediate version of


PCP, which we call the Modified Posts Correspondence Problem, or MPCP.
Post’s Correspondence Problem
The Modified PCP
In the modified PCP, there is the additional requirement on a solution that the first
pair on the A and B lists must be the first pair in the solution.
Post’s Correspondence Problem
The Modified PCP
In the modified PCP, there is the additional requirement on a solution that the first
pair on the A and B lists must be the first pair in the solution. More formally, an
instance of MPCP with lists A=w1,w2,...,wk and B=x1,x2,...xk, and a solution is a list
of 0 0r more integers i1,i2,..., im such that

w1wi1wi2...,wim = x1xi1xi2...,xim
Post’s Correspondence Problem
The Modified PCP
We are given an instance of MPCP with lists A=w1,w2,...,wk and B=x1,x2,...xk,
for some integer k.
Post’s Correspondence Problem
The Modified PCP
We are given an instance of MPCP with lists A=w1,w2,...,wk and B=x1,x2,...xk,
for some integer k.
We assume * and $ are symbols not present in the alphabet Σ of this MPCP
instance .
Post’s Correspondence Problem
The Modified PCP
We are given an instance of MPCP with lists A=w1,w2,...,wk and B=x1,x2,...xk,
for some integer k.
We assume * and $ are symbols not present in the alphabet Σ of this MPCP
instance .
We construct a PCP instance C=y0,y1,...,yk+1 and D=z0,z1,...zk+1 , as follows:
Post’s Correspondence Problem
The Modified PCP
We construct a PCP instance C=y0,y1,...,yk+1 and D=z0,z1,...zk+1 , as follows:
1. For i = 1,2,...,k, let yi be wi with a * after each symbol of wi ,and let zi be xi with
a * before each symbol of xi.
Post’s Correspondence Problem
The Modified PCP
We construct a PCP instance C=y0,y1,...,yk+1 and D=z0,z1,...zk+1 , as follows:
1. For i = 1,2,...,k, let yi be wi with a * after each symbol of wi ,and let zi be xi with
a * before each symbol of xi.
2. y=*y1, and z0=z1.
Post’s Correspondence Problem
The Modified PCP
We construct a PCP instance C=y0,y1,...,yk+1 and D=z0,z1,...zk+1 , as follows:
1. For i = 1,2,...,k, let yi be wi with a * after each symbol of wi ,and let zi be xi with
a * before each symbol of xi.
2. y=*y1, and z0=z1.
3. yk+1= $ and zk+1=$
Post’s Correspondence Problem
The Modified PCP
We construct a PCP instance C=y0,y1,...,yk+1 and D=z0,z1,...zk+1 , as follows:
1. For i = 1,2,...,k, let yi be wi with a * after each symbol of wi ,and let zi be xi with
a * before each symbol of xi.
2. y=*y1, and z0=z1.
3. yk+1= $ and zk+1=$
Post’s Correspondence Problem
The Modified PCP
We construct a PCP instance C=y0,y1,...,yk+1 and D=z0,z1,...zk+1 , as follows:
1. For i = 1,2,...,k, let yi be wi with a * after each symbol of wi ,and let zi be xi with
a * before each symbol of xi.
2. y=*y1, and z0=z1.
3. yk+1= $ and zk+1=$
Post’s Correspondence Problem
Theorem: MPCP reduces to PCP
Post’s Correspondence Problem
Reducing Lu to MPCP
Given a pair (M,w), we construct an instance (A,B) of MPCP such that TM M
accepts input w if and only if (A,B) has a solution
Post’s Correspondence Problem
Reducing Lu to MPCP
Let M=(Q,Σ,Γ,δ,q0,B F) be a TM and let w in Σ* be an input string.
We construct an instance of MPCP as follows
Post’s Correspondence Problem
Reducing Lu to MPCP
Let M=(Q,Σ,Γ,δ,q0,B F) be a TM and let w in Σ* be an input string.
We construct an instance of MPCP as follows
1. The first pair is
List A List B
# #q0w#
Post’s Correspondence Problem
Reducing Lu to MPCP
Let M=(Q,Σ,Γ,δ,q0,B F) be a TM and let w in Σ* be an input string.
We construct an instance of MPCP as follows
1. The first pair is
List A List B
# #q0w#
2. Tape symbols and the separator # can be appended to both lists. The pairs
List A List B
X X for
each X in Γ
# #'
Post’s Correspondence Problem
Reducing Lu to MPCP
Let M=(Q,Σ,Γ,δ,q0,B F) be a TM and let w in Σ* be an input string.
We construct an instance of MPCP as follows
1. The first pair is
List A List B
# #q0w#
2. Tape symbols and the separator # can be appended to both lists. The pairs
List A List B
X X for each X
in Γ
# #'
3. To simulate a move of M, we have certain pairs that reflect those moves. For all q in Q-F(ie, q is a
nonaccepting state), p in Q, and X, Y and Z in Γ we have:
List A List B
qX Yp if δ(q,X)=(p,Y,R)
ZqX pZY if δ(q,X)=(p,Y,L); Z is
any tape symbol
q# Yp# if δ(q,B)=(p,Y,R)
Zq# pZY# if δ(q,B)=(p,Y,L); Z is any
tape symbol
Post’s Correspondence Problem
Reducing Lu to MPCP
Let M=(Q,Σ,Γ,δ,q0,B F) be a TM and let w in Σ* be an input string.
We construct an instance of MPCP as follows
4. if q is an accepting state, then for all tape symbols X and Y, there are pairs:

List A List B
XqY q
Xq q
qY q
5. Finally, once the accepting state has consumed all tape symbols
List A List B
q## #
Post’s Correspondence Problem
Reducing Lu to MPCP

Let us convert TM

and input string w =01 to an instance of MPCP.


Post’s Correspondence Problem
Reducing Lu to MPCP
1. The first pair is
List A List B
# #q0w#
Post’s Correspondence Problem
Reducing Lu to MPCP
1. The first pair is
List A List B
# #q0w#

We must start with the first pair, (start state q 1 and input 01) as required in any solution to MPCP
A:#
B:#'q101#'
Post’s Correspondence Problem
Reducing Lu to MPCP
2. Tape symbols and the separator # can be appended to both lists. The pairs
List A List B
X X for
each X in Γ
# #'
Post’s Correspondence Problem
Reducing Lu to MPCP
2. Tape symbols and the separator # can be appended to both lists. The pairs
List A List B
X X for
each X in Γ
# #'
Post’s Correspondence Problem
Reducing Lu to MPCP
3.To simulate a move of M, we have certain pairs that reflect those moves. For all q in Q-F(ie, q is a nonaccepting state), p
in Q, and X, Y and Z in Γ we have:
List A List B
qX Yp if
δ(q,X)=(p,Y,R)
ZqX pZY if δ(q,X)=(p,Y,L); Z is
any tape symbol
q# Yp# if
δ(q,B)=(p,Y,R)
Zq# pZY# if δ(q,B)=(p,Y,L); Z is any
tape symbol
Post’s Correspondence Problem
Reducing Lu to MPCP
3.To simulate a move of M, we have certain pairs that reflect those moves. For all q in Q-F(ie, q is a nonaccepting state), p
in Q, and X, Y and Z in Γ we have:
List A List B
qX Yp if
δ(q,X)=(p,Y,R)
ZqX pZY if δ(q,X)=(p,Y,L); Z is
any tape symbol
q# Yp# if
δ(q,B)=(p,Y,R)
Zq# pZY# if δ(q,B)=(p,Y,L); Z is any
tape symbol
Post’s Correspondence Problem
Reducing Lu to MPCP
4. if q is an accepting state, then for all tape symbols X and Y, there are pairs:

List A List B
XqY q
Xq q
qY q
Post’s Correspondence Problem
Reducing Lu to MPCP
4. if q is an accepting state, then for all tape symbols X and Y, there are pairs:

List A List B
XqY q
Xq q
qY q
Post’s Correspondence Problem
Reducing Lu to MPCP
5. Finally, once the accepting state has consumed all tape symbols
List A List B
q## #
Post’s Correspondence Problem
Reducing Lu to MPCP
5. Finally, once the accepting state has consumed all tape symbols
List A List B
q## #
The Classes P and NP
The Classes P and NP
Problems Solvable in Polynomial Time

A Turing machine M is said to be of time complexity T(n) [or to have running time T(n)], if
wheneverM is given an input w of length n, M halts after making at most T(n) moves,
regardless of whether or not M accepts.

An Example Kruskal’ Algorithm


The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’ Algorithm)

A minimum weight spanning tree has the least possible total edge weight of all spanning
trees
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’ Algorithm)

There is a well-known greedy algorithm, called Kruskal’s Algorithm, for finding a MWST
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’ Algorithm)

There is a well-known greedy algorithm, called Kruskal’s Algorithm, for finding a MWST
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’ Algorithm)

There is a well-known greedy algorithm, called Kruskal’s Algorithm, for finding a MWST
The Classes P and NP
roblems Solvable in Polynomial Time (An Example Kruskal’ Algorithm)
P

There is a well-known greedy algorithm, called Kruskal’s Algorithm,


for finding a MWST

It is possible to implement this algorithm using a computer, not a


Turing machine on a graph with m nodes and e edges in time O(m+ e
log e)
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’
Algorithm)There is a well-known greedy algorithm, called
Kruskal’s Algorithm, for finding a MWST

It is possible to implement this algorithm using a computer, not a


Turing machine on a graph with m nodes and e edges in time
O(m+ e log e)
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’
Algorithm)
When we translate the above ideas to Turing machines, we face
several issues,
● When we deal with Turing machines, we may only think of
problems as languages,and the only output is yes or no, ie,
accept or reject. For instance, the MWST tree problem could
be couched as “given this graph G and limit W, does G have a
spanning tree of weight W or less?”
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’
Algorithm)
Let us consider a possible code for the graphs and weight limits
that could be the input to the MWST problem. The code has five
symbols, 0,1,the left and right parentheses, and the comma
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’
Algorithm)
Let us consider a possible code for the graphs and weight limits
that could be the input to the MWST problem. The code has five
symbols, 0,1,the left and right parentheses, and the comma

100
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’
Algorithm)
Let us consider a possible code for the graphs and weight limits
that could be the input to the MWST problem. The code has five
symbols, 0,1,the left and right parentheses, and the comma

100,101000
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’
Algorithm)
Let us consider a possible code for the graphs and weight limits
that could be the input to the MWST problem. The code has five
symbols, 0,1,the left and right parentheses, and the comma

100,101000(1,10,1111)
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’
Algorithm)
Let us consider a possible code for the graphs and weight limits
that could be the input to the MWST problem. The code has five
symbols, 0,1,the left and right parentheses, and the comma

100,101000(1,10,1111)(1,11,1010)(10,11,1100)
(10,100,10100)(11,100,10010)
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’
Algorithm)
1. One tape can be used to store the nodes and their current
component numbers The length of this table is O(n).
2. A tape can be used,as we scan the edges on the input tape, to
hold the currently least edge weight found, among those edges
that have not been marked “used”. Scanning for the lowest
weight, unmarked edge takes O(n) time.
The Classes P and NP
Problems Solvable in Polynomial Time (An Example Kruskal’
Algorithm)
3. When an edge is selected in a round, This task takes O(n) time.
4. A tape can be used to hold the two components, i and j􀀀 being
merged when an edge is found to connect two previously
unconnected components. This scan also takes O(n) time
The Classes P and NP
An NP Example The Traveling Salesman Problem

You might also like