Petri Nets: Concurrency, Reachability & Invariants
A rigorous working model of weighted place/transition nets: enabling and firing, true concurrency and conflict, reachability and coverability, behavioral properties, incidence matrices, invariants, structural certificates, extension boundaries, and a diagnostic workflow.
A state machine puts the whole system in one control state. A Petri net instead distributes state across places and lets several local events become possible at once. That small change makes resource competition, synchronization, causal independence, and unbounded accumulation explicit rather than forcing them into one exponentially large product state.
This entry fixes one baseline throughout: a weighted place/transition net (P/T net) with nonnegative integer tokens and no capacities, guards, priorities, time, or probability. Extensions are useful, but their extra rules must be named because they change enabling, firing, and sometimes decidability.
The typed P/T-net contract #
The underlying graph is directed and bipartite: arcs go only from a place to a transition or from a transition to a place. The maps are intentionally typed on in both directions. The argument order identifies a place and a transition; Pre versus Post identifies the arc direction. This avoids the common mistake of declaring a pre-incidence map in the output direction.
Once orders for and are fixed, a marking is a vector and Pre and Post are matrices. For one transition , write and for its columns.
Two restricted terms are worth keeping separate:
- An ordinary net has only unit nonzero arc weights. A weighted P/T net permits any nonnegative integer weights.
- A pure net has no place-transition pair with both and . General P/T semantics does not require purity. Such a self-loop can require tokens while returning them, even though its net incidence is zero.
Places are not intrinsically “conditions” and transitions are not intrinsically “random events.” Those are possible interpretations. Formally, a marking is a token-count vector and firing chooses an enabled transition nondeterministically unless an explicitly stochastic extension supplies probabilities or rates.
Enabling and firing are local and atomic #
A transition is enabled at marking exactly when every input requirement is available:
If fires, all its input consumption and output production form one atomic state change:
The brackets mean that is enabled at and its firing yields . Enabling must be checked against Pre, not against the net token change. A self-loop may have zero incidence while still requiring a token.
Steps and multisets of transitions #
Formal step semantics treats a finite step as a transition multiset . It is enabled when the marking can pay for all occurrences together:
Its firing yields
This formulation matters when a step contains two occurrences of one transition or two transitions sharing an input place: individual enabling is not enough; their combined demand must fit.
Concurrency, conflict, and interleaving #
These three ideas describe different facts.
- Co-enabled
- Distinct transitions $t$ and $u$ are each individually enabled at the same marking $M$.
- Step-concurrent at $M$
- The two-transition multiset is enabled: $M\geq\mathop{\mathrm{Pre}}_t+\mathop{\mathrm{Pre}}_u$. Both resource demands can be met together.
- Pairwise semantic conflict at $M$
- $t$ and $u$ are co-enabled, but their two-transition multiset is not enabled. Their individual demands fit separately, while their combined demand does not.
- Interleaving
- A linear sequence records one firing before another. It is an observation order, not automatically a causal dependency.
Pairwise conflict is only the binary case. More generally, a finite nonempty transition multiset is in semantic conflict at when every one-transition restriction is enabled with its full multiplicity, but itself is not. This matters: if three transitions each consume one token from the same place and , every pair is a valid step while the triple is in conflict. At , the same structure is conflict-free for that triple.
Post-firing disabling is a stronger, separate predicate. If two self-looping transitions each consume and immediately replace the only token in , they are in pairwise semantic conflict because the joint step needs two tokens; nevertheless, firing either one restores the token and leaves the other enabled. A conflict definition based only on what remains enabled after one firing would miss this case.
If and are step-concurrent in a weighted P/T net, both serializations are possible and meet at the same marking:
The reason is algebraic. The joint enabling inequality leaves enough input tokens for either transition after the other consumes its share, and vector addition commutes. Interleaving semantics represents the one concurrent step as two paths; it preserves the final marking but forgets that neither event had to cause the other.
Conflict is different. If a place contains one token and both and require it without immediately replacing it, each is individually enabled but their joint step is not. In this canonical choice case, firing one also removes the witness that enabled the other.
Confusion: when concurrency changes a choice #
Let mean that and are in pairwise semantic conflict at reachable marking . A confusion exists at when distinct transitions can be chosen such that and are step-concurrent at , but firing one of them changes whether the other is in conflict with . In other words, an event that is causally independent of part of a choice changes that choice's enabled conflict set.
This is a marking-dependent interaction, not merely the presence of one conflict and one concurrent pair somewhere in the same net. It covers the symmetric pattern in which and are concurrent while both compete with , and the asymmetric pattern in which the ordering of a concurrent event creates or removes a later conflict. The distinction matters to distributed scheduling: a supposedly local concurrent decision can change which global alternative remains available.
One structural subclass prevents this mixing. For an ordinary unit-weight P/T structure, define
The net is free-choice when every input arc satisfies
Therefore, if a place offers more than one outgoing choice, every candidate transition has that place as its only input. An unrelated synchronization input cannot selectively enable only some candidates. In an ordinary 1-safe net, this separates choice from synchronization and rules out the classical confusion pattern above.
Free-choice structure alone is not enough for the marking-dependent conflict relation when places may hold several tokens. Let ; let consume the token in and produce one in ; and let and each consume one token from . The structure is free-choice, and is step-concurrent with . Initially , but after fires, contains two tokens and and are jointly enabled, so their pairwise semantic conflict disappears. The firing of an independent event changed the enabled choice without violating the structural free-choice condition. Weighted variants likewise need an explicitly stated generalization: unequal input weights can make candidates enabled under different token counts even when the unweighted support graph looks free-choice.
Worked bounded example: fork, independent completion, join #
Let the place order be
where is an idle job, and are active branches, and and are completed branches. The four transitions are:
| Transition | Consumes | Produces | Meaning |
|---|---|---|---|
fork |
start both branches | ||
finish_L |
finish the left branch | ||
finish_R |
finish the right branch | ||
join |
synchronize and return idle |
Start from
One exact firing trace is
After fork, finish_L and finish_R are step-concurrent. Reversing their order gives the other path through and reaches the same pre-join marking . join is disabled until both completions are present, so synchronization is an enabling constraint rather than a special control primitive.
The reachable set is exactly the five markings drawn in the upper panel. Inspection already suggests that the net is safe, deadlock-free, live, reversible, and persistent. The definitions below make those claims testable rather than visual guesses.
Reachability is exact; coverability is an upper question #
A firing sequence is executable from when there are markings
Write for the complete path and
for the reachability set. A target is reachable only when some execution ends at that exact vector.
A target marking is coverable when
componentwise. Coverability asks whether the net can reach at least the requested token counts, perhaps with additional tokens elsewhere. It compares a reachable marking with the target , not with the initial marking.
Reachability graph #
The reachability graph has one vertex for every marking in and an edge
for every firing . It is finite exactly when the marked net is bounded. For the fork/join example, the graph is finite and exact; paths answer reachability, deadlock, reversibility, and liveness questions directly. Its size can still grow exponentially with the number of concurrent components because all distinguishable token distributions remain explicit.
Karp–Miller-style acceleration and the boundary #
An unbounded net can have an infinite reachability graph. For example, one input-free transition that adds one token to place reaches . The core idea of Karp–Miller-style acceleration is to compare a descendant with an ancestor on its branch and replace components that can keep growing by .
The symbol obeys and for finite . It means arbitrarily large finite values are coverable in that component. It is not a token count and not an exact reachable marking.
That sentence is the intuition, not the complete algorithm. A correct finite construction must also specify which symbolic nodes are expanded, how loop ends and repeated labels are handled, and why the expansion terminates. Hack's complete coverability-tree construction supplies those details for weighted P/T nets. Its finite tree decides coverability: a finite target is coverable exactly when it is componentwise dominated by an appropriate symbolic node. It also exposes unbounded components. But acceleration deliberately loses exact-count information such as parity and correlations between places. Therefore:
- a reachability graph is exact but may be infinite;
- a complete -accelerated coverability tree is finite and sufficient for coverability and boundedness;
- the abstraction does not decide exact reachability or liveness by itself.
General P/T-net reachability is nevertheless decidable. Mayr's 1981 paper presented an algorithm for the general Petri-net reachability problem, establishing that result by a substantially deeper construction. “The coverability tree cannot answer it” and “the problem is undecidable” are not equivalent claims.
Behavioral properties with quantifiers #
Let .
- $k$-bounded
- For a specified $k\in\mathbb{N}$, the net is $k$-bounded when $\forall M\in R(M_0),\ \forall p\in P:\ M(p)\leq k$. A net is bounded if some finite $k$ satisfies this condition.
- Safe
- The net is 1-bounded: every reachable place count belongs to $\{0,1\}$. Safety never means token values $\{1,2\}$.
- Deadlocked marking
- $M$ is deadlocked when $\mathop{\mathrm{En}}(M)=\varnothing$. The net is deadlock-free when every reachable marking enables at least one transition.
- Live transition and live net
- A transition $t$ is live when, from every $M\in R(M_0)$, some continuation can eventually fire $t$: $\forall M\in R(M_0),\ \exists\sigma,M',M'':\ M[\sigma\rangle M'[t\rangle M''$. The net is live when every transition is live.
- Reversible
- $\forall M\in R(M_0):\ M_0\in R(M)$. Every reachable marking can return to the initial marking. More generally, a home marking is reachable from every reachable marking.
- Persistent
- For every reachable $M$ and every pair of distinct enabled transitions $t,u$, firing either does not disable the other: $M[t\rangle M'\Rightarrow u\in\mathop{\mathrm{En}}(M')$, with the universally quantified swapped pair covering the other direction.
Liveness is stronger than deadlock freedom: a system may always have some enabled transition while permanently starving another. Persistence is not the negation of that definition; it is the preservation of an already enabled alternative after another firing.
For the fork/join net, the five-node reachability graph proves all six claims:
- every coordinate is 0 or 1, so it is safe and bounded;
- every node has an outgoing edge, so it is deadlock-free;
- from any node the cycle can progress until every transition fires, so every transition is live;
- every node reaches , so it is reversible;
- the only marking with two enabled transitions is the post-fork marking, and either completion leaves the other enabled, so it is persistent.
These are properties of the marked net . Changing only can change every conclusion.
Incidence matrix and the state equation #
Fix place rows and transition columns. Define
For the fork/join net, using row order and column order (fork, finish_L, finish_R, join),
If an executable sequence fires transition exactly times, its Parikh vector is . Summing each firing equation gives the state equation
This equation is a necessary condition for reachability: every executable sequence supplies a nonnegative integer solution. It is not sufficient because records only net token change. It forgets the order of firings and whether the intermediate input requirements were ever available.
A spurious state-equation solution #
Take places and one transition with
From , the equation with yields the nonnegative candidate
Yet is not enabled initially because has no token, and there is no other transition. The target satisfies the state equation but is unreachable. Any analysis that solves must still prove that some ordering of the proposed transition multiset is executable.
P-invariants and T-invariants #
The incidence matrix exposes exact linear certificates.
For the fork/join net,
satisfies , giving
The coefficient 2 accounts for the one idle token becoming two branch tokens. Because every coefficient is positive, this invariant supplies a finite upper bound for every place. A nonnegative invariant with zero coefficients may bound only the places in its support; an invariant with negative coefficients is an algebraic conservation law but not directly a token bound.
Here
is a T-invariant: one fork, each completion once, and one join have zero total marking change. The exact trace above realizes that multiset and returns to .
The equations do not supply their own executions:
- a P-invariant constrains reachable markings but does not characterize the reachability set;
- a T-invariant need not have any enabled ordering from the chosen ;
- even a realizable T-invariant does not by itself prove that every transition is live, that the net is reversible, or that the cycle is reachable from every reachable marking;
- a basis of linear invariants may miss nonlinear and ordering constraints.
Use invariants to prove impossibility, conservation, or bounds; use behavioral reasoning to prove an execution exists.
Traps and siphons are structural certificates #
For a place set , define
Thus contains transitions that put tokens into , while contains transitions that take tokens from .
- A trap satisfies . Every transition that removes tokens from the set also returns at least one token somewhere in it. Once a trap is marked, it remains marked.
- A siphon satisfies . Every transition that adds tokens to the set also requires tokens from it. Once a siphon is empty, it remains empty.
These implications follow directly from the arc sets and firing rule, including weighted arcs. They are not complete deadlock tests. A marked trap need not be bounded; an empty siphon need not deadlock the whole net; and whether a trap starts marked or a siphon can become empty is behavioral information tied to . Stronger conclusions require a theorem for a stated net subclass.
Structural facts versus marked behavior #
The unmarked structure is ; adding produces a marked net. This division prevents two frequent reasoning errors.
| Kind of statement | What it depends on | Examples |
|---|---|---|
| Structural | graph and weights | incidence matrix, P/T-invariant solution spaces, traps, siphons, free-choice shape |
| Behavioral | structure plus initial marking and executions | reachability, coverability, boundedness, safety, deadlock, liveness, reversibility, persistence |
An invariant equation is structural, but its conserved constant and the bound inferred from it depend on the initial marking. Conversely, finding no useful linear invariant does not prove that the marked net is unbounded.
Graph reductions have the same boundary. Removing a place, fusing transitions, or collapsing a subnet is valid only under a specific reduction theorem whose structural, weight, marking, and target-property side conditions have been checked. There is no unconditional list of local rewrites that preserves boundedness, liveness, reachability, and reversibility all at once.
Extensions change the contract #
Plain weighted P/T arcs inspect and update token counts only through fixed nonnegative integer Pre and Post weights. The following variants add distinct semantics:
| Extension | Additional rule | What must not be assumed from plain P/T semantics |
|---|---|---|
| Place capacities | a firing must respect a maximum post-firing count | plain nets have no implicit capacity or overflow rejection |
| Read/test arcs | require tokens without consuming them | enabling is no longer described solely by the consuming Pre column |
| Inhibitor arcs | require a place count below a threshold, often zero | this is a zero test, not an ordinary input arc |
| Reset arcs | remove all tokens from a place on firing | the update is marking-dependent, not one fixed incidence column |
| Priorities | suppress lower-priority enabled transitions | enabled in the token sense may no longer mean selectable |
| Colored/high-level nets | tokens have types or values; bindings, guards, and arc expressions select data | a colored marking is not a plain vector of anonymous counts without an explicit unfolding |
| Timed nets | attach delays, clocks, or firing intervals | untimed reachability alone says nothing about deadlines or duration |
| Stochastic nets | attach probabilities, rates, or distributions | plain nondeterministic choice is not random choice |
Adding one of these features can change expressiveness, analysis algorithms, and decidability boundaries. Always put the variant in the model's name and restate its enabling and firing rules before reusing a property or theorem.
Diagnostic workflow #
When a net or an analysis result looks wrong, work from semantics outward:
- Name the exact net class. Record whether weights, capacities, read/inhibitor/reset arcs, priorities, colors, time, or stochastic rules are present.
- Type the structure. Check , arc endpoints, nonnegative integer weights, and the direction of
PreandPost. - Write the initial marking and place order. Every vector and matrix must use the same declared order.
- Recompute enabling before firing. Verify componentwise; then apply the complete atomic equation.
- Separate choice from concurrency. For co-enabled transitions, test the combined inequality and then test whether one firing disables the other.
- Find a short exact trace. A concrete sequence often exposes a reversed arc, missing token, or illegal extension faster than global analysis.
- Use algebra as a filter. Compute , check the state equation, and solve for P/T-invariants. Treat a failed necessary condition as a proof of impossibility; do not treat a passed condition as proof of reachability.
- Choose exact or covering analysis deliberately. Build the reachability graph only when boundedness makes it finite or exploration limits are explicit. Use Karp–Miller-style coverability acceleration for coverability and unboundedness, never as an exact-marking oracle.
- State the property's quantifiers. “No deadlock found,” “each transition fired once,” and “live from every reachable marking” are three different claims.
- Validate any reduction against its theorem. List the property being preserved and every side condition before changing the net.
The central discipline is simple: keep the enabling relation, the token-update equation, and the question being asked distinct. Most incorrect Petri-net arguments collapse at least two of those layers.