455 (Toa)
455 (Toa)
Submission date
Submission ID:
File name: Assignment docx (110.11K)
Word count:
Character count:
Assignment no 1
Question no1
Question no 2
a. 𝐿 = {𝑎𝑎, 𝑏𝑏, 𝑎𝑎𝑎𝑎, 𝑏𝑏𝑏𝑏, 𝜆}
Transition Table:
\[
\begin{array}{c|cc}
& a & b \\
\hline
q_0 & q_1 & q_2 \\
q_1 & q_3 & q_4 \\
q_2 & q_4 & q_3 \\
q_3 & q_3 & q_3 \\
q_4 & q_4 & q_4 \\
\end{array}
\]
DFA:
- This language represents strings of length 5, where the first and last symbols are either 'a' or 'b',
and the middle symbol is either 'a' or 'b'.
**DFA:**
- This language represents strings where the first two symbols are 'ab' or 'ba', the last symbol is
'b', and there can be any number of 'a' or 'b' in between.
DFA:
- This language represents strings where the first three symbols are 'aaa', the middle part can
have any number of 'a' or 'b', and the last part can have any number of 'b' followed by 'a' or 'b'.
DFA:
- This language represents strings of length 5 or more, where the first four symbols can be 'a' or
'b', and there must be at least one 'a' or 'b' in the middle.
DFA:
- This language includes the strings 'a', 'ba', 'bba', and the empty string.
DFA:
- This language includes the strings 'aba', 'bab', 'bbbb', and 'aaa'.
Question no 3
### a) {𝑎𝑤𝑎𝑎: 𝑤 ≥ 3, 𝑤{𝑏{𝑎, 𝑏}∗𝑏𝑏}}
### d) Language of the words that start with aa and end bb and have aab as a substring.
RE:
\[ aaXbb + aaYaabZ + aaZaabYbb + aaWaabZaabYbb \]
TG:
1. \( S \rightarrow aaT \)
2. \( T \rightarrow bb \)
3. \( U \rightarrow aaV \)
4. \( V \rightarrow aabW \)
5. \( W \rightarrow Z \)
6. \( Z \rightarrow bb \)
GTG:
- Nodes: \( S, T, U, V, W, Z \)
- Edges: \( S \xrightarrow{a} U, U \xrightarrow{a} V, V \xrightarrow{b} W, W \xrightarrow{Z}
Z, Z \xrightarrow{b} T \)
### b) Language of the words that start and end with different double letters and have aaa as a
substring.
RE:
\[ (XX + YY + ZZ + WW)aaa(X + Y + Z + W) \]
TG:
1. \( S \rightarrow XX + YY + ZZ + WW \)
2. \( T \rightarrow aaaU \)
3. \( U \rightarrow X + Y + Z + W \)
GTG:
- Nodes: \( S, T,U \)
- Edges: \( S \xrightarrow{aaa} T, T \xrightarrow{X + Y + Z + W} U \)
RE:
\[ a{a, b}^*b + aa{a, b}^*b + aaa{a, b}^*b \]
TG:
1. \( S \rightarrow aT \)
2. \( T \rightarrow {a, b}^*b \)
GTG:
- Nodes: \( S, T \)
- Edges: \( S \xrightarrow{a} T, T \xrightarrow{{a, b}} T \)
j) Language of the words that start with bb and end aa with and have baa as a substring.
RE:
\[ bbXaa + bbYbaaX + bbZbaaYaaX + bbWbaaZaaYaaX \]
TG
1. \( S \rightarrow bbT \)
2. \( T \rightarrow aaU \)
3. \( U \rightarrow baV \)
4. \( V \rightarrow aaW \)
5. \( W \rightarrow X \)
6. \( X \rightarrow Y \)
7. \( Y \rightarrow Z \)
8. \( Z \rightarrow W \)
GTG:
- Nodes: \( S, T, U, V, W, X, Y, Z \)
- Edges: \( S \xrightarrow{a} T, T \xrightarrow{a} U, U \xrightarrow{b} V, V \xrightarrow{a}
W, W \xrightarrow{X} X, X \xrightarrow{Y} Y, Y \xrightarrow{Z} Z, Z \xrightarrow{W} T \)
k) All the Strings in which the total no of 1’s is divisible by 3, no matter how they are arranged
such as 1101100101.
RE:
\[ (0 + (1(1(1(0 + 00)0 + 0) + 0)))^* \]
TG:
1. \( S \rightarrow 0T \)
2. \( T \rightarrow (1U + 0)^* \)
3. \( U \rightarrow (1V + 0)^* \)
4. \( V \rightarrow (1(1W + 00) + 0)^* \)
5. \( W \rightarrow (1(1X + 00)0 + 0)^* \)
6. \( X \rightarrow 1Y + 0 \)
7. \( Y \rightarrow (1Z + 00)0 \)
8. \( Z \rightarrow 1W + 0 \)
GTG:
- Nodes: \( S, T, U, V, W, X, Y, Z \)
- Edges: \( S \xrightarrow{0} T, T \xrightarrow{(1U + 0)^*} T, U \xrightarrow{(1V + 0)^*} U,
V \xrightarrow{(1(1W + 00) + 0)^*} V, W \xrightarrow{(1(1X + 00)0 + 0)^*} W, X \
xrightarrow{1Y + 0} Y, Y \xrightarrow{(1Z + 00)0} Y, Z \xrightarrow{1W + 0} W \)
l) All the words in which any 0’s that occur are found in clumps of odd numbers.
RE:
\[ (1 + (0(00)^*1))^* \]
TG:
1. \( S \rightarrow 1T \)
2. \( T \rightarrow (0U + 1)^* \)
3. \( U \rightarrow (00V + 1)^* \)
4. \( V \rightarrow 1 \)
GTG:
- Nodes: \( S, T, U, V \)
- Edges: \( S \xrightarrow{1} T, T \xrightarrow{(0U + 1)^*} T, U \xrightarrow{(00V + 1)^*} U,
V \xrightarrow{1} T \)