1.3 Deterministic vs. Non-deterministic FSAs

Look at the following FSA:

It accepts/generates the same language as our first laughing machine, but it differs from the FSAs we have seen so far in a very important way. It has two arcs labelled with the same symbol (a) going out of one state (state 2) -- this FSA is non-deterministic.

Mathematically speaking, non-determinism doesn't add anything to what FSAs can do. In fact, we can always find a deterministic automaton that recognizes/generates exactly the same language as a non-deterministic automaton. Also when using an automaton for generation, there is no big difference between deterministic and non-deterministic machines. You can think of the machine flipping a coin to decide which transitition to take whenever there is more than one arc going out of a state. There is, however, a big difference when we want to use the machine for recognition. When the next symbol on the input tape is an a, the machine has to decide which transition to take and if it makes the wrong decision, it may fail to recognize the input string, even though it would have been able to, had it decided differently. That means that non-determinism brings with it the need to perform search.

Here is an example. Assume that we want to check whether the FSA above recognizes the word ha!. Starting from state 1 we have no choice but to go to state 2 via the h transition. But next, we have to read an a and there are two a transitions going out of state 2. Which one should we take? Well, you can see of course that we would want to take the transition leading to state 3, because only when taking this transition will we be able to read the whole input and end in a final state. However, remember that the machine cannot look ahead and can therefore not base its decision on the rest of the input or the following states in the automaton. All it can do at this point is to arbitrarily decide for one transition, try it, and go back to try another transition in case this one turns out to not lead us to acceptance of the string. That means, we have to systematically try all alternatives and to do so, we have to keep track of what we have tried already.

Patrick Blackburn and Kristina Striegnitz
Version 1.2.4 (20020829)