In mathematics and computer science, a history monoid is a way of representing the histories of concurrently running computer processes as a collection of strings, each string representing the individual history of a process. The history monoid provides a set of synchronization primitives (such as locks, mutexes or thread joins) for providing rendezvous points between a set of independently executing processes or threads.
History monoids occur in the theory of concurrent computation, and provide a low-level mathematical foundation for process calculi, such as CSP the language of communicating sequential processes, or CCS, the calculus of communicating systems. History monoids were first presented by M.W. Shields.[1]
History monoids are isomorphic to trace monoids (free partially commutative monoids) and to the monoid of dependency graphs. As such, they are free objects and are universal. The history monoid is a type of semi-abelian categorical product in the category of monoids.
Let
A=(\Sigma1,\Sigma2,\ldots,\Sigman)
\Sigmak
P(A)
* | |
P(A)=\Sigma | |
1 |
x
* | |
\Sigma | |
2 |
x … x
* | |
\Sigma | |
n |
(In more formal language,
P(A)
\Sigmak
u=(u1,u2,\ldots,un)
and
v=(v1,v2,\ldots,vn)
then
uv=(u1v1,u2v2,\ldots,unvn)
for all
u,v
P(A)
\Sigma=\Sigma1\cup\Sigma2\cup … \cup\Sigman.
(The union here is the set union, not the disjoint union.) Given any string
w\in\Sigma*
* | |
\Sigma | |
k |
* | |
\pi | |
k |
\pi:\Sigma*\toP(A)
w\in\Sigma*
\pik
\pi(w)\mapsto(\pi1(w),\pi2(w),\ldots,\pin(w)).
For every
a\in\Sigma
\pi(a)
\Sigmak
\pi(a)=(a1,a2,\ldots,an)
where
ak=\begin{cases}aifa\in\Sigmak\\ \varepsilonotherwise. \end{cases}
Here,
\varepsilon
H(A)
P(A)
H(A)=\{\pi(a)|a\in\Sigma\}*
H(A)
The use of the word history in this context, and the connection to concurrent computing, can be understood as follows. An individual history is a record of the sequence of states of a process (or thread or machine); the alphabet
\Sigmak
A letter that occurs in two or more alphabets serves as a synchronization primitive between the various individual histories. That is, if such a letter occurs in one individual history, it must also occur in another history, and serves to "tie" or "rendezvous" them together.
Consider, for example,
\Sigma1=\{a,b,c\}
\Sigma2=\{a,d,e\}
\Sigma=\{a,b,c,d,e\}
(a,a)
(b,\varepsilon)
(c,\varepsilon)
(\varepsilon,d)
(\varepsilon,e)
bcbcc
ddded
bcbdddcced
b
c
d
e
The letter
a
b
c
d
e
a
bcdabe
bdcaeb
bcab
dae
d
c
a
e
c
e
c
A history monoid is isomorphic to a trace monoid, and as such, is a type of semi-abelian categorical product in the category of monoids. In particular, the history monoid
H(\Sigma1,\Sigma2,\ldots,\Sigman)
M(D)
D=\left(\Sigma1 x \Sigma1\right)\cup \left(\Sigma2 x \Sigma2\right)\cup … \cup \left(\Sigman x \Sigman\right).
In simple terms, this is just the formal statement of the informal discussion given above: the letters in an alphabet
\Sigmak
\Sigmaj
Conversely, given any trace monoid
M(D)
\Sigmaa,=\{a,b\}
(a,b)
D