You are on page 1of 1

[Quiz—2] Summer 2021: CSE 309: Theory of Automata

Tuesday, July 8, 2021. Total Marks: 10, Duration: 30 minutes

— SOLUTION —
Question 1 [5 points]
Let L1 = {1, 11, 111, 1111, . . .} and L2 = {0, 00, 000, 0000, . . .}. Design a Turing machine M
that accepts the strings from L1 ∪ L2 .

Solution: Let M1 be a TM that decides L1 and M2 be a TM that decides L2 . We can


construct a Turing machine M for the language L = L1 ∪ L2 as following:
M = “on input w:

1. Pass w to both L1 and L2

2. Let a1 and a2 be the responses from L1 and L2 , respectively

3. if any of a1 or a2 is accept then accept, reject, otherwise.”

Question 2 [5 points]
Prove or disprove following:
Let A1 , A2 , . . . , An be a finite collection of (possibly infinite) regular languages defined over
some alphabet Σ such that all Ai ’s are pair-wise disjoint. Then, the language ni=1 Ai can be
S

recognized a deterministic Turing machine.


[Hint: Give a proof if the above statement is true or give a counterexample if the statement
is false.]

Solution: The above statement is True and we can construct a deterministic Turing
machine that accepts the union of regular languages A1 , A2 , . . . , An .
Since A1 , A2 , . . . , An are regular languages therefore they can be decided by Turing ma-
chines M1 , M2 , . . . , Mn , respectively. We can construct a deterministic Turing machine
M for the language ni=1 Ai as following:
S

M = “On input w:

1. Pass w to each Turing machine M1 , M2 , . . . , Mn

2. Let a1 , a2 , . . . , an be responses from M1 , M2 , . . . , Mn , respectively

3. If any ai from a1 , a2 , . . . , an is accept then accept, reject, otherwise.”

The above Turing machine M is deterministic and decides (not just recognize) the lan-
guage ni=1 Ai .
S

You might also like