Myhill–Nerode theorem

From Wikipedia, the free encyclopedia
(Redirected from Myhill-Nerode theorem)
Jump to navigation Jump to search

In the theory of formal languages, the Myhill–Nerode theorem provides a necessary and sufficient condition for a language to be regular. The theorem is named for John Myhill and Anil Nerode, who proved it at the University of Chicago in 1957 (Nerode & Sauer 1957, p. ii).

Statement

[edit | edit source]

Given a language L, and a pair of strings x and y, define a distinguishing extension to be a string z such that exactly one of the two strings xz and yz belongs to L. Define a relation L on strings as xL y if there is no distinguishing extension for x and y. It is easy to show that L is an equivalence relation on strings, and thus it divides the set of all strings into equivalence classes.

The Myhill–Nerode theorem states that a language L is regular if and only if L has a finite number of equivalence classes, and moreover, that this number is equal to the number of states in the minimal deterministic finite automaton (DFA) accepting L. Furthermore, every minimal DFA for the language is isomorphic to the canonical one (Hopcroft & Ullman 1979).

Myhill, Nerode (1957)(1) L is regular if and only if L has a finite number of equivalence classes.

(2) This number is equal to the number of states in the minimal deterministic finite automaton (DFA) accepting L.

(3) The minimal DFA is unique up to unique isomorphism. That is, for any minimal DFA acceptor, there exists exactly one isomorphism from it to the following one:

Let each equivalence class [x] correspond to a state, and let state transitions be a:[x][xa] for each aΣ. Let the starting state be [ϵ], and the accepting states be [x] where xL.

Generally, for any language, the constructed automaton is a state automaton acceptor. However, it does not necessarily have finitely many states. The Myhill–Nerode theorem shows that finiteness is necessary and sufficient for language regularity.

Some authors refer to the L relation as Nerode congruence,[1][2] in honor of Anil Nerode.

Proof

(1) If L is regular, construct a minimal DFA to accept it. Clearly, if x,y end up in the same state after running through the DFA, then xLy, thus the number of equivalence classes of L is at most the number of DFA states, which must be finite.

Conversely, if L has a finite number of equivalence classes, then the state automaton constructed in the theorem is a DFA acceptor, thus the language is regular.

(2) By the construction in (1).

(3) Given a minimal DFA acceptor A, we construct an isomorphism to the canonical one.

Construct the following equivalence relation: xAy if and only if x,y end up on the same state when running through A.

Since A is an acceptor, if xAy then xLy. Thus each L equivalence class is a union of one or more equivalence classes of A. Further, since A is minimal, the number of states of A is equal to the number of equivalence classes of L by part (2). Thus A=L.

Now this gives us a bijection between states of A and the states of the canonical acceptor. It is clear that this bijection also preserves the transition rules, thus it is an isomorphism of DFA. The isomorphism is unique, since for both DFA, any state is reachable from the starting state for some word x.

Use and consequences

[edit | edit source]

The Myhill–Nerode theorem may be used to show that a language L is regular by proving that the number of equivalence classes of L is finite. This may be done by an exhaustive case analysis in which, beginning from the empty string, distinguishing extensions are used to find additional equivalence classes until no more can be found.

For example, the language consisting of binary representations of numbers that can be divided by 3 is regular. Given two binary strings x,y, extending them by one digit gives 2x+b,2y+b, so 2x+b2y+bmod3 iff xymod3. Thus, 00 (or 11), 01, and 10 are the only distinguishing extensions, resulting in the 3 classes. The minimal automaton accepting our language would have three states corresponding to these three equivalence classes.

Another immediate corollary of the theorem is that if for a language L the relation L has infinitely many equivalence classes, it is not regular. It is this corollary that is frequently used to prove that a language is not regular.

Generalizations

[edit | edit source]

The Myhill–Nerode theorem can be generalized to tree automata.[3]

See also

[edit | edit source]

References

[edit | edit source]
  1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value). Here: Sect. 1.5, p.35-36.
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value)..
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value)..
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).. ASTIA Document No. AD 155741.
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value)..

Further reading

[edit | edit source]
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).