A-Level · Theory of Computation

Finite State Machines

A finite state machine is genuinely simple: a fixed set of states, and rules for which state to move to next based on what symbol arrives. That's it. What varies is what the machine actually produces, and that distinction is the entire point of this page.

Section 2

FSM without output: accept or reject

This machine has exactly one job: read the whole input, then say yes or no. It accepts any binary string with an even number of 1s. Type a string and step through it.

Controls

Try one

Exam tips

  • The double-ringed state is the only accept state. Whether the string is accepted depends entirely on which state the machine ends up in after reading every symbol, not on anything that happened partway through.
  • This machine happens to have its start state and accept state be the same state (S0), that's not a rule, just how this particular example works out.
Section 3

FSM with output: a Mealy machine

This machine never accepts or rejects anything, it just produces an output symbol on every single transition. This one outputs a 1 exactly when the current symbol and the previous symbol were both 1 (overlapping pairs count).

Input

Output

Controls

Try one

Exam tips

  • Every edge here is labelled input/output, not just input. That extra output symbol on every transition is the entire structural difference from the machine in Section 2.
  • Overlapping pairs genuinely both count: for input "111", positions 2 and 3 each pair with their immediate predecessor, giving output "011", not "010".
Section 4

The real difference, side by side

PropertyFSM without outputMealy machine (FSM with output)
Produces on each transitionNothing, just changes stateAn output symbol
What matters at the endWhich state it finished in (accept or not)The entire sequence of outputs produced along the way
Needs an accept stateYesNo, there's no concept of accepting or rejecting
Typical useRecognising a pattern (does this string match?)Transforming a stream (parity generators, simple encoders)

Both machines you stepped through above have exactly 2 states and exactly the same input alphabet, {0, 1}. The only structural difference is whether transitions carry an output symbol.

Section 5

Check your understanding