TOC-V
TOC-V
SATHYABAMA
Institute of Science and Technology
Deemed to be University
Chennai.
T( RL) U(REL)
• If T is TM recognizing L(RL) then we can get a TM that
accepts the language L by modifying T so that when the
output is 0 it does not enter the reject state but enters into
an infinite loop.
Theorem 2:
Statement:
The complement of a RL is recursive (or) If L is recursive, so is L ′.
• Let L be a Recursive Language and M be the TM that halts on all inputs and
accepts L.
• Construct M1 for L′.
• M accepts and halts for Yes, then M′ rejects and halts.
• M rejects and halts for N, then M′ accepts and halts.
Theorem 4:
Statements:
i. Union of two recursive languages is recursive.
ii. Union of two recursively enumerable
languages is REL.
iii. Intersection of two recursively enumerable
languages is REL.
i. Union of two recursive languages is recursive.
Solution :
B A ABC
BA AB C
BAABC
BAABC
Order: 1,2,4
Example 2: PCP
Consider the following domino’s
A B
1. 1 111
2. 10111 10
3. 10 0
Solution :
1 1 1 …..
111
11111111
Order: 1,
Example 3: PCP
Consider the following domino’s
Solution :
10 10 10 …
10101101101
101011011011
Order: 1,3
• Example 4:
1 2 3 4 5
• Solution:
1 5 2 3 4 4 3 4
Halting Problem
40
A non-Trivial Property
• A non-trivial property is satisfied by some
recursively enumerable languages and are not
satisfied by others.
• Formally speaking, in a non-trivial property,
where L ∈ P, both the following properties hold:
– Property 1 − There exists Turing Machines, M1 and
M2 that recognize the same language, i.e. either
( <M1>, <M2> ∈ L ) or ( <M1>,<M2> ∉ L )
– Property 2 − There exists Turing Machines M1 and
M2, where M1 recognizes the language while M2
does not, i.e. <M1> ∈ L and <M2> ∉ L
Reductions
• A reduction from language L to language L’ is an
algorithm (TM that always halts) that takes a
string w and converts it to a string x, with the
property that:
x is in L’ if and only if w is in L.
• If we reduce L to L’, and L’ is decidable,
– then the algorithm for L’ + the algorithm of the
reduction shows that L is also decidable.
42
Picture of the Reduction
Accept
iff M
accepts w
M, w M’
A real Hypothetical
reduction algorithm for
algorithm property P Otherwise
halt without
accepting
43
Proof of Rice’s Theorem
• Assume: every nontrivial property P of the RE
languages, LP is decidable.
• We show how to reduce Lu to LP.
• Since we know Lu is decidable, it follows that LP
is also decidable.
44
The Reduction
• Our reduction algorithm must take M and w
and produce a TM M’.
• L(M’) has property P if and only if M accepts
w.
• M’ has two tapes, used for:
Simulates another TM- ML on the input to M’.
Simulates M on w.
Note: neither M, ML, nor w is input to M’.
45
The Reduction – (2)
• Assume that does not have property P.
• Proof
– Let L be any language with property P, and let ML
be a TM that accepts L.
46
Design of M’
1. On the second tape, write w and then
simulate M on w.
2. If M accepts w, then simulate ML on the input
x to M’, which appears initially on the first
tape.
3. M’ accepts its input x if and only if ML accepts
x.
47
Action of M’ if M Accepts w
On accept
Simulate M Simulate ML
x on input w on input x
Accept
iff x is
in ML
48
Design of M’ – (2)
• Suppose M accepts w.
• Then M’ simulates ML and therefore accepts x
if and only if x is in L.
• That is, L(M’) = L, L(M’) has property P, and M’
is in LP.
49
Design of M’ – (3)
• Suppose M does not accept w.
• Then M’ never starts the simulation of ML, and never
accepts its input x.
• Thus, L(M’) = , and L(M’) does not have property P.
• That is, M’ is not in LP.
50
Design of M’ – Conclusion
• Thus, the algorithm that converts M and w to
M’ is a reduction of Lu to LP.
• Thus, LP is undecidable.
• Hence Rice Theorem is proved
51
Applications of Rice’s Theorem
• We now have any number of undecidable
questions about TM’s:
– Is L(M) a regular language?
– Is L(M) a CFL?
– Does L(M) include any palindromes?
– Is L(M) empty?
– Does L(M) contain more than 1000 strings?
– Etc., etc.
52
THANK YOU