14

Tomorrow is my presentation and I want to clear my concepts…

I've read that in DFA, "For each state, transition on all possible symbols (alphabet) should be defined."

Is for each state, defining transition on all possible symbols mandatory in DFA? If its not, then please give any examples?

Nathan Davis
  • 642
  • 1
  • 5
  • 13
HQuser
  • 255
  • 2
  • 8

3 Answers3

25

Suppose a DFA was allowed to have missing transitions. What happens if you encounter a symbol which has no transtion defined for it? The result is undefined. That would seem to violate the "deterministic" characteristic of a DFA.

However, it's trivial to transform such an incomplete DFA into a complete DFA. Simply add a new state, illegal, and map any undefined transitions to the illegal state. Finally, add transitions for every symbol from the illegal state back to itself. This illegal state is often called a sink state, because once data falls into the sink there's no way to get out.

So, from a practical perspective, it's kind of moot, as long as you have a well-defined way to handle missing transitions.

Gilles 'SO- stop being evil'
  • 44,159
  • 8
  • 120
  • 184
Nathan Davis
  • 642
  • 1
  • 5
  • 13
13

A DFA is specified by the following data:

  • An alphabet $\Sigma$.
  • A set of states $Q$.
  • An initial state $q_0 \in Q$.
  • A set of final states $F \subseteq Q$.
  • A transition function $\delta\colon Q \times \Sigma \to Q$.

As you can see from the signature of $\delta$, it specifies a transition at every state for every symbol.

D.W.
  • 167,959
  • 22
  • 232
  • 500
Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
6

A DFA is often defined as a restricted type of NFA. If $\Sigma$ is the input alphabet and $Q$ is the set of states, the transition structure of an NFA is specified as either a relation $\rho \subseteq Q \times \Sigma \times Q$, or as a function $\delta : (Q \times \Sigma) \to 2^Q$. If we adopt the latter definition, then we can say that an NFA is deterministic if $|\delta(q,\sigma)| \leq 1$ for all $q\in Q$ and $\sigma \in \Sigma$, and complete if $\delta(q,\sigma) \neq \emptyset$, again, for all $q \in Q$ and $\sigma \in \Sigma$.

A word is accepted by an NFA if it has an accepting run. A deterministic automaton has at most one run. A complete automaton has at least one run.

Some authors define trim automata as those in which each state is on some path from an initial state to a final state. For certain languages, you cannot have automata that are both trim and complete. In those cases, it is convenient to keep the completeness requirement out of the definition of deterministic automaton.

Fabio Somenzi
  • 171
  • 1
  • 5