Syntactic monoid

In mathematics and computer science, the syntactic monoid "M"("L") of a formal language "L" is the smallest monoid that recognizes the language "L".
Syntactic quotient.
The free monoid on a given set is the monoid whose elements are all the strings of zero or more elements from that set, with string concatenation as the monoid operation and the empty string as the identity element. Given a subset formula_1 of a free monoid formula_2, one may define sets that consist of formal left or right inverses of elements in formula_1. These are called quotients, and one may define right or left quotients, depending on which side one is concatenating. Thus, the right quotient of formula_1 by an element formula_5 from formula_2 is the set
Similarly, the left quotient is
Syntactic equivalence.
The syntactic quotient induces an equivalence relation on "M", called the syntactic relation, or syntactic equivalence (induced by "S"). The right syntactic equivalence is the equivalence relation
Similarly, the left syntactic relation is
The syntactic congruence or Myhill congruence may be defined as
The definition extends to a congruence defined by a subset "S" of a general monoid "M". A disjunctive set is a subset "S" such that the syntactic congruence defined by "S" is the equality relation.
Let us call formula_12 the equivalence class of formula_13 for the syntactic congruence.
The syntactic congruence is compatible with concatenation in the monoid, in that one has
for all formula_15. Thus, the syntactic quotient is a monoid morphism, and induces a quotient monoid
This monoid formula_17 is called the syntactic monoid of "S".
It can be shown that it is the smallest monoid that recognizes "S"; that is, "M"("S") recognizes "S", and for every monoid "N" recognizing "S", "M"("S") is a quotient of a submonoid of "N". The syntactic monoid of "S" is also the transition monoid of the minimal automaton of "S".
Similarly, a language "L" is regular if and only if the family of quotients
is finite. The proof of the "only if" part is as follows. Assume that a finite automaton recognizing formula_19 reads input "x" which leads to state "p". If "y" is another string read by the machine, also terminating in the same state "p", then clearly one has formula_20. Thus, the number of elements in formula_21 is at most equal to the number of states of the automaton and formula_22 is at most the number of final states. For a proof of the "if" part, assume that the number of elements in formula_21 is finite. One can then construct an automaton where formula_24 is the set of states, formula_25 is the set of final states, the language "L" is the initial state, and the transition function is given by formula_26. Clearly, this automaton recognizes "L". Thus, a language "L" is recognizable if and only if the set formula_21 is finite. Note that this proof also builds the minimal automaton.
Given a regular expression "E" representing "S", it is easy to compute the syntactic monoid of "S".
A group language is one for which the syntactic monoid is a group.