DFAs are the simplest computational model we will consider. The "memory" of a DFA is limited to the state it is currently in. At each state, an input can move it into another state.
For example the following DFA accepts $.50 in exact change.
Note that:
The way that DFAs "compute" is by either accepting or rejecting their input according to their state rules.
For the example DFA above, we have:
N | D | Q | |
0 | 5 | 10 | 25 |
5 | 10 | 15 | 30 |
10 | 15 | 20 | 35 |
15 | 20 | 25 | 40 |
20 | 25 | 30 | 45 |
25 | 30 | 35 | 50 |
30 | 35 | 40 | R |
35 | 40 | 45 | R |
40 | 45 | 50 | R |
45 | 50 | R | R |
50 | R | R | R |
R | R | R | R |
What is the formal definition of the following DFA?
What about the following DFA?
We say that DFA $M$ accepts string $w$ iff $M$ ends up in an accept state when it has finished reading $w$.
We say that the language of $M$, written as $L(M)$ is the set of all strings denoted accepted by $M$. We also say that $L$ is recognized by $M$.
What is the language of the following DFA?
What about the following DFA?
Any language that is recognized by some DFA is said to be regular.
The language of floating-point numbers in typical programming languages is regular.
Examples:
Here "d" refers to any digit 0-9
Compilers do in fact use finite automata for recognizing patterns like this.
Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.