# Toward Uniform Random Generation in 1-safe Petri Nets

Samy Abbes

► To cite this version:

Samy Abbes. Toward Uniform Random Generation in 1-safe Petri Nets. GASCOM 2016, 2016, Bastia, France. 10.1016/j.endm.2017.05.002. hal-01292954

HAL Id: hal-01292954

https://hal.science/hal-01292954

Submitted on 24 Mar 2016

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Toward Uniform Random Generation in 1-safe Petri Nets

Samy Abbes

University Paris Diderot - Paris 7

CNRS Laboratory IRIF (UMR 8243)

Paris, France

samy.abbes@univ-paris-diderot.fr

## Abstract

We study the notion of uniform measure on the space of infinite executions of a 1-safe Petri net. Here, executions of 1-safe Petri nets are understood up to commutation of concurrent transitions, which introduces a challenge compared to usual transition systems. We obtain that the random generation of infinite executions reduces to the simulation of a finite state Markov chain. Algorithmic issues are discussed.

## 1—Introduction

Petri nets are formal models designed to describe and analyze the behavior of concurrent systems. Among the many kinds of systems where Petri nets may be introduced to formally describe a concurrent dynamics, distributed databases [9] and telecommunication networks [5] are two typical examples. Both examples involve temporal evolution on the one hand, and the paradigm of resource sharing on the other hand, where resources are “spatially” distributed. Requests for resources are local, in such a way that any two actions requiring disjoint sets of resources may be considered as parallel.

Since their initial introduction in the 1960’s, several variants of Petri nets have been studied. In this paper, we shall limit ourselves to 1-safe Petri nets, which we briefly define now. An *unmarked Petri net* is a triple $N = (P, T, F)$, where $P$ and $T$ are two finite and disjoint non empty sets of *places* and of *transitions* respectively, and $F \subseteq (P \times T) \cup (T \times P)$ is called the *flow relation*. Graphically, places are traditionally represented by circles and transitions are represented by squares or rectangles (see Figure 1). The flow relation is depicted by arrows from places to transitions and from transitions to places.

Given a transition $t \in T$, the *preset* $\bullet t$ and the *postset* $t^\bullet$ of $t$ are the sets of places defined as follows:

$$ \bullet t = \{p \in P : (p, t) \in F\}, $$

$$ t^\bullet = \{p \in P : (t, p) \in F\}. $$

It is assumed that the preset and the postset of any transition are both non empty.

A *marking* of $N$ is any integer valued function $M : P \to \mathbb{N}$. The marking is said to be 1-*safe*, or simply *safe*, whenever $M(p) \le 1$ for all places $p \in P$. The number $M(p)$ is interpreted as a number of *tokens* lying in the place $p$. Tokens are graphically figured inside places, as in Figure 1. Given a marking $M$ of $N$, and a transition $t \in T$, we say that $t$ can fire from $M$, or that $M$ enables $t$, whenever $M(\cdot) > 0$ on $\bullet t$.

If $t$ can fire from $M$, then the *firing rule* $M \xrightarrow{t} M'$ defines the new marking $M'$ as follows (see the commentary below and the illustration in Figure 1):

$$ \forall p \in P \quad M'(p) = \begin{cases} M(p), & \text{if } p \notin (\bullet t \cup t^\bullet) \\ M(p) - 1, & \text{if } p \in \bullet t \setminus t^\bullet \\ M(p) + 1, & \text{if } p \in t^\bullet \setminus \bullet t \\ M(p), & \text{if } p \in (\bullet t \cap t^\bullet) \end{cases} $$
<figure><img src="image_2.png" /><figcaption>Figure 1: Illustrating the firing rule in Petri nets</figcaption></figure>

The intuitive interpretation of the firing rule is as follows. The tokens located in places of the preset $\bullet t$ are resources, needed for firing and consumed by the transition when fired; this explains the second rule. The firing of $t$ also produces new resources, i.e., tokens; the third rule specifies that the new tokens are created in the postset of $t$. If a place belongs to both the pre- and the postset of $t$, then we can see the fourth rule as the simultaneous instance of both the second and the third rule: an existing resource is consumed and immediately after a new one is created, replacing the first one. Finally, the first rule specifies that only places “near” the firing transition are concerned by the firing rule. Note that the total number of tokens in the net may differ once the transition has fired.

Given a marking $M_0$, a firing sequence from $M_0$ is a sequence $(t_1, \dots, t_k)$ of transitions such that, for some markings $M_1, \dots, M_k$ defined inductively, the firing rules $M_{i-1} \xrightarrow{t_i} M_i$ hold for all $i = 1, \dots, k$. Of course, if such markings exist, they are unique. Retaining only the last marking, we introduce the obvious notation $M_0 \xrightarrow{t_1 \cdots t_k} M_k$, with the convention $M_0 \xrightarrow{\epsilon} M_0$ for the empty sequence $\epsilon$, which is considered as a firing sequence.

Any marking $M$ such that $M_0 \xrightarrow{t_1 \cdots t_k} M$ holds for some firing sequence $t_1 \cdots t_k$ is said to be reachable from $M_0$.

A Petri net is a quadruple $N = (P, T, F, M_0)$, such that $(P, T, F)$ is an unmarked Petri net, of which $M_0$ is a marking, called the initial marking of the net. The Petri net $N$ is said to be 1-safe, or simply safe, whenever all markings reachable from $M_0$ are safe; this implies of course that $M_0$ itself is safe. By convention, we assume that $M_0$ is fixed once and for all, and by a marking $M$ of the net we mean any marking reachable from $M_0$.

Based on firing sequences, authors have introduced a refined point of view on the executions of Petri nets. The idea is to underline the concurrency features of the model. Indeed, the firing rule enlightens that a special status should be given to pairs $(t, t')$ of transitions such that $(\bullet t \cup t') \cap (\bullet t' \cup t') = \emptyset$; in this paper, we shall say that two such transitions are distant. According to the firing rule, if both $t$ and $t'$ are enabled by some marking $M$, and if they are distant, then: 1) the firing of one does not prevent the firing of the other one, and 2) the markings resulting from the two firing sequences $t \cdot t'$ and $t' \cdot t$, fired from $M$, are the same.

Henceforth, instead of mere firing sequences, it is natural to consider equivalence classes of firing sequences, with respect to some congruence $\mathcal{R}$, such that $(t \cdot t', t' \cdot t) \in \mathcal{R}$ for any two distant transitions $t$ and $t'$. We define thus $\mathcal{R}$ as the smallest congruence on the set firing sequences that contains all pairs $(t \cdot t', t' \cdot t)$, for $t$ and $t'$ two distant transitions. Hence, two firing sequences are congruent whenever one can pass from one to another by applying a finite number of times elementary
transformations of the form:

$$ (x) \cdot t \cdot t' \cdot (y) \rightarrow (x) \cdot t' \cdot t \cdot (y) $$

where (x) and (y) are any two words on the alphabet T, and t and t' are two distant transitions.

Equivalence classes of firing sequences are called configurations; intuitively, they only capture the causal relations between transitions, and they leave unspecified the chronological relations between distant and unrelated transitions; see for instance G. Winskel's notion of event structure and of unfolding of Petri net for a precise account on this interpretation [12].

In this paper, we are interested in the random sampling of configurations of a given safe Petri net. We insist that it shall not be confused with the random sampling of firing sequences. The later ultimately reduces to the standard procedure of sampling in a large, but finite transition system, with the set of markings of the net as set of states. By contrast, the sampling of configurations is by no means standard—at least, not on first sight.

Therefore, we consider configurations as our primary objects of interest, instead of their underlying firing sequences. It is consistent with the general idea that the concurrent firing of distant transitions should not be ordered, since the ordering of parallel transitions does not correspond to any “observable” of the system and thus would be rather artificial.

In order to properly deal with configurations, we rely first on the notion of trace monoid (also called heap monoid [14] or free partially commutative monoid [7]). More precisely, the exact notion that we need is that of a trace monoid acting on a finite set. Associated with the action of a trace monoid, is a notion of uniform probability measure on the space of “infinite traces”, developed in a previous work [1]. In the context of Petri nets, infinite traces correspond to the infinite executions of the net.

The purpose of this paper is thus twofold: 1) give an account on the uniform measure relative to the action of a trace monoid on a finite set; and 2) analyze the application of this theory in the context of safe Petri nets and for random sampling purposes. The intended applications related to random generation are of two kinds: random generation of infinite executions of a Petri net, uniformly distributed and once this has been properly defined, on the one hand; random generation of a finite execution, uniformly distributed among all finite executions of size n, on the other hand. The results of the paper allow to tackle the first task, at least theoretically, although some algorithmic issues inevitably remain and are discussed. The second task, concerning finite sampling, is not discussed here because of space constraints. Let us mention however that the solution to a similar, but simpler problem treated in [3], could probably be extended to this case with few modifications. In turn, these are the basic building blocks needed, for instance, for probabilistic model checking of formal properties of concurrent systems.

The application to Petri nets will be treated on an example. Henceforth, the contributions of this paper consist mainly in the new questions that we formulate concerning the uniform measure relatively to the specific model of Petri nets, compared to more general asynchronous systems.

We underline that the probabilistic dynamics to which we are naturally brought radically differs from that of stochastic Petri nets [4]—this is due to the radical turn we have taken in our analysis by considering configurations instead of firing sequences, as explained above.

The outline of the paper is as follows. Section 2 recalls the basics on trace monoids and their combinatorics. Section 3 is devoted to the action of trace monoids and their combinatorics, and introduces the associated notion of uniform measure. It is only in
Section 4 that we meet with Petri nets again, applying the results from Section 3 to their case.

## 2—Trace monoids and their boundary

Let $\Sigma$ be an *alphabet*, that is to say, a finite set, the elements of which are called *letters*. Let also $I \subset \Sigma \times \Sigma$ be a binary relation, that we assume to be symmetric and *irreflexive*, and that is called an *independence relation*. Let $\Sigma^*$ denote the monoid of $\Sigma$-words, and let $\mathcal{R}$ be the smallest congruence on $\Sigma^*$ containing all pairs $(ab, ba)$ for $(a, b) \in I$. The *trace monoid* $M = M(\Sigma, I)$ is the quotient monoid $M = \Sigma^*/\mathcal{R}$. In other words, $M$ is the presented monoid:

$$M = \langle \Sigma \mid ab = ba \text{ for all } (a, b) \in I \rangle.$$

Elements of $M$ are called *traces*. The concatenation of traces is denoted with the dot ".", and the identity element is denoted $\varepsilon$. Clearly, if $x$ and $y$ are two $\mathcal{R}$-congruent words, they have the same length. This defines a length function $|\cdot|: M \to \mathbb{N}$ on traces. Clearly also, the left divisibility relation on $M$, defined by $x \le y \iff \exists z \ y = x \cdot z$, is a partial order on $M$.

A *clique* of $M$ is any product of the form $\gamma = a_1 \dots a_k$, where $a_1, \dots, a_k$ are letters such that $i \ne j \implies (a_i, a_j) \in I$. Note in particular that the $a_i$'s are pairwise distinct. Let $\mathcal{C}$ denote the set of cliques; this is a finite set. Let also $\mathcal{C} = \mathcal{C} \setminus \{\varepsilon\}$ denote the set of non empty cliques. A pair $(\gamma, \gamma') \in \mathcal{C} \times \mathcal{C}$ is said to be in normal form whenever, for each letter $b$ occurring in $\gamma'$, there is a letter $a$ occurring in $\gamma$ such that $(a, b) \notin I$. We denote it by the symbol $\gamma \to \gamma'$.

A sequence $(\gamma_1, \dots, \gamma_n)$ in $\mathcal{C}$ is said to be normal whenever $\gamma_i \to \gamma_{i+1}$ holds for all $i \in \{1, \dots, n-1\}$. It is well known that traces admit the following normal form [7, 14]: for every $x \in M \setminus \{\varepsilon\}$, there exists a unique integer $n \ge 1$ and a unique normal sequence $(\gamma_1, \dots, \gamma_n)$ in $\mathcal{C}$ such that $x = \gamma_1 \dots \gamma_n$.

The existence of this normal form is the basis for establishing the following combinatorial results. Let $\mu(z)$ be the polynomial, called *Möbius polynomial*, and defined by:

$$\mu(z) = \sum_{\gamma \in \mathcal{C}} (-1)^{|\gamma|} z^{|\gamma|}.$$

Let also the growth series $G(z)$ be defined by:

$$G(z) = \sum_{k \ge 0} \lambda(k) z^k, \quad \lambda(k) = \#S(k), \quad S(k) = \{x \in M : |x| = k\}.$$

Then $G(z)$ is a rational series, inverse of the Möbius polynomial: $G(z) = 1/\mu(z)$. Furthermore [10, 11, 8], $\mu(z)$ has a unique root of smallest modulus. This root, say $p_0$, is real and lies in $(0, 1]$, and coincides with the radius of convergence of the series $G(z)$. We shall extend in next section this well known result in the framework of a trace monoid acting on a finite set.

The existence of the normal form entails that traces are in bijection with finite paths in the finite graph of non empty cliques $(\mathcal{C}, \to)$. It is thus natural to define *infinite traces* as infinite paths in the very same graph $(\mathcal{C}, \to)$. Let $\partial M$ denote the set of infinite traces. The set $\partial M$ is called the *boundary* of $M$. It is standard that the set $\partial M$, equipped with the natural topology, is metrisable and compact.

It is a bit less standard to extend the partial ordering relation $\le$ from $M$ to $\partial M$. Let $\xi = (\gamma_1, \gamma_2, \dots)$ be an infinite trace, and let $x \in M$. Then we put $x \le \xi$ if
and only if $x \le (\gamma_1 \dots \gamma_k)$ in $\mathcal{M}$ for all $k$ large enough. And we define the visual cylinder $\uparrow x$, as the following subset of $\partial\mathcal{M}$:

$$ \uparrow x = \{ \xi \in \partial\mathcal{M} : x \le \xi \}. $$

We will be interested in probability measures on the space $\partial\mathcal{M}$ equipped with its Borel $\sigma$-algebra. The following result shows the importance of visual cylinders in this respect (see [2, § 2.2]).

**Lemma 2.1**—Any probability measure $m$ on $\partial\mathcal{M}$ is entirely characterized by the countable collection $m(\uparrow x)$, for $x$ ranging over $\mathcal{M}$.

We conclude this section by illustrating the above notions on a concrete example. It will be given a Petri net interpretation below in Section 4.

Let $\Sigma = \{a, b, c, d, e\}$ and let $\mathcal{M} = \langle\Sigma|ad = da, ae = ea, bd = db, be = eb, ce = ce\rangle$. The set of non empty cliques is $\mathcal{C} = \{a, b, c, d, e, ad, ae, bd, be, ce\}$. For instance, the trace $adebc = daebc = dabec$ has the normal form $(ad) \to (be) \to (c)$.

The Möbius polynomial of $\mathcal{M}$ is: $\mu(z) = 1 - 5z + 5z^2$, and its root of smallest modulus is $p_0 = \frac{1}{2} - \frac{1}{2\sqrt{5}}$.

### 3—Uniform measure relative to the action of a trace monoid

Let $\mathcal{M} = \mathcal{M}(\Sigma, I)$ be a trace monoid. Let also $Y$ be a finite set of states. We assume given a right monoid action of $\mathcal{M}$ on $Y$, that is to say, a function $\varphi: Y \times \mathcal{M} \to \mathcal{M}$ denoted by $\varphi(s, x) = s \cdot x$, satisfying the following:

$$ \forall s \in Y \quad s \cdot \varepsilon = s, \quad \forall (s, x, y) \in Y \times \mathcal{M} \times \mathcal{M} \quad s \cdot (x \cdot y) = (s \cdot x) \cdot y. $$

The pair $(Y, \mathcal{M})$, with the action understood, is called an asynchronous system. The traces $x \in \mathcal{M}$ are thought of as actions featuring parallelism; the effect of the action $x \in \mathcal{M}$ on a state $s \in Y$ is to change the state of the system into the new state $s \cdot x$.

A desirable feature is to disable some actions, depending on the current state of the system. We render this feature by assuming the existence of a particular state $\perp$, such that $\perp \cdot x = \perp$ for all $x \in \mathcal{M}$. We put $Y = X \cup \{\perp\}$ with $\perp \notin X$, so that the “real” states are actually the elements of $X$; we will always restrict our attention to those pairs $(s, x) \in X \times \mathcal{M}$ such that $s \cdot x \ne \perp$. Hence, it is customary to introduce the following notation:

$$ \forall s \in X \quad \mathcal{M}_s = \{x \in \mathcal{M} : s \cdot x \ne \perp\}. $$

We say that the action is irreducible if, for every pair $(s, t) \in X \times X$ of states, there exists an action $x \in \mathcal{M}$ such that $x \ne \varepsilon$ and $t = s \cdot x$. We shall always assume that the action under consideration is irreducible.

On the combinatorics side, the analogous of the growth series is the following matrix of formal series:

$$ G = (G_{s,t})_{(s,t) \in X \times X}, \quad G_{s,t}(z) = \sum_{x \in \mathcal{M} : x \cdot s = t} z^{|x|}. $$

Note that each line of $G$, say indicated by $s \in S$, sums up to the growth series $G_s$ of the subset $\mathcal{M}_s$, defined by:

$$ G_s(z) = \sum_{k \ge 0} \lambda_s(k), \quad \lambda_s(k) = \#\{x \in \mathcal{M}_s : |x| = k\}. \quad (1) $$
Let us define the Möbius matrix $M$ by:

$$M = (M_{s,t})_{(s,t) \in X \times X}, \qquad M_{s,t}(z) = \sum_{\gamma \in \mathcal{C} : s \cdot \gamma = t} (-1)^{|\gamma|} z^{\gamma},$$

where $\mathcal{C}$ denotes the set of cliques of $\mathcal{M}$. Then $M(z)$ is the formal inverse of the growth matrix: $G(z)M(z) = I$, where $I$ is the identity matrix of size $|X| \times |X|$ (see [1, Theorem 5.10]).

Given our hypothesis that the action is irreducible, all entries in the growth matrix $G$ have the same radius of convergence, say $q_0 \in (0, 1]$. It is also the common radius of convergence of the growth series $G_s(z)$, for $s \in X$, defined in (1). We call $q_0$ the characteristic root of the system $(Y, \mathcal{M})$.

Let the theta polynomial be the polynomial with integer coefficients defined by $\theta(z) = \det M(z)$. Then $q_0$ is the smallest positive root of $\theta(z)$ [1, Theorem 5.11].

The above elements of combinatorics allow us to introduce a notion of uniform measure, as follows. For each state $s \in X$, and for each real number $q \in (0, q_0)$, let $m_{s,q}$ be the discrete probability measure on $\mathcal{M}$ defined by:

$$m_{q,s} = \frac{1}{G_s(q)} \sum_{x \in \mathcal{M}_s} q^{|x|} \delta_{\{x\}},$$

where $\delta_{\{x\}}$ is the Dirac measure at $x$. Then, according to [1, Theorem 5.16], the family $(m_{s,q})_{q<q_0}$ converges weakly, as $q \to q_0^-$, toward a probability measure $\nu_s$ concentrated on $\partial \mathcal{M}$, and which satisfies the following property (recall that a probability measure on $\partial \mathcal{M}$ is entirely determined by its values on visual cylinders):

$$\forall s \in X \quad \forall x \in \mathcal{M}_s \quad \nu_s(\uparrow x) = q_0^{|x|} \Gamma(s, s \cdot x), \qquad (2)$$

and $\nu_s(\uparrow x) = 0$ whenever $x \notin \mathcal{M}_s$, i.e., whenever $s \cdot x = \perp$. In (2), $\Gamma(\cdot, \cdot) : X \times X \to (0, \infty)$ is a function satisfying the following cocycle identity: $\Gamma(s, u) = \Gamma(s, t)\Gamma(t, u)$ for all $s, t, u \in X$.

We call the family $\nu = (\nu_s)_{s \in X}$ the uniform measure of the asynchronous system $(Y, \mathcal{M})$, although it is only each individual $\nu_s$ which is actually a probability measure. Clearly, the state $s$ indexing $\nu_s$ is to be seen as the initial state of the system. The form (2), together with the cocycle identity, immediately yields the following property:

$$\forall (s, x, y) \in X \times \mathcal{M} \times \mathcal{M} \quad \nu_s(\uparrow (x \cdot y)) = \nu_s(x) \cdot \nu_{s \cdot x}(\uparrow y). \qquad (3)$$

This chain rule (3) justifies that the uniform measure $\nu$ is called a Markov measure; but there are other families satisfying (3) than the uniform measure that we just constructed.

Regarding a uniqueness result, we leave the following question open: is there a unique pair $(q_0, \Gamma)$, where $q_0 \in (0, 1]$ and $\Gamma(\cdot, \cdot) : X \times X \to (0, \infty)$ satisfies the cocycle identity, such that the formula $\nu_s(\uparrow x) = q_0^{|x|} \Gamma(x, s \cdot x)$ for $x \in \mathcal{M}_s$ and $\nu_s(\uparrow x) = 0$ for $x \notin \mathcal{M}_s$, defines a probability measure on $\partial \mathcal{M}$ for all $s \in X$?

From the sampling point of view, the following realization result is interesting. Let $s_0 \in X$ be a fixed initial state, and let $\xi \in \partial \mathcal{M}$ be an infinite trace distributed according to $\nu_{s_0}$. Let $\xi$ be given as the infinite path $\xi = (C_1, C_2, \dots)$ in $(\mathcal{C}, \to)$ (see Section 2). Here, we see $(C_k)_{k \ge 1}$ as a sequence of random variables under the probability $\nu_{s_0}$. Finally, for $k \ge 0$, let $S_k$ be the state of the system reached after the action of the $k$ first cliques: $S_k = s_0 \cdot (C_1 \dots C_k)$, with $S_0 = s_0$ by convention. Then, according to [1, Theorem 4.5], under $\nu_{s_0}$, the sequence of pairs $(S_{k-1}, C_k)_{k \ge 1}$ is a homogeneous Markov chain with values in $(X \times \mathcal{C})$, that we call the Markov
chain of states-and-cliques. Furthermore: 1) the transition matrix of the chain is independent of $s_0$; and 2) both the initial measure and the transition matrix of the chain have algebraic expressions involving only $q_0$ and $\Gamma(\cdot, \cdot)$. See [1] for the explicit expressions.

Hence, both for theoretical and for sampling purposes, the problem comes down to determining the characteristic root $q_0$ and the cocycle $\Gamma(\cdot, \cdot)$. As for $q_0$, its characterization as a particular root of the theta polynomial yields the following algorithmic issues: 1) list all cliques of $\mathcal{M}$, which is very well known to be hard (exponential in the size of $\Sigma$ in worst case [13]); 2) compute a determinant of size $|X| \times |X|$, the entries of which are polynomials of degree at most $\alpha$, where $\alpha$ is the maximal size of a clique; 3) solve the equation $\theta(z) = 0$ for the smallest positive root, where $\theta$ is of degree at most $\alpha|X|$ and $\alpha$ is the maximal size of a clique.

Regarding the cocycle $\Gamma(\cdot, \cdot)$, we have not found a systematic way of determining it. We will see in next section how to determine it in practice on an example. Based on the uniqueness conjecture stated above, we can expect that this technique actually works in general, yielding an algorithmic way of obtaining the cocycle.

## 4—Application to 1-safe Petri nets

In this section, we study 1-safe Petri nets as asynchronous systems as defined in the previous section. Although this point of view is quite natural, it does not seem to have been adopted by other authors yet, not formally at least.

Let $N = (P, T, F, M_0)$ be a 1-safe Petri nets. Define the set of states $X$ as the state of reachable markings of $N$. We consider $\Sigma = T$ as alphabet, and as independence relation $I$, we take $I = \{(t, t') \in T \times T : (\bullet t \cup t') \cup (\bullet t' \cup t'') = \emptyset\}$, hence the set of distant pairs as defined in Section 1. Finally, let $\mathcal{M} = \mathcal{M}(\Sigma, I)$ be the associated trace monoid (see Section 2).

Putting $Y = X \cup \{\perp\}$, we define an action of $\mathcal{M}$ on $Y$ as follows. Let $M \in X$, and let $x \in \mathcal{M}$, of which $(t_1, \dots, t_k)$ is a representative sequence of transitions. Then, if $(t_1, \dots, t_k)$ is a firing sequence from $M$, we put $M \cdot x = M'$ such that $M \xrightarrow{t_1 \cdots t_k} M'$; and if $(t_1, \dots, t_k)$ is not a firing sequence from $M$, we put $M \cdot x = \perp$. Obviously, this definition does not depend on the representative sequence $(t_1, \dots, t_k)$. It is clear also that $M \cdot (x \cdot y) = (M \cdot x) \cdot y$ holds for all $x, y \in \mathcal{M}$.

Let us consider for instance the Petri net depicted in Figure 2, with the initial marking, say $M_0$, depicted. Clearly, this net is safe, and its only reachable marking, say $M_1$, other than $M_0$ is the marking obtained from $M_0$ by firing transition $b$. The associated trace monoid is $\mathcal{M} = \langle a, b, c, d, e, \mid ad = da, ae = ea, bd = db, be = eb, ce = ec \rangle$, that is to say, the example trace monoid introduced at the end of Section 2. The action obeys the following description, which implies in particular that it is an irreducible action:

$$ 
\begin{array}{lclcl}
M_0 \cdot a = M_0 & M_0 \cdot b = M_1 & M_0 \cdot c = \perp & M_0 \cdot d = M_0 & M_0 \cdot e = M_0 \\
M_1 \cdot a = \perp & M_1 \cdot b = \perp & M_1 \cdot c = M_0 & M_1 \cdot d = M_1 & M_1 \cdot e = M_1
\end{array}
$$

Note however that this description does not characterize the action by itself, since it does not render the concurrency features encoded in the independence relation $I$.

The Möbius matrix and the theta polynomials are:

$$ M(z) = \begin{pmatrix} 1 - 3z + 2z^2 & -z + 2z^2 \\ -z + z^2 & 1 - 2z \end{pmatrix} \qquad \theta(z) = (1-z)(1-2z)(1-2z-z^2). $$

The characteristic root is thus $q_0 = \sqrt{2} - 1$.
<figure><img src="image_3.png" /><figcaption>Figure 2: Example of a safe Petri net. The underlying trace monoid is the one introduced at the end of Section 2.</figcaption></figure>

Let $\nu = (\nu_{M_0}, \nu_{M_1})$ be the uniform measure associated with the action. Let also $\Gamma(\cdot, \cdot)$ be the cocycle associated with $\nu$, so that $\nu_M(\uparrow x) = q_0^{|x|}\Gamma(M, M \cdot x)$ for all $M \in \{M_0, M_1\}$ and for all $x \in \mathcal{M}_M$. Then, by the cocycle property of $\Gamma$, one has $\Gamma(M_0, M_0) = \Gamma(M_1, M_1) = 1$ on the one hand, and one has $\Gamma(M_1, M_0) = 1/\Gamma(M_0, M_1)$ on the other hand. Hence $\Gamma(\cdot, \cdot)$ is entirely determined by the single value $\lambda = \Gamma(M_0, M_1)$.

In order to retrieve the value $\lambda$, we write down the following equation. This is equivalent [2, 1] to writing down the total probability law for the first clique $C_1$, starting from marking $M_0$:

$$ \sum_{\gamma \in \mathcal{C} : M_0 \cdot \gamma \neq \perp} (-1)^{\gamma} \nu_{M_0}(\uparrow \gamma) = 0. $$

Since $\nu_{M_0}(\uparrow \gamma) = q_0^{|\gamma|}\Gamma(M_0, M_0 \cdot \gamma)$ on the one hand, and since the cliques $\gamma$ such that $M \cdot \gamma \neq \perp$ range over $\{\epsilon, a, b, d, e, ad, ae, bd, be\}$, this writes as:

$$ 1 - 3q_0\Gamma(M_0, M_0) - q_0\Gamma(M_0, M_1) + 2q_0^2\Gamma(M_0, M_0) + 2q_0^2\Gamma(M_0, M_1) = 0. $$

Since $\Gamma(M_0, M_0) = 1$, introducing the unknown $\lambda = \Gamma(M_0, M_1)$ yields:

$$ \lambda = \frac{1 - 3q_0 + 2q_0^2}{q_0(1 - 2q_0)} = \frac{-1 + 3q_0}{1 - 2q_0}, $$

the later equality following from the equation $1 - 2q_0 - q_0^2 = 0$. Introducing the value $q_0 = \sqrt{2} - 1$ finally yields the simple expression: $\lambda = \sqrt{2}$. Therefore the visual cylinders are given probabilities with the following simple expressions:

$$ \forall x \in \mathcal{M}_{M_0} \quad \nu_{M_0}(\uparrow x) = \begin{cases} (\sqrt{2} - 1)^{|x|}, & \text{if } M_0 \cdot x = M_0 \\ \sqrt{2}(\sqrt{2} - 1)^{|x|}, & \text{if } M_0 \cdot x = M_1 \end{cases} $$

$$ \forall x \in \mathcal{M}_{M_1} \quad \nu_{M_1}(\uparrow x) = \begin{cases} (\sqrt{2} - 1)^{|x|}, & \text{if } M_1 \cdot x = M_1 \\ \frac{1}{\sqrt{2}}(\sqrt{2} - 1)^{|x|}, & \text{if } M_1 \cdot x = M_0 \end{cases} $$

The above formulas however are not operational for sampling purposes. One way to obtain a sampling method is to consider the Markov chain of states-and-cliques, that is to say, the random sequence of pairs $(M_{k-1}, C_k)_{k \ge 1}$, where $(C_k)_{k \ge 1}$ is the sequence of cliques forming an infinite trace $\xi$ and $M_k$ is the marking reached after
the $k^{\text{th}}$ clique (see Section 3). Based on the formulas of [1] and on the values found above for $q_0$ and for $\Gamma(\cdot, \cdot)$, we find that the transition matrix of $(M_{k-1}, C_k)_{k \ge 1}$ is the following stochastic matrix—keeping in mind that only the reachable pairs $(M, \gamma) \in X \times \mathbb{C}$ have to be considered, see the remark below:

$$
\begin{pmatrix}
-M_0, a & -1 + \sqrt{2} & 0 & 0 & 0 & 0 & 2 - \sqrt{2} & 0 & 0 & 0 & 0 \\
-M_0, c & -2 + \frac{3}{2}\sqrt{2} & 0 & 1 - \frac{1}{2}\sqrt{2} & 0 & 0 & 3 - 2\sqrt{2} & 0 & 0 & -1 + \sqrt{2} & 0 \\
M_0, ad & -7 + 5\sqrt{2} & 0 & 3 - 2\sqrt{2} & 3 - 2\sqrt{2} & 0 & 10 - 7\sqrt{2} & 0 & 0 & -4 + 3\sqrt{2} & -4 + 3\sqrt{2} \\
M_0, ae & -7 + 5\sqrt{2} & 0 & 3 - 2\sqrt{2} & 3 - 2\sqrt{2} & 0 & 10 - 7\sqrt{2} & 0 & 0 & -4 + 3\sqrt{2} & -4 + 3\sqrt{2} \\
M_0, ce & -7 + 5\sqrt{2} & 0 & 3 - 2\sqrt{2} & 3 - 2\sqrt{2} & 0 & 10 - 7\sqrt{2} & 0 & 0 & -4 + 3\sqrt{2} & -4 + 3\sqrt{2} \\
M_1, b & 0 & 3 - 2\sqrt{2} & 0 & 0 & -2 + \frac{3}{2}\sqrt{2} & 0 & -1 + \sqrt{2} & 1 - \frac{1}{2}\sqrt{2} & 0 & 0 \\
M_1, d & 0 & 3 - 2\sqrt{2} & 0 & 0 & -2 + \frac{3}{2}\sqrt{2} & 0 & -1 + \sqrt{2} & 1 - \frac{1}{2}\sqrt{2} & 0 & 0 \\
M_1, e & 0 & 0 & 0 & 0 & 0 & 0 & 2 - \sqrt{2} & -1 + \sqrt{2} & 0 & 0 \\
M_1, bd & 0 & 3 - 2\sqrt{2} & 0 & 0 & -2 + \frac{3}{2}\sqrt{2} & 0 & -1 + \sqrt{2} & 1 - \frac{1}{2}\sqrt{2} & 0 & 0 \\
M_1, be & 0 & 3 - 2\sqrt{2} & 0 & 0 & -2 + \frac{3}{2}\sqrt{2} & 0 & -1 + \sqrt{2} & 1 - \frac{1}{2}\sqrt{2} & 0 & 0
\end{pmatrix}
$$

Furthermore, the initial law of the chain, i.e., the law of $(M_0, C_1)$, has the form $\delta_{\{M_0\}} \otimes \kappa$, where $\kappa$ is the probability distribution on $\mathbb{C}$ given by:

$$
\begin{align*}
\kappa(a) &= -7 + 5\sqrt{2} & \kappa(b) &= 10 - 7\sqrt{2} & \kappa(c) &= 0 & \kappa(d) &= 0 & \kappa(e) &= 0 \\
\kappa(ad) &= 3 - 2\sqrt{2} & \kappa(ae) &= 3 - 2\sqrt{2} & \kappa(bd) &= -4 + 3\sqrt{2} & \kappa/be) &= -4 + 3\sqrt{2} & \kappa(ce) &= 0
\end{align*}
$$

A remark on these values: the equality $\kappa(c) = 0$ is normal, since $c$ is not enabled at $M_0$. On the contrary, both $d$ and $e$ are enabled at $M_0$, and yet we find that $\kappa$ vanishes on $d$ and $e$. This is obtained from a straightforward computation based on the formulas of [1] applied to our case. But it is also worth mentioning an intuitive explanation, as follows. Assume for instance that $C_1 = d$. Then the system stays in $M_0$, and since $c$ is not enabled at $M_0$, the next clique will be either $d$ or $e$, but will not contain either $a$ nor $b$, by the definition of the normal form. The same will happen for the next clique, and so on. Henceforth $a$ and $b$ will never occur; but this has zero probability, and it explains that $\kappa(d) = 0$. The same holds for $\kappa(e) = 0$. The same reasoning also explains that the pairs $(M_0, d)$ and $(M_0, e)$ are not reachable states of the Markov chain of states-and-cliques, and thus do not appear as lines in the transition matrix above.

Given the initial distribution and the transition matrix, one is of course able to simulate the Markov chain $(M_{k-1}, C_k)_{k \ge 1}$. In turn, the random trace $(C_1 \cdots C_k)$ corresponds to the $k$ first cliques of a uniformly distributed infinite execution of the net.

We observe that the transition matrix displayed above has the following property: for any clique $\gamma$, the law of the next marking starting from $(M_0, \gamma)$ is independent of $\gamma$; and similarly when starting from $(M_1, \gamma)$. We deduce that the sequence $(M_k)_{k \ge 0}$ is itself a Markov chain, with transition matrix:

$$
\begin{pmatrix} -1 + \sqrt{2} & 2 - \sqrt{2} \\ 1 - \frac{1}{2}\sqrt{2} & \frac{1}{2}\sqrt{2} \end{pmatrix}
$$

Based on the results obtained for the above specific example, the following questions arise naturally regarding how to deal with a general 1-safe Petri net.

1. What would be an algorithmic way of computing the cocycle $\Gamma(\cdot, \cdot)$?

2. The uniform measure has the simple characterization $\nu_s(\uparrow x) = q_0^{|x|} \Gamma(s, s \cdot x)$. By contrast, its realization as a Markov chain involves a set of states which grows, in worst case, exponentially fast with the number of places and with the number of transitions of the net. It is therefore natural to seek for other means for uniform generation than the computation of the Markov chain of states-and-cliques. This relates with the next point.
3. In our specific example, the uniform measure clearly shows a probabilistic in-dependence between the two *parallel choices* between *a* over *b* on the one hand, and between *d* over *e* on the other hand. Until which extend can we generalize this spatial independence property for a safe Petri net? Does it take a more specific formulation for certain particular classes of safe Petri nets, such as free-choice nets for instance [6]? Can we use this independence property to devise an efficient sampling algorithm for executions of nets?

4. For our specific example, we have observed that the sequence of markings $(M_k)_{k \ge 0}$ reached by the Markov chain of states-and-cliques $(M_{k-1}, C_k)_{k \ge 1}$ is itself a Markov chain; this is not the case for general asynchronous systems. Can we obtain sufficient conditions on the structure of a 1-safe Petri nets for this to hold?

References

[1] S. Abbes. "Dynamics of asynchronous systems". 2015. Submitted for publication. Available at http://arxiv.org/abs/1505.05536.

[2] S. Abbes and J. Mairesse. "Uniform and Bernoulli measures on the boundary of trace monoids". In: *J. Combinat. Th. A* 135 (2015), pp. 201–236.

[3] S. Abbes and J. Mairesse. "Uniform generation in trace monoids". In: *MFCS 2015, part 1*. Vol. 9234. LNCS. Springer, 2015, pp. 63–75.

[4] F. Baccelli, G. Cohen, G.J. Olsder, and J.-P. Quadrat. *Synchronization and Linearity*. Wiley, 1992.

[5] A. Benveniste, É. Fabre, S. Haar, and C. Jard. "Diagnosis of asynchronous discrete-events systems: a net unfolding approach". In: *IEEE Trans. Aut. Control* 48.5 (2003), pp. 714–727.

[6] E. Best. *Structure Theory of Petri nets: the Free Choice Hiatus*. Springer, 1987.

[7] P. Cartier and D. Foata. *Problèmes combinatoires de commutation et réar-rangements*. Vol. 85. Lecture Notes Math. Springer, 1969.

[8] P. Csikvári. "Note on the smallest root of the independence polynomial". In: *Combinat., Prob. Comput.* 22.1 (2013), pp. 1–8.

[9] V. Diekert. *Combinatorics on Traces*. Vol. 454. LNCS. Springer, 1990.

[10] M. Goldwurm and M. Santini. "Clique polynomials have a unique root of smallest modulus". In: *Inf. Proc. Letters* 75.3 (2000), pp. 127–132.

[11] D. Krob, J. Mairesse, and I. Michos. "Computing the average parallelism in trace monoids". In: *Disc. Math.* 273 (2003), pp. 131–162.

[12] M. Nielsen, G. Plotkin, and G. Winskel. "Petri nets, event structures and domains, part 1". In: *Theoret. Comp. Sc.* 13 (1981), pp. 85–108.

[13] E. Tomita, A. Tanaka, and H. Takahashi. "The worst-case time complexity for generating all maximal cliques and computational experiments". In: *Theoret. Comp. Sc.* 363.1 (2006). COCOON 2004, pp. 28–42.

[14] X. Viennot. "Heaps of pieces, I : basic definitions and combinatorial lemmas". In: *Combinatoire énumérative*. Vol. 1234. Lecture Notes Math. Springer, 1986, pp. 321–350.