For each language below over the alphabet
-
$L = \{b, bb, bbb, bba\}$ . - All words which begin and end in
$ba$ . -
$L = \{c^ib^ia^i \;|\; i \geq 0\}$ .
We can distinguish between words having one character by appending
At first, I will define
a | b | |
---|---|---|
Thus establishing the upper bound on number of classes: 6. Now, I will use a “representative” of every class to find the distinguishing extension.
b | ba | baa | bab | |
---|---|---|---|---|
baba | ba | a | ||
bab | ba | a | a | |
baa | ba | |||
ba |
Apparently,
Not only this language doesn’t answer the requirement of having only two letters in its alphabet, it is also not a regular language. Once I prove the language isn’t regular, it immediately follows that it has infinitely many equivalence classes.
Suppose, for contradiction,
Build the reduced DFA of the given NFA:
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,
semithick]
\node[accepting,initial,state] (A) {$q_0$};
\node[accepting,state] (B) [above right of=A] {$q_1$};
\node[state] (C) [below right of=A] {$q_2$};
\node[accepting,state] (D) [right of=B] {$q_3$};
\node[accepting,state] (E) [right of=D] {$q_4$};
\node[accepting,state] (F) [right of=C] {$q_5$};
\node[accepting,state] (G) [right of=F] {$q_6$};
\path (A) edge node {$b,\epsilon$} (B)
edge node {$a$} (D)
edge node {$b$} (C)
edge node {$\epsilon$} (F)
(C) edge node {$a$} (A)
(B) edge node {$a$} (D)
(D) edge node {$b$} (B)
(E) edge node {$b,\epsilon$} (D)
edge node {$a,b$} (G)
edge node {$a$} (F)
(F) edge node {$a$} (G)
(G) edge node {$b$} (F);
\end{tikzpicture}
In the first step, notice that there are no arrows leading to
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,
semithick]
\node[accepting,initial,state] (A) {$q_0$};
\node[accepting,state] (B) [above right of=A] {$q_1$};
\node[state] (C) [below right of=A] {$q_2$};
\node[accepting,state] (D) [right of=B] {$q_3$};
\node[accepting,state] (F) [right of=C] {$q_5$};
\node[accepting,state] (G) [right of=F] {$q_6$};
\path (A) edge node {$b,\epsilon$} (B)
edge node {$a$} (D)
edge node {$b$} (C)
edge node {$\epsilon$} (F)
(C) edge node {$a$} (A)
(B) edge node {$a$} (D)
(D) edge node {$b$} (B)
(F) edge node {$a$} (G)
(G) edge node {$b$} (F);
\end{tikzpicture}
In the next step, we can replace all
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,
semithick]
\node[accepting,initial,state] (A) {$q_0$};
\node[accepting,state] (B) [above right of=A] {$q_1$};
\node[state] (C) [below right of=A] {$q_2$};
\node[accepting,state] (D) [right of=B] {$q_3$};
\node[accepting,state] (F) [right of=C] {$q_5$};
\node[accepting,state] (G) [right of=F] {$q_6$};
\path (A) edge node {$b$} (B)
edge node {$a$} (D)
edge node {$b$} (C)
edge node {$a$} (G)
(C) edge node {$a$} (A)
(B) edge node {$a$} (D)
(D) edge node {$b$} (B)
(F) edge node {$a$} (G)
(G) edge node {$b$} (F);
\end{tikzpicture}
Now we can create product automation to obtain a DFA:
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,
semithick]
\node[accepting,initial,state] (A) {$q_0$};
\node[accepting,state] (B) [above right of=A] {$q_3,q_6$};
\node[accepting,state] (C) [right of=B] {$q_5$};
\node[accepting,state] (D) [right of=C] {$q_6$};
\node[accepting,state] (E) [below right of=A] {$q_1,q_2$};
\node[accepting,state] (F) [right of=E] {$q_3,q_0$};
\node[accepting,state] (G) [above of=F] {$q_1$};
\node[accepting,state] (H) [right of=G] {$q_3$};
\path (A) edge node {$a$} (B)
edge node {$b$} (E)
(B) edge node {$a$} (C)
edge node {$b$} (G)
(C) edge node {$b$} (D)
(D) edge node {$a$} (C)
(E) edge node {$a$} (F)
(F) edge node {$a$} (B)
edge node {$b$} (E)
(G) edge node {$a$} (H)
(H) edge node {$b$} (G);
\end{tikzpicture}
Now we are ready to build the table of “representatives” of the classes:
a | b | aa | ab | ba | aab | |
---|---|---|---|---|---|---|
aba | a | a | a | a | a | |
aab | b | aa | b | b | ||
ba | aa | b | a | b | ||
ab | aa | a | ||||
aa | a | a | ||||
b | b |
Which means that
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,
semithick]
\node[accepting,initial,state] (A) {$q_0$};
\node[accepting,state] (B) [right of=A] {$q_3,q_6,q_1$};
\node[accepting,state] (C) [right of=B] {$q_5,q_3$};
\node[accepting,state] (D) [below of=A] {$q_1,q_2$};
\node[accepting,state] (E) [right of=D] {$q_3,q_0$};
\path (A) edge node {$a$} (B)
edge node {$b$} (D)
(B) edge node {$a$} (C)
(C) edge node {$b$} (B)
(D) edge node {$a$} (E)
(E) edge node {$a$} (B)
edge node {$b$} (D);
\end{tikzpicture}
Prove that the language $L=\{0^r1^s2^t0t+3 \;|\; r,s,t \geq 1\}$ is not regular using Myhill-Nerode theorem.
Assume, for contradiction,
Given alphabet
In the first step I’ll design a DFA to accept this language:
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,
semithick]
\node[initial,state] (A) {$q_0$};
\node[state] (B) [right of=A] {$q_1$};
\node[state] (C) [below of=B] {$q_2$};
\node[state] (D) [below of=C] {$q_3$};
\node[accepting,state] (E) [below of=A, left of=D] {$q_4$};
\node[state] (F) [below of=D] {$q_5$};
\node[accepting,state] (G) [right of=D, right of=C] {$q_6$};
\path (A) edge node {$\Sigma$} (B)
(B) edge node {$\Sigma$} (C)
(C) edge node {$\Sigma \setminus 1$} (B)
edge node {$1$} (D)
(D) edge node {$0$} (F)
edge node {$\Sigma \setminus 1$} (C)
edge [loop right] node {$1$} (D)
(E) edge node {$1$} (D)
edge node {$\Sigma \setminus \{1,0\}$} (C)
edge node {$0$} (F)
(F) edge node {$1$} (E)
edge node {$\Sigma \setminus 1$} (G)
(G) edge node {$1$} (D)
edge node {$\Sigma \setminus 1$} (C);
\end{tikzpicture}
Let’s verify whether every two “representatives” of this automaton have a distinguishing extension:
For the ease of notation
1 | 1 | 1 | ||
0 | 0 | |||
101 |
Since we could find a distinguishing extension for each pair of the states in the automaton, it follows that the number of equivalence classes is the same as the number of the states, i.e. 7.