A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Myhill-Nerode Theorem

Graduate Depth 85 in the knowledge graph ☐ I know this ☆ Set as goal
348prerequisites beneath it
See this on the map →
DFA Properties and Minimization AlgorithmsRegular Languages: Definition and Characterization→
automata regular-languages minimization

Core Idea

The Myhill-Nerode theorem characterizes regular languages via equivalence classes over strings: a language is regular if and only if the set of right equivalence classes (where two strings are equivalent if appending any suffix produces the same acceptance result) is finite. This provides a criterion for regularity independent of any automaton, showing that regularity is fundamentally about how many 'distinct behaviors' a language requires. The theorem yields an algorithm for computing minimal DFAs and proves certain languages (like palindromes) cannot be regular by showing infinite equivalence classes.

How It's Best Learned

Compute equivalence classes for both regular and non-regular languages explicitly. Prove non-regularity using infinite equivalence classes. Construct minimal DFAs from equivalence class partitions.

Common Misconceptions

Confusing the right-invariant equivalence relation with other string equivalences. Assuming equivalent strings must be identical. Applying the theorem to non-regular language classes.

Explainer

From your work with DFA minimization and regular language properties, you know that some languages can be recognized by finite automata and some cannot, and that every regular language has a unique minimal DFA. The Myhill-Nerode theorem provides the deepest explanation of *why* this is true — it characterizes regularity purely in terms of the language itself, without reference to any particular machine.

The central concept is an equivalence relation on strings. Given a language L over alphabet Σ, we say two strings x and y are Myhill-Nerode equivalent (written x ≡_L y) if for every possible suffix z ∈ Σ*, the strings xz and yz are either both in L or both not in L. In other words, x and y are equivalent if no continuation can distinguish them — they behave identically with respect to membership in L. For example, if L is the language of binary strings with an even number of 1s, then the strings "01" and "10" are equivalent because both contain exactly one 1, so appending any suffix produces the same accept/reject outcome for both. But "01" and "00" are *not* equivalent: appending the empty string gives "01" (odd number of 1s, rejected) versus "00" (even number of 1s, accepted).

The theorem states: a language L is regular if and only if the number of equivalence classes under ≡_L is finite. Moreover, that number of equivalence classes equals the number of states in the minimal DFA for L. Each equivalence class corresponds to exactly one state — the state represents "everything the machine needs to remember about the input seen so far," and two strings that lead to the same state are precisely those that no suffix can distinguish. This is why the minimal DFA is unique: the equivalence classes are determined by the language, not by any design choice.

The theorem's power as a proof tool comes from its contrapositive: if you can exhibit infinitely many strings that are pairwise distinguishable (each pair separated by some suffix), then the language is not regular. Consider the language {aⁿbⁿ | n ≥ 0}. The strings a, aa, aaa, ... are all pairwise distinguishable: aⁱ and aʲ (with i ≠ j) are separated by the suffix bⁱ, since aⁱbⁱ ∈ L but aʲbⁱ ∉ L. Infinitely many equivalence classes means no finite automaton suffices, so the language is not regular. This argument is often cleaner and more illuminating than the pumping lemma, because it directly identifies what makes the language complex: it requires the machine to remember an unbounded amount of information about the input.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches → Finite State Machines (FSMs) → Deterministic Finite Automata (DFA) → Nondeterministic Finite Automata (NFA) → Two-Way Finite Automata → NFA to DFA Conversion (Subset Construction) → DFA Properties and Minimization Algorithms → Regular Languages: Definition and Characterization → Myhill-Nerode Theorem

Longest path: 86 steps · 348 total prerequisite topics

Prerequisites (2)

Leads To (0)

No topics depend on this one yet.