Syntactic monoid

From HandWiki
Short description: Smallest monoid that recognizes a formal language

In mathematics and computer science, the syntactic monoid [math]\displaystyle{ M(L) }[/math] of a formal language [math]\displaystyle{ L }[/math] is the smallest monoid that recognizes the language [math]\displaystyle{ L }[/math].

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 [math]\displaystyle{ S }[/math] of a free monoid [math]\displaystyle{ M }[/math], one may define sets that consist of formal left or right inverses of elements in [math]\displaystyle{ S }[/math]. These are called quotients, and one may define right or left quotients, depending on which side one is concatenating. Thus, the right quotient of [math]\displaystyle{ S }[/math] by an element [math]\displaystyle{ m }[/math] from [math]\displaystyle{ M }[/math] is the set

[math]\displaystyle{ S \ / \ m=\{u\in M \;\vert\; um\in S \}. }[/math]

Similarly, the left quotient is

[math]\displaystyle{ m \setminus S=\{u\in M \;\vert\; mu\in S \}. }[/math]

Syntactic equivalence

The syntactic quotient induces an equivalence relation on [math]\displaystyle{ M }[/math], called the syntactic relation, or syntactic equivalence (induced by [math]\displaystyle{ S }[/math]).

The right syntactic equivalence is the equivalence relation

[math]\displaystyle{ s \sim_S t \ \Leftrightarrow\ S \,/ \,s \;=\; S \,/ \,t \ \Leftrightarrow\ (\forall x\in M\colon\ xs \in S \Leftrightarrow xt \in S) }[/math].

Similarly, the left syntactic equivalence is

[math]\displaystyle{ s \;{}_S{\sim}\; t \ \Leftrightarrow\ s \setminus S \;=\; t \setminus S \ \Leftrightarrow\ (\forall y\in M\colon\ sy \in S \Leftrightarrow ty \in S) }[/math].

Observe that the right syntactic equivalence is a left congruence with respect to string concatenation and vice versa; i.e., [math]\displaystyle{ s \sim_S t \ \Rightarrow\ xs \sim_S xt\ }[/math] for all [math]\displaystyle{ x \in M }[/math].

The syntactic congruence or Myhill congruence[1] is defined as[2]

[math]\displaystyle{ s \equiv_S t \ \Leftrightarrow\ (\forall x, y\in M\colon\ xsy \in S \Leftrightarrow xty \in S) }[/math].

The definition extends to a congruence defined by a subset [math]\displaystyle{ S }[/math] of a general monoid [math]\displaystyle{ M }[/math]. A disjunctive set is a subset [math]\displaystyle{ S }[/math] such that the syntactic congruence defined by [math]\displaystyle{ S }[/math] is the equality relation.[3]

Let us call [math]\displaystyle{ [s]_S }[/math] the equivalence class of [math]\displaystyle{ s }[/math] for the syntactic congruence. The syntactic congruence is compatible with concatenation in the monoid, in that one has

[math]\displaystyle{ [s]_S[t]_S=[st]_S }[/math]

for all [math]\displaystyle{ s,t\in M }[/math]. Thus, the syntactic quotient is a monoid morphism, and induces a quotient monoid

[math]\displaystyle{ M(S)= M \ / \ {\equiv_S} }[/math].

This monoid [math]\displaystyle{ M(S) }[/math] is called the syntactic monoid of [math]\displaystyle{ S }[/math]. It can be shown that it is the smallest monoid that recognizes [math]\displaystyle{ S }[/math]; that is, [math]\displaystyle{ M(S) }[/math] recognizes [math]\displaystyle{ S }[/math], and for every monoid [math]\displaystyle{ N }[/math] recognizing [math]\displaystyle{ S }[/math], [math]\displaystyle{ M(S) }[/math] is a quotient of a submonoid of [math]\displaystyle{ N }[/math]. The syntactic monoid of [math]\displaystyle{ S }[/math] is also the transition monoid of the minimal automaton of [math]\displaystyle{ S }[/math].[1][2][4]

A group language is one for which the syntactic monoid is a group.[5]

Myhill–Nerode theorem

The Myhill–Nerode theorem states: a language [math]\displaystyle{ L }[/math] is regular if and only if the family of quotients [math]\displaystyle{ \{m \setminus L \,\vert\; m\in M\} }[/math] is finite, or equivalently, the left syntactic equivalence [math]\displaystyle{ {}_S{\sim} }[/math] has finite index (meaning it partitions [math]\displaystyle{ M }[/math] into finitely many equivalence classes).[6]

This theorem was first proved by Anil Nerode (Nerode 1958) and the relation [math]\displaystyle{ {}_S{\sim} }[/math] is thus referred to as Nerode congruence by some authors.[7][8]

Proof

The proof of the "only if" part is as follows. Assume that a finite automaton recognizing [math]\displaystyle{ L }[/math] reads input [math]\displaystyle{ x }[/math], which leads to state [math]\displaystyle{ p }[/math]. If [math]\displaystyle{ y }[/math] is another string read by the machine, also terminating in the same state [math]\displaystyle{ p }[/math], then clearly one has [math]\displaystyle{ x \setminus L\,= y \setminus L }[/math]. Thus, the number of elements in [math]\displaystyle{ \{m \setminus L \,\vert\; m\in M\} }[/math] is at most equal to the number of states of the automaton and [math]\displaystyle{ \{m \setminus L \,\vert\; m\in L\} }[/math] is at most the number of final states.

For a proof of the "if" part, assume that the number of elements in [math]\displaystyle{ \{m \setminus L \,\vert\; m\in M\} }[/math] is finite. One can then construct an automaton where [math]\displaystyle{ Q=\{m \setminus L \,\vert\; m\in M\} }[/math] is the set of states, [math]\displaystyle{ F=\{m \setminus L \,\vert\; m\in L\} }[/math] is the set of final states, the language [math]\displaystyle{ L }[/math] is the initial state, and the transition function is given by [math]\displaystyle{ \delta_y \colon x \setminus L \to y\setminus(x \setminus L) =(xy) \setminus L }[/math]. Clearly, this automaton recognizes [math]\displaystyle{ L }[/math].

Thus, a language [math]\displaystyle{ L }[/math] is recognizable if and only if the set [math]\displaystyle{ \{m \setminus L \,\vert\; m\in M\} }[/math] is finite. Note that this proof also builds the minimal automaton.

Examples

  • Let [math]\displaystyle{ L }[/math] be the language over [math]\displaystyle{ A = \{a, b\} }[/math] of words of even length. The syntactic congruence has two classes, [math]\displaystyle{ L }[/math] itself and [math]\displaystyle{ L_1 }[/math], the words of odd length. The syntactic monoid is the group of order 2 on [math]\displaystyle{ \{L, L_1\} }[/math].[9]
  • For the language [math]\displaystyle{ (ab+ba)^* }[/math], the minimal automaton has 4 states and the syntactic monoid has 15 elements.[10]
  • The bicyclic monoid is the syntactic monoid of the Dyck language (the language of balanced sets of parentheses).
  • The free monoid on [math]\displaystyle{ A }[/math] (where [math]\displaystyle{ \left|A\right| \gt 1 }[/math]) is the syntactic monoid of the language [math]\displaystyle{ \{ww^R \mid w \in A^*\} }[/math], where [math]\displaystyle{ w^R }[/math] is the reversal of the word [math]\displaystyle{ w }[/math]. (For [math]\displaystyle{ \left|A\right| = 1 }[/math], one can use the language of square powers of the letter.)
  • Every non-trivial finite monoid is homomorphic[clarification needed] to the syntactic monoid of some non-trivial language,[11] but not every finite monoid is isomorphic to a syntactic monoid.[12]
  • Every finite group is isomorphic to the syntactic monoid of some regular language.[11]
  • The language over [math]\displaystyle{ \{a, b\} }[/math] in which the number of occurrences of [math]\displaystyle{ a }[/math] and [math]\displaystyle{ b }[/math] are congruent modulo [math]\displaystyle{ 2^n }[/math] is a group language with syntactic monoid [math]\displaystyle{ \mathbb{Z} / 2^n\mathbb{Z} }[/math].[5]
  • Trace monoids are examples of syntactic monoids.
  • Marcel-Paul Schützenberger[13] characterized star-free languages as those with finite aperiodic syntactic monoids.[14]

References

  1. 1.0 1.1 Holcombe (1982) p.160
  2. 2.0 2.1 Lawson (2004) p.210
  3. Lawson (2004) p.232
  4. Straubing (1994) p.55
  5. 5.0 5.1 Sakarovitch (2009) p.342
  6. "Linear Automaton Transformations", Proceedings of the American Mathematical Society 9 (4): 541–544, 1958, doi:10.1090/S0002-9939-1958-0135681-9 
  7. Brzozowski, Janusz; Szykuła, Marek; Ye, Yuli (2018), "Syntactic Complexity of Regular Ideals", Theory of Computing Systems 62 (5): 1175–1202, doi:10.1007/s00224-017-9803-8 
  8. Crochemore, Maxime et al. (2009), "From Nerode's congruence to suffix automata with mismatches", Theoretical Computer Science 410 (37): 3471–3480, doi:10.1016/j.tcs.2009.03.011 
  9. Straubing (1994) p.54
  10. Lawson (2004) pp.211-212
  11. 11.0 11.1 McNaughton, Robert; Papert, Seymour (1971). Counter-free Automata. Research Monograph. 65. With an appendix by William Henneman. MIT Press. p. 48. ISBN 0-262-13076-9. https://archive.org/details/CounterFre_00_McNa/page/48. 
  12. Lawson (2004) p.233
  13. Marcel-Paul Schützenberger (1965). "On finite monoids having only trivial subgroups". Information and Computation 8 (2): 190–194. doi:10.1016/s0019-9958(65)90108-7. http://igm.univ-mlv.fr/~berstel/Mps/Travaux/A/1965-4TrivialSubgroupsIC.pdf. 
  14. Straubing (1994) p.60