**2. Sequences and their properties**

Prior to the formal introduction of the term of sequential object Petri net, we present the definition of sequence over the finite set from which the denomination of this class of Petri nets has been derived. *N* denotes the set of all natural numbers, *N0* the set of all nonnegative integer numbers, *P*(*A*) denotes the family of all the subsets of given set *A*.

Let *A* be a non-empty set. By the (non-empty finite) **sequence** *σ* over the set *A* we understand a mapping *σ*: {1, 2, …, *n*}  *A,* where *n N.* Mapping *ε*:  *A* is called the **empty sequence** over the set *A*. We usually represent the sequence *σ*: {1, 2, …, *n*}  *A* by the notation *σ = <a1*, *a2*, …, *an>* of the elements of the set *A*, where *ai = σ*(*i*) for 1 ≤ *i* ≤ *n*. We also consider any element of the set *A* as the sequence over the set *A*, ie. mapping *σ*:{1} *A.* Empty sequence *ε*:  *A* over the set *A* we usually represent by the notation *ε = <>.* We denote the set of all **finite non-empty** sequences over the set *A* by the notation *A*SQ*,* the set of all **finite** (and possible empty) sequences over the set *A* by the notation *A*ESQ*.* 

Note also, that the set *A* can be any non-empty set, which means that it can be also the nonempty set of sequences over some non-empty set *B*, ie. *A* = *B*ESQ. Thus member of the sequence over the set *B*ESQ can be then another sequence over the set *B.* This fact thus also similarly allows sequences over the sets (*B*ESQ)ESQ, ((*B*ESQ)ESQ)ESQ, etc. The term of sequence over some non-empty set has thus **recursive character** and every such sequence can consists from **subsequences** consisting from subsequences etc. We denote the set of all **finite nonempty** sequences without the empty subsequences over the union of sets *A*, *A*SQ, (*A*SQ)SQ, ((*A*SQ)SQ)SQ, … by the notation *A*RQ*,* the set of all **finite** (and possible empty or with empty subsequences) sequences over the union of sets *A*, *A*ESQ, (*A*ESQ)ESQ, ((*A*ESQ)ESQ)ESQ, … by the notation *A*ERQ*.*

The **length of the sequence** *σ = <a1*, *a2*, …, *an>*, where *σ A*ERQ, *n N*, is equal to the natural number *n*, the length of the empty sequence *ε* is equal to the number 0. The length of the sequence *σ* we represent by the notation *length*(*σ*), or @*σ*, the set of all the elements of the sequence *σ* we represent by the notation *elem*(*σ*), ie. *elem*(*σ*) = {*ai* | *ai = σ*(*i*) for 1 ≤ *i* ≤ *n*}, *elem*(*ε*) = . The **subsequences of the sequence** *σ* is the mapping *subsq*: *A*ERQ *P*(*A*ERQ)*,* such that for *i*, 1 ≤ *i* ≤ *n*: ((*σ subsq*(*σ*)) (((*ai* == *ε*) (*ai A*)) *ai subsq*(*σ*)) (((*ai* != *ε*) (*ai A*)) ((*ai subsq*(*σ*)) (*subsq*(*ai*) *subsq*(*σ*))). The **members of the sequence** *σ* is the mapping *memb*: *A*ERQ *P*(*A*)*,* so that *memb*(*σ*) = {*a* | (*a subsq*(*σ*)) (*a A*)}, *memb*(*ε*) = .

If *σ = <a1*, *a2*, …, *an>* and *τ = <b1*, *b2*, …, *bm>* are the finite sequences, where *σ A*ERQ, *τ A*ERQ, *n N, m N,* then by the **concatenation of the sequences** *σ* and *τ*, denoted by *στ*, we understand the finite sequence *στ* = <*a1*, *a2*, …, *an*, *b1*, *b2*, …, *bm>* and its length is equal to *n + m*. We say, that the sequences *σ* and *τ* are **equal**, denoted by *σ* == *τ*, if the following is simultaneously true: (*n* = *m*) (*i*, 1 ≤ *i* ≤ *n*: (((*ai* = *ε*) (*bi* = *ε*)) ((*ai A*) (*bi A*) (*ai* = *bi*)) ((*ai* ≠ *ε*) (*bi* ≠ *ε*) (*ai A*) (*bi A*) (*ai* == *bi*)))).

If, for instance, *τ A*ERQ*, τ* = <<*a*, <*a*, *b*>>, <*a*, <*c*>, *b*>, <>>, then *length*(*τ*) = 3, *elem*(*τ*) = {<*a*, <*a*, *b*>>, <*a*, <*c*>, *b*>, <>}, *subsq*(*τ*) = {<<*a*, <*a*, *b*>>, <*a*, <*c*>, *b*>, <>>, <*a*, <*a*, *b*>>, <*a*, <*c*>, *b*>, <*a*, *b*>, <*a*>, <*b*>, <*c*>, <>} and *memb*(*τ*) = {*a*, *b*, *c*}.

When operating with sequences, notation in the form of *n*\*(*σ*) can be utilized, where *σ A*ERQ, *n N*. Informally, that notation expresses sequence consisting of *n* concatenations of the sequence *σ*. If, for example *A* = *N0*, *σ =* <1, 2>, then notation 3\*(*σ*) represents the sequence 3\*(<1, 2>) == <1, 2><1, 2><1, 2> == <1, 2, 1, 2, 1, 2>.

**Multiset** *M* over a non-empty set *S* is a function *m*: *S N0.* By the non-negative number *m*(*a*) *N0, a S,* we denote the number of occurrences of the element *a* in the multiset *m.* We usually represent the multiset *m* by the formal sum ( )` *a S ma a* . By *S*MS we denote the set of all

non-empty multisets over the set *S*, by *S*EMS we denote the set of all multisets over the set *S*.

*IDENT* denotes the set of all **identifiers** and it is understood to be a set of non-empty finite sequences over the set of all letters of the selected national alphabet and the set of all decadic digits that starts with a letter. Identifiers are recorded in a way usual for standard programming languages. Examples of correctly formed identifiers for example involve the *thread*, *var22*, , etc. On the contrary, for example sequences *2main*, *first goal*, *\_input*, are not identifiers. Moreover is it true, that if ID1, ID2, …, IDn *IDENT*, where n *N*, n > 1, then we call the sequence in the form ID1.ID2. … .IDn **compound identifier** (i.e. for example the sequence *Main.Thread.Variable1* is a compound identifier). *#IDENT* set is understood to be the set of all non-empty finite sequences in the form #A, where A *IDENT*. Then, elements of *#IDENT* set for example include sequences *#thread*, *#var22*, *#*, etc.

The **s**et (*N0***)**RQ we will denote by the symbol *Tokens*. The set *ArcSeq* (*arc sequences*) is defined by the following:

i. if *x* (*IDENT #IDENT*), then <*x*> *ArcSeq*,

ii. if *x Tokens*, then *x ArcSeq*,

196 Petri Nets – Manufacturing and Computer Science

research to conclude the chapter.

notation *A*ERQ*.*

**2. Sequences and their properties** 

Positive characteristics of Petri nets demonstrate only in not too much large-scale modules at high abstraction level. That is why Petri nets are often understood as the theoretical abstract module only, whose applicability for design, analysis and verification of extensive programming systems is limited. Therefore, this article briefly describes a special class of sequential object Petri nets and its possibilities of multithreading object-oriented programming systems modeling, which eliminates the stated shortcomings required for

This chapter is arranged into the following sections: in the section 2 is described the term of the sequence over the finite set and its properties which denominates the class of the sequential object Petri nets; section 3 explains the base term of this chapter, ie. sequential object Petri net and its properties; section 4 explains in details implementation of the mechanism of firing of transitions in a sequential object Petri net; section 5 then discusses the area of object-oriented programming systems and their representation by the sequential object Petri nets; section 6 explains the example of simple class hierarchy represented by the sequential object Petri net and it is inspired by the several base classes of the Java programming language class hierarchy. Finally, the section 7 gives the conclusions of the

Prior to the formal introduction of the term of sequential object Petri net, we present the definition of sequence over the finite set from which the denomination of this class of Petri nets has been derived. *N* denotes the set of all natural numbers, *N0* the set of all non-

Let *A* be a non-empty set. By the (non-empty finite) **sequence** *σ* over the set *A* we understand a mapping *σ*: {1, 2, …, *n*}  *A,* where *n N.* Mapping *ε*:  *A* is called the **empty sequence** over the set *A*. We usually represent the sequence *σ*: {1, 2, …, *n*}  *A* by the notation *σ = <a1*, *a2*, …, *an>* of the elements of the set *A*, where *ai = σ*(*i*) for 1 ≤ *i* ≤ *n*. We also consider any element of the set *A* as the sequence over the set *A*, ie. mapping *σ*:{1} *A.* Empty sequence *ε*:  *A* over the set *A* we usually represent by the notation *ε = <>.* We denote the set of all **finite non-empty** sequences over the set *A* by the notation *A*SQ*,* the set of

Note also, that the set *A* can be any non-empty set, which means that it can be also the nonempty set of sequences over some non-empty set *B*, ie. *A* = *B*ESQ. Thus member of the sequence over the set *B*ESQ can be then another sequence over the set *B.* This fact thus also similarly allows sequences over the sets (*B*ESQ)ESQ, ((*B*ESQ)ESQ)ESQ, etc. The term of sequence over some non-empty set has thus **recursive character** and every such sequence can consists from **subsequences** consisting from subsequences etc. We denote the set of all **finite nonempty** sequences without the empty subsequences over the union of sets *A*, *A*SQ, (*A*SQ)SQ, ((*A*SQ)SQ)SQ, … by the notation *A*RQ*,* the set of all **finite** (and possible empty or with empty subsequences) sequences over the union of sets *A*, *A*ESQ, (*A*ESQ)ESQ, ((*A*ESQ)ESQ)ESQ, … by the

negative integer numbers, *P*(*A*) denotes the family of all the subsets of given set *A*.

all **finite** (and possible empty) sequences over the set *A* by the notation *A*ESQ*.* 

design, analysis and verification of these systems in several directions.


The elements of *Tokens* set for example involve sequences <1>, <22, <0, 0>>, <<3, 2>, <4, <7, 8>>>, etc.). The set of arc sequences *ArcSeq* is, informally said, the set of **non-empty final recursive sequences** over the set (*IDENT #IDENT Tokens*) which do not contain empty subsequences and which can contain as their members even selected operations over those recursive sequences, between which is the determination of the recursive sequence length and concatenation of recursive sequences. So examples of elements of the set *ArcSeq* can be sequences <a, b, 1>, <#s, @(s), <1, <2, 3>>>, <a, thread, a\*(<thread>), <1, 0>>, etc.

Sequential Object Petri Nets and the Modeling of Multithreading Object-Oriented Programming Systems 199

vi. *MA* is a finite set of **multiarcs***, MA*  ((*P IP*)  *T*) (*T*  (*P OP*))*, A MA* = *,* vii. *IOPN* is a function of **input and output place numbers***, IOPN*: (*IP OP*) *N*, that is

xi. *IPF* is an **input place function** of multiarcs*, IPF*: (*T*  (*P OP*)) *AIP,* where (*T*  (*P* 

xii. *OPF* is an **output place function** of multiarcs*, OPF*: ((*P IP*) *T*) *AOP,* where ((*P* 

The finite set of places *P* is used for expressing of conditions of a modeled programming system and in the net layout we notate them with circles. *IP* is a finite set of input places of the net page representing its input interface. Additionally, no input place of the net page can be identical with any of its places. Input places are represented in the page layout with circles of highlighted upper semicircle. Then, *OP* is a finite set of output places of the net page representing its output interface. Additionally, no output place of the net page can be identical with any of its places. The definition admits even such possibility that the selected input place is identical with any of output places of the given net page. Output places are represented in the net page layout with circles of highlighted

Likewise the finite set of transitions *T* is used for describing events in the programming system and we notate them with rectangles. That set is disjoint with the set of places *P* of the given net page. *A* is the finite set of arcs being principally oriented while connecting the place with transition or transition with place and in the layout of net we represent them by oriented arrows drawn in full line. It is worth considering that none of output arcs of any transition can be associated with any input place of the net page, and none of input arcs of any transition can be associated with any output place of the net page. *MA* is finite set of multiarcs, newly introduced type of arc in sequential object Petri nets. Functionalities of multiarc are used for the modeling of synchronous and asynchronous calling of methods in the given programming system and they follow the principles of the multiarcs in the bi-relational P/T Petri nets (Martiník, 2011). Multiarcs are represented in layouts of the net with oriented arrows drawn with dash line. The set of arcs of the given page is disjoint with the set of its multiarcs, hence it is not allowed the existence of the ordered pair (*place, transition*) or (*transition, place*) connected by both types of oriented

*IOPN* function of the identification of input and output places of the net page assigns to each input and output place of the particular net page **unique** natural number which is

: *p OP γ*}*,*

: *p IP γ*}*,* 

*,*

iii. *OP* is a finite set of **output places***, P OP = ,* iv. *T* is a finite set of **transitions***,* (*P IP OP*)  *T* = *,* v. *A* is a finite set of **arcs***, A*  ((*P IP*)  *T*) (*T*  (*P OP*))*,*

viii. *AF* is an **arc function***, AF*: (*A MA*) *ArcSeq*, ix. *MAF* is a **multiarc function***, MAF*: *MA ArcSeq*, x. *TP* is a function of **transition priorities***, TP*: *T N*,

xiv. *IF* is an **initialization function***, IF*: (*P IP OP*) *Tokens***EMS***.*

*OP*))  *MA, AIP =* {*p | γ*

*IP*)  *T*)  *MA*, *AOP =* {*p | γ*

xiii. *SP* is a finite set of **subpages**, *SP* 

injective,

lower semicircle.

arcs.

Let *AS ArcSeq*, *AS* = *<a1*, *a2*, …, *an*>, where *n N*. Then the mapping *variables*: *ArcSeq P*(*IDENT #IDENT N0*) is defined so that for *AS ArcSeq i*, 1 ≤ *i* ≤ *n*:


Thus mapping *variables* assigns to each arc sequence *AS ArcSeq*, *AS* = *<a1*, *a2*, …, *an*>, where *n N*, the set of members from the sets *IDENT*, *#IDENT* a *N0* contained in it. The set of *variables*(*AS*) associated with a particular arc *AS* will be identified in the text by the term **variables of the arc sequence** *AS*. So if for example *AS* = <a, thread, a\*(<thread>), <1, 0>>, then *variables*(*AS*) = {a, thread, 1, 0}.

### **3. Sequential object Petri nets and their properties**

**Sequential Object Petri Net** is an ordered pair *SOPN =* (, *PN*), where


By elements of the finite non-empty set of pages we routinely mark identifiers from the set *IDENT*. Injective function *PN* of numbering of pages of the net assigns to each page of sequential object Petri net *SOPN* the unique natural number within the net.

Let *SOPN =* (, *PN*) is a sequential object Petri net. **Page** of the sequential object Petri net *SOPN* is an ordered touple *PG =* (*P, IP, OP, T, A, MA, IOPN, AF, MAF, TP, IPF, OPF, SP, IF*), *PG*  , where:


Sequential Object Petri Nets and the Modeling of Multithreading Object-Oriented Programming Systems 199

iii. *OP* is a finite set of **output places***, P OP = ,*

198 Petri Nets – Manufacturing and Computer Science

iii. if *x ArcSeq*, then <*x*> *ArcSeq* and also <*length*(*x*)> *ArcSeq*,

sequences <a, b, 1>, <#s, @(s), <1, <2, 3>>>, <a, thread, a\*(<thread>), <1, 0>>, etc.

*P*(*IDENT #IDENT N0*) is defined so that for *AS ArcSeq i*, 1 ≤ *i* ≤ *n*:

The elements of *Tokens* set for example involve sequences <1>, <22, <0, 0>>, <<3, 2>, <4, <7, 8>>>, etc.). The set of arc sequences *ArcSeq* is, informally said, the set of **non-empty final recursive sequences** over the set (*IDENT #IDENT Tokens*) which do not contain empty subsequences and which can contain as their members even selected operations over those recursive sequences, between which is the determination of the recursive sequence length and concatenation of recursive sequences. So examples of elements of the set *ArcSeq* can be

Let *AS ArcSeq*, *AS* = *<a1*, *a2*, …, *an*>, where *n N*. Then the mapping *variables*: *ArcSeq*

v. if *ai* = *xy*, where *x ArcSeq* and *y ArcSeq*, then (*variables*(*x*) *variables*(*AS*))

vi. if *ai* = *n*\*(*x*), where *n* (*IDENT N*) and *x ArcSeq*, then (*n variables*(*AS*))

Thus mapping *variables* assigns to each arc sequence *AS ArcSeq*, *AS* = *<a1*, *a2*, …, *an*>, where *n N*, the set of members from the sets *IDENT*, *#IDENT* a *N0* contained in it. The set of *variables*(*AS*) associated with a particular arc *AS* will be identified in the text by the term **variables of the arc sequence** *AS*. So if for example *AS* = <a, thread, a\*(<thread>), <1, 0>>,

sequential object Petri net *SOPN* the unique natural number within the net.

*IDENT*. Injective function *PN* of numbering of pages of the net assigns to each page of

*SOPN* is an ordered touple *PG =* (*P, IP, OP, T, A, MA, IOPN, AF, MAF, TP, IPF, OPF, SP, IF*),

*N*, that is injective.

, *PN*) is a sequential object Petri net. **Page** of the sequential object Petri net

, *PN*), where

of pages we routinely mark identifiers from the set

v. if *n* (*IDENT N*) and *x ArcSeq*, then *n*\*(*x*) *ArcSeq*.

iv. if *x ArcSeq* and *y ArcSeq*, then *xy ArcSeq*,

i. if *ai* (*IDENT*  **#IDENT**), then *ai variables*(*AS*), ii. if *ai Tokens*, then *memb*(*ai*) *variables*(*AS*),

(*variables*(*y*) *variables*(*AS*)),

(*variables*(*x*) *variables*(*AS*)).

then *variables*(*AS*) = {a, thread, 1, 0}.

i.

Let *SOPN =* (

*PG*  

iii. if *ai* = <*x*>, where *x ArcSeq*, then *variables*(*x*) *variables*(*AS*), iv. if *ai* = *length*(*x*), where *x ArcSeq*, then *variables*(*x*) *variables*(*AS*),

**3. Sequential object Petri nets and their properties** 

**Sequential Object Petri Net** is an ordered pair *SOPN =* (

 is a finite non-empty set of **pages***,* ii. *PN* is a **page number function***, PN*:

ii. *IP* is a finite set of **input places***, P IP = ,*

By elements of the finite non-empty set

i. *P* is a finite set of **places***,*

, where:


The finite set of places *P* is used for expressing of conditions of a modeled programming system and in the net layout we notate them with circles. *IP* is a finite set of input places of the net page representing its input interface. Additionally, no input place of the net page can be identical with any of its places. Input places are represented in the page layout with circles of highlighted upper semicircle. Then, *OP* is a finite set of output places of the net page representing its output interface. Additionally, no output place of the net page can be identical with any of its places. The definition admits even such possibility that the selected input place is identical with any of output places of the given net page. Output places are represented in the net page layout with circles of highlighted lower semicircle.

Likewise the finite set of transitions *T* is used for describing events in the programming system and we notate them with rectangles. That set is disjoint with the set of places *P* of the given net page. *A* is the finite set of arcs being principally oriented while connecting the place with transition or transition with place and in the layout of net we represent them by oriented arrows drawn in full line. It is worth considering that none of output arcs of any transition can be associated with any input place of the net page, and none of input arcs of any transition can be associated with any output place of the net page. *MA* is finite set of multiarcs, newly introduced type of arc in sequential object Petri nets. Functionalities of multiarc are used for the modeling of synchronous and asynchronous calling of methods in the given programming system and they follow the principles of the multiarcs in the bi-relational P/T Petri nets (Martiník, 2011). Multiarcs are represented in layouts of the net with oriented arrows drawn with dash line. The set of arcs of the given page is disjoint with the set of its multiarcs, hence it is not allowed the existence of the ordered pair (*place, transition*) or (*transition, place*) connected by both types of oriented arcs.

*IOPN* function of the identification of input and output places of the net page assigns to each input and output place of the particular net page **unique** natural number which is used at the implementation of mechanism of execution of transitions associated with multiarcs of the net page. With each arc or multiarc of the net page is associated the value of its arc function *AF*, which assigns to each arc or multiarc (one) **arc sequence**, i.e. the element of *ArcSeq* set. With each multiarc of the net page is additionally associated the value of its multiarc function *MAF*, which assigns to each such multiarc (one) **arc sequence**, i.e. the element of *ArcSeq* set. The layout of the net page shows values of *AF* and *MAF* functions associated with particular multiarc in the form *AF* | *MAF*. With all transitions of the net page are associated values of their functions of transition priorities *TP* assigning each transition with (the only) value of such transition priority, which is the value of a certain natural number. If the value of function of transition priorities is not explicitly indicated in the net layout with the particular transition, we assign it to the value of natural number 1.

Sequential Object Petri Nets and the Modeling of Multithreading Object-Oriented Programming Systems 201

If **page\_identifier** is the identifier of the selected net page and **element\_identifier** is the identifier of a place, input place, output place or transition of the net page, we call the compound identifier in the form **page\_identifier.element\_identifier** so called **distinguished identifier of the element of net page**, which uniquely identifies it within the given sequential object Petri net. Designs of distinguished identifiers of subpages of the net and of its elements

For the sake of better transparency we will not indicate in layouts of nets explicit values of page number function *PN*, and explicit values of function of input and output place numbers *IOPN* of identification of input and output places of individual net pages any more. Moreover, we will not indicate values of functions *IPF* and *OPF* of particular multiarcs in the form of **a.b** pair of natural numbers, but in the form of the pair of identifiers

*OP*  **page** is particular input, or output place of the net page while it holds that **a** =

Layouts of sequential object Petri nets are usually further adjusted in the sense of notations of declarations of headings of methods and their calling within the text of the program, similarly as shown in Figure 2. Here, identifiers of input and output places of the net pages are complemented by (informative) notation of the shape of tokens, which are accepted by those input and output places (see the notation of the input places **Main.in<a>, Sub.start<c, 1>** and of the output places **Main.In<b>, Sub.Start<c>**). We will not record values of functions *AF* and *MAF* in the form of the ordered pair separated by | line any more. The value of the arc function *AF* is indicated separately and the value of the multiarc function *MAF* is indicated behind the value of the input place function *IPF* on the net page, perhaps with a value of the output place function *OPF* of particular multiarc (see notation **Sub.start<b, 1>** and **Sub.Start<b>** of the net page **Main**) in the sense of declaration of calling of methods with the entry of values of input parameters or output

is the net page and **ioplace** *IP*  **page**, perhaps **ioplace**

can be also executed for cases of sub subpages of the net pages, etc.

**Figure 1.** Sequential object Petri net

**page.ioplace**, where **page**

values of these methods.

*PN*(**page**) and **b** = *IOPN*(**page.ioplace**).

The input place function of multiarcs *IPF* assigns each multiarc of the net page connecting ordered pair (*transition*, *place*) a certain **input place of the selected net page**. The definition admits even the possibility of assigning the selected multiarc of the particular net page with some of the input places of the same net page (ie. it is allowed to model recursive methods). The particular input place *p* of the selected net page *γ* (*γ* ) is in the layout of network identified by ordered pair of natural numbers (*PN*(*γ*), *IOPN*(*γ.p*)), where the first member of the pair indicates the value of page number function *PN* and the second member of the pair identifies the selected input place *p* on the net page *γ* with the particular value of function *IOPN*. We present this ordered pair in layouts of net pages usually in the form *PN*(*γ*).*IOPN*(*γ.p*). The output place function of multiarcs *OPF* assigns each multiarc of the net page connecting the ordered pair (*place*, *transition*) with a certain **output place of the selected net page.** The definition again admits the possibility of assigning to the selected multiarc of the given net page some of the output places of the same net page. The particular output place *p* of the selected net page *γ* is marked in a similar way as in case of the function *IPF*.

A part of each net page can be the finite set *SP* of its subpages, which are by themselves the net pages (i.e. elements of the set ). Initialization function *IF* assigns each place including input and output places of the net page with a **multiset of tokens.** That function is also identified in literature as *M0.* We routinely mark identifiers from the set *IDENT* by elements of the set of places, input places, output places and transitions.

Figure 1 shows the sequential object Petri net *SOPN =* (, *PN*), where  *=* {**Main**, **Sub**}*, PN =*  {(**Main,** 1), (**Sub,** 2)}*.* Net page of this sequential object Petri net **Main** = (*P, IP, OP, T, A, MA, IOPN, AF, MAF, AP, IPF, OPF, SP, IF*), where *P =* {**P1**, **P2**}*, IP =* {**in**}, *OP =* {**In**}, *T =* {**T1**, **T2**}*, A =* {(**in**, **T1**), (**P1**, **T1**), (**T2**, **In**)}*, MA =* {(**T1**, **P2**), (**P2**, **T2**)}*, IOPN =* {(**in**, 1), (**In**, 2)}*, AF =* {((**in**, **T1**), <a>), ((**P1**, **T1**), <b, 1>), ((**T1**, **P2**), <a>), ((**P2**, **T2**), <a>), ((**T2**, **In**), <b>)}*, MAF =* {((**P2**, **T2**), <b>), ((**T1**, **P2**), <b,1>)}*, TP =* {(**T1**, 1), (**T2**, 1)}*, IPF =* {((**T1**, **P2**), (2.1))}*, OPF =* {((**P2**, **T2**), (2.2))}*, SP = , IF =* {(**in**, 1`<1>), (**P1**, ), (**P2**, ), (**In**, )}. Net page **Sub** = (*P, IP, OP, T, A, MA, IOPN, AF, MAF, AP, IPF, OPF, SP, IF*), where *P = , IP =* {**start**}, *OP =* {**Start**}, *T =* {**T1**}*, A =* {(**start**, **T1**), (**T1**, **Start**)}*, MA = , IOPN =* {(**start**, 1), (**Start**, 2)}*, AF =* {((**start**, **T1**), <c, 1>), ((**T1**, **Start**), <c>)}*, MAF = , TP =* {(**T1**, 1)}*, IPF = , OPF = , SP = , IF =* {(**start**, ), (**Start**, 1`<3>)}.

**Figure 1.** Sequential object Petri net

200 Petri Nets – Manufacturing and Computer Science

value of natural number 1.

net pages (i.e. elements of the set

used at the implementation of mechanism of execution of transitions associated with multiarcs of the net page. With each arc or multiarc of the net page is associated the value of its arc function *AF*, which assigns to each arc or multiarc (one) **arc sequence**, i.e. the element of *ArcSeq* set. With each multiarc of the net page is additionally associated the value of its multiarc function *MAF*, which assigns to each such multiarc (one) **arc sequence**, i.e. the element of *ArcSeq* set. The layout of the net page shows values of *AF* and *MAF* functions associated with particular multiarc in the form *AF* | *MAF*. With all transitions of the net page are associated values of their functions of transition priorities *TP* assigning each transition with (the only) value of such transition priority, which is the value of a certain natural number. If the value of function of transition priorities is not explicitly indicated in the net layout with the particular transition, we assign it to the

The input place function of multiarcs *IPF* assigns each multiarc of the net page connecting ordered pair (*transition*, *place*) a certain **input place of the selected net page**. The definition admits even the possibility of assigning the selected multiarc of the particular net page with some of the input places of the same net page (ie. it is allowed to model recursive methods).

identified by ordered pair of natural numbers (*PN*(*γ*), *IOPN*(*γ.p*)), where the first member of the pair indicates the value of page number function *PN* and the second member of the pair identifies the selected input place *p* on the net page *γ* with the particular value of function *IOPN*. We present this ordered pair in layouts of net pages usually in the form *PN*(*γ*).*IOPN*(*γ.p*). The output place function of multiarcs *OPF* assigns each multiarc of the net page connecting the ordered pair (*place*, *transition*) with a certain **output place of the selected net page.** The definition again admits the possibility of assigning to the selected multiarc of the given net page some of the output places of the same net page. The particular output place *p* of

A part of each net page can be the finite set *SP* of its subpages, which are by themselves the

input and output places of the net page with a **multiset of tokens.** That function is also identified in literature as *M0.* We routinely mark identifiers from the set *IDENT* by elements

{(**Main,** 1), (**Sub,** 2)}*.* Net page of this sequential object Petri net **Main** = (*P, IP, OP, T, A, MA, IOPN, AF, MAF, AP, IPF, OPF, SP, IF*), where *P =* {**P1**, **P2**}*, IP =* {**in**}, *OP =* {**In**}, *T =* {**T1**, **T2**}*, A =* {(**in**, **T1**), (**P1**, **T1**), (**T2**, **In**)}*, MA =* {(**T1**, **P2**), (**P2**, **T2**)}*, IOPN =* {(**in**, 1), (**In**, 2)}*, AF =* {((**in**, **T1**), <a>), ((**P1**, **T1**), <b, 1>), ((**T1**, **P2**), <a>), ((**P2**, **T2**), <a>), ((**T2**, **In**), <b>)}*, MAF =* {((**P2**, **T2**), <b>), ((**T1**, **P2**), <b,1>)}*, TP =* {(**T1**, 1), (**T2**, 1)}*, IPF =* {((**T1**, **P2**), (2.1))}*, OPF =* {((**P2**, **T2**), (2.2))}*, SP = , IF =* {(**in**, 1`<1>), (**P1**, ), (**P2**, ), (**In**, )}. Net page **Sub** = (*P, IP, OP, T, A, MA, IOPN, AF, MAF, AP, IPF, OPF, SP, IF*), where *P = , IP =* {**start**}, *OP =* {**Start**}, *T =* {**T1**}*, A =* {(**start**, **T1**), (**T1**, **Start**)}*, MA = , IOPN =* {(**start**, 1), (**Start**, 2)}*, AF =* {((**start**, **T1**), <c, 1>), ((**T1**, **Start**), <c>)}*, MAF = , TP =* {(**T1**, 1)}*, IPF = , OPF = , SP = , IF =* {(**start**, ), (**Start**, 1`<3>)}.

the selected net page *γ* is marked in a similar way as in case of the function *IPF*.

of the set of places, input places, output places and transitions.

Figure 1 shows the sequential object Petri net *SOPN =* (

). Initialization function *IF* assigns each place including

, *PN*), where

 *=* {**Main**, **Sub**}*, PN =* 

) is in the layout of network

The particular input place *p* of the selected net page *γ* (*γ*

If **page\_identifier** is the identifier of the selected net page and **element\_identifier** is the identifier of a place, input place, output place or transition of the net page, we call the compound identifier in the form **page\_identifier.element\_identifier** so called **distinguished identifier of the element of net page**, which uniquely identifies it within the given sequential object Petri net. Designs of distinguished identifiers of subpages of the net and of its elements can be also executed for cases of sub subpages of the net pages, etc.

For the sake of better transparency we will not indicate in layouts of nets explicit values of page number function *PN*, and explicit values of function of input and output place numbers *IOPN* of identification of input and output places of individual net pages any more. Moreover, we will not indicate values of functions *IPF* and *OPF* of particular multiarcs in the form of **a.b** pair of natural numbers, but in the form of the pair of identifiers **page.ioplace**, where **page** is the net page and **ioplace** *IP*  **page**, perhaps **ioplace** *OP*  **page** is particular input, or output place of the net page while it holds that **a** = *PN*(**page**) and **b** = *IOPN*(**page.ioplace**).

Layouts of sequential object Petri nets are usually further adjusted in the sense of notations of declarations of headings of methods and their calling within the text of the program, similarly as shown in Figure 2. Here, identifiers of input and output places of the net pages are complemented by (informative) notation of the shape of tokens, which are accepted by those input and output places (see the notation of the input places **Main.in<a>, Sub.start<c, 1>** and of the output places **Main.In<b>, Sub.Start<c>**). We will not record values of functions *AF* and *MAF* in the form of the ordered pair separated by | line any more. The value of the arc function *AF* is indicated separately and the value of the multiarc function *MAF* is indicated behind the value of the input place function *IPF* on the net page, perhaps with a value of the output place function *OPF* of particular multiarc (see notation **Sub.start<b, 1>** and **Sub.Start<b>** of the net page **Main**) in the sense of declaration of calling of methods with the entry of values of input parameters or output values of these methods.

#### 202 Petri Nets – Manufacturing and Computer Science

Sequential Object Petri Nets and the Modeling of Multithreading Object-Oriented Programming Systems 203

Let *T Tokens*, *T* = *<t1*, *t2*, *…*, *tn*>, where *n N*, *AS ArcSeq*. We denote, that there exists **input binding of the arc sequence** *AS* to the token *T*, if there exists mapping *InputBind*: *AS*

i. If *AS* = <*a1*, *a2*, …, *an*>, where *a1*, *a2*, …, *an* (*IDENT #IDENT N0*), then:

c. u *variables*(*AS*) *v variables*(*AS*): ((*u* = *v*) (*InputBind*(*u*) == *InputBind*(*v*))).

f. *u variables*(*AS*) *v variables*(*AS*): ((*u* = *v*) (*InputBind*(*u*) == *InputBind*(*v*))).

Then, input binding of the arc sequence *AS* to the token *T* via mapping *InputBind*: *AS T*

i. Arc sequence is in the form *AS* = *<a1*, *a2*, …, *an>*, where *n N*, i.e. it holds that *length***(***AS***) =** *length***(***T***) =** *n*, while generally **more than one** of elements *a1*, *a2*, …, *an* of that sequence can be the element of the set *#IDENT*. Then, at the input binding of the arc sequence *AS* to the token *T* we execute, informally said, binding of mutually corresponding elements of sequences according to their order. If an element *ai* of the arc sequence *AS* is a nonnegative integer, then such element must be bound to single-element *ti* of token *T*, where 1 ≤ *i* ≤ *n*, which is also nonnegative integer and the value of both those numbers must be identical. If *u* and *v* are two identical variables of the arc sequence *AS*, then the values of elements of the token *T* bound to them must be identical. Figure 3 shows a very simple example of input binding of the arc sequence *AS* = <1, a, a, #c, 3> to the

ii. Arc sequence is in the form *AS* = *<a1*, *a2*, …, *ak-1*, *ak*, *ak+1*, …, *am>*, where *m N*, holds that *length***(***AS***) <** *length***(***T***)**, i.e. *m* < *n*, and at the same time just a single element *ak #IDENT*, where 1 ≤ *k* ≤ *m*. Then, that only element *ak* is bound to the **sequence** *<tk*, *tk+*1, *…*, *tk+n-m>* of elements of the token *T*. In binding of other elements of the sequence *AS* the same rules hold as it was in the case of (i). An example of that type of binding of the arc sequence *AS* = <x, #y, 5, z> (and thus element *a2 #IDENT*) to the token *T* = <4, 8, 10,

ii. If *AS* = *<a1*, *a2*, …, *ak-1*, *ak*, *ak+1*, …, *am*>, where *m* < *n*, 1 ≤ *k* ≤ *m*, *ak #IDENT, a1*, …, *ak-*1,

a. if *ai*  (*IDENT #IDENT*) for 1 ≤ *i* ≤ *n,* then *InputBind*(*ai*) = *ti*, b. if *ai N0* for 1 ≤ *i* ≤ *n,* then (*InputBind*(*ai*) = *ti*) (*ai* = *ti*),

*ak+*1, …, *am*  (*IDENT N0*), *m N*, then:

b. if *ai IDENT* for 1 ≤ *i* ≤ *k-*1*,* then *InputBind*(*ai*) = *ti*, c. if *ai IDENT* for *k*+1 ≤ *i* ≤ *m*, then *InputBind*(*ai*) = *tn-m+i*, d. if *ai N0* for 1 ≤ *i* ≤ *k-*1*,* then (*InputBind*(*ai*) = *ti*) (*ai* = *ti*), e. if *ai N0* for *k+*1 ≤ *i* ≤ *m,* then (*InputBind*(*ai*) = *tn-m+i*) (*ai* = *tn-m+i*),

iii. In other case the mapping *InputBind* is not defined.

can be successfully realized in the following two cases:

a. *InputBind*(*ak*) = <*tk*, *tk+1*, …, *tk+n-m*>,

token *T* = <1, 10, 10, 2, 3>:

**Figure 3.** Binding of arc sequence to token

2, 5, 19> is shown in Figure 4.

*T* that satifies the following:

**Figure 2.** Sequential object Petri net

Let *SOPN =* (, *PN*) is a sequential object Petri net, *PG*  is its net page. By the marking *M*  of the net page *PG* we understand the mapping *M*: (*P IP OP*) *Tokens***EMS***,* where *P PG, IP PG, OP PG.* By the marking of the net *SOPN* we understand the marking of all its net pages.

Let *SOPN =* (, *PN*) is a sequential object Petri net, *PG*  is its page. Then:

