Skip to content
Part IA Michaelmas Term

Row Matching

The rule

Two states pp and qq are row-match equivalent if, for every possible input value, they produce the same output and point to the same next state. In state-table terms: read off row pp and row qq and check character by character that every column agrees.

If row qq matches row pp, then:

  • replace every occurrence of qq in the next state columns with pp, then
  • delete row qq from the table.

This sometimes frees up further rows: now that qq has gone, another pair of rows may become identical. Repeat until no two rows match.

Worked example (Mealy)

Take this Mealy state table from the 2025/26 notes:

CurrentNext X=0X{=}0Next X=1X{=}1Output X=0X{=}0Output X=1X{=}1
ABC00
BDE00
CFG00
DHI00
EJK00
FLM00
GNP00
HAA00
IAA00
JAA01
KAA00
LAA01
MAA00
NAA00
PAA00

Step 1: collapse identical destination rows

Rows H and I are exactly the same in every column. Replace state I with H in the next-state columns, then drop row I. The same logic removes the rows K, M, N, P, which all match H. After these replacements:

CurrentNext X=0X{=}0Next X=1X{=}1Output X=0X{=}0Output X=1X{=}1
ABC00
BDE00
CFG00
DHH00
EJH00
FLH00
GHH00
HAA00
JAA01
LAA01

Both I and the four rows that matched H are gone.

Step 2: collapse rows that became identical

Now row D and row G are identical (both go to H/H with output 0/0). Replace every G in the next-state columns with D and drop row G. Rows E and F are identical too, so replace F with E and drop row F.

CurrentNext X=0X{=}0Next X=1X{=}1Output X=0X{=}0Output X=1X{=}1
ABC00
BDE00
CED00
DHH00
EJH00
HAA00
JAA01
LAA01

Step 3: collapse further

Rows J and L are now identical, so replace L with J and drop row L:

CurrentNext X=0X{=}0Next X=1X{=}1Output X=0X{=}0Output X=1X{=}1
ABC00
BDE00
CED00
DHH00
EJH00
HAA00
JAA01

We started with 15 states (A, B, C, D, E, F, G, H, I, J, K, L, M, N, P) and ended with 7. No further rows match, so row matching has nothing more to give.

Row matching iteration

What row matching misses

Look at the final table above. Are D and H equivalent? Both output 0 for each input, but their next-state entries differ: D goes to (H, H) while H goes to (A, A). Row matching cannot decide, because the next-state labels are literally different. Yet if H and D really do behave identically in context, both could still be merged.

Row matching is purely syntactic. It never looks beyond the labels. To catch states whose next states differ but are themselves equivalent, you need the implication table, which is the subject of the next note:

Implication Table

This distinction matters in supervision questions and Tripos examples: an implication-table question is one where row matching gets you part of the way but cannot finish the job.