Myhill-Nerode theorem
Intheoryformal languages,Myhill-Nerode Theorem providesnecessarysufficient condition forlanguagebe regular. Italmost exclusively usedorderprove thatgiven languagenot regular.Givenlanguage L, definerelation RL on strings byrule x RL y if thereno distinguishing extension z withproperty that exactly one ofstrings xzyzin L. Iteasyshow that RLan equivalence relation on strings,thusdividessetall finite strings into one or more equivalence classes.
The Myhill-Nerode Theorem states thatnumberstates insmallest automaton accepting Lequal tonumberequivalence classesRL. The intuitionthat if one startssuchminimal automaton, then any strings xy that drivetosame state will be insame equivalence class;if one starts withpartition into equivalence classes, one can easily construct an automaton that uses its statekeep track ofequivalence class containingpart ofstring seen so far.
A consequence ofMyhill-Nerode Theoremthatlanguage Lregular (i.e., accepted byfinite state machine) ifonly ifnumberequivalence classesRLfinite.
The immediate corollarythat iflanguage defines an infinite setequivalence classes, itnot regular. Itthis corollary thatfrequently usedprove thatlanguagenon-regular.
Example proofnon-regularity
Considerlanguage . Now considerinfinite setstrings . For any two strings from this set x = ai, y = ak i < k, we can append z = bkeach, which resultsxz = aibk, whichnotL,yz = akbk, whichin L. Thus each string ofform ai belongs todifferent equivalence class, so therean infinite numberequivalence classes defined bylanguage,so byMyhill-Nerode Theorem itnot regular.
Note that this language can be "pumped" insense that any nonempty string inlanguage can be expanded by replacingsingle aarbitrarily many copiesa. The language thus gives an example ofnon-regular language that cannot be shownbe non-regular usingpumping lemma.
