4.6.2 · D1Theory of Computation

Foundations — Finite automata — DFA - formal definition (5-tuple), state diagrams

1,791 words8 min readBack to topic

Before you can read or , every one of those little marks must mean something you can see. Below we earn each symbol, in an order where each rests on the one before it.


1. A set and the curly braces

Picture: a bag with a few labelled marbles inside. is a bag holding one marble marked 0 and one marked 1.

Why the topic needs it: four of the five parts of a DFA are sets — the states , the alphabet , and the accept states are literally bags of things, and even the start state is one marble pulled from the bag.


2. "Element of" and "subset"

Picture: is one marble pointing into a bag; is a small bag nested inside a big bag.

Why the topic needs it:

  • — the start state is one of the machine's states.
  • — the accepting (glowing) states are some of all the states.
  • Acceptance is decided by the test "": did we finish inside the glowing bag?

3. Symbols, an alphabet , and strings

Picture: think of as the keyboard — the only keys allowed. A string is what you typed: a row of key-presses read strictly left to right.

Why the topic needs it: the machine reads members of . The empty string is the sneaky edge case — a DFA accepts iff the start state is already glowing, so you must know exists and has length .


4. A function and the arrow

Picture: a vending machine. Press one button (input), get exactly one item (output). Same button → same item, every time.

Why the topic needs it: is a function. If it were allowed to give a set of next states, or to leave some buttons dead, you'd have an NFA — see NFA — nondeterministic finite automata — not a DFA.


5. The Cartesian product — pairing two bags

Picture: a grid. Rows are states, columns are symbols; every cell is one pair .

Why the topic needs it: the transition rule reads a pair — "which state am I in AND which symbol did I read". That input type is exactly , so means "feed the machine a (state, symbol) cell of the grid, receive the next state".


6. Putting the arrows on a picture — the state diagram

Picture: a board-game map. Squares are states; the labelled arrows are the movement rules; you always know which square you're on.

Why the topic needs it: the diagram and the 5-tuple are the same object in two languages. Reading one off the other is the core skill of the whole topic.


7. Recursion — how one-step grows into whole-string

Picture: climbing down a staircase. Each step "process the string " = "first process the shorter string , then take one more footstep on ". The bottom stair is (nothing left to process).

Why the topic needs it: acceptance is defined as . Without recursion you have no meaning for "run the whole word", only "read one letter".


The prerequisite map

Sets and braces

Membership and subset

Alphabet Sigma and symbols

Strings and empty string epsilon

Sigma star all strings

Function total single valued

Cartesian product pairs

Transition function delta

State diagram arrows

Extended delta by recursion

Acceptance and language L of M

DFA 5 tuple

Every arrow says "you need the left idea before the right one makes sense". Notice how sets feed almost everything, and how the whole tower converges on the DFA 5-tuple.


Where these foundations go next

Once you own this vocabulary, the parent note DFA — formal definition becomes readable line by line. From there the ideas branch into Regular expressions, NFA — nondeterministic finite automata and its bridge Subset construction (NFA → DFA), the limits proved by Regular languages and the Pumping Lemma, the tidy-up of DFA minimization (Myhill–Nerode), and the real-world payoff in Lexical analysis / tokenizers.


Equipment checklist

Test yourself — cover the right side and answer aloud.

What is a set, in one phrase?
A collection of distinct things written in curly braces; order and repeats don't matter.
What does "finite" guarantee about and ?
You could count the elements and stop — the machine's memory is bounded.
Read and in words.
" is a state in "; " is a sub-collection of the states in ".
What is and what is ?
is the finite alphabet of symbols; is the set of all finite strings over , including .
What is and its length?
The empty string — a string of length , meaning "no symbols read".
Give the two promises of a "total, single-valued" function.
Total = every input has an output; single-valued = exactly one output each. Together = deterministic.
What set does take as input, and why ?
— the pair (current state, symbol read); the product pairs one from each bag.
In a diagram, what are a double circle and an arrow-from-nowhere?
Double circle = accept state (); arrow from nowhere = the start state .
Why must be defined recursively?
handles one symbol only; recursion chains single steps into a whole string, with base case .
When does a DFA accept ?
Exactly when the start state is an accept state.