What Language Does This DFA Recognize?

10 replies · 3K views · last reply
evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hello! (Wave)

The following DFA is given:

View attachment 5685

I want to find the language that it recognizes. The alphabet is $\Sigma=\{0,1\}$.

Isn't the language this one: $(0^{\ast} 1^{+} 0^{\ast} )^{+}$?

Also I want to draw a dfa that recognizes the following languages and that have the referred number of states. The alphabet is still $\{0,1\}$.

  • $\{0\}$, with two states
  • $1^{\ast} (001^+)^{\ast}$, with 3 states
  • $\{ \epsilon \}$ , with 1 state
  • $0^{\ast}$ with 1 state


But can it be that $1$ goes nowhere? :eek:


But then the word $1$ isn't accepted... :( What could we change?


Can it be that 0 and 1 go nowhere? (Worried)

Again $1$ goes nowhere... Is that possible?
 
Attachments
  • DFA with start state q1 (unmarked) and accept state q2 (double circle). q1 loops on 0; q1 to q2 on 1; q2 loops on 1; q2 to q1 on 0.
    dfa.png
    2.4 KB · Views: 175
  • Two-state DFA diagram: start state q1 with an arrow labeled 0 leading to accepting state q2, drawn with a double circle.
    zero.png
    1.3 KB · Views: 174
  • State diagram of a DFA with states q1, q2 and q3, where q3 is the double-circled accepting state; q1 loops on 1, q1 goes to q2 on 0, q2 goes to q1 on 1 and to q3 on 0, q3 loops on 1 and goes back to q2 on 0.
    d2.png
    3.2 KB · Views: 178
  • Diagram of a single-state automaton: an unlabeled incoming arrow points into a double-ringed circle, marking one state as both start and accepting.
    d3.png
    697 bytes · Views: 173
  • State diagram of a DFA with a single start state marked by an incoming arrow, drawn as a double circle (accepting), with a self-loop labeled 0.
    d4.png
    1.3 KB · Views: 155
Hey evinda! (Wave)

evinda said:
Isn't the language this one: $(0^{\ast} 1^{+} 0^{\ast} )^{+}$?

Does the DFA allow a $0$ at the end? (Wondering)

Also I want to draw a dfa that recognizes the following languages and that have the referred number of states. The alphabet is still $\{0,1\}$.

  • $\{0\}$, with two states
But can it be that $1$ goes nowhere? :eek:

It depends on the definition of a DFA that you have. Does it allow that? (Wondering)
As far as I'm concerned, it should be fine if $1$ doesn't go anywhere - it keeps the DFA simple and straight forward.
But if we want $1$ to go somewhere as well, we can introduce a new state that we call sink and define a transition for $1$ to it. Since it's not a final state, the machine can be "stuck" there and not accept the word.

Btw, shouldn't there be an arrow identifying the start state?

  • $1^{\ast} (001^+)^{\ast}$, with 3 states
But then the word $1$ isn't accepted... What could we change?

You didn't identify the start state yet. :eek:
How about making $q_3$ the start state?

Btw, doesn't your machine accept an arbitrary number of consecutive $0$'s? Should it? (Wondering)

  • $\{ \epsilon \}$ , with 1 state
Can it be that 0 and 1 go nowhere?

  • $0^{\ast}$ with 1 state
Again $1$ goes nowhere... Is that possible?

Same thing, if necessary we can introduce a sink state.
 
I like Serena said:
Does the DFA allow a $0$ at the end? (Wondering)

No, it doesn't... (Shake) So should the language be of the following form?

$(0^{\ast} 1^+ 0^{+}1)^{\ast}$
I like Serena said:
It depends on the definition of a DFA that you have. Does it allow that? (Wondering)

View attachment 5690

View attachment 5691
I like Serena said:
As far as I'm concerned, it should be fine if $1$ doesn't go anywhere - it keeps the DFA simple and straight forward.
But if we want $1$ to go somewhere as well, we can introduce a new state that we call sink and define a transition for $1$ to it. Since it's not a final state, the machine can be "stuck" there and not accept the word.

Btw, shouldn't there be an arrow identifying the start state?

So you mean that the DFA could be drawn as follows?

View attachment 5692

I like Serena said:
Btw, doesn't your machine accept an arbitrary number of consecutive $0$'s? Should it? (Wondering)

It does... But, it shouldn't... (Worried)

I like Serena said:
You didn't identify the start state yet. :eek:
How about making $q_3$ the start state?
View attachment 5693

But now we have again consecutive 0s ... What could we do to change that? (Thinking)
 
Attachments
  • Definition 1.5 from a textbook: A finite automaton is a 5-tuple (Q, Σ, δ, q0, F), where 1. Q is a finite set called the states, 2. Σ is a finite set called the alphabet, 3. δ: Q × Σ→Q is the transition function, 4. q0 ∈ Q is the start state, and 5. F ⊆ Q is the set of accept states.
    fin.JPG
    12.3 KB · Views: 191
  • Printed textbook page with two paragraphs defining deterministic and nondeterministic computation; the words "deterministic" and "nondeterministic" are highlighted in blue and yellow.
    dett.JPG
    17.2 KB · Views: 165
  • State diagram of a DFA with states q1, q2 (accepting, double circle), q3 and q4 (dashed). Start arrow into q1; q1 goes to q2 on 0, q1 goes to q3 on 1; q2 goes to q3 on 0 and to q4 on 1.
    fr2.png
    2.8 KB · Views: 152
  • State diagram with three states q1, q2, q3, where q1 and q3 are accepting. Start arrow enters q3; q3 loops on 1 and goes to q2 on 0. q2 goes to q1 on 0. q1 loops on 1 and goes back to q2 on 0.
    fr4.png
    3 KB · Views: 169
evinda said:
No, it doesn't... (Shake) So should the language be of the following form?

$(0^{\ast} 1^+ 0^{+}1)^{\ast}$
https://www.physicsforums.com/attachments/5685

How about the word $1$? Does the DFA accept it? And your expression? (Wondering)Let's go through this state by state.
In state q1 we can accept $0^*$ followed by $1$ to q2 followed by $1\ast$ after which we can stop.
That is: $0^* 1 1^* = 0^* 1^+$.

After that, we can go back to q1 with $0$, followed by $0^*$, followed again by $1 1^*$ after which we can stop.
So: $0^* 1 1^* 0 0^* 1 1^* = 0^* 1^+ 0^+ 1^+$.

And we can keep going to get: $0^* 1^+ 0^+ 1^+ 0^+ 1^+ 0^+ 1^+ ...$.

So we can have:
$$
0^* 1^+ \\
0^* 1^+ 0^+ 1^+ \\
0^* 1^+ 0^+ 1^+ 0^+ 1^+ 0^+ 1^+ ...
$$
Hmm, how can we abbreviate that? (Wondering)
https://www.physicsforums.com/attachments/5690
View attachment 5691

The fact that $\delta$ is a function of $Q\times \Sigma$ implies that every state should have outgoing arrows for each input symbol.
However, with the number of supposed states that is given for each problem, there is no room for a sink. (Nerd)

Btw, it specifies that the start state should be $q_0$, but that's not the case in your DFA's. :eek:
So you mean that the DFA could be drawn as follows?

I was thinking more of:
View attachment 5694
However, the problem statement says you should have 2 states, so I don't think you're supposed to include a sink.
It does... But, it shouldn't... (Worried)

But now we have again consecutive 0s ... What could we do to change that? (Thinking)

Let's start with introducing new states where needed.
We should get the following DFA:
View attachment 5696
Agreed? (Wondering)

However, we should have 3 states instead of 4.
Fortunately states $q_0$ and $q_3$ look the same.
Could we leave out $q_3$ and redirect its arrows to $q_0$? (Wondering)
 
Attachments
  • State diagram of a DFA with states q0 (start), q1 (accepting, double circle), and q2. Arrows: q0 to q1 labeled 0; q0 to q2 labeled 1; q1 to q2 labeled 0,1; q2 self-loop labeled 0,1.
    DFA_with_sink.png
    3.1 KB · Views: 162
  • State diagram of a DFA with states q0 (start, accepting), q1, q2 and q3 (accepting); arrows labelled 1, 0, 0, 1 move q0 to q1 to q2 to q3, with 1 looping on q0 and q3, and 0 from q3 back to q1.
    DFA_1ast_001plusast.png
    4.1 KB · Views: 173
1. It would be better to devote its own thread to every question. Discussing five automata in one thread is confusing.

2. I believe you are using the Sipser's book "Introduction To The Theory Of Computation". There the transition function of a DFA returns a state and is total, i.e., every state must have an outgoing arrow for every symbol. This is in contrast to NFAs, where the transition function returns a set (possibly empty) of states. I believe it is not possible to construct a DFA with one state accepting $\{\varepsilon\}$ or $0^*$,but it is possible to construct such NFAs.

3. It would be helpful of you specify exercise numbers if exercises are taken from the Sipser's book.
 
I like Serena said:
How about the word $1$? Does the DFA accept it? And your expression? (Wondering)Let's go through this state by state.
In state q1 we can accept $0^*$ followed by $1$ to q2 followed by $1\ast$ after which we can stop.
That is: $0^* 1 1^* = 0^* 1^+$.

After that, we can go back to q1 with $0$, followed by $0^*$, followed again by $1 1^*$ after which we can stop.
So: $0^* 1 1^* 0 0^* 1 1^* = 0^* 1^+ 0^+ 1^+$.

And we can keep going to get: $0^* 1^+ 0^+ 1^+ 0^+ 1^+ 0^+ 1^+ ...$.

So we can have:
$$
0^* 1^+ \\
0^* 1^+ 0^+ 1^+ \\
0^* 1^+ 0^+ 1^+ 0^+ 1^+ 0^+ 1^+ ...
$$
Hmm, how can we abbreviate that? (Wondering)

So the language is this one: $0^{\ast} 1^+ (0^+ 1^+)^{\ast}$, right?
I like Serena said:
The fact that $\delta$ is a function of $Q\times \Sigma$ implies that every state should have outgoing arrows for each input symbol.
However, with the number of supposed states that is given for each problem, there is no room for a sink. (Nerd)

(Nod)
I like Serena said:
Let's start with introducing new states where needed.
We should get the following DFA:

Agreed? (Wondering)

However, we should have 3 states instead of 4.
Fortunately states $q_0$ and $q_3$ look the same.
Could we leave out $q_3$ and redirect its arrows to $q_0$? (Wondering)

Yes... (Nod) Ah, I see... Then the DFA will be the following, right?

View attachment 5697

Does this often happen that we draw a dfa with one more state than the desired number and that the final state is equal to the initial one?

- - - Updated - - -

Evgeny.Makarov said:
1. It would be better to devote its own thread to every question. Discussing five automata in one thread is confusing.

2. I believe you are using the Sipser's book "Introduction To The Theory Of Computation". There the transition function of a DFA returns a state and is total, i.e., every state must have an outgoing arrow for every symbol. This is in contrast to NFAs, where the transition function returns a set (possibly empty) of states. I believe it is not possible to construct a DFA with one state accepting $\{\varepsilon\}$ or $0^*$,but it is possible to construct such NFAs.

3. It would be helpful of you specify exercise numbers if exercises are taken from the Sipser's book.

I found these exercises from some notes of computability theory, but the most of them are from the Sipser's book. Next time I will specify the exercise numbers.

So these exercises are examples of situations where NFAs are needed, right?
 
Attachments
  • State diagram of a DFA with states q0 (start and accepting), q1 and q2. q0 loops on 1; q0 goes to q1 on 0; q1 goes to q2 on 0; q2 returns to q0 on 1.
    f5.png
    3 KB · Views: 163
evinda said:
So these exercises are examples of situations where NFAs are needed, right?
Why don't you look at the exact statement of the problem? But the only DFAs with one state in the language $\{0,1\}$ are the ones accepting $\emptyset$ and $\{0,1\}^*$.
 
Evgeny.Makarov said:
Why don't you look at the exact statement of the problem?

At the book that I have I found the statement I have written above.

According to the online version I have, the statement is the following:

View attachment 5698

So the latter should be the right problem statement.

So are the above automata the right NFAs?

- - - Updated - - -

Evgeny.Makarov said:
But the only DFAs with one state in the language $\{0,1\}$ are the ones accepting $\emptyset$ and $\{0,1\}^*$.

Do we have the DFA that accepts only the $\emptyset$ if $q_0$ is a non-accepting state and the DFA that accepts $\{0,1\}^*$ otherwise?
 
Attachments
  • Exercise 1.7 from a textbook listing NFA construction problems over the alphabet {0,1}, parts a through h, with parts a and f marked by a caret.
    fre.JPG
    16.3 KB · Views: 147
Evgeny.Makarov said:
2. I believe you are using the Sipser's book "Introduction To The Theory Of Computation". There the transition function of a DFA returns a state and is total, i.e., every state must have an outgoing arrow for every symbol. This is in contrast to NFAs, where the transition function returns a set (possibly empty) of states. I believe it is not possible to construct a DFA with one state accepting $\{\varepsilon\}$ or $0^*$,but it is possible to construct such NFAs.

I've always been a bit confused about these definitions.
The FA's we have here are all deterministic, even though not all input symbols have a state transition.
Still, we can consider every missing symbol to have an implicit transition to an extra sink state.
That's very different from a non-deterministic FA that would typically have multiple state transitions for the same symbol.
So what's the big deal that a DFA is supposed to have a transition for every symbol?

evinda said:
So the language is this one: $0^{\ast} 1^+ (0^+ 1^+)^{\ast}$, right?

Yes. We can even further abbreviate it to $(0^*1^+)^+$. (Nod)
Yes... (Nod) Ah, I see... Then the DFA will be the following, right?

Does this often happen that we draw a dfa with one more state than the desired number and that the final state is equal to the initial one?

Yes. We will have to do whatever is required for the problem statement.
Usually there is no real need to reduce the number of states though - it's just an optimization that happens to look more pleasing to the eye and is less work to draw. (Wink)
 
evinda said:
So are the above automata the right NFAs?
Sorry, as I said, this thread contains many automata for various problems, both correct and incorrect. I am reluctant to go over the whole thread and give my opinion for each of them. Either summarize the latest information or start a new thread for each problem.

evinda said:
Do we have the DFA that accepts only the $\emptyset$ if $q_0$ is a non-accepting state and the DFA that accepts $\{0,1\}^*$ otherwise?
Yes.

I like Serena said:
I've always been a bit confused about these definitions.
The FA's we have here are all deterministic, even though not all input symbols have a state transition.
Still, we can consider every missing symbol to have an implicit transition to an extra sink state.
That's very different from a non-deterministic FA that would typically have multiple state transitions for the same symbol.
So what's the big deal that a DFA is supposed to have a transition for every symbol?
I agree, whether the transition function is total or not does not change the concept of the automaton significantly: it's still essentially a DFA. In contrast, if the function returns sets of states instead of individual states, this is a very different concept: an NFA. I am just saying that any questions and confusion is unnecessary if we stay within the realm of the book. Instead of defining the transition function of DFA as $\delta:Q\to Q\cup\{\emptyset\}$ and considering special cases in definitions and proofs, the author chose to consider the output $\emptyset$ only in NFAs, which makes the treatment uniform. Each problem clearly states whether it requires a DFA or an NFA. Then why complicate the situation and wonder if problem statements should be changed?