Assignment 1
Assignment 1
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: 𝐿 = {𝑤 𝑜𝑣𝑒𝑟 Σ = {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 is 15.
a. 𝐿1 = Σ0 ∪ Σ1 ∪ Σ2 ∪ Σ3 .
b. 𝐿2 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5 𝑎𝑛𝑑 |𝑤| 𝑖𝑠 𝑜𝑑𝑑 }.
c. 𝐿3 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5 𝑎𝑛𝑑 |𝑤| 𝑖𝑠 𝑒𝑣𝑒𝑛 }.
d. 𝐿4 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5 }.
e. 𝐿5 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5 𝑎𝑛𝑑 |𝑤| 𝑖𝑠 𝑜𝑑𝑑 𝑎𝑛𝑑 𝑤 𝑠𝑡𝑎𝑟𝑡𝑠 𝑤𝑖𝑡ℎ 𝑎 𝑎𝑛𝑑 𝑒𝑛𝑑𝑠 𝑎𝑡 𝑏 }.
f. 𝐿6 = {𝑤 𝑜𝑣𝑒𝑟 Σ | |𝑤| > 2 𝑎𝑛𝑑 |𝑤| ≤ 5, 𝑡ℎ𝑖𝑟𝑑 𝑐ℎ𝑎𝑟𝑐𝑡𝑒𝑟 𝑜𝑓 𝑤 𝑖𝑠 𝑏 }.
g. 𝐿2 ∩ 𝐿3 and |𝐿2 ∩ 𝐿3 | = ?
h. 𝐿2 ∩ 𝐿4 and |𝐿2 ∩ 𝐿4 | = ?
i. 𝐿3 ∩ 𝐿4 and |𝐿3 ∩ 𝐿4 | = ?
j. 𝐿2 − 𝐿4 𝑎𝑛𝑑 |𝐿2 − 𝐿4 | = ?
k. 𝐿3 − 𝐿4 𝑎𝑛𝑑 |𝐿3 − 𝐿4 | = ?
a. The language of all strings over {a, b} containing exactly two a’s.
b. The language of all strings over {a, b} containing at least two a’s.
c. The language of all strings over {a, b} that do not end with ab.
d. The language of all strings over {a, b} not containing the substring ab.
e. The language of all strings over {0, 1} in which number of 0’s are even and string length is odd.