Lecture 17. Closure Properties of Recursive and R.E. Languages
Lecture 17. Closure Properties of Recursive and R.E. Languages
languages
1
If L1 and L2 are recursive, then L1 ∪ L2 is recursive.
Proof:
• Let L1 and L2 be two recursive languages.
• Then there exists two Turing machines M1 and M2 that
decides M1 and M2, respectively.
• Construct a new 2-tape Turing machine M that operates
as follows:
1. Copy the input string w from the first tape to the second
tape.
2. Simulate M1 on the first tape. If M1 halts at y, then
M halts at y. If M1 halts at n, proceed to step 3.
3. Simulate M2 on the second tape. If M2 halts at y, then
M halts at y. If M2 halts at n, then M also halts at n.
• Verify that M indeed decides L1 ∪ L2:
· If w ∈ L1 ∪ L2 ⇒ w ∈ L1 or w ∈ L2 ⇒ (M1 halts at y)
or (M2 halts at y) ⇒ M halts at y.
· If w ∈
/ L1 ∪ L2 ⇒ w ∈ / L1 and w ∈/ L2 ⇒ (M1 halts at
n) and (M2 halts at n) ⇒ M halts at n.
2
If L1 and L2 are recursive, then L1L2 is recursive.
Proof:
• Let L1 and L2 be two recursive languages.
• Then there exists two Turing machines M1 and M2 that
decides M1 and M2, respectively.
• Construct a nondeterministic 2-tape Turing machine which
operates as follows:
1. nondeterministically splits w into two strings x and y
such that w = xy, then copy y to the second tape
(leaving x on the first tape).
2. Simulate M1 on the first tape. If M1 halts at n, then
this computation of M rejects w. If M1 halts at y, then
M continues to simulate M2 on the second tape. If M2
halts at y, then M accepts w. If M2 halts at n, then
again this computation rejects w.
• Verify that M indeed decides L1L2:
· If w ∈ L1L2 ⇒ there exists x and y such that w = xy
where x ∈ L1 and y ∈ L2 ⇒ M can choose to split w = xy,
which will allow it to lead to M1 accepts x and M2 accepts
y, thus M accepts w in that computation, thus w ∈ L(M ).
· If w ∈
/ L1L2 ⇒ for all x and y such that w = xy either
x∈ / L1 or y ∈
/ L2 ⇒ for all x and y, either M1 rejects x or
M2 rejects y. Thus M rejects w, and w ∈ / L(M ).
3
Closure properties of r.e. languages