Exercise with regular languages

In summary, the language L={l ε {a,b}*:the word l does not contain the subword bba} is regular and its equivalence relation has four classes: {[a], [b], [bb], [bba]}. The minimal deterministic finite automaton that recognizes this language has four states, each corresponding to one of the equivalence classes. To find the equivalence classes, one can build the automaton and associate each state with an equivalence class, or use the Myhill-Nerode theorem.
  • #1
mathmari
Gold Member
MHB
5,049
7
Hello!
I need some help at the following exercise:
The language L={l ε {a,b}*:the word l does not contain the subword bba} is regular.Which are the equivalence classes of the relation [tex] \approx_{L} [/tex] ?
Also,which is the smallest(as for the number of states) deterministic automata
that recognize this language?
 
Technology news on Phys.org
  • #2
Have you studied the theory around the Myhill–Nerode theorem? It may be easier to try building the automaton.

Hint: One equivalence class consists of words that contain bba.
 
  • #3
Evgeny.Makarov said:
Hint: One equivalence class consists of words that contain bba.

Could you explain to me how to find the equivalence classes?? :confused:

Why does one equivalence class consists of words that contain bba, since the language is L={l ε {a,b}*:the word l does not contain the subword bba} ?? :confused:
 
Last edited by a moderator:
  • #4
mathmari said:
Why does one equivalence class consists of words that contain bba, since the language is L={l ε {a,b}*:the word l does not contain the subword bba} ?
The equivalence relation is defined not on $L$, but on $\{a, b\}^*$. Thus, even words that are not in $L$ form equivalence classes. If $w\notin L$, then $[w]\cap L=\emptyset$ where $[w]$ is the equivalence class of $w$. This is because $u\approx_L w$ implies $u\varepsilon\in L\iff w\varepsilon\in L$ and $w\varepsilon=w\notin L$ where $\varepsilon$ is the empty word. In other words, $L$ is the union of some classes, and unless $L=\{a,b\}^*$, the complement of $L$ is the union of the rest of the classes.

mathmari said:
Could you explain to me how to find the equivalence classes?
I recommend building an automaton recognizing the language. Then classes are naturally associated with the states of the automaton (with a single state if the automaton is minimal or with a subset of states otherwise). In particular, if a word contains $bba$, then it is definitely not in the language. If an automaton has read $bba$, then it should be in a "sink" state, from which there is no path to an accepting state.

For another example, if an automaton reads $a$ in the initial state, it can stay in that state because reading $a$ does not lead to reading $bba$. In terms of $\approx_L$, $\varepsilon w=w\in L\iff aw\in L$. That is, $a\in[\varepsilon]$. On the other hand, if an automaton reads $b$ in the initial state, it should remember this fact by switching to a different state. Reading $ba$ in that new state is not the same as reading $ba$ in the initial state. Thus, $b\notin[\varepsilon]$ because $bba\in L\nLeftrightarrow ba\in L$.
 
  • #5
Evgeny.Makarov said:
I recommend building an automaton recognizing the language. Then classes are naturally associated with the states of the automaton (with a single state if the automaton is minimal or with a subset of states otherwise). In particular, if a word contains $bba$, then it is definitely not in the language. If an automaton has read $bba$, then it should be in a "sink" state, from which there is no path to an accepting state.

For another example, if an automaton reads $a$ in the initial state, it can stay in that state because reading $a$ does not lead to reading $bba$. In terms of $\approx_L$, $\varepsilon w=w\in L\iff aw\in L$. That is, $a\in[\varepsilon]$. On the other hand, if an automaton reads $b$ in the initial state, it should remember this fact by switching to a different state. Reading $ba$ in that new state is not the same as reading $ba$ in the initial state. Thus, $b\notin[\varepsilon]$ because $bba\in L\nLeftrightarrow ba\in L$.

Is the automaton the following:

[tex] q_{0}\overset{a}{\rightarrow}q_{0} [/tex]
[tex] q_{0}\overset{b}{\rightarrow}q_{1} [/tex]
[tex] q_{1}\overset{a}{\rightarrow}q_{0} [/tex]
[tex] q_{1}\overset{b}{\rightarrow}q_{2} [/tex]
[tex] q_{2}\overset{a}{\rightarrow}q_{3} [/tex]
[tex] q_{2}\overset{b}{\rightarrow}q_{0} [/tex]
[tex] q_{3}\overset{a,b}{\rightarrow}q_{3} [/tex]
Final states: [tex] q_{0},q_{1},q_{2}. [/tex] ??
 
  • #6
In state $q_2$, symbol $b$ should lead again to $q_2$. Your current version accepts $bbba$, which is incorrect. Other than that, I agree.
 
  • #7
So, to find the equivalence classes do I have to find all the words that are created by the automaton?
 
  • #8
I am not sure what you mean by "created". If two words drive the automaton from the initial state to the same state, then they are equivalent. This is because whatever continuation you choose, the automaton will behave the same, i.e., the automaton will end up in the same state on each of the two words plus the continuation. And since the automaton accepts the language in question, it can't happen that one word plus continuation is in the language while the other word plus continuation is not in the language. And this is the definition of $\approx_L$.
 
  • #9
So are the equivalence classes those that consist of the word that contain:
1) a
2) b
3) bb
4) bba
?
 
  • #10
mathmari said:
So are the equivalence classes those that consist of the word that contain:
1) a
2) b
3) bb
4) bba
?
Yes.
 
  • #11
Is building an automaton recognizing the language the only way to find the equivalence classes?
 
  • #12
In some sense, yes because equivalence classes are isomorphic to the minimal automaton in the following sense. For each class $[w]$ there is a state $q_w$ and for each symbol $a$ there is a transition from $q_w$ to $q_{wa}$. This is the content of the Myhill-Nerode theorem. In particular, the number of classes is finite iff the automaton accepting the language is finite and hence the language is regular. Every language has the corresponding equivalence relation and, if I am not mistaken, is accepted by a possibly infinite automaton, but regularity means finiteness.
 
  • #13
So, having found the equivalence classes first, that means that the automaton has so many states as the number the equivalence classes?
 
  • #14
Why don't you study the theorem? "The Myhill–Nerode theorem states that $L$ is regular if and only if $R_L$ has a finite number of equivalence classes, and moreover that the number of states in the smallest deterministic finite automaton (DFA) recognizing $L$ is equal to the number of equivalence classes in $R_L$."
 
  • #15
Ok! Thank you! Your answers were helpful! (Yes)
 

FAQ: Exercise with regular languages

What are regular languages?

Regular languages are a type of formal language that can be described by a regular expression or a deterministic finite automaton. They are used to model patterns in strings, and are commonly used in computer science and linguistics.

Why is it important to exercise with regular languages?

Exercising with regular languages helps to improve our understanding and ability to work with these formal languages. It also allows us to become familiar with different regular expressions and automata, which are essential tools in many areas of computer science.

How can I practice exercises with regular languages?

There are various resources available for practicing exercises with regular languages. You can find online tutorials, textbooks, and even interactive games that allow you to practice constructing regular expressions and automata.

What benefits can I gain from exercising with regular languages?

Exercising with regular languages can improve your problem-solving skills, logical thinking, and ability to analyze and understand complex patterns. It can also help you become more efficient and proficient in working with regular expressions and automata.

Is it necessary to have a strong math or programming background to exercise with regular languages?

While having a strong math or programming background can certainly be helpful, it is not a requirement for exercising with regular languages. With various resources available, anyone can learn and practice exercises with regular languages regardless of their background.

Similar threads

Replies
1
Views
2K
Replies
2
Views
2K
Replies
9
Views
7K
Replies
8
Views
2K
Replies
6
Views
3K
Replies
1
Views
2K
Replies
18
Views
3K
Back
Top