A deterministic finite (state) automaton (DFA) is one of the weakest model of computation. It is ‘memoryless’, i.e. it cannot store past states, and can only read an input string. It changes its states in a deterministic way i.e. it always takes the same computation path for the same input.
%%🖋 Edit in Excalidraw, and the dark exported image%%
A more formal way of defining determinism is that the DFA only has one possible move at every ‘step’.
Definition
Deterministic Finite Automata (DFA) ^definition-dfa
A DFA is defined as a 5-tuple:
Behaviour
- A DFA always halts, or finishes processing, for any given input finite-length input string.
- If a DFA gets a character and doesn’t know what to do, it halts and rejects the character (as a ‘catch-all’)
Connection To Regular Languages
Recall the definition of a regular language:
Another way to interpret this is that, given a DFA , there are set of strings (a regular language) that accepts.
For example, take the DFA below:
%%🖋 Edit in Excalidraw, and the dark exported image%%
The DFA only accepts strings that contain any number of zeros. This is because it does contain transitions that require other inputs, so if it received a 1, it would not know what to do, and by default, rejects the string/word. That is:
where is the Kleene star operation applied on
The corresponding regular language is hence .
Minimal DFAs
See Minimal DFA
Examples
1: State diagram of a simple DFA
Find the formal definition () for the state diagram for the DFA below. Also include the set of accepted strings
Solution
The specifications are given below (the transition function isn’t required here):
accepts strings only containing , but it also has the restriction that these strings must be odd length (even length strings causes it to switch from 1 to 2 back to 1). That is:
2: Another DFA state diagram
Find the formal definition () for the state diagram for the DFA below. Also include the set of accepted strings
%%🖋 Edit in Excalidraw, and the dark exported image%%
Solution
The specifications are given below (the transition function isn’t required here):
accepts strings from the following regular language: