Grammars Controlled by Petri Nets

Formal language theory, introduced by Noam Chomsky in the 1950s as a tool for a description of natural languages [8–10], has also been widely involved in modeling and investigating phenomena appearing in computer science, artificial intelligence and other related fields because the symbolic representation of a modeled system in the form of strings makes its processes by information processing tools very easy: coding theory, cryptography, computation theory, computational linguistics, natural computing, and many other fields directly use sets of strings for the description and analysis of modeled systems. In formal language theory a model for a phenomenon is usually constructed by representing it as a set of words, i.e., a language over a certain alphabet, and defining a generative mechanism, i.e., a grammar which identifies exactly the words of this set. With respect to the forms of their rules, grammars and their languages are divided into four classes of Chomsky hierarchy: recursively enumerable, context-sensitive, context-free and regular.


Introduction
Formal language theory, introduced by Noam Chomsky in the 1950s as a tool for a description of natural languages [8][9][10], has also been widely involved in modeling and investigating phenomena appearing in computer science, artificial intelligence and other related fields because the symbolic representation of a modeled system in the form of strings makes its processes by information processing tools very easy: coding theory, cryptography, computation theory, computational linguistics, natural computing, and many other fields directly use sets of strings for the description and analysis of modeled systems. In formal language theory a model for a phenomenon is usually constructed by representing it as a set of words, i.e., a language over a certain alphabet, and defining a generative mechanism, i.e., a grammar which identifies exactly the words of this set. With respect to the forms of their rules, grammars and their languages are divided into four classes of Chomsky hierarchy: recursively enumerable, context-sensitive, context-free and regular.
Context-free grammars are the most investigated type of Chomsky hierarchy which, in addition, have good mathematical properties and are extensively used in many applications of formal languages. However, they cannot cover all aspects which occur in modeling of phenomena. On the other hand, context-sensitive grammars, the next level in Chomsky hierarchy, are too powerful to be used in applications of formal languages, and have bad features, for instance, for context-sensitive grammars, the emptiness problem is undecidable and the existing algorithms for the membership problem, thus for the parsing, have exponential complexities. Moreover, such concepts as a derivation tree, which is an important tool for the analysis of context-free languages, cannot be transformed to context-sensitive grammars. Therefore, it is of interest to consider "intermediate" grammars which are more powerful than context-free grammars and have similar properties. One type of such grammars, called grammars with regulated rewriting (controlled or regulated grammars for short), is defined by considering grammars with some additional mechanisms which extract some subset of the generated language in order to cover some aspects of modeled phenomena. Due to the variety of investigated practical and theoretical problems, different additional mechanisms to grammars can be considered. Since Abraham [1] first defined matrix grammars in 1965, several grammars with restrictions such as programmed, random context, valence grammars, and etc., have been introduced (see [16]). However, the rapid developments in present day technology, industry, medicine and other areas challenge to deal with more and more new and complex problems, and to look for new suitable tools for the modeling and investigation of these problems. Petri net controlled grammars, which introduce concurrently parallel control mechanisms in formal language theory, were proposed as a theoretical model for some problems appearing in systems biology and automated manufacturing systems (see [18-23, 56, 59-62]).
Petri nets, which are graphical and mathematical modeling tools applicable to many concurrent, asynchronous, distributed, parallel, nondeterministic and stochastic systems, have widely been used in the study of formal languages. One of the fundamental approaches in this area is to consider Petri nets as language generators. If the transitions in a Petri net are labeled with a set of (not necessary distinct) symbols, a sequence of transition firing generates a string of symbols. The set of strings generated by all possible firing sequences defines a language called a Petri net language, which can be used to model the flow of information and control of actions in a system. With different kinds of labeling functions and different kinds of final marking sets, various classes of Petri net languages were introduced and investigated by Hack [34] and Peterson [46]. The relationship between Petri net languages and formal languages were thoroughly investigated by Peterson in [47]. It was shown that all regular languages are Petri net languages and the family of Petri net languages are strictly included in the family of context-sensitive languages but some Petri net languages are not context-free and some context-free languages are not Petri net languages. It was also shown that the complement of a free Petri net language is context-free [12].
Another approach to the investigation of formal languages was considered by Crespi-Reghizzi and Mandrioli [11]. They noticed the similarity between the firing of a transition and application of a production rule in a derivation in which places are nonterminals and tokens are separate instances of the nonterminals. The major difference of this approach is the lack of ordering information in the Petri net contained in the sentential form of the derivation. To accommodate it, they defined the commutative grammars, which are isomorphic to Petri nets. In addition, they considered the relationship of Petri nets to matrix, scattered-context, nonterminal-bounded, derivation-bounded, equal-matrix and Szilard languages in [13].
The approach proposed by Crespi-Reghizzi and Mandrioli was used in the following works. By extending the type of Petri nets introduced in [11] with the places for the terminal symbols and arcs for the control of nonterminal occurrences in sentential forms, Marek andČeška showed that for every random-context grammar, an isomorphic Petri net can be constructed, where each derivation of the grammar is simulated by some occurrence sequence of transitions of the Petri net, and vice versa. In [39] the relationship between vector grammars and Petri nets was investigated, partially, hybrid Petri nets were introduced and the equality of the family of hybrid Petri net languages and the family of vector languages was shown. By reduction to Petri net reachability problems, Hauschildt and Jantzen [35] could solve a number of open problems in regulated rewriting systems, specifically, every matrix language without appearance checking over one letter alphabet is regular and the finiteness problem for the families of matrix and random context languages is decidable; In several papers [2,14,25], Petri nets are used as minimization techniques for context-free (graph) grammars. For instance, in [2], algorithms to eliminate erasing and unit (chain) rules, algorithms to remove useless rules using the Petri net concept are introduced.
In this chapter we summarize the recent obtained results on Petri net controlled grammars and propose new problems for further research.
In Section 2 we recall some basic concepts and results from the areas formal languages and Petri nets: strings, grammars, languages, Petri nets, Petri net languages and so on, which will be used in the next sections.
In Section 3 we define a context-free Petri net (a cf Petri net for short), where places correspond to nonterminals, transitions are the counterpart of the production rules, the tokens reflect the occurrences of symbols in the sentential form, and there is a one-to-one correspondence between the application of (sequence of) rules and the firing of (sequence of) transitions. Further, we introduce grammars controlled by k-Petri nets, i.e., cf Petri nets with additional k places, and studies the computational power and closure properties of families of languages generated by k-Petri net controlled grammars.
In Section 4 we consider a generalization of the k-Petri net controlled grammars: we associate an arbitrary place/ transition net with a context-free grammar and require that the sequence of applied rules corresponds to an occurrence sequence of transitions in the Petri net. With respect to different labeling strategies and different definitions of final marking sets, we define various classes of Petri net controlled grammars. Here we study the influence of the labeling functions and the effect of the final markings on the generative power.
It is known that many decision problems in formal language theory are equivalent to the reachability problem in Petri net theory, which has been shown that it is decidable, however, it has exponential time complexity. The result of this has been the definition of a number of structural subclasses of Petri nets with a smaller complexity and still adequate modeling power. Thus, it is interesting to consider grammars controlled by such kind of subclasses of Petri nets. In Section 5 we continue our study of arbitrary Petri net controlled grammars by restricting Petri nets to their structural subclasses, i.e., special Petri nets such as state machines, marked graphs, and free-choice nets, and so on.
In Section 6 we examine Petri net controlled grammars with respect to dynamical properties of Petri nets: we use (cf and arbitrary) Petri nets with place capacities. We also investigate capacity-bounded grammars which are counterparts of grammars controlled by Petri nets with place capacities.
In Section 7 we draw some general conclusions and present suggestions for further research.

Preliminaries
In this section we recall some prerequisites, by giving basic notions and notations of the theories formal languages, Petri nets and Petri net languages which are used in the next sections. The reader is referred to [16,34,36,42,45,47,50,52] for further information.

General notions and notations
Throughout the chapter we use the following general notations. ∈ denotes the membership of an element to a set while the negation of set membership is denoted by ∈. The inclusion is denoted by ⊆ and the strict (proper) inclusion is denoted by ⊂. The symbol ∅ denotes the empty set. The set of positive (non-negative) integers is denoted by N (N 0 ). The set of integers is denoted by Z. The power set of a set X is denoted by 2 X , while the cardinality of a set X is denoted by |X|.
Let Σ be an alphabet which is a finite nonempty set of symbols. A string (sometimes a word) over the alphabet Σ is a finite sequence of symbols from Σ. The empty string is denoted by λ. The length of a word w, denoted by |w|, is the number of occurrences of symbols in w. The number of occurrences of a symbol a in a string w is denoted by |w| a . The set of all strings over the alphabet Σ is denoted by Σ * . The set of nonempty strings over Σ is denoted by Σ + , i.e., For two languages L 1 , L 2 ⊆ Σ * the operation shuffle is defined by

Grammars
A phrase structure (Chomsky) grammar is a quadruple G = (V, Σ, S, R) where V and Σ are two disjoint alphabets of nonterminal and terminal symbols, respectively, S ∈ V is the start symbol A rule of the form u → λ is called an erasing rule.
A phrase structure grammar G = (V, Σ, S, R) is called a GS grammar (a phrase structure grammar due to Ginsburg and Spanier [31] The families of languages generated by GS grammars and by phrase structure grammars are denoted by GS and RE, respectively. It is well-known that the family GS is equal to the family RE. A string x ∈ (V ∪ Σ) * directly derives a string y ∈ (V ∪ Σ) * in G, written as x ⇒ y if and only if there is a rule u → v ∈ R such that x = x 1 ux 2 and y = x 1 vx 2 for some x 1 , x 2 ∈ (V ∪ Σ) * . The reflexive and transitive closure of the relation ⇒ is denoted by ⇒ * . A derivation using the sequence of rules π = r 1 r 2 · · · r k , r i ∈ R, 1 ≤ i ≤ k, is denoted by The families of languages generated by context-sensitive, context-free, linear and regular grammars are denoted by CS, CF, LIN and REG, respectively. Further we denote the family of finite languages by FIN. The next strict inclusions, named Chomsky hierarchy, hold (for details, see [52]):

Regulated grammars
The idea of regulated rewriting consists of restricting the application of the rules in a context-free grammar in order to avoid some derivations and hence obtaining a subset of the context-free language generated in usual way. The computational power of some context-free grammars with regulated rewriting turns out to be greater than the power of context-free grammars.
A regularly controlled grammar is a quintuple G = (V, Σ, S, R, K) where V, Σ, S, R are specified as in a context-free grammar and K is a regular set over R. The language generated by G consists of all words w ∈ Σ * such that there is a derivation S A matrix grammar is a quadruple G = (V, Σ, S, M) where V, Σ, S are defined as for a context-free grammar, M is a finite set of matrices which are finite strings over a set R of context-free rules (or finite sequences of context-free rules). The language generated by the A vector grammar is a quadruple G = (V, Σ, S, M) whose components are defined as for a matrix grammar. The language generated by the grammar G is defined by where V, Σ, S, R are defined as for a context-free grammar and v is a mapping from R into Z. The language generated by G consists of all strings w ∈ Σ * such that there is a derivation S whose components are defined as for additive valence grammars. The language generated by G consists of all strings w ∈ Σ * such that there is a derivation S The families of languages generated by regularly controlled, matrix, vector, additive valence and positive valence grammars (with erasing rules) are denoted by rC, MAT, VEC, aV, pV (rC λ , MAT λ , VEC λ , aV λ , pV λ ), respectively. Theorem 2. The following inclusions and equalities hold (for details, see [16]):

Petri nets
A Petri net (PN) is a construct N = (P, T, F, φ) where P and T are disjoint finite sets of places and transitions, respectively, A Petri net can be represented by a bipartite directed graph with the node set P ∪ T where places are drawn as circles, transitions as boxes and arcs as arrows. The arrow representing an arc (x, y) ∈ F is labeled with φ(x, y); if φ(x, y) = 1, then the label is omitted.
An ordinary net (ON) is a Petri net N = (P, T, F, φ) where φ(x, y) = 1 for all (x, y) ∈ F. We omit φ from the definition of an ordinary net, i.e., N = (P, T, F).
A mapping μ : P → N 0 is called a marking. For each place p ∈ P, μ(p) gives the number of tokens in p. Graphically, tokens are drawn as small solid dots inside circles.
In this case t can occur (fire). Its occurrence transforms the marking μ into the marking μ defined is called an occurrence sequence enabled at a marking μ and finished at a marking μ k if there are markings μ 1 , μ 2 , . . . , μ k−1 such that In short this sequence can be written as μ is set of markings which are called final markings. An occurrence sequence ν of transitions is called successful for M if it is enabled at the initial marking ι and finished at a final marking τ of M. If M is understood from the context, we say that ν is a successful occurrence sequence.
A Petri net N is said to be k-bounded if the number of tokens in each place does not exceed a finite number k for any marking reachable from the initial marking ι, i.e., μ(p) ≤ k for all p ∈ P and for all μ ∈ R(N, ι). A Petri net N is said to be bounded if it is k-bounded for some k ≥ 1.
A Petri net with place capacity is a system N = (P, T, F, φ, ι, κ) where (P, T, F, φ, ι) is a marked Petri net and κ : P → N 0 is a function assigning to each place a number of maximal admissible tokens. A marking μ of the net N is valid if μ(p) ≤ κ(p), for each place p ∈ P. A transition t ∈ T is enabled by a marking μ if additionally the successor marking is valid.

Special Petri nets
It is known that many decision problems are equivalent to the reachability problem [33], which has been shown to be decidable. However, it has exponential space complexity [40], thus from a practical point of view, Petri nets may be too powerful to be analyzed. The result of this has been the definition of a number of subclasses of Petri nets in order to find a subclass with a smaller complexity and still adequate modeling power for practical purposes. These subclasses are defined by restrictions on their structure intended to improve their analyzability. We consider the following main structural subclasses of Petri nets.
A state machine (SM) is an ordinary Petri net such that each transition has exactly one input place and exactly one output place, i.e., | • t| = |t • | = 1 for all t ∈ T. This means that there can not be concurrency but there can be conflict.
A generalized state machine (GSM) is an ordinary Petri net such that | • t| ≤ 1 and |t • | ≤ 1 for all t ∈ T.
A marked graph (MG) is an ordinary Petri net such that each place has exactly one input transition and exactly one output transition, i.e., | • p| = |p • | = 1 for all p ∈ P. This means that there can not be conflict but there can be concurrency.
A generalized marked graph (GMG) is an ordinary Petri net such that | • p| ≤ 1 and |p • | ≤ 1 for all p ∈ P.
A casual net (CN) is a generalized marked graph each subgraph of which is not a a cycle.
A free-choice net (FC) is an ordinary Petri net such every arc is either the only arc going from the place, or it is the only arc going to a transition, i.e., that if p This means that there can be both concurrency and conflict but not the same time.
An extended free-choice net (EFC) is an ordinary Petri net such that if p An asymmetric choice net (AC) is an ordinary Petri net such that if p In asymmetric choice nets concurrency and conflict (in sum, confusion) may occur but not asymmetrically.

k-Petri net controlled grammars
Since a context-free grammar and its derivation process can also be described by a Petri net (see [11]), where places correspond to nonterminals, transitions are the counterpart of the production rules, and the tokens reflect the occurrences of symbols in the sentential form, and there is a one-to-one correspondence between the application of (sequence of) rules and the firing of (sequence of) transitions, it is a very natural and very easy idea to control the derivations in a context-free grammar by adding some features to the associated Petri net. In this section we introduce a Petri net associated with a context-free grammar (i.e., a context-free Petri net), construct Petri net control mechanisms from cf Petri nets by adding new places, and define the corresponding grammars, called k-Petri net controlled grammars.
The construction of the following type of Petri nets is based on the idea of using similarity between the firing of a transition and the application of a production rule in a derivation in which places are nonterminals and tokens are separate occurrences of nonterminals. (the other components of the grammar can be seen from these rules). Figure 1 illustrates a cf Petri net N 1 with respect to the grammar G 1 . Obviously, L(G 1 ) = {a n b n c m | n, m ≥ 1}.
The following proposition shows the similarity between terminal derivations in a context-free grammar and successful occurrences of transitions in the corresponding cf Petri net.

Proposition 3.
Let N = (P, T, F, φ, ι, β, γ) be the cf Petri net with respect to a context-free grammar G = (V, Σ, S, R). Then S r 1 r 2 ···r n ====⇒ w, w ∈ Σ * is a derivation in G iff t 1 t 2 · · · t n , ι is an occurrence sequence of transitions in N such that γ(t 1 t 2 · · · t n ) = r 1 r 2 · · · r n and μ n (p) = 0 for all p ∈ P. Now we define a k-Petri net, i.e., a cf Petri net with additional k places and additional arcs from/to these places to/from transitions of the net, the pre-sets and post-sets of the additional places are disjoint.

Definition 3.
A k-Petri net controlled grammar (k-PN controlled grammar for short) is a quintuple G = (V, Σ, S, R, N k ) where V, Σ, S, R are defined as for a context-free grammar and N k is a k-PN with respect to the context-free grammar (V, Σ, S, R).

Definition 4.
The language generated by a k-Petri net controlled grammar G consists of all strings w ∈ Σ * such that there is a derivation is an occurrence sequence of the transitions of N k enabled at the initial marking ι and finished at the final marking τ.
We denote the family of languages generated by k-PN controlled grammars (with erasing rules) by PN k (PN λ k ), k ≥ 1. Example 2. Let G 2 be a 2-PN controlled grammar with the production rules: and the corresponding 2-Petri net N 2 is given in Figure 2. Then it is easy to see that The following theorem presents the relations of languages generated by k-Petri net controlled grammars to context-free, (positive) additive valence and vector languages.
The next theorem shows that the language families generated by k-Petri net controlled grammars form infinite hierarchy with respect to the numbers of additional places.
The closure properties of the language families generated by k-PN controlled grammars are given in the following theorem.

Arbitrary Petri net controlled grammars
In this section we consider a generalization of regularly controlled grammars: instead of a finite automaton we associate a Petri net with a context-free grammar and require that the sequence of applied rules corresponds to an occurrence sequence of the Petri net, i.e., to sequences of transitions which can be fired in succession. However, one has to decide what type of correspondence is used and what concept is taken as an equivalent of acceptance.
Since the sets of occurrence sequences form the language of a Petri net, we choose the correspondence and the equivalent for acceptance according to the variations which are used in the theory of Petri net languages.
Therefore as correspondence we choose a bijection (between transitions and rules) or a coding (any transition is mapped to a rule) or a weak coding (any transition is mapped to a rule or the empty word) which agree with the classical three variants of Petri net languages (see e.g. [34,57,58]).
We consider two types of acceptance from the theory of Petri net languages: only those occurrence sequences belonging to the languages which transform the initial marking into a marking from a given finite set of markings or all occurrence sequences are taken (independent of the obtained marking). If we use only the occurrence sequence leading to a marking in a given finite set of markings we say that the Petri net controlled grammar is of t-type; if we consider all occurrence sequences, then the grammar is of r-type. We add a further type which can be considered as a complement of the t-type. Obviously, if we choose a finite set M of markings and require that the marking obtained after the application of the occurrence sequence is smaller than at least one marking of M (the order is componentwise), then we can choose another finite set M of markings and require that the obtained marking belongs to M . The complementary approach requires that the obtained marking is larger than at least one marking of the given set M. The corresponding class of Petri net controlled grammars is called of g-type. Therefore, we obtain nine classes of Petri net controlled grammars since we have three different types of correspondence and three types of the set of admitted occurrence sequences. These types of control are generalizations of those types of control considered in the previous chapter, too, where instead of arbitrary Petri nets only such Petri nets have been considered where the places and transitions correspond in a one-to-one manner to nonterminals and rules, respectively.
We now introduce the concept of control by an arbitrary Petri net.

Definition 5.
An arbitrary Petri net controlled grammar is a tuple G = (V, Σ, S, R, N, γ, M) where V, Σ, S, R are defined as for a context-free grammar and N = (P, T, F, ϕ, ι) is a (marked) Petri net, γ : T → R ∪ {λ} is a transition labeling function and M is a set of final markings.

Definition 6.
The language generated by a Petri net controlled grammar G, denoted by L(G), consists of all strings w ∈ Σ * such that there is a derivation S r 1 r 2 ···r k ====⇒ w ∈ Σ * and an occurrence sequence ν = t 1 t 2 · · · t s which is successful for M such that r 1 r 2 · · · r k = γ(t 1 t 2 · · · t s ).
and N 3 is illustrated in Figure 3. If M is the set of all reachable markings, then G 3 generates the language If M = {μ} with μ(p) = 0 for all p ∈ P, then it generates the language  R(N, ι), M is the set of all markings such that for every marking μ ∈ M there is a marking μ ∈ M 0 such that μ ≥ μ .
We use the notation (x, y)-PN controlled grammar where x ∈ {f , −λ, λ} shows the type of a labeling function and y ∈ {r, t, g} shows the type of a set of final markings. We denote by  PN(x, y) and PN λ (x, y) the families of languages generated by (x, y)-PN controlled grammars without and with erasing rules, respectively, where x ∈ { f , −λ, λ} and y ∈ {r, t, g}.
The following theorem shows that the labeling strategy does not effect on the generative capacity of arbitrary Petri net controlled grammars.

Theorem 8. For y ∈ {r, t, g},
Not surprisingly, arbitrary Petri net controlled grammars generate matrix languages. Moreover, in [65] it was proven that the erasing rules in arbitrary Petri net controlled grammars can be eliminated without effecting on the generative power of the grammars. If we take into consideration this result, we obtain the following inclusions and equalities:

Grammars controlled by special Petri nets
In the previous section we investigated arbitrary Petri net controlled grammars in dependence on the type of labeling functions and on the definitions of final markings, and showed that Petri net controlled grammars have the same power as some other regulating mechanisms such as matrices, finite automata. If we consider these matrices and finite automata in terms of control mechanisms, special types of matrices and special regular languages are widely investigated in literature, for instance, as control, simple matrices ( [37]) or some subclasses of regular languages ( [15,17]) are considered. Thus, it is also natural to investigate grammars controlled by some special classes of Petri nets. We consider (generalized) state machines, (generalized) marked graphs, causal nets, (extended) free-choice nets, asymmetric choice nets and ordinary nets. Similarly to the general case we also investigate the effects of labeling policies and final markings to the computational power, and prove that the family of languages generated by (arbitrary) Petri net controlled grammars coincide with the family of languages generated by grammars controlled by free-choice nets.
Let G = (V, Σ, S, R, N, γ, M) be an arbitrary Petri net controlled grammar. The grammar G is called a (generalized) state machine, (generalized) marked graph, causal net, (extended) free-choice net, asymmetric choice net or ordinary net controlled grammar if the net N is a (generalized) state machine, (generalized) marked graph, causal net, (extended) free-choice net, asymmetric choice net or ordinary net, respectively. We also use a notation an (x, y)-(generalized) state machine, ((generalized) marked graph, causal net, (extended) free-choice net, asymmetric choice net and ordinary net) controlled grammar where x ∈ {f , −λ, λ} shows the type of a labeling function γ and y ∈ {r, t, g} shows the type of a set of final markings.
We denote the families of languages generated by grammars controlled by state machines, generalized state machines, marked graphs, generalize marked graphs, causal nets, free-choice nets, extended free-choice nets, asymmetric nets, ordinary nets and Petri nets where x ∈ { f , −λ, λ} and y ∈ {r, t, g}.
The inclusion X(x, y) ⊆ X λ (x, y) immediately follows from the definition where the Petri net N 4 illustrated in Figure 4 is a labeled state machine and M = {μ} where μ(p 0 ) = 1 and μ(p) = 0 for all p ∈ P − {p 0 }, then Example 5. Let G 5 = ({S, A, B}, {a, b}, S, R, N 5 , γ , M ) be a MG controlled grammar where R is as for the grammar G 1 in Example 4, a labeled marked graph N 5 is illustrated in Figure 5 and M = {μ} where μ(p) = 0 for all p ∈ P. Then L(G 5 ) = {ww | w ∈ {a, b} * and w ∈ Perm(w)} ∈ MG λ (λ, t).
We have the same result on the labeling strategies as that in the previous section: the labeling of transitions of special Petri nets do not effect on the generative powers of the families of languages generated by grammars controlled by these nets.

Capacity-bounded grammars
In this section we continue the research in this direction by restricting to (context-free, extended or arbitrary) Petri nets with place capacities. Quite obviously, a context-free Petri net with place capacity regulates the defining grammar by permitting only those derivations where the number of each nonterminal in each sentential form is bounded by its capacity. Similar mechanisms have been introduced and investigated by several authors. Grammar with finite index (the index of a grammar is the maximal number of nonterminals simultaneously appearing in its complete derivations (considering the most economical derivations for each string)) were first considered by Brainerd [7]. Nonterminal-bounded grammars (a grammar a nonterminal-bounded if the total number of nonterminals in every sentential form does not exceed an upper bound) were introduced by Altman and Banerji in [3][4][5]. A "weak" variant of nonterminal-bounded grammars (only the complete derivations are required to be bounded) were defined by Moriya [44]. Ginsburg and Spanier introduced derivation-bounded languages in [32] (all strings which have complete derivation in a grammar G consisting of sentential forms each of which does not contain more than k nonterminals collected in the set L k (G)). There it was shown that grammars regulated in this way generate the family of context-free languages of finite index, even if arbitrary nonterminal strings are allowed as left-hand sides of production rules. Finite index restrictions to regulated grammars have also been investigated [29,30,48,49,51,[53][54][55]. There it was shown that the families of most regulated languages are collapse.
In this section we show that capacity-bounded context-free grammars have a larger generative power than context-free grammars of finite index while the family of languages generated by capacity-bounded phrase structure grammars (due to Ginsburg and Spanier) and several families of languages generated by grammars controlled by extended cf Petri nets with place capacities coincide with the family of matrix languages of finite index.
We will now introduce capacity-bounded grammars and show some relations to similar concepts known from the literature. The families of languages generated by capacity-bounded GS grammars and by context-free capacity-bounded grammars are denoted by GS cb and CF cb , respectively. The capacity function mapping each nonterminal to 1 is denoted by 1. The notions of finite index and bounded capacities can be extended to matrix, vector and semi-matrix grammars. The corresponding language families are denoted by Capacity-bounded grammars are very similar to derivation-bounded grammars, which were studied in [32]. A derivation-bounded grammar is a quintuple G = (V, Σ, S, R, k) where G = (V, Σ, S, R) is a grammar and k ∈ N is a bound on the number of allowed nonterminals. The language of G contains all words w ∈ L(G ) that have a derivation S ⇒ * w such that |β| V ≤ k, for each sentential form β of the derivation.
Other related concepts are nonterminal-bounded grammars and grammars of finite index. A context-free grammar G = (V, Σ, S, R) is nonterminal-bounded if |β| V ≤ k for some fixed k ∈ N and all sentential forms β derivable in G. The index of a derivation in G is the maximal number of nonterminal symbols in its sentential forms. G is of finite index if every word in L(G) has a derivation of index at most k for some fixed k ∈ N. The family of context-free languages of finite index is denoted by CF fin .
Note that there is a subtle difference between the first two and the last two concepts. While context-free nonterminal-bounded and finite index grammars are just context-free grammars with a certain structural property (and generate context-free languages by definition), capacity-bounded and derivation-bounded grammars are special cases of regulated rewriting (and could therefore generate non-context-free languages). However, it has been shown that the family of derivation bounded languages is equal to CF fin , even if arbitrary grammars due to Ginsburg and Spanier are permitted [32]. We will now give an example of capacity-bounded grammars generating non-context-free languages. = ⇒ ABCD (r 2 r 3 r 4 r 6 r 8 r 9 ) n =======⇒ a n ABb n c n CD =⇒ a n+1 FCb n+1 c n+1 ED r 10 r 11 r 12 = === ⇒ a n b n c n (in the last phase, the sequences r 10 r 12 r 11 and r 12 r 10 r 11 could also be applied with the same result). Therefore, L(G) = {a n b n c n | n ≥ 1}.
The above example shows that capacity-bounded grammars -in contrast to derivation bounded grammars -can generate non-context-free languages. Moreover, any context-free language generated by a grammar of G of finite index is also generated by the capacity-bounded grammar (G, κ) where κ is capacity function constantly k.
Let CF 1 cb and GS 1 cb be the language families generated by context-free and arbitrary grammars with capacity function 1. Then, Lemma 12. CF cb = CF 1 cb and GS cb = GS 1 cb .
On the other hand, capacity-bounded GS grammars generate exactly the family of matrix languages of finite index. This is in contrast to derivation bounded grammars which generate only context-free languages of finite index [32].
It turns out that capacity-bounded context-free grammars are strictly between context-free languages of finite index and matrix languages of finite index.
The next theorem shows that the families of capacity bounded matrix and vector languages are exactly the family of matrix languages with finite index.
As regards closure properties, we remark that the constructions showing the closure of CF under homomorphisms, union, concatenation and Kleene closure can be easily extended to the case of capacity-bounded languages.

Theorem 16. CF cb is closed under homomorphisms, union, concatenation and Kleene closure.
Regarding intersection with regular sets and inverse homomorphisms, we can show non-closure properties.

Theorem 17. CF cb is neither closed under intersection with regular sets nor under inverse homomorphisms.
Control by Petri nets can in a natural way be adapted to Petri nets with place capacities. A context-free grammar is controlled by its context-free Petri net with place capacity by only allowing derivations that correspond to valid firing sequences respecting the capacity bounds. The (trivial) proof for the equivalence between context-free grammars and grammars controlled by cf Petri nets can be immediately transferred to context-free grammars and Petri nets with capacities: Theorem 18. Grammars controlled by context-free Petri nets with place capacity functions generate the family of capacity-bounded context-free languages.
Let us now turn to grammars controlled by arbitrary Petri nets with capacities. Let G = (V, Σ, S, R, N, γ, M) be an arbitrary Petri net controlled grammar. G is called a grammar controlled by an arbitrary Petri net with place capacity if N is a Petri net with place capacity. The families of languages generated by grammars controlled by arbitrary Petri nets with place capacities (with erasing rules) is denoted by PN cb (x, y) (PN λ cb (x, y)) where x ∈ { f , −λ, λ} and y ∈ {r, t, g}.
The next statement indicates that the language generated by a grammar controlled by an arbitrary Petri net with place capacities iff it is generated by a matrix grammar (for details, see [56]).

Conclusions and future research
The chapter summarizes the recent results on Petri net controlled grammars presented in [18-23, 56, 59-62] and the close related topic: capacity-bounded grammars. Though the theme of regulated grammars is one of the classic topics in formal language theory, a Petri net controlled grammar is still interesting subject for the investigation for many reasons. On the one hand, this type of grammars can successfully be used in modeling new problems emerging in manufacturing systems, systems biology and other areas. On the other hand, the graphically illustrability, the ability to represent both a grammar and its control in one structure, and the possibility to unify different regulated rewritings make this formalization attractive for the study. Moreover, control by Petri nets introduces the concept of concurrency in regulated rewriting systems.
We should mention that there are some open problems, the study of which is of interest: one of them concerns to the classic open problem of the theory of regulated rewriting systems -the strictness of the inclusion MAT ⊆ MAT λ . We showed that language families generated by (arbitrary) Petri net controlled grammars are between the families MAT and MAT λ . Moreover, the work [65] of G. Zetzsche shows that the erasing rules in Petri net controlled grammars with finite set of final markings can be eliminated without effecting on the generative power, which gives hope that one can solve this problem.
There is also another very interesting topic in this direction for the future study. If we notice the definitions of derivation-bounded [32] or nonterminal-bounded grammars [3][4][5] only nonterminal strings are allowed as left-hand sides of production rules. Here, an interesting question is emerged, what kind of languages can be generated if we derestrict this condition, i.e., allow any string in the left-hand side of the rules?
In all investigated types of Petri net controlled grammars, we only used the sequential firing mode of transitions. The consideration of simultaneous firing of transitions, another fundamental feature of Petri nets, opens a new direction for the future research: one can study grammars controlled by Petri nets under parallel firing strategy, which introduces concurrently parallelism in formal language theory.
Grammar systems can be considered as a formal model for a phenomenon of solving a given problem by dividing it into subproblems (grammars) to be solved by several parts in turn (CD grammar systems) or in parallel (PC grammar systems). The control of derivations in grammar systems also allows increasing computational power grammar systems. We can extend the regulation of a rule by a transition to the regulation a set of rules by a transition, which defines a new type of grammar systems: the firing of a transition allows applying several (assigned) rules in a derivation step parallelly and different modes.
In [19-22, 41, 62] it was shown that by adding places and arcs which satisfy some structural requirements one can generate well-known families of languages as random context languages, valence languages, vector languages and matrix languages. Thus, the control by Petri nets can be considered as a unifying approach to different types of control. On the other hand, Petri nets can be transformed into occurrence nets, i.e., usually an infinite, tree-like structure whose nodes have the same labels as those of the places and transitions of the Petri net preserving the relationship of adjacency, using unfolding technique introduced in [43] and given in [24] in detail under the name of branching processes. Any finite initial part, i.e., prefix of the occurrence net of a cf Petri net can be considered as a derivation tree for the corresponding context-free grammar as it has the same structure as a usual derivation tree, here we can also accept the rule of reading "leaf"-places with tokens from the left to the right as in usual derivation trees. We can also generalize this idea for regulated grammars considering prefixes of the occurrences nets obtained from cf Petri nets with additional places. Hence, we can take into consideration the grammar as well as its control, and construct (Petri net) derivation trees for regulated grammars, which help to construct effective parsing algorithms for regulated rewriting systems. Though the preliminary results (general parsing algorithms, Early-like parsing algorithm for deterministic extended context-free Petri net controlled grammars, etc.) were obtained in [63,64], the problem of the development of the effective parsing algorithms for regulated grammars remain open.