Create your own
Lesson illustration

Proving DFA State Lower Bounds with Pairwise Distinguishable Strings

Hello. In the previous lesson, you proved nonregularity by assuming a target language was regular and using closure properties to force a contradiction. That method filtered a language into a known nonregular one.

This lesson begins the Myhill–Nerode viewpoint. Instead of transforming the language, we ask: How much information about a prefix must a DFA retain in order to handle every possible continuation? If two prefixes require different future behavior, they must have led to different DFA states. Finding many such prefixes proves a lower bound on the number of states.

By the end, you will be able to exhibit a set of pairwise distinguishable strings and turn it into a rigorous Myhill–Nerode lower-bound proof.


Distinguishability: different possible futures

Let . Two strings and are distinguishable with respect to if there is some suffix such that exactly one of and belongs to .

The suffix is called a distinguishing suffix or witness. Formally, and are distinguishable when either

or

The empty string is allowed as a suffix. Thus, if and , then already distinguishes them.

The key point is that distinguishability is a property of the language, not of a particular DFA diagram. We use a witness suffix to prove a constraint that every DFA for the language must satisfy.

Consider

The strings and are distinguishable with respect to . Take

Then

but

The suffix reveals that the machine must somehow retain the difference between having seen two zeros and having seen five zeros.

[PDF] Notes on State Minimization 1 Distinguishable and Indistinguishable ...

Read Notes on State Minimization, a Stanford CS154 handout by Luca Trevisan and Ryan Williams. It gives the formal definition of distinguishability and proves the state lower-bound principle that this lesson uses.

In Section 1, “Distinguishable and Indistinguishable States” (PDF pp. 1–2), first read the definition, including the two short examples. Then follow the key lemma: focus on why reaching the same state after x and y would make every common suffix behave identically. On the next page, beginning with “Consider now the following generalization of the notion of distinguishability,” read the set argument, which lifts the idea from one pair of strings to k strings.


Why one distinguishing suffix forces two states

Suppose is a DFA recognizing . Imagine that two strings and lead to the same state:

Once the DFA is in state , it has no record of whether it arrived after reading or . If it then reads the same suffix , it must behave identically in both cases:

Therefore, and must either both be accepted or both be rejected.

Now take the contrapositive:

If some suffix makes exactly one of and belong to , then and must lead to different states in every DFA recognizing .

This is the engine behind Myhill–Nerode lower bounds. A distinguishing suffix is evidence that the DFA cannot merge two prefixes into one state.

It is useful to frame this in terms of the possible “futures” of a string. Define the future of relative to as

Two strings are distinguishable exactly when their futures differ: at least one suffix belongs to one future but not the other.

The Myhill–Nerode equivalence relation is written

Thus, distinguishable strings lie in different Myhill–Nerode equivalence classes. For this lesson, the important consequence is simple: different equivalence classes require different DFA states.


From one pair to a lower bound

A set of strings

is pairwise distinguishable with respect to if every two different strings in the set are distinguishable. More precisely, for each pair , there must be some suffix such that exactly one of and is in .

The suffix may depend on the pair. You do not need to find one universal suffix that distinguishes every pair.

Lower-bound principle

If has a pairwise distinguishable set of strings, then every DFA recognizing has at least states.

The proof is short but should be written carefully.

Let be pairwise distinguishable with respect to , and let be any DFA recognizing .

For every two distinct indices and , the strings and have a distinguishing suffix. Therefore, they cannot lead to the same state. Hence the strings in lead to distinct states of . It follows that has at least states.

This is the lower-bound direction of the Myhill–Nerode theorem.

Be precise about what it does and does not establish:

  • A set of pairwise distinguishable strings proves at least states are necessary.
  • It does not by itself prove that states are sufficient.
  • To prove a DFA has exactly states in the minimum possible implementation, one also needs an equivalent DFA with states. The next lesson will make that argument systematic.

A finite lower bound: counting ones modulo

Consider, for an integer , the language

where is the number of ones in . The language contains exactly the strings whose number of ones is divisible by .

We will prove that any DFA recognizing needs at least states.

Choose the candidate set

Since , this set has exactly strings. Intuitively, its members represent the distinct remainders possible after counting ones.

Take any two distinct strings and in , where

Use the suffix

Appending to the first string gives

But appending the same suffix to gives a string with

ones. Modulo , this count has remainder . Because and both indices are between and , this remainder is not zero. Therefore,

So every two distinct strings in are distinguishable. By the lower-bound principle, every DFA for requires at least states.

The proof captures a broader pattern:

If a language requires a DFA to remember one of different unresolved situations, look for prefixes whose required completions differ.

For , the unresolved situation is the count of ones modulo .


Infinite distinguishable sets prove nonregularity

The same method proves nonregularity when there are arbitrarily large pairwise distinguishable sets.

Return to the language from the previous lesson:

Previously, you proved nonregular by intersecting it with the regular filter . Now we will see the memory obstruction directly.

Consider the infinite set

Take two different members, and . Without loss of generality, suppose

Choose the suffix

Then

because the completed string has exactly zeros and ones. But

because it has more zeros than ones.

Thus, and are distinguishable. Since and were arbitrary distinct nonnegative integers, every pair of strings in is distinguishable.

For any positive integer , the finite subset

has pairwise distinguishable strings. Therefore, any DFA for would need at least states for every .

But a DFA has a fixed finite number of states. If it had states, taking would yield the contradiction that it needs at least states. Therefore, is not regular.

The closure-property proof and this proof reach the same conclusion differently:

  • The closure proof filters until the known language appears.
  • The distinguishability proof shows that every possible number of zeros already creates a distinct future requirement.

A reliable proof-writing template

When asked to prove a DFA lower bound using Myhill–Nerode distinguishability, use this structure.

  1. State the target language and the number you aim to lower-bound.

  2. Specify a candidate set

  3. Take an arbitrary distinct pair from the set. If the strings have parameters, state the relevant condition, such as .

  4. Choose a distinguishing suffix , usually as a formula based on the pair.

  5. Verify opposite membership outcomes:

    or the reverse.

  6. Conclude pairwise distinguishability, then invoke the lower-bound principle to state that every DFA for has at least states.

For a nonregularity proof, replace the fixed with an infinite family, or show that such a set exists for every positive .

Two frequent errors are worth guarding against:

ErrorWhy it failsRepair
Showing that each candidate string can be distinguished from only one other stringA -state lower bound requires every distinct pair to require different states.Start with an arbitrary pair and prove the witness construction works for that pair.
Claiming two strings reach different states without comparing membership after a common suffixDifferent-looking prefixes can lead to the same state.Exhibit one suffix that makes exactly one completed string belong to the language.
Finding many strings but not stating why they are pairwise distinguishableQuantity alone proves nothing; a DFA can merge indistinguishable strings.Explicitly name the witness suffix and perform both membership checks.
Using a witness that depends on only one string without verifying the other caseThe suffix must separate the selected pair, not merely complete one candidate successfully.Compute both and .

Key takeaways

A DFA’s state summarizes everything relevant about the input prefix for all future continuations. If two prefixes have a suffix that produces opposite membership outcomes, they cannot share that summary and therefore cannot reach the same state.

A set of pairwise distinguishable strings gives a Myhill–Nerode lower bound of states. An infinite pairwise distinguishable set shows that no finite DFA can recognize the language.

Next, you will use the same two ingredients from the opposite direction: to prove that a given DFA is minimal, you will establish that all of its states are reachable and that no two of those states can be merged.

Can't find a good explanation? Sign up and we'll make it for you

Sign up