Is the DFA of the language L correct?

  • Topic:
  • Thread starter Thread starter mathmari
  • Start date Start date
  • Tags Tags
    Dfa Language
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
8 replies · 2K views
mathmari
Gold Member
MHB
Messages
4,984
Reaction score
7
Hello! :o

I have to construct the DFA of the language $L=\{w \in \{a,b\}^*: \text{ each } "a" \text{ of the word w is appeared only after and before a } "b"\}$.

I tried the following...Could you tell if it's right?
But is it deterministic? From the second state where do we go with $a$ ?
 

Attachments

  • bab.png
    bab.png
    2.7 KB · Views: 150
Last edited by a moderator:
Physics news on Phys.org
Re: Is the DFA of the language $L$ correct?

mathmari said:
I have to construct the DFA of the language $L=\{w \in \{a,b\}^*: \text{ each } "a" \text{ of the word w is appeared only after and before a } "b"\}$.
Immediately after and before a b, or can there be symbols between them?

mathmari said:
I tried the following...Could you tell if it's right?
This automaton accepts ab where a is not preceeded by a b..

mathmari said:
But is it deterministic? From the second state where do we go with $a$ ?
If consecutives a's are not allowed then there should an arrow to the "sink" state that is not accepting and from which there is no escape.
 
Re: Is the DFA of the language $L$ correct?

Evgeny.Makarov said:
Immediately after and before a b, or can there be symbols between them?

This automaton accepts ab where a is not preceeded by a b..

This is the pronunciation of the exercise.
What I understand is that $aa $ is not allowed but $bb$ or $bba$ or $abbb$ or $babb$ is allowed..
Am I wrong?
 
Re: Is the DFA of the language $L$ correct?

mathmari said:
This is the pronunciation of the exercise.
...
Am I wrong?
In general, we can only help with mathematical questions. I can't help clarify what a certain person meant when he/she devised a particular exercise, especially if there is a chance that there is a language barrier.

To me, the most natural way to interpret the exercise is that each a must be immediately preceded and immediately followed by a b.

mathmari said:
What I understand is that $aa $ is not allowed but $bb$ or $bba$ or $abbb$ or $babb$ is allowed.
The strings $bba$ or $abbb$ should not be allowed because a is not surrounded by b's.
 
Re: Is the DFA of the language $L$ correct?

Evgeny.Makarov said:
In general, we can only help with mathematical questions. I can't help clarify what a certain person meant when he/she devised a particular exercise, especially if there is a chance that there is a language barrier.

To me, the most natural way to interpret the exercise is that each a must be immediately preceded and immediately followed by a b.

The strings $bba$ or $abbb$ should not be allowed because a is not surrounded by b's.

Ok...I tried it again... Is it now correct?
 

Attachments

  • bab.png
    bab.png
    3.2 KB · Views: 131
Re: Is the DFA of the language $L$ correct?

I believe that the empty word should be acceptable because every $a$ (there is none) is surrounded by $b$'s. Also, there is still no arrow to the sink state when $a$ is read in the third state. Finally, why not make $b$ go from the third state back to the second one? Why do you need another accepting state?
 
Evgeny.Makarov said:
I believe that the empty word should be acceptable because every $a$ (there is none) is surrounded by $b$'s. Also, there is still no arrow to the sink state when $a$ is read in the third state. Finally, why not make $b$ go from the third state back to the second one? Why do you need another accepting state?

Do you mean something like that?
 

Attachments

  • bab.png
    bab.png
    3.1 KB · Views: 149
Yes. And the arrows for $a$ and $b$ from the bottom state to itself.
 
Evgeny.Makarov said:
Yes. And the arrows for $a$ and $b$ from the bottom state to itself.

Nice! Thanks a lot for your help! :o