Elementary Petri nets are the objects of a category whose morphisms can represent simulations or refinements of them. The interpretations of the linear logic connectives of the dialectica category can be lifted to the category and used to define compound nets. Each connective gives a different interpretation to the corresponding compound net, based on its meaning in intuitionistic linear logic.
The scope of the paper is wider and it covers markings, a definition of a category of arbitrary Petri nets and the description of for some different from . We will focus on the aspect of composition of Petri nets via logical connectives giving a concrete example for each one of them and trying to give an interpretation to their corresponding constructs on Petri nets.
Preliminary definitions
Petri nets
We start by introducing Petri nets and elementary Petri nets, which will be the focus of this post.
Petri nets describe systems where some processes, called events, can be fired when all their preconditions are marked with at least the amount of tokens indicated by the weight of each arrow. After an event has been fired, the markings of all postconditions of this event will be increased by the weight of each arrow. We will represent events with rectangles and conditions with circles. The following figure represents the firing of the event . Its preconditions, and , are indicated with an incoming arrow together with a weight. Similarly, its postconditions, and , are indicated with an outgoing arrow together with a weight. The firing of consumes a token from and two tokens from and produces one token in and three tokens in .
A Petri net is given by two sets and two multirelations . The set represents the events that are possible in the net while the set represents the conditions around the events in . The multirelation keeps track of ”how many times” a condition is needed in order to fire an event. Similarly, the multirelation keeps track of ”how many times” a condition is produced after firing an event.
We will write and to indicate the multisets of preconditions and postconditions of an event .
In this post, we will focus on Petri nets whose and multirelations are ordinary relations and, thus, correspond to subsets of . These are called elementary Petri nets.
In general, the weight of each condition can be an integer. In the case of elementary Petri nets, only nets whose arrows have weight one are considered (thus, the weight is omitted).
The category of elementary Petri nets
We can define the category of elementary Petri nets based on the dialectica category . Objects and morphisms in are defined from objects and morphisms in .
Let be a category with finite limits, then there is a category defined as follows.
-
An object is a pair , where and are objects in .
-
A morphism from to is a pair of morphisms in such that is a morphism from to and from to in .
An object of represents an elementary Petri net whose precondition and postcondition relations are given by and . Taking lets us explicit the conditions for to be a morphism of Petri nets. We obtain that
This means that the net is a refinement of . Intuitively, this means that consumes and produces at least as many resources as .
This is not the only way one can define morphisms of Petri net. It is possible to reverse the direction of the unique morphism for one or both the components and of a Petri net. It is also possible to consider morphisms that give an if and only if in the condition above. All these variants have interpretations that is worth investigating. We shortly discuss the intuitions behind these variants in the last section.
The dialectica category
We briefly give the definition of dialectica category that is necessary to define . The reader already familiar with this work is invited to skip to the next section.
Given a category with finite limits, we define the dialectica category as follows.
-
Objects are relations on objects of . They are given by monics in . We indicate them with .
-
A morphism between two objects and is given by a pair of morphisms and in such that there exists a (necessarily unique and monic) morphism such that the following triangle commutes.
Theorem (de Paiva): If is a locally cartesian closed category with finite disjoint coproducts, then is a model of intuitionistic linear logic.
The structure of that interprets the linear logic connectives can be lifted to the category of elementary Petri nets and used to define composites of Petri nets relying on the intuition of the linear logic connectives.
Composing Petri nets
In this section, we define how the constructs of linear logic are interpreted in and, consequently, in . We give concrete examples in to try to explain the intuitive meaning of these constructs on Petri nets.
Cartesian product
The cartesian product of two nets and is a Petri net where events are pairs that represent both the events , in , and , in , happening at the same time. Conditions in the product net are conditions in or in .
To give a concrete example, consider two Petri nets representing interactions among genes (we took this example from a paper that uses open Petri nets for gene regulatory networks). The first one represents a gene that, deactivating itself, can activate gene or gene , and the second one represents a gene that can deactivate .
Their cartesian product represents the concurrent activation of or by and deactivation of by . In fact, in order to be able to activate and deactivate simultaneously, all the preconditions of in and all the preconditions of in must be marked.
More formally, the conditions on the precondition and postcondition relations for the product in are given by the union of the preconditions and postconditions in the component nets.
These conditions come from the more general definition of the product in the category . In the category , the cartesian product of two nets is defined by component-wise products. where and indicate cartesian products in .
For the more interested reader, we present the formal definition of cartesian product in the dialectica category . The cartesian product of two objects and in is the relation given by where and indicate the product and coproduct in the category . The projections are given by the morphisms and .
By the universal property of the product, when , we obtain the following condition for the product relation, which directly gives the conditions for the product of Petri nets that we presented above.
Coproduct
The behaviour of a coproduct net is to be able to fire either an event in the first net or one in the second. Thus, events in the coproduct net are events from the first net or the second. Conditions are pairs of conditions in the first and second net, respectively. When a condition in the coproduct is marked, it is interpreted as one of the two conditions, or , is marked. We will show this through a concrete example. Consider the first of the Petri nets introduced above.
Its behaviour is to activate either or by deactivating . This behaviour seems the one of a coproduct net as we just described it. In fact, we can see that the coproduct of the two nets , representing the activation of , and , representing the activation of , below is refined by the net .
In fact, a refinement of by is the morphism of elementary nets given by
The conditions for the coproduct of two nets in can be given explicitly.
The coproduct of two nets is given by component-wise coproducts. where and are coproducts in .
We define the coproduct of two objects and in . It is the relation given by where and indicate the product and coproduct in the category . The inclusions are the morphisms and .
By the universal property of the coproduct, when , we can express the coproduct relation in terms of the component relations. This gives the conditions in written above.
Monoidal product
The monoidal product also represents the concurrent firing of events in the two nets but, contrary to the cartesian product, it keeps track of the necessary channels of communication between events in one net and conditions in the other for the concurrent event to happen. Thus, events in are going to be again pairs of events , with an event in and an event in . However, conditions are going to be pairs of functions from events in one net to conditions in the other, so that represents a channel from the events in to the conditions in and a channel from the events in to the conditions in . Consider the monoidal product of the Petri nets shown above and .
On the right hand side, we indicate with the function from to that sends to . We indicate with the functions from to that send to , to and to , to , and to , respectively.
The preconditions for the synchronous event are all those channels that, whenever can fire, enable the preconditions of and all those channels that, whenever can fire, enable the preconditions of . This means that the preconditions of are pairs of functions such that and or . Similarly, after firing , the channels such that and .
In , the conditions on the preconditions and postconditions sets can be given explicitly.
More generally, in , the monoidal product of two nets is given by the component-wise monoidal product where and are monoidal products in .
For the details of this definition, we need to define the monoidal product of two objects and in . It is the relation given by where indicates the pullback of along in the category and indicates the pullback of and .
By taking , these conditions can be explicitly stated as follows.
Units
The units of the operations given so far are the terminal object, the initial object and the monoidal unit respectively.
The unit for the cartesian product is the empty relation from to , the unit of the coproduct is the empty relation from to and the monoidal unit is the identity relation from to , where and indicate the initial and terminal object of , respectively.
Exponential
The exponential of two nets, as one might expect, gives information about the morphisms from one net to the other because morphisms from to correspond to points of the exponential . Events in have the types of morphisms from to , and they correspond to morphisms precisely when they have all places in the exponential net as preconditions and postconditions. Places in the exponential are elements in which the events can be evaluated, namely, pairs with and . The following example shows that there is one possible morphism from the first net to the second one, the one corresponding to the coloured event .
On the right hand side, we indicate with the function from to that sends to and with the only function from to .
If the first net represents cooking pizza from the ingredients and the second net represents destroying the ingredients, then destroying the ingredients is a refinement of using the ingredients to cook a pizza and the refinement map is given by the pair of functions that sends cooking to destroying and the ingredients to the ingredients.
We can write the precondition and postcondition relations of the exponential of by in terms of the ones in and .
More generally, in the category , the exponential of two nets is given by the component-wise exponential where and are exponentials in .
In the category , the exponential of two objects and is the relation given by the greatest subobject of such that with and , where indicates the pullback of along in the category , indicates the pullback of and and indicates the inclusion of subobjects.
When , these conditions can be explicitly stated as follows.
Disjunctive monoidal product
The disjunctive monoidal product is the interpretation of the par connective in linear logic, whose meaning is well known to be unintuitive. Its behaviour on Petri nets is similar to the one of but with disjunction instead of conjunction. Events in are pairs of functions from the conditions in one net to the events in the other, and places elements in which to evaluate the events, namely pairs with and . We can see an example.
On the right hand side, we indicate with the function from to that sends to and with the only function from to .
In , the conditions on the preconditions and postconditions of can be given explicitly.
In the category , the disjunctive monoidal product of two nets is given by the component-wise monoidal product where and are disjunctive monoidal products in .
In , the disjunctive monoidal product of two objects and is the relation given by where indicates the pullback of along in the category and indicates the unique map from the coproduct of the domains of and .
By taking , these conditions can be explicitly stated as follows.
Negation
The unit for the disjunctive monoidal product is given by the net with one place and one event that are not related to each other.
The exponential corresponds to the negation of the relation . The same interpretation holds for the objects of .
Asynchronous events
We have seen how to model events happening synchronously with the cartesian product. One may wonder how to account for the possibility for only one net to fire in the cartesian product. The idea is to allow both the nets to ”do nothing” by adding an extra ”empty” event to both the nets and, then, taking the cartesian product. This is obtained by taking the coproduct with the negation net. In fact, the net is the net with one additional event that has no preconditions nor postconditions.
We take again the example of genes activating other genes to show how this works concretely. We compute .
We see that the events in this net are pairs of events in and , with the same interpretation that they have in the cartesian product , or events, like , and , that represent the asynchronous events gene activates gene , gene activates gene and gene deactivates gene , respectively, happening in one net while the other net ”does nothing”.
Discussion
The challenge of this framework is to understand how it can be useful in the numerous and diverse applications of Petri nets. In order to do this, it is worth investigating different twists in the definition of the category . As mentioned above, it is possible to reverse the direction of the unique morphism (the one appearing in the definition of morphism in ) in either of the components or of a Petri net. Thus, we can get four variants of category , based on the four different combinations for defining morphisms in this category. By changing the direction of the morphism in the definition of morphism in the category , we obtain another category, isomorphic to , called . The four variants are as follows. A pair is a morphism of such that:
-
in , and in .
-
in , and in .
-
in , and in .
-
in , and in .
We can explicit the conditions above in the case . For all in and all in we get the following inequalities.
-
and . Intuitively, this can be summed up as ”more gives more”.
-
and . Intuitively, this can be summed up as ”less gives more”.
-
and . Intuitively, this can be summed up as ”more gives less”.
-
and . Intuitively, this can be summed up as ”less gives less”.
The definition that we chose to present is the first one, given in the earlier version of the paper (where elementary Petri nets are called structurally safe), while the third variant is the same category defined in a later version of the paper. Morphisms in (1) represent refinements, while morphisms in (3) represent simulations.
It is also possible to generalise this construction to arbitrary Petri nets by taking pairs of objects of of the form and we leave the detailed discussion of this definition as another aspect to investigate further.
We thank the organizers of the ACT school for making this blog post possible and our group, in particular our TA Jade Master for her helpful suggestions.
from Hacker News https://ift.tt/2ZZDg9G
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.