0% found this document useful (0 votes)
20 views13 pages

Unit IV Closure Properties of RE and Recursive Language

Uploaded by

Lochan Shruthi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views13 pages

Unit IV Closure Properties of RE and Recursive Language

Uploaded by

Lochan Shruthi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 13

Closure Properties for Recursive and

Recursively Enumerable Languages

•TMs model General Purpose (GP) Computers:


– If a TM can do it, so can a GP computer
– If a GP computer can do it, then so can a TM

If you want to know if a TM can do X, then some equivalent


question are:
– Can a general purpose computer do X?
– Can a C/C++/Java/etc. program be written to do X?

For example, is a language L recursive?


– Can a C/C++/Java/etc. program be written that always halts and
accepts L?
1
• TM Block Diagrams:
– If L is a recursive language, then a TM M that accepts L and always halts
can be pictorially represented by a “chip” or “box” that has one input and
two outputs.

yes
w M
no

– If L is a recursively enumerable language, then a TM M that accepts L can


be pictorially represented by a “box” that has one output.

yes
w M

2
• Theorem 1: The recursive languages are closed with respect to complementation, i.e., if
L is a recursive language, then so is L   *  L

• Proof: Let M be a TM such that L = L(M) and M always halts. Construct TM M’ as


follows:

M’
yes
yes
w M no
no

• Note That:
– M’ accepts iff M does not
– M’ always halts since M always halts

From this it follows that the complement of L is recursive. 

• Question: How is the construction achieved? Do we simply complement the final states
in the TM? No! A string in L could end up in the complement of L.
– Suppose q5 is an accepting state in M, but q0 is not.
– If we simply complemented the final and non-final states, then q 0 would be an accepting state
in M’ but q5 would not.
– Since q0 is an accepting state, by definition all strings are accepted by M’ 3
• Theorem 2: The recursive languages are closed with respect to union, i.e., if
L1 and L2 are recursive languages, then so is L3  L1  L2

• Proof: Let M1 and M2 be TMs such that L1 = L(M1) and L2 = L(M2) and M1
and M2 always halts. Construct TM M’ as follows:

M’ yes
yes start
w M1 M2 no
no

• Note That:

– L(M’) = L(M1) L(M2)
• L(M’) is a subset of L(M1) U L(M2)
• L(M1) U L(M2) is a subset of L(M’)
– M’ always halts since M1 and M2 always halt

L3  L1  L2 4
It follows from this that is recursive. 
• Theorem 3: The recursive enumerable languages are closed with respect to union, i.e.,
if L1 and L2 are recursively enumerable languages, then so is L3  L1  L2

• Proof: Let M1 and M2 be TMs such that L1 = L(M1) and L2 = L(M2). Construct M’ as
follows:

M’ yes yes
M1

w
yes
M2

• Note That:
– L(M’) = L(M1) U L(M2)
• L(M’) is a subset of L(M1) U L(M2)
• L(M1) U L(M2) is a subset of L(M’)
– M’ halts and accepts iff M1 or M2 halts and accepts
L3  L1  L2
It follows from this that is recursively enumerable. 
5
• Theorem 4: If L and L are both recursively enumerable then L (and therefore L ) is
recursive.

• Proof: Let M1 and M2 be TMs such that L = L(M1) and L= L(M2). Construct M’ as
follows:

M’ yes yes
M1

w
yes
M2 no

• Note That:
– L(M’) = L
• L(M’) is a subset of L
• L is a subset of L(M’)
– M’ is TM for L
– M’ always halts since either M1 or M2 halts for any given string
– M’ shows that L is recursive
It follows from this that L (and therefore its’ complement) is recursive.
So, L is also recursive (we proved it before). 
6
Concatenation of RE Language

• Let L1 = L(M1) and L2 = L(M2).


• Assume M1 and M2 are single-semi-infinite-
tape TM’s.
• Construct 2-tape Nondeterministic TM M:
1. Guess a break in input w = xy.
2. Move y to second tape.
3. Simulate M1 on x, M2 on y.
4. Accept if both accept. 7
Concatenation of Recursive
Language
• Can’t use a NTM.
• Systematically try each break w = xy.
• M1 and M2 will eventually halt for each
break.
• Accept if both accept for any one break.
• Reject if all breaks tried and none lead to
acceptance.
8
Star
• Same ideas work for each case.
• RE: guess many breaks, accept if M 1
accepts each piece.
• Recursive: systematically try all ways to
break input into some number of pieces.

9
Reversal
• Start by reversing the input.
• Then simulate TM for L to accept w if and
only wR is in L.
• Works for either Recursive or RE
languages.

10
11
12
TM as Enumerators

13

You might also like