The lexicographic order is a generalization of the order in which words are listed in a dictionary, according to the order of letters where the spelling of two words first differs.
Let be a well-ordered family of linearly ordered sets. The lexicographic order on the product of sets is the linear order defined as follows: if and , then iff where is the least element in the set .
While this notion is most often seen for linear orders, it can be applied also toward more general relations. For example, one might apply the construction to sets equipped with a transitive relation , dropping the trichotomy assumption.
Often this notion is extended to subsets of as well. For instance, the free monoid on a linearly ordered set can be embedded in a countable power
where is the result of freely adjoining a bottom element to , and for each finite list we have
Then the lexicographic order on is the one inherited from its embedding into the lexicographically ordered set .
if is linearly ordered and the underlying set is regarded as the terminal coalgebra for the functor , with coalgebra structure , then the lexicographic order on may be defined corecursively: