Deterministic Finite Automata DFA
💡 What is a Deterministic Finite Automaton (DFA)?
A DFA is a simple mathematical model of a computer with limited memory that reads strings and decides whether they belong to a language.
It's called:
-
Finite → because it has a finite number of states.
-
Automaton → because it's an abstract machine.
-
Deterministic → because for every state and input symbol, there is exactly one transition.
🔢 Formal Definition of a DFA
A DFA is a 5-tuple:
Where:
Component | Meaning |
---|---|
Finite set of states | |
Finite set of input symbols (alphabet) | |
Transition function: | |
Start state, where the machine begins | |
Set of accepting (final) states |
🧠 DFA Behavior:
-
It starts in the initial state
-
Reads the input string one symbol at a time
-
Based on current state and input symbol, it moves to a new state
-
When input ends:
-
If it’s in a final state, the string is accepted
-
Otherwise, the string is rejected
-
✅ Key Properties of a DFA
-
Determinism: No ambiguity — exactly one transition for each symbol from a state.
-
Memoryless: The only "memory" is the current state.
-
Complete transition function: For every state and symbol, a transition must be defined.
-
Recognizes Regular Languages: DFAs define or recognize all and only the regular languages.
📘 Example
Let’s define a DFA that accepts all strings over {0, 1} ending with 1.
-
-
-
start state
-
-
Transition function :
Current State | Input | Next State |
---|---|---|
0 | ||
1 | ||
0 | ||
1 |
This DFA remembers the last symbol — if it’s a 1
, it accepts.
Comments
Post a Comment