Is the DFA of the language L correct?

In summary, 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"\}$ is correct, but it needs another accepting state for the empty word.
  • #1
mathmari
Gold Member
MHB
5,049
7
Hello! :eek:

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: 75
Last edited by a moderator:
Technology news on Phys.org
  • #2
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.
 
  • #3
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?
 
  • #4
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.
 
  • #5
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: 66
  • #6
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?
 
  • #7
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: 64
  • #8
Yes. And the arrows for $a$ and $b$ from the bottom state to itself.
 
  • #9
Evgeny.Makarov said:
Yes. And the arrows for $a$ and $b$ from the bottom state to itself.

Nice! Thanks a lot for your help! :eek:
 

FAQ: Is the DFA of the language L correct?

What is a DFA?

A DFA, or Deterministic Finite Automaton, is a type of finite state machine used in computer science and mathematics to recognize patterns in strings of characters.

What is the language L in reference to the DFA?

The language L is the set of all strings that can be recognized and accepted by the DFA. The DFA is designed specifically for this language, and any input string that is not a part of L will not be accepted by the DFA.

How is the correctness of a DFA determined?

The correctness of a DFA is typically determined by testing it with a variety of input strings, both from the language L and from outside of L. If the DFA correctly accepts all strings from L and rejects all other strings, it is considered to be correct.

What are some common errors in a DFA that can result in incorrect recognition?

Some common errors in a DFA include missing or incorrect transitions between states, duplicate states, or incomplete or incorrect final states. These errors can cause the DFA to accept strings that are not a part of L or reject strings that should be accepted.

Can a DFA ever be guaranteed to be correct?

No, a DFA is not guaranteed to be correct. It is possible that the DFA may not be able to recognize certain strings that are a part of L, or may incorrectly accept strings that are not in L. However, with careful design and testing, the chances of a DFA being incorrect can be greatly reduced.

Similar threads

Replies
6
Views
3K
Replies
10
Views
3K
Replies
13
Views
4K
Replies
18
Views
3K
Replies
10
Views
3K
Replies
4
Views
2K
Replies
43
Views
7K
Replies
24
Views
4K
Back
Top