Assignment 01
Assignment 01
Assignment 01
Total Marks: 30
Due Date: 03 April 2023
Instructions:
Q1.
Give the strings of each language of the following problems in ascending order of word length and also
give the cardinalities of the languages.
Example: L= {𝑤 𝑜𝑣𝑒𝑟 Σ = {a, b} | |𝑤| ≤ 3 }, list the members of L and what is the cardinality of L.
L = {Λ, a, b, aa, ab, ba, bb, aaa, aab, aba, abb, baa, bab, bba, bbb}.
Cardinality of L = |L| = 15.
a. 𝐿2 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5 𝑎𝑛𝑑 |𝑤| 𝑖𝑠 𝑜𝑑𝑑 }
b. 𝐿5 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5 𝑎𝑛𝑑 |𝑤| 𝑖𝑠 𝑜𝑑𝑑 𝑎𝑛𝑑 𝑤 𝑠𝑡𝑎𝑟𝑡𝑠 𝑤𝑖𝑡ℎ 𝑎 𝑎𝑛𝑑 𝑒𝑛𝑑𝑠 𝑎𝑡 𝑏 }.
c. 𝐿6 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5, 𝑡ℎ𝑖𝑟𝑑 𝑐ℎ𝑎𝑟𝑐𝑡𝑒𝑟 𝑜𝑓 𝑤 𝑖𝑠 𝑏 }.
Q2.
Consider Σ = {0, 1, 2} design DFA of the following languages.
a. 𝐿1 = {𝑠 𝑜𝑣𝑒𝑟 Σ | 𝑠𝑢𝑚 𝑜𝑓 𝑑𝑖𝑔𝑖𝑡𝑠 𝑖𝑛 𝑠 𝑎𝑟𝑒 ≥ 5 𝑎𝑛𝑑 ≤ 10}
b. 𝐿2 = {𝑠 𝑜𝑣𝑒𝑟 Σ | 𝑠𝑢𝑚 𝑜𝑓 𝑑𝑖𝑔𝑖𝑡𝑠 𝑖𝑛 𝑠 𝑖𝑠 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 2 }
c. 𝐿4 = {𝑠 𝑜𝑣𝑒𝑟 Σ | |𝑠| ≤ 4 𝑎𝑛𝑑 𝑠𝑢𝑚 𝑜𝑓 𝑑𝑖𝑔𝑖𝑡𝑠 𝑖𝑛 𝑠 𝑖𝑠 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 2 𝑜𝑟 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 3 }
d. 𝐿 = {𝑤 ∈ {𝑎, 𝑏}∗ |𝑤 𝑒𝑛𝑑𝑠 𝑤𝑖𝑡ℎ 𝑎𝑏𝑏}
e. 𝐿 = {𝑤 ∈ {𝑎, 𝑏}∗ |𝑤 𝑐𝑜𝑛𝑡𝑎𝑖𝑛 𝑠𝑢𝑏𝑠𝑡𝑟𝑖𝑛𝑔 𝑎𝑏𝑏𝑎𝑎𝑏}
f. 𝐿 = {𝑤 ∈ {𝑎, 𝑏}∗ |𝑤 𝑐𝑜𝑛𝑡𝑎𝑖𝑛𝑠 𝑎𝑡𝑙𝑒𝑎𝑠𝑡 𝑡ℎ𝑟𝑒𝑒 𝑎′𝑠}
g. 𝐿 = {𝑤 ∈ {0,1, 2,3}∗ |𝑠𝑢𝑚 𝑜𝑓 𝑑𝑖𝑔𝑖𝑡𝑠 𝑖𝑛 𝑤 𝑎𝑟𝑒 𝑒𝑖𝑡ℎ𝑒𝑟 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 4 𝑜𝑟 6}
h. 𝐿 = {𝑤 ∈ {𝑎, 𝑏, 𝑐}∗ |𝑛𝑎 (𝑤) 𝑎𝑛𝑑 𝑛𝑏 (𝑤) 𝑎𝑟𝑒 𝑒𝑣𝑒𝑛 𝑏𝑢𝑡 𝑛𝑐 (𝑤) 𝑎𝑟𝑒 𝑜𝑑𝑑}
𝐿 = {𝑤 ∈ Σ ∗ | 𝑤 contains the substring 010, but does not contain the substring 0101}
Q 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.