You are on page 1of 1

Theory of Automata

Assignment 2
Due Date: 11th November in the Class

Problem#1: Consider Σ = {a, b}, design DFA of the following languages:

a. 𝐿 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5 𝑎𝑛𝑑 |𝑤| 𝑖𝑠 𝑜𝑑𝑑 }.


b. 𝐿 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5 𝑎𝑛𝑑 |𝑤| 𝑖𝑠 𝑒𝑣𝑒𝑛 }.
c. 𝐿 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5 }.
d. 𝐿 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5 𝑎𝑛𝑑 |𝑤| 𝑖𝑠 𝑜𝑑𝑑 𝑎𝑛𝑑 𝑤 𝑠𝑡𝑎𝑟𝑡𝑠 𝑤𝑖𝑡ℎ 𝑎 𝑎𝑛𝑑 𝑒𝑛𝑑𝑠 𝑎𝑡 𝑏 }.
e. 𝐿 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5, 𝑡ℎ𝑖𝑟𝑑 𝑐ℎ𝑎𝑟𝑐𝑡𝑒𝑟 𝑜𝑓 𝑤 𝑖𝑠 𝑏 }.

Problem#2: Consider Σ = {0, 1, 2} design DFA of the following languages.

a. 𝐿1 = {𝑠 𝑜𝑣𝑒𝑟 Σ | 𝑠𝑢𝑚 𝑜𝑓 𝑑𝑖𝑔𝑖𝑡𝑠 𝑖𝑛 𝑠 𝑎𝑟𝑒 ≥ 5 𝑎𝑛𝑑 ≤ 10}


b. 𝐿2 = {𝑠 𝑜𝑣𝑒𝑟 Σ | 𝑠𝑢𝑚 𝑜𝑓 𝑑𝑖𝑔𝑖𝑡𝑠 𝑖𝑛 𝑠 𝑖𝑠 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 2 }
c. 𝐿3 = {𝑠 𝑜𝑣𝑒𝑟 Σ | 𝑠𝑢𝑚 𝑜𝑓 𝑑𝑖𝑔𝑖𝑡𝑠 𝑖𝑛 𝑠 𝑖𝑠 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 3 }
d. 𝐿4 = {𝑠 𝑜𝑣𝑒𝑟 Σ | |𝑠| ≤ 4 𝑎𝑛𝑑 𝑠𝑢𝑚 𝑜𝑓 𝑑𝑖𝑔𝑖𝑡𝑠 𝑖𝑛 𝑠 𝑖𝑠 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 2 𝑜𝑟 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 3 }
e. 𝐿 = {𝑤 ∈ {𝑎, 𝑏}∗ |𝑤 𝑒𝑛𝑑𝑠 𝑤𝑖𝑡ℎ 𝑎𝑏𝑏}
f. 𝐿 = {𝑤 ∈ {𝑎, 𝑏}∗ |𝑤 𝑐𝑜𝑛𝑡𝑎𝑖𝑛 𝑠𝑢𝑏𝑠𝑡𝑟𝑖𝑛𝑔 𝑎𝑏𝑏𝑎𝑎𝑏}
g. 𝐿 = {𝑤 ∈ {𝑎, 𝑏}∗ |𝑤 𝑐𝑜𝑛𝑡𝑎𝑖𝑛𝑠 𝑎𝑡𝑙𝑒𝑎𝑠𝑡 𝑡ℎ𝑟𝑒𝑒 𝑎′𝑠}
h. 𝐿 = {𝑤 ∈ {0,1, 2,3}∗ |𝑠𝑢𝑚 𝑜𝑓 𝑑𝑖𝑔𝑖𝑡𝑠 𝑖𝑛 𝑤 𝑎𝑟𝑒 𝑒𝑖𝑡ℎ𝑒𝑟 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 4 𝑜𝑟 6}
i. 𝐿 = {𝑤 ∈ {0,1,2,3,4,5,6,7,8,9}∗ |𝑤 𝑖𝑠 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 5 𝑎𝑛𝑑 6}
j. 𝐿 = {𝑤 ∈ {𝑎, 𝑏, 𝑐}∗ |𝑛𝑎 (𝑤) 𝑎𝑛𝑑 𝑛𝑏 (𝑤) 𝑎𝑟𝑒 𝑒𝑣𝑒𝑛 𝑏𝑢𝑡 𝑛𝑐 (𝑤) 𝑎𝑟𝑒 𝑜𝑑𝑑}
k. 𝐿 = {𝑤 ∈ Σ∗ | 𝑤 contains the substring 010, but does not contain the substring 0101}

Problem#3: In each part below, draw an FA accepting the indicated language over {a, b}.
a. The language of all strings containing exactly two a’s.
b. The language of all strings containing at least two a’s.
c. The language of all strings that do not end with ab.
d. The language of all strings that begin or end with aa or bb.
e. The language of all strings not containing the substring aa.
f. The language of all strings in which the number of a’s is even.
g. The language of all strings in which both the number of a’s and the number of b’s are
even.
h. The language of all strings containing no more than one occurrence of the string aa.
(The string aaa contains two occurrences of aa.)
i. The language of all strings in which every a (if there are any) is followed immediately by
bb.
j. The language of all strings containing both bb and aba as substrings.
k. The language of all strings containing both aba and bab as substrings.

You might also like