Unit IV Closure Properties of RE and Recursive Language
Unit IV Closure Properties of RE and Recursive Language
yes
w M
no
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
M’
yes
yes
w M no
no
• Note That:
– M’ accepts iff M does not
– M’ always halts since M always halts
• 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
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