3.4.12 · D2Sequential Circuits

Visual walkthrough — State minimization techniques

2,186 words10 min readBack to topic

This is a companion to the Hinglish note and leans on Finite State Machines, Mealy vs Moore Machines, and the uniqueness guarantee of the Myhill–Nerode Theorem.


Step 1 — What a state machine looks like before we touch it

WHAT we are looking at: four states . The symbol (read "delta of and ") is just a name for the circle you land on if you are in circle and press input .

WHY draw it first: you cannot merge states you cannot see. The whole algorithm is "which circles are secretly the same circle?" — so we need the map in front of us.

PICTURE — our test machine. Circles show their output number; blue arrows are input , pink arrows are input .

Figure — State minimization techniques

The state table for the exact same machine (this is Worked Example 2 from the parent):

State Output
A B C 0
B B D 0
C B C 0
D B D 1

Step 2 — The question that defines "the same"

WHAT the symbol says:

The upside-down A, , means "for all" — every input , no exceptions.

WHY this is subtle: the definition is circular — "twins go to twins." You cannot check it directly because you would need to already know the twins. The trick of the next steps is to break that circle by checking short experiments first, then longer ones.

PICTURE — the experiment idea: two machines, same buttons pressed, comparing beep tapes.

Figure — State minimization techniques

Step 3 — The shortest experiment: colour by output ()

WHAT we do first: the shortest possible experiment presses zero buttons — you just read the output you are sitting on. So = "sort by output."

  • all output → same colour (call it block 1).
  • outputs → its own colour (block 2).

WHY start here: length-0 is the coarsest honest split. It can only under-split (lump too many together), never wrongly separate twins — because true twins must beep the same right now. Every later step only breaks colours apart, never re-merges. That one-directional refinement is what makes the algorithm stop.

PICTURE — the board coloured by output. Two colours: yellow (output 0) and pink (output 1).

Figure — State minimization techniques

Step 4 — Press one button and look where each state lands ()

WHAT we do: for each state in the big yellow block, press each button and record which colour block it lands in. That colour-pair is the state's signature.

Using 's colours (block 1 = , block 2 = ):

State press lands in press lands in signature
A → block 1 → block 1
B → block 1 → block 2
C → block 1 → block 1

WHY this exact rule works: pressing button from produces output-of- (already equal inside a block) and then leaves you at . Two states are distinguishable by a length- experiment precisely when they were already distinguishable, OR their landing states differ by a length- experiment — i.e. their landings sit in different blocks. That is the whole inductive step, and it is why we compare blocks, not raw state names.

and share signature ; 's is different, so splits off.

PICTURE — the arrows re-drawn, each state tagged with where its two buttons land, and peeling away because its pink-button arrow escapes into block 2.

Figure — State minimization techniques

Step 5 — Press again to confirm the survivors ()

WHAT we do: repeat the signature check, but now with the new finer colours , , . Only the still-shared block needs re-checking (singletons can never split further).

State press press signature
A
C

WHY this is the crucial confirmation: refining once is not enough — a new split can trigger more splits down the line (a chain reaction). We must press again. Here and still match, so no new split happens:

PICTURE — side-by-side: and produce identical landing-colour pairs, so they lock together.

Figure — State minimization techniques

Step 6 — The stopping rule, and why it must halt

WHAT happened: . When a full pass leaves every colour untouched, the partition is stable and we stop. The chain of refinements is:

The symbol means "is coarser than or equal to" — each step has the same or more colours, never fewer.

WHY it always terminates: every pass either splits a block (strictly more colours) or changes nothing (we stop). With states you can split at most times before every state is its own colour — so the algorithm cannot loop forever. Here , and we stopped after 2 passes.

PICTURE — the descending staircase of partitions, from 2 blocks down to the stable 3 blocks.

Figure — State minimization techniques

Step 7 — Edge and degenerate cases you must not skip

Case (a) — all outputs identical. If every state outputs the same value, has one block. Then you press buttons and split from there. The method still works; it just starts coarser.

Case (b) — already minimal. If in Step 4 every signature is different (as in Worked Example 1 of the parent, where gave ), is all singletons and nothing ever merges. That is a valid, common outcome — the machine was already minimal.

Case (c) — an unreachable state. If a circle has no arrows pointing into it from the start state, it is dead weight. Partition refinement will happily assign it a colour, but you should delete unreachable states first — otherwise you might "merge" a phantom.

Case (d) — a self-loop / sink. A state whose every button returns to itself (like a trap) has signature "(my own block, my own block)". It refines fine; it just never leaves.

WHY cover these: the reader must never meet a machine the method mishandles. The rule "delete unreachable, then refine" makes it airtight.

PICTURE — a mini gallery of the four edge machines and what the method does to each.

Figure — State minimization techniques

Step 8 — Cash in the result: build the smaller machine

WHAT we do: each surviving colour becomes one state. Rename .

State Out
S B S 0
B B D 0
D B D 1

(Where the old table said "go to ", the new one says "go to ", because is now inside .)

WHY it is smaller and correct: 4 states → 3 states. By the Myhill–Nerode Theorem this minimal machine is unique up to renaming — anyone who minimises correctly gets the same 3-state machine. State count sets flip-flop count via (see Flip-Flops and State Assignment (Encoding)); here both need 2 flip-flops, but the next-state and output logic gets simpler, and on larger machines a merge often drops a flip-flop outright.

PICTURE — old 4-circle machine morphing into the new 3-circle machine, and fused.

Figure — State minimization techniques

The one-picture summary

Everything above, compressed: draw → colour by output → press buttons and split on landing-colours → repeat until stable → fuse each colour into one state.

Figure — State minimization techniques
Recall Feynman: the whole walkthrough in plain words

Picture four toy robots . First we paint robots by the beep they make just standing there: beep "0" so we paint them yellow, beeps "1" so it's pink. Now the game: for each yellow robot, press each button and watch which colour it walks into. walks yellow-then-yellow. does the same. But walks yellow-then-pink — different! So is a fake twin; we repaint it its own colour. Now and still match, so we press again to be sure — they still match, and nothing new changes, so we stop. and were true twins all along: glue them into one robot . Four robots became three, same behaviour, cheaper toy. The magic rule that made it all work and made it stop: colours only ever split, never re-merge, and you can only split so many times before every robot is alone.

Why compare landing blocks not state names?
Two landings in the same block are indistinguishable so far, so they cannot yet distinguish their parents; only a block-difference is a real length-(k+1) distinguisher.
What two events can end a pass and why does that force termination?
A block splits (strictly more colours) or nothing changes (stop); you can split at most N-1 times, so it cannot loop.
What do you delete before refining?
Unreachable states, so you never merge a phantom state that no input string can reach.

#flashcards/hardware