Trace monoid

From HandWiki
Short description: Generalization of strings in computer science

In computer science, a trace is a set of strings, wherein certain letters in the string are allowed to commute, but others are not. It generalizes the concept of a string, by not forcing the letters to always be in a fixed order, but allowing certain reshufflings to take place. Traces were introduced by Pierre Cartier and Dominique Foata in 1969 to give a combinatorial proof of MacMahon's master theorem. Traces are used in theories of concurrent computation, where commuting letters stand for portions of a job that can execute independently of one another, while non-commuting letters stand for locks, synchronization points or thread joins.[1] The trace monoid or free partially commutative monoid is a monoid of traces. In a nutshell, it is constructed as follows: sets of commuting letters are given by an independency relation. These induce an equivalence relation of equivalent strings; the elements of the equivalence classes are the traces. The equivalence relation then partitions up the free monoid (the set of all strings of finite length) into a set of equivalence classes; the result is still a monoid; it is a quotient monoid and is called the trace monoid. The trace monoid is universal, in that all dependency-homomorphic (see below) monoids are in fact isomorphic.

Trace monoids are commonly used to model concurrent computation, forming the foundation for process calculi. They are the object of study in trace theory. The utility of trace monoids comes from the fact that they are isomorphic to the monoid of dependency graphs; thus allowing algebraic techniques to be applied to graphs, and vice versa. They are also isomorphic to history monoids, which model the history of computation of individual processes in the context of all scheduled processes on one or more computers.

Trace

Let [math]\displaystyle{ \Sigma^* }[/math] denote the free monoid, that is, the set of all strings written in the alphabet [math]\displaystyle{ \Sigma }[/math]. Here, the asterisk denotes, as usual, the Kleene star. An independency relation [math]\displaystyle{ I }[/math] on [math]\displaystyle{ \Sigma }[/math] then induces a (symmetric) binary relation [math]\displaystyle{ \sim }[/math] on [math]\displaystyle{ \Sigma^* }[/math], where [math]\displaystyle{ u\sim v }[/math] if and only if there exist [math]\displaystyle{ x,y\in \Sigma^* }[/math], and a pair [math]\displaystyle{ (a,b)\in I }[/math] such that [math]\displaystyle{ u=xaby }[/math] and [math]\displaystyle{ v=xbay }[/math]. Here, [math]\displaystyle{ u,v,x }[/math] and [math]\displaystyle{ y }[/math] are understood to be strings (elements of [math]\displaystyle{ \Sigma^* }[/math]), while [math]\displaystyle{ a }[/math] and [math]\displaystyle{ b }[/math] are letters (elements of [math]\displaystyle{ \Sigma }[/math]).

The trace is defined as the reflexive transitive closure of [math]\displaystyle{ \sim }[/math]. The trace is thus an equivalence relation on [math]\displaystyle{ \Sigma^* }[/math], and is denoted by [math]\displaystyle{ \equiv_D }[/math], where [math]\displaystyle{ D }[/math] is the dependency relation corresponding to [math]\displaystyle{ I , }[/math] that is [math]\displaystyle{ D = (\Sigma \times \Sigma) \setminus I }[/math] and conversely [math]\displaystyle{ I = (\Sigma \times \Sigma) \setminus D . }[/math] Clearly, different dependencies will give different equivalence relations.

The transitive closure implies that [math]\displaystyle{ u\equiv v }[/math] if and only if there exists a sequence of strings [math]\displaystyle{ (w_0,w_1,\cdots,w_n) }[/math] such that [math]\displaystyle{ u\sim w_0 }[/math] and [math]\displaystyle{ v\sim w_n }[/math] and [math]\displaystyle{ w_i\sim w_{i+1} }[/math] for all [math]\displaystyle{ 0\le i \lt n }[/math]. The trace is stable under the monoid operation on [math]\displaystyle{ \Sigma^* }[/math] (concatenation) and is therefore a congruence relation on [math]\displaystyle{ \Sigma^* }[/math].

The trace monoid, commonly denoted as [math]\displaystyle{ \mathbb {M}(D) }[/math], is defined as the quotient monoid

[math]\displaystyle{ \mathbb {M}(D) = \Sigma^* / \equiv_D. }[/math]

The homomorphism

[math]\displaystyle{ \phi_D:\Sigma^*\to \mathbb {M}(D) }[/math]

is commonly referred to as the natural homomorphism or canonical homomorphism. That the terms natural or canonical are deserved follows from the fact that this morphism embodies a universal property, as discussed in a later section.

One will also find the trace monoid denoted as [math]\displaystyle{ M(\Sigma,I) }[/math] where [math]\displaystyle{ I }[/math] is the independency relation. Confusingly, one can also find the commutation relation used instead of the independency relation (it differs by including all the diagonal elements).

Examples

Consider the alphabet [math]\displaystyle{ \Sigma=\{a,b,c\} }[/math]. A possible dependency relation is

[math]\displaystyle{ \begin{matrix} D &=& \{a,b\}\times\{a,b\} \quad \cup \quad \{a,c\}\times\{a,c\} \\ &=& \{a,b\}^2 \cup \{a,c\}^2 \\ &=& \{ (a,b),(b,a),(a,c),(c,a),(a,a),(b,b),(c,c)\} \end{matrix} }[/math]

The corresponding independency is

[math]\displaystyle{ I_D=\{(b,c)\,,\,(c,b)\} }[/math]

Therefore, the letters [math]\displaystyle{ b,c }[/math] commute. Thus, for example, a trace equivalence class for the string [math]\displaystyle{ abababbca }[/math] would be

[math]\displaystyle{ [abababbca]_D = \{abababbca\,,\; abababcba\,,\; ababacbba \} }[/math]

The equivalence class [math]\displaystyle{ [abababbca]_D }[/math] is an element of the trace monoid.

Properties

The cancellation property states that equivalence is maintained under right cancellation. That is, if [math]\displaystyle{ w\equiv v }[/math], then [math]\displaystyle{ (w\div a)\equiv (v\div a) }[/math]. Here, the notation [math]\displaystyle{ w\div a }[/math] denotes right cancellation, the removal of the first occurrence of the letter a from the string w, starting from the right-hand side. Equivalence is also maintained by left-cancellation. Several corollaries follow:

  • Embedding: [math]\displaystyle{ w \equiv v }[/math] if and only if [math]\displaystyle{ xwy\equiv xvy }[/math] for strings x and y. Thus, the trace monoid is a syntactic monoid.Template:Non-sequitur
  • Independence: if [math]\displaystyle{ ua\equiv vb }[/math] and [math]\displaystyle{ a\ne b }[/math], then a is independent of b. That is, [math]\displaystyle{ (a,b)\in I_D }[/math]. Furthermore, there exists a string w such that [math]\displaystyle{ u\equiv wb }[/math] and [math]\displaystyle{ v\equiv wa }[/math].
  • Projection rule: equivalence is maintained under string projection, so that if [math]\displaystyle{ w\equiv v }[/math], then [math]\displaystyle{ \pi_\Sigma(w)\equiv \pi_\Sigma(v) }[/math].

A strong form of Levi's lemma holds for traces. Specifically, if [math]\displaystyle{ uv\equiv xy }[/math] for strings u, v, x, y, then there exist strings [math]\displaystyle{ z_1, z_2, z_3 }[/math] and [math]\displaystyle{ z_4 }[/math] such that [math]\displaystyle{ (w_2, w_3)\in I_D }[/math] for all letters [math]\displaystyle{ w_2\in\Sigma }[/math] and [math]\displaystyle{ w_3\in\Sigma }[/math] such that [math]\displaystyle{ w_2 }[/math] occurs in [math]\displaystyle{ z_2 }[/math] and [math]\displaystyle{ w_3 }[/math] occurs in [math]\displaystyle{ z_3 }[/math], and

[math]\displaystyle{ u\equiv z_1z_2,\qquad v\equiv z_3z_4, }[/math]
[math]\displaystyle{ x\equiv z_1z_3,\qquad y\equiv z_2z_4. }[/math][2]

Universal property

A dependency morphism (with respect to a dependency D) is a morphism

[math]\displaystyle{ \psi:\Sigma^*\to M }[/math]

to some monoid M, such that the "usual" trace properties hold, namely:

1. [math]\displaystyle{ \psi(w)=\psi(\varepsilon) }[/math] implies that [math]\displaystyle{ w=\varepsilon }[/math]
2. [math]\displaystyle{ (a,b)\in I_D }[/math] implies that [math]\displaystyle{ \psi(ab)=\psi(ba) }[/math]
3. [math]\displaystyle{ \psi(ua)=\psi(v) }[/math] implies that [math]\displaystyle{ \psi(u)=\psi(v\div a) }[/math]
4. [math]\displaystyle{ \psi(ua)=\psi(vb) }[/math] and [math]\displaystyle{ a\ne b }[/math] imply that [math]\displaystyle{ (a,b)\in I_D }[/math]

Dependency morphisms are universal, in the sense that for a given, fixed dependency D, if [math]\displaystyle{ \psi:\Sigma^*\to M }[/math] is a dependency morphism to a monoid M, then M is isomorphic to the trace monoid [math]\displaystyle{ \mathbb{M}(D) }[/math]. In particular, the natural homomorphism is a dependency morphism.

Normal forms

There are two well-known normal forms for words in trace monoids. One is the lexicographic normal form, due to Anatolij V. Anisimov and Donald Knuth, and the other is the Foata normal form due to Pierre Cartier and Dominique Foata who studied the trace monoid for its combinatorics in the 1960s.[3]

Unicode's Normalization Form Canonical Decomposition (NFD) is an example of a lexicographic normal form - the ordering is to sort consecutive characters with non-zero canonical combining class by that class.

Trace languages

Just as a formal language can be regarded as a subset of [math]\displaystyle{ \Sigma^* }[/math], the set of all possible strings, so a trace language is defined as a subset of [math]\displaystyle{ \mathbb{M}(D) }[/math] all possible traces.

Alternatively, but equivalently, a language [math]\displaystyle{ L\subseteq\Sigma^* }[/math] is a trace language, or is said to be consistent with dependency D if

[math]\displaystyle{ L = [L]_D }[/math]

where

[math]\displaystyle{ [L]_D = \bigcup_{w \in L} [w]_D }[/math]

is the trace closure of a set of strings.

See also

Notes

  1. Sándor & Crstici (2004) p.161
  2. Proposition 2.2, Diekert and Métivier 1997.
  3. Section 2.3, Diekert and Métivier 1997.

References

General references

  • Diekert, Volker; Métivier, Yves (1997), "Partial Commutation and Traces", in Rozenberg, G.; Salomaa, A., Handbook of Formal Languages Vol. 3; Beyond Words, Springer-Verlag, Berlin, pp. 457–534, ISBN 3-540-60649-1, http://citeseer.ist.psu.edu/diekert97partial.html 
  • Lothaire, M. (2011), Algebraic combinatorics on words, Encyclopedia of Mathematics and Its Applications, 90, With preface by Jean Berstel and Dominique Perrin (Reprint of the 2002 hardback ed.), Cambridge University Press, ISBN 978-0-521-18071-9 
  • Antoni Mazurkiewicz, "Introduction to Trace Theory", pp 3–41, in The Book of Traces, V. Diekert, G. Rozenberg, eds. (1995) World Scientific, Singapore ISBN 981-02-2058-8
  • Volker Diekert, Combinatorics on traces, LNCS 454, Springer, 1990, ISBN 3-540-53031-2, pp. 9–29
  • Sándor, Jozsef; Crstici, Borislav (2004), Handbook of number theory II, Dordrecht: Kluwer Academic, pp. 32–36, ISBN 1-4020-2546-7 

Seminal publications

  • Pierre Cartier and Dominique Foata, Problèmes combinatoires de commutation et réarrangements, Lecture Notes in Mathematics 85, Springer-Verlag, Berlin, 1969, Free 2006 reprint with new appendixes
  • Antoni Mazurkiewicz, Concurrent program schemes and their interpretations, DAIMI Report PB 78, Aarhus University, 1977