Labelled graph rules in P systems

  • Williams Sureshkumar
  • Kalpana Mahalingam
  • Raghavan Rama
Original Article
  • 63 Downloads

Abstract

P systems with graph productions were introduced by Freund in 2004. It was shown that such a variant of P system can generate any recursively enumerable language of weakly connected graphs. In this paper, we consider such P systems where the input is any connected graph and each graph production is labelled over an alphabet. We name the system as Process Guided P System where the computation is guided by a string over the set of labels. The set of all strings over the label alphabet which results in the halting computation of the system forms a guiding language of the system. We compare such guiding languages with Chomsky hierarchy. Two direct applications of this variant are also given.

Keywords

Graph production Guiding language Recursively enumerable language Spanning tree Chemical graph 

1 Introduction

P systems are parallel/distributed computing models which compute any data like strings, multi sets, graphs, etc. Some well-known work on P systems with string objects can be found in [1]. The computation proceeds in a parallel manner using the indicated rules in all the membranes on the given input. The halting configuration is well defined for each variant where the output can be viewed either in one of the elementary membranes or in the environment. Two important classes of P systems that use catalyst along with the given data structure are shown to be computationally universal [1]. Another approach to view the evolution that generates languages by means of P systems with active membranes is defined in [1]. In this model, the evolution is shown to be computationally universal. In [2], the authors have defined a variant of P system with graph productions on weakly connected graphs. They also have shown that such systems with prioritized rules can generate recursively enumerable languages of weakly connected graphs working in a single membrane.

P systems are effectively used for solving some well-known theory NP-hard problems in Graph theory. Recently, the authors in [3] used kernal P system to solve graph coloring problem. In [4], the authors have a predefined strategy to control the application of the rules of the system. They define a language which controls the graph transformation. In [5], the membrane structure is described as a tree and the authors have found a P system that contains its data structure as a graph that may not have their membrane structure as a tree. Defining a strategy language or a control language for graph rewriting is called a graph-based programming language [6].

The concepts of control strings in P systems were first introduced by Ajeesh Ramanujan [7, 8]. This model processes multiset of objects and the evolution is based on the labels of the rules associated with them. In [9], the authors have defined a P system, processing, isotonic arrays in a controlled manner, predefined by strings over the labels of the rules, (i.e.), the rules are labelled and the strings over the labels indicate the sequence of applications of the rules. The study of control languages was extended to Tissue P-systems in [10]. The concept of Szilard and control languages of a particular type of finite splicing systems was studied in [11].

In this paper, we define a P system with graph productions. Such a system will rewrite any connected graph. The graph productions in all the membranes are labelled. The processing or computation will be guided by a string over the labels of the graph productions for a possible predefined halting configuration. So, we call the system as Process Guided P System with Graph productions (PGPSG). We study some interesting theoretical properties of this system. We also give two interesting applications of the system. The first application is the extraction of a spanning tree of a given connected graph using a context-free language guidance. In the second application, a chemical reaction is modeled by a P system where the guiding language is a regular language.

This paper is divided into five sections. Section 2 introduces the necessary preliminaries. The definition of P system with graph productions is given. Then, we continue to define Process Guided P System with Graph productions (PGPSG). We illustrate the working of this model with some examples in this section. Interesting theoretical results are given in Sect. 3. Section 4 deals with the two applications of our model. The last section presents some concluding remarks.

2 Definitions and examples

We refer the reader to [1] and [12] for basic notions, notations and results about formal language theory and membrane computing, respectively. For an alphabet V, we denote by \(V^{*}\) the set of all strings over V, including the empty string, denoted with \(\lambda \); \(V^{*}\setminus \{\lambda \}\) is denoted by \(V^{+}\).

A graph G over \((V_n, E_e)\) is a triple \(G = (N(G), n(G), E(G))\), where \(V_n\) and \(E_e\) are alphabets for labelling the nodes and edges, respectively. N(G) is a finite set of nodes and \(E(G) \subseteq (N(G) \times E_e \times N(G))\) is a finite set of edges of G. Let \(n(G) : N(G) \rightarrow V_n\) be a labelling function for nodes in N(G). Any triple (srt) with \(s, t \in V_n\), \(s\ne t\), and \(r\in E_e\) can be interpreted as an edge between nodes labelled s and t and the edge is labelled by r.

The graphs considered in this paper are finite, undirected, with no multiple edges and self loops. A graph \(G = (N(G), n(G), E(G))\) is called connected if and only if between any two distinct nodes \(h, k \in N(G)\) of G there is a path between h and k. Then, two possibilities arise, i.e., either an edge \((h, e, k) \in E(G)\) or there exists a sequence of edges in E(G) of the form \((h, e_1, k_1), (k_1, e_2, k_2), \dots , (k_m, e_{m+1}, k)\) joining h and k.

For any input graph \(G = (V_n, E_e)\), the graph rewriting rules are of the following forms:
  1. 1.

    Node addition \(A[X, \lambda , \lambda ; Y, e, U]\) or \(A[\lambda , \lambda , X; U, e, Y]\) : Add a new node with label U and connect it to an already existing node with label X by a new edge labelled by e. Also change the label of the already existing node from X to Y.

     
  2. 2.

    Deleting a node \(D[Y, e, U; X, \lambda , \lambda ]\) or \(D[U, e, Y; \lambda , \lambda , X]\) : Delete a node labelled by U which is incident with exactly one edge (YeU) and change the label of the remaining node from Y to X.

     
  3. 3.

    Node label change \(C[X, \lambda , \lambda ; Y,\lambda , \lambda ]\) : Change the label of a node from X to Y; usually this production is written for short as C[XY].

     
  4. 4.

    Edge addition \(A[X, \lambda , Z; Y, e, U]\) : Add a new edge labelled by e between two different nodes labelled by X and Z, where X and Z are not already adjacent, at the same time changing the labels of the nodes from X and Z to Y and U (in order to avoid multiple edges, this graph production can only be applied to nodes which are not already connected by such an edge labelled by e).

     
  5. 5.

    Deleting an edge \(D[Y, e, U; X, \lambda , Z]\) : Delete an existing edge labelled by e between two different nodes labelled by Y and U, at the same time changing the labels of the nodes from Y and U to X and Z (this graph production can only be applied; if after the deletion of this edge labelled by e the resulting graph is still connected).

     
  6. 6.

    Edge label change C[XdZYeU] : Change the label of an edge, between two different nodes labelled by X and Z, respectively, from d to e at the same time changing the labels of the nodes from X and Z to Y and U.

     
The above productions perform the operations given in Sect. 2.2, respectively, on an input which is a connected graph G.

2.1 P systems with local graph productions

We first define P systems with local graph productions as defined in [2].

Definition 1

[2] A P system with local graph productions is a construct \(\varPi \) of the form \(\varPi = (V_n, E_e, T_n, T_e, \mu , g_1, \dots , g_n, (R_1, \rho _1), \dots , (R_n, \rho _n), i_o)\), where
  • \(V_n\), \(E_e\) are the alphabets for the nodes and edges, respectively;

  • \(T_n\), \(T_e\) are the terminal alphabets for the nodes and edges, respectively;

  • \(\mu \) is a membrane structure with n membranes labelled in a one-to-one manner with \(1, 2, \dots , n\);

  • \(g_1, \dots , g_n\) are set of connected graphs over \((V_n, E_e)\) associated with the regions enclosed by the membranes \(1, 2, \dots , n\) of \(\mu \);

  • \(R_1, \dots , R_n\) are finite sets of rules associated with the (regions enclosed by the) membranes \(1, 2, \dots , n\): which are of the form (ptar), where p is a local graph production over \((V_n, E_e)\) and \(tar \in \{in, out, here \}\) is the target assigned to p;

  • \(\rho _1, \dots , \rho _n\) are partial order relations over \(R_1, \dots , R_n\);

  • \(i_0 \in \{1, 2, \dots , n \}\) is the label of the output membrane.

Starting from the initial configuration, the system passes from one configuration to another one, by non-deterministically choosing a rule from \(R_i\) (if possible), for each of the underlying connected graphs in every region. These rules are applied in parallel to these graphs, which are modified according to the graph productions p and shift according to the assigned target.

A sequence of transitions is called a computation; it is successful if and only if it halts (i.e., no rule can be applied to any of the connected graphs in any region). The result of a successful computation then is the set of all graphs over \((T_n, T_e)\) present in the designated output membrane \(i_0\).

2.2 Process Guided P Systems with graph productions

We now introduce Process Guided P Systems with graph productions and we denote it as PGPSG.

Definition 2

A Process Guided P System with graph productions (PGPSG) \(\varPi \) of degree n (\(\ge 1\)) is a construct
$$\begin{aligned} \varPi= & {} \Big (V_n, E_e, T_n, T_e, \mu , g_1, \dots , g_n, (R_1, \rho _1), \dots ,\\&(R_n, \rho _n), i_o, H, F \Big ), \end{aligned}$$
where \(V_n, E_e, T_n, T_e, \mu , g_1, \dots , g_n, (R_1, \rho _1), \dots , (R_n, \rho _n), i_o\) are same as in Definition 1, H is a finite alphabet set, which is used for labelling the rules and F is the set of final configurations.

Let \(R = \bigcup _{i=1}^{n}R_i\). Here, we assign a label to every rule in R where the labels are chosen from H or the label can be \(\lambda \) (empty label). Define a labelling function \(f : R \rightarrow H \cup \{\lambda \}\) that assigns a label to each rule in R. The rules are labelled such that more than one rule may have the same label, but the same rule in different membranes cannot be assigned different labels. We extend the labelling for a label sequence \(S = l_1~ l_2~ \dots ~l_k \in R^{*}\) as \(f(l_1~ l_2~ \dots ~ l_k) = f(l_1) f(l_2 \dots l_k\)). A transition \(C {\mathop {\Rightarrow }\limits ^{b}}C^{'}\) between two successive configurations uses only rules with the same label b and rules labelled with \(\lambda \). If at least one rule has a label \(b\in H\), then the transition is called \(\lambda \)-restricted transition. If we allow all rules with \(\lambda \) label, then the transition is called \(\lambda \)-unrestricted transition (or \(\lambda \)-transition). S is called the regulating/guiding string.

The working of \(\varPi \) is as follows: A regulating string of input symbols (over H) is said to be accepted if all its symbols are consumed and \(\varPi \) reaches a configuration in the set F. We call such a \(\varPi \) to be working in accepting mode. The set of all regulating strings accepted in this way by computations in a PGPSG \(\varPi \) is denoted by \(LPG_{\lambda }PSG(\varPi )\). The subscript indicates the fact that \(\lambda \)-steps (all rules applied in one step can have \(\lambda \) label) are permitted. When only steps where at least one rule with a non-empty label is used, the guiding language is denoted by \(LPGPSG(\varPi )\). The family of languages \(LPGPSG(\varPi )\) associated with PGPSG with at most m membranes working in accepting mode is denoted by \(LPGPSG_m\). In the \(\lambda \)-unrestricted case, the corresponding language family is denoted by \(LPG_{\lambda }PSG_m\).

In the following examples, we construct PGPSG which can generate cycles, complete graphs and complete bipartite graphs with regular and context-sensitive guiding languages.

Example 1

There exists a PGPSG that halts on a cycle of length n \((n \ge 3,~ n= \left| E(G)\right| = \left| V(G)\right| )\) and accepts the guiding regular language \(\big \{a^{n}~ \big |~ n \ge 3 \big \}\).
Fig. 1

The set of cycles of length n (\(n \ge 3\)) in F of \(\varPi _1\)

We construct a PGPSG \(\varPi _1\), which accepts the guiding regular language \(\big \{a^{n}~ \big |~ n \ge 3 \big \}\) and halts on a cycle of length n, \((n \ge 3,~ n= \left| E(G)\right| = \left| V(G)\right| )\).
Fig. 2

The set of all complete graphs in F of \(\varPi _2\)

Fig. 3

The set of all complete bipartite graphs in F of \(\varPi _3\)

Let \(\varPi _1 = \Big (\{S, X, B\},\{\phi \}, \{y\}, \{e\}, [_1[_2]_2]_1, g_1, g_2, R_1, R_2, 2, \{a\}, F \Big )\), where
$$\begin{aligned} R_1= & {} \Big \{1)~ a: A[S,\lambda , \lambda ;X, e, B],here~,\\&2)~ a: A[B,\lambda , \lambda ;y, e, B]~,in_2 \Big \},\\ R_2= & {} \Big \{3)~ a: A[B,\lambda , \lambda ;y, e, B],here~,~ \\&4)~ a: A[B,\lambda , X;y, e, y],here\Big \}, \end{aligned}$$
\(g_1\) contains a single node labelled by S, \(g_2 = {\{}\emptyset {\}}\) and the set of final configuration F is the set of cycle of length n (\(n \ge 3\)) (see Fig. 1). The guiding regular language accepted by \(\varPi _2\) is \(PGPSG_2(\varPi _1) = \Big \{a^{n}~ \big |~ n \ge 3,~ n= \left| E(G)\right| =\left| V(G)\right| \Big \}\).

The working of PSPSG \(\varPi _1\) is as follows: In region 1, starting with a single node labelled by S, apply rule ‘1’, followed by rule ‘2’ once. The resulting graph contains three nodes labelled by X, y, B and two edges (Xey) and (yeB) and is sent to region 2. In region 2, apply rule ‘3’, \((n-3)\) times followed by the termination rule ‘4’ once to obtain the graph with n nodes (each node labelled by y) and n edges (each edge labelled by e) which is indeed a cycle of length n \((n \ge 3)\) in F. So the system accepts the regular language for the given final configuration.

Example 2

There exists a PGPSG that halts on a complete graph with n vertices \((n \ge 2)\) and accepts the guiding context-sensitive language

\(L =\Big \{a^{1 + 2 + \dots + (n-1)}~ \big |~ n \ge 2,~ n = \left| V(G)\right| \Big \}\). The construction of PGPSG \(\varPi _2\) with one membrane is as follows:

Let \(\varPi _2 = \Big (\{S\},\{\phi \}, \{x\}, \{e\}, [_1]_1, g_1, R_1, 1, \{a\}, F \Big )\), where
$$\begin{aligned} R_1= & {} \Big \{1)~ a: A[S,\lambda , \lambda ;S, e, x],here~,\\&~2)~ a: A[S,\lambda , \lambda ;x, e,x],here~,\\&3)~ a: A[x,\lambda , x;x, e, x],here \Big \}, \end{aligned}$$
\(g_1\) contains a single node labelled by S and the set of final configuration F is the set of all complete graphs with n vertices \((n\ge 2)\) (see Fig. 2). The guiding context-sensitive language accepted by \(\varPi _2\) is \(LPGPSG_1(\varPi _2) = L\).

The PGPSG \(\varPi _2\) constructed above works as follows: In the initial configuration, \(\varPi _2\) contains a single node labelled by a non-terminal S. By repeated application of rule ‘1’, \((n-2)\) times, followed by rule ‘2’ once, we obtain the connected graph with n nodes and \((n-1)\) edges where each node is labelled by x and each edge is labelled by e. Finally, applying rule ‘3’, \((1 + 2 + \dots + (n-2))\) times for all possible pairs of nodes (xx), we get the resultant complete graph. Each guided string accepted by \(\varPi _2\) corresponds to a complete graph in F.

Example 3

There exists a PGPSG that halts on a complete bipartite graph with \((m + n)\) vertices (\(m \ge 1, n \ge 1\)) and accepts the context-sensitive language \(L = \Big \{a^{mn+1}~ \big |~ m = \left| N_1\right| ,~ n = \left| N_2\right| ,~ m \ne n \Big \}\cup \Big \{a^{mn+1}~ \big |~ m = \left| N_1\right| ,~n = \left| N_2\right| ,~ m = n \Big \}\).

Let \(K_{m, n}\) \((m\ge 1, n\ge 1)\) be a complete bipartite graph on \((m + n)\) vertices, whose vertex set is partitioned into sets \(N_1\) with m nodes and \(N_2\) with n nodes. Now, we construct a PGPSG \(\varPi _3\) such that it accepts the context-sensitive language L and halts on a complete bipartite graph.

Let \(\varPi _3 = \Big (\{S, Y\},\{\phi \}, \{x, y\}, \{e\}, [_1[_2]_2]_1, g_1, g_2, R_1, R_2, 2, \{a\}, F \Big )\), where
$$\begin{aligned} R_1= & {} \Big \{1)~ a: A[S,\lambda , \lambda ;S, e, y],here~,\\&2)~ a: A[S,\lambda , \lambda ;x, e, Y],here~,\\&3)~ a: A[\lambda ,\lambda , Y;x, e, Y],here~,\\&~4)~ a: C[Y;y],in_2 \Big \},\\ R_2= & {} \Big \{5)~ a: A[x,\lambda , y;x, e, y],here\Big \}, \end{aligned}$$
\(g_1\) contains a single node labelled by S, \(g_2 = {\{}\emptyset {\}}\) and the set of all final configurations F is the set of all complete bipartite graphs with \((m + n)\) vertices \((m\ge 1, n\ge 1)\) (see Fig. 3). The guiding context-sensitive language accepted by \(\varPi _3\) is \(LPGPSG_2(\varPi _3) = L\).

The working of PGPSG \(\varPi _3\) is as follows: In region 1, starting with a single node labelled by S in partition \(N_1\), apply rule ‘1’, \((n-1)\) times , followed by rule ‘2’, once. Then, n nodes in partition \(N_2\) are produced, the first \((n-1)\) nodes are labelled by y and the \(n\mathrm{{th}}\) node is labelled by Y. At the same time, the node S in \(N_1\) is renamed as x and it is connected with each node in \(N_2\) by an edge labelled by e. Now, apply rule ‘3’, \((m-1)\) times followed by rule ‘4’, once. The remaining \((m-1)\) nodes in \(N_1\) are produced and are labelled by x. The node Y in \(N_2\) is renamed by y and it is connected with each node in \(N_1\) by an edge labelled by e. The resultant graph is expelled to region 2. In region 2, apply rule ‘5’ to all possible pairs of nodes (xy), x in \(N_1\) and y in \(N_2\) by an edge labelled by e. We obtain a complete bipartite graph \(K_{m, n}\). Each guided string accepted by \(\varPi _3\) corresponds to a complete bipartite graph in F.

3 Theoretical results

In this section, we explore the relationship between the family of guiding languages of Process Guided P Systems with graph productions (\(\lambda \)-restricted) and the family of \(\lambda \)-free finite, regular, context-free and context-sensitive languages. The simulation of recursively enumerable languages is done via \(\lambda \)-unrestricted LPGPSG.
Notation:

For any family \(\mathcal {K}\) of languages, \(\mathcal {K} \setminus \{ \lambda \}\) means the family of \(\lambda \)-free languages.

Theorem 1

\(REG \setminus \{ \lambda \} \subseteq LPGPSG_{1}\)

Proof

Let \(L \in (REG \setminus \{ \lambda \}\) and \(D = (Q,~\varSigma ,~\delta ,~ p,~F_D)\) be a deterministic finite automaton accepting L. Let m be the number of states in D. Rename the states as \(q_i, 1 \le i \le m\), such that \(q_1 = p\) and the transition rules are changed accordingly. Let \( D^{'} = (Q^{'},~\varSigma ,~\delta ^{'},~q_1,~F_D^{'})\) be the modified DFA. Using \( D^{'}\) we construct a PGPSG \(\varPi _4\) with one membrane accepting \(L(D^{'})\) as follows:

\(\varPi _4 = \Big (\{Q^{'}\}, \{\phi \}, \{x\}, \{e\}, [_1]_1, g_1, R_1, 1, \varSigma , F \Big )\), where \(g_1\) contains a single node labelled by \(q_1\), \(R_1 = \Big \{1)~ a: A[q_i,\lambda , \lambda ;x, e, q_j],here~\big /~ (q_i, a, q_j) \in \delta {'}~\Big \} \cup \Big \{~2)~ a: A[S,\lambda , \lambda ;x, e, x],here~\big /~~(q_i, a, q_f) \in \delta {'}~,~q_f \in F^{'}_D \Big \}\) and the set of final configuration F is a set of all linear graphs with nodes with symbols of a string over \(\varSigma \) from left to right.

The PGPSG \(\varPi _4\) constructed above works as follows: The PGPSG \(\varPi _4\) starts with a single node labelled with \(q_1\), where \(q_1\) corresponds to the start symbol of the DFA in the membrane. When the system uses rule 1, it simulates the application of the rule \((q_i, a, q_j) \in \delta {'}\) by the DFA, that is, if the current symbol is a and the system contains a path graph with one of whose node is labelled by \(q_i\), then the current input symbol a is consumed, the label of the node \(q_i\) is renamed with a terminal symbol x and a new node with label \(q_j\) is created and is connected to x by an edge e (note that, at any instance, PGPSG contains only a path graph with only one node labelled by \(q_j\) and all other nodes are labelled by x and each edge is labelled by e). The system accepts the input string when the input is completely read and the corresponding configuration in F is reached. The membrane contains a path graph which is from F. \(\square \)

Theorem 2

\(LPGPSG_{\star } \setminus REG \ne \emptyset \)

Proof

Let \(L_1 = \Big \{ a{^n}b^{n}~~\big |~~ n\ge 1 \Big \}\), a context-free language that is not regular. We construct a PGPSG \(\varPi _5\) with two membranes whose guiding language is \(L_1\) as follows :
$$\begin{aligned} \varPi _5= & {} \Big (\{S, B\}, \{\phi \}, \{x\}, \{e\}, [_1[_2]_2]_1, g_1, g_2, R_1, R_2, 2, \{a, b\}, F \Big ),\,\hbox {where}\\ R_1= & {} \Big \{1)~ a: A[S,\lambda , \lambda ;B, e, S],here~,~2)~ a: C[S;B],in_2~\Big \}, \\ R_2= & {} \Big \{3)~ b: C[B;x],here\Big \}, \end{aligned}$$
\(g_1\) contains a single node labelled by S and \(g_2 = {\{}\emptyset {\}}\) and the set of final configuration F is a 2-tuple where the first component is empty and the second component is the set of all linear graphs with n (\(n\ge 1\)) nodes, where each node is labelled with x and each edge is labelled with e.

The working of PGPSG \(\varPi _5\) is as follows: In the initial configuration, \(\varPi _5\) contains a single node labelled by a non-terminal S in region 1 whereas region 2 is empty. Now, we have a possibility to apply either rule 1 or rule 2. Suppose in the first step we apply rule 1, ‘\(n-1\)’ (\(n\ge 1\)) times, it generates a path graph with n nodes, each node being labelled by B except the \(n\mathrm{{th}}\) node, which is labelled by S and each edge is labelled by e. By applying rule 2 once, the resultant path graph is expelled to region 2, where each node is labelled by B and each edge is labelled by e and the corresponding guided string is \(a^{n}\). Now in region 2, rule 3 is applied ‘n’ times to reach a configuration in F. The corresponding guided string is \(a^{n}b^{n}\). \(\square \)

Remark 1

\((REG\setminus \{ \lambda \}) \subset LPGPSG_{\star }\).

We proceed further to see whether \((CF\setminus \{ \lambda \}) \subseteq LPGPSG_{\star }\) which we prove in the following theorem.

Theorem 3

\((CF \setminus \{\lambda \}) \subseteq LPGPSG_{2}\)

Proof

Let \(G = (N, T, P, S)\) be a context-free grammar in Greibach normal form. Let n be the number of non-terminals in N. The non-terminals in N are renamed as \(A_i\), \(1 \le i \le n\) such that \(A_1 = S\) and also the rules are modified accordingly as per the new non-terminals. Let \(G^{'} = (N^{'}, T, P^{'}, S)\) be the grammar thus modified. Now, we construct a PGPSG \(\varPi _6\)with two membranes using \(G^{'}\) as follows:
$$\begin{aligned} \varPi _6= & {} \Big (N^{'}, N^{'} \cup \{A_{{\{}j, k, \dots l, e{\}}}, 1 \le j, k, l \le \\&n \}, \{x\}, \{e\}, [_1[_2]_2]_1, g_1, g_2, R_1, R_2, 2, T, F \Big ), \end{aligned}$$
where \(g_1\) is a single labelled with \(A_1\) and \(g_2\) is empty,
$$\begin{aligned} R_1= & {} \Big \{1)~ a: A[A_1,\lambda , \lambda ;A_m, A_{{\{}j, k, \dots l, e{\}}}, x],in_2\\&\big |~A_{1} \rightarrow aA_{m}A_{j}A_{k} \dots A_{l} \in P^{'}\Big \} \\&\cup \Big \{2)~ a: A[A_1,\lambda , \lambda ;x, e, x],in_2~\big |~A_{1} \rightarrow a \in P^{'}\Big \}, \\ R_2= & {} \Big \{3)~ a: A[A_i,A_{{\{}j, k, \dots l, e{\}}}, x;~A_r, A_{{\{}p, \dots q, j, k, \dots l, e{\}}}, x]~ \\&\big |~A_{i} \rightarrow aA_{r}A_{p} \dots A_{q} \in P^{'}\Big \} \\&\cup \Big \{4)~ a: A[A_i,A_{{\{}j, k, \dots l, e{\}}}, x;A_j, A_{{\{} k, \dots l, e{\}}}, x]~\big |\\&A_{i} \rightarrow a \in P^{'}\Big \}\\&\cup \Big \{5)~ a: A[A_i,A_e, x;x, e, x]~\big |~A_{i} \rightarrow a \in P^{'}\Big \}, \end{aligned}$$
\(g_1\) contains a single node labeled by \(A_1\) and \(g_2 = {\{}\emptyset {\}}\) and the set of final configurations \(F = \{(\phi , g) ~\big |\)  where g is a linear graph with two nodes and each node labelled by x and connected by an edge \(e \}\).
Initially, PGPSG \(\varPi _6\) starts with a single node labelled with \(A_1\), the start symbol of \(G^{'}\) in region 1 whereas region 2 is empty. Now, we can apply either rule 2 which corresponds to \(A_1\rightarrow a\) in \(G^{'}\) or rule 1 which corresponds to \(A_{1} \rightarrow aA_{m}A_{j}A_{k} \dots A_{l}\), \(1\le k, j, l\le n\) in \(G^{'}\). If we apply rule 1, then the system halts with the following path graph
and the corresponding guided string is a. Suppose, rule 1 is applied, then the single node labelled with \(A_1\) is replaced by a new label \(A_j\) and new vertex labelled with x is created. Now these two nodes x and \(A_j\) are connected by an edge labelled by \(A_{{\{}j, k, \dots l, e{\}}}\) and the resultant graph is expelled to region 2. In region 2, rules 3 and 4 are applied repeatedly to obtain the following graph:
where \(1\le r \le n\). Finally, rule 5, which is the only possible rule that can be used, is applied and the computation halts with the following graph.
The guiding string is obtained by consuming a label of a rule in each step. \(\square \)

Example 4

Consider a context-free grammar G in Greibach normal form with \(A_1\) as the start symbol and with productions
$$\begin{aligned} A_1\rightarrow & {} aA_3A_1A_3 / aA_2\\ A_2\rightarrow & {} a \\ A_3\rightarrow & {} b \end{aligned}$$
Consider a string ababaabb which can be derived by the left most derivation as follows:
$$\begin{aligned} A_1\Rightarrow & {} aA_3A_1A_3 \Rightarrow abA_1A_3 \Rightarrow abaA_3A_1A_3A_3\\\Rightarrow & {} ababA_1A_3A_3\Rightarrow ababaA_2A_3A_3\\\Rightarrow & {} ababaaA_3A_3 \Rightarrow ababaabA_3 \Rightarrow ababaabb. \end{aligned}$$
It is illustrated in Fig. 4 that how the string ababaabb guides the system towards a final configuration.
Fig. 4

The derivation of a string ababaabb by PGPSG \(\varPi _6\)

Remark 2

An argument given in the proof of Theorem 2 for a guided context-free language \(\{ a^{n}b^{n} | n\ge 1 \}\) can be extended to the guided context-sensitive language \(\{ a^{n}b^{n}c^{n} | n\ge 1 \}\), where PGPSG will work with three membranes. The set of rules of PGPSG is given below:
$$\begin{aligned} R_1= & {} \Big \{1)~ a: A[S,\lambda , \lambda ;B, e, S],here~>~2)~ a: C[S;Y],in_2~\Big \}, \\ R_2= & {} \Big \{3)~ b: A[B, e, Y;Y, e, Z],here~>~4)~ a: C[Y;Z],in_3~\Big \}, \\ R_3= & {} \Big \{3)~ c: C[Z;x],here\Big \}, \end{aligned}$$
\(g_1\) contains a single node labeled by S, \(g_2 = {\{}\emptyset {\}}\) and \(g_3 = {\{}\emptyset {\}}\). The set of final configurations \(F = \{(\phi , \phi , g) ~\big |\)  where g belongs to the set of all linear graphs with n (\(n\ge 1\)) nodes, each node labelled with x and each edge labelled with \(e \}\).

Hence, we have the following theorem.

Theorem 4

\( LPGPSG_{\star } \setminus CF\ne \emptyset \)

Remark 3

Hence, we conclude that \((CF \setminus \{\lambda \}) \subset LPGPSG_{\star }\)

Theorem 5

\(CS \setminus LPGPSG_{\star } \ne \emptyset \)

Proof

Consider the context sensitive language \(L = \{ {a^{2}}^{n}~ /~ n \ge 0 \}\). Since L is over a one letter alphabet and we intend to use no \(\lambda \)-rule, all the rules in the PGPSG must be an a-rule. Note that each a-rule can insert (or delete or rename) exactly one node (or edge). Suppose we assume that there exits a PGPSG \(\varPi _7\) with m membranes that accepts L and halts on a configuration in F, where F is the set of final configurations which consists of paths of length n, \(n\ge 1\) in which each node is labelled by x and each edge is labelled by e. First, we show the non-existence of such a system for \(m = 1\). The argument for m membrane P system will be identical to this. The reason is that in both situations we need infinite number of rules in the membrane system to build L. Let \(g_1, g_2, \dots , g_n\) be the graphs in the initial configuration of \(\varPi _7\). We recall that the successful halting computation means that the system must halt as well as the graphs remaining in the output membrane with each node and edge are labelled by terminals.

In the following steps, we actually look for rules in the membrane to build L recursively.
  1. 1.

    In order to accept a guiding string a, whose length is one, the system must go up to one step (transition). Therefore, each graph \(g_1, g_2, \dots , g_n\) in \(\varPi _7\) must contain at most one node (or edge) labelled by a non-terminal. To reach the successful halting computation, we must apply one or more insert (or delete or rename) rule to replace each node (or edge) labelled with non-terminal by a terminal. Note that, we have introduced at least one new rule to accept the regulated string a.

     
  2. 2.

    By (1) above, we know that each graph \(g_1, g_2, \dots , g_n\) contains at most one node (or edge) labelled by a non-terminal. To accept a guiding string \(a^2\), the system must go up to two steps (transitions). In order to do this, at least to one of the graphs \(g_1, g_2, \dots , g_n\), we need to apply the insert (or delete or rename) rule, which is a new rule. This rule may be recursive (can be repeated any number of times) or non-recursive (applied only once). If the rule is recursive, then it also accepts the strings \(a^3, a^5, a^6,\)...\( \notin L\). Suppose, it is non-recursive, we can apply it once, followed by an existing rule as mentioned in step 1, to halt the computation. Hence, to accept \(a^2\), we have introduced a new rule.

     
  3. 3.

    Similarly, in order to accept \(a^4\), the system must go up to 4 steps. At least for one of the graphs \(g_1, g_2, \dots , g_n\), we need to apply the rules in a way that there is no recursion. In all the possible cases, if any of the rule is recursive, it leads to the generation of a guiding string not in L. Therefore, the only possibility is non-recursive rules. In all the cases, we can see that at least one new rule is required to accept \(a^4\).

     
So, to accept each string in \(L = \{ {a^{2}}^{n} ~/~ n \ge 0 \}\), we need to introduce at least one a-rule in each step. Since L is infinite, the number of a-rules required to accept L is also infinite.

Now we give the argumentative proof similar to the above to show that there does not exist any PGPSG to accept L. Suppose we assume that there is one such PGPSG \(\varPi _7\) with m membranes. If at least in any one of the m membrane contain a recursive a-rule then, it leads to an infinite loop or the system accepts a string not in L. On the other hand, if the system contains only non-recursive a-rules, then the number of a-rules must be infinite, which is a contradiction. Hence the theorem. \(\square \)

In the following result, we show that any \(LPGPSG_{\star }\) will be a context-sensitive language.

Theorem 6

\(LPGPSG_{\star } \subsetneqq CS\)

Proof

We show how PGPSG will be recognized by a linear bounded automaton (LBA). In order to do this, we simulate a computation of a PGPSG by remembering the number of nodes and the corresponding edges in the graphs, after the acceptance of each symbol in the guiding string. We then show that the total number of nodes and edges in the graphs is bounded by the length of the guiding string.

Consider a guiding language L of a PGPSG \(\varPi _8\) with m membranes and let r be the total number of rules in these m membranes. Let \(w = a_1a_2 \dots a_l\), \(l \ge 1\) be a guiding string in L. Let \(g_1, g_2, \dots , g_n\) be the graphs in the m membranes of \(\varPi _8\) in the initial configuration . We build a multi-track non-deterministic LBA B which simulates \(\varPi _8\). In order for B to simulate \(\varPi _8\), it has to keep track of the labels of nodes and edges in the graphs after accepting each symbol in the guiding string. So B has a track assigned to every rule of \(\varPi _8\), a track for each non-terminal-node-membrane pair \((g_i^{A_k}, j)\), with \(1\le k \le N\) and \(1\le i \le n\), where N is the total number of non-terminal nodes in the system and \(j \in \{1, 2,\dots , m\}\), a track for each terminal-node-membrane pair \((g_i^{C_k}, j)\) with \(1\le k \le T\) and \(1\le i \le n\), where T is the total number of terminal nodes in the system and \(j \in \{1, 2,\dots , m\}\) and tracks for each triple \((X, Y, i), (X^{'},Y^{'},i) \in R \times R \times \{1, 2,\dots , n\}\) where \(R = V_n \cup E_e \cup T_n \cup T_e\).

B keeps track of the configuration of \(\varPi _8\) by assigning a positive integer to each track described above which denotes
  1. 1.

    the number of non-terminal-nodes of a graph \(g_i\) in membrane j,

     
  2. 2.

    the number of terminal nodes of a graph \(g_i\) in membrane j,

     
  3. 3.

    the number of edges whose end vertices are labelled with X and Y of graph \(g_i\),

     
respectively, and assigning a symbol from \(E_e \cup T_e\) on each track assigned to the triple \((X^{'}, Y^{'}, i)\), denoting the label of the edge between the nodes labelled with X and Y of graph \(g_i\).

A single step of the computation of B is as follows: Based on the current configuration and the next symbol to be generated, B chooses a set of rules that are to be applied in the next step, by writing an integer on the track corresponding to the rules which indicates the number of times that particular rule is applied. Then, for each pair \((g_i^{A_k}, j)\) and \((g_i^{C_k}, j)\), B examines the chosen rule set and writes the number of nodes labelled by a non-terminal and terminal of a graph \(g_i\) in membrane j. For each triple (XYi), B records the number of edges between the nodes labelled with X and Y of a graph \(g_i\), and for each triple \((X^{'}, Y^{'}, i)\), B identifies a symbol from \(E_e \cup T_e\). At any computation step, the deletion or insertion of nodes in the current graph can be updated using in the pairs \((g_i^{A_k}, j)\) and \((g_i^{A_k}, j)\). We can see that in any step of the computation, the tracks contain integers bounded by the number of symbols (labels of nodes and edges) inside \(\varPi _8\).

The number of symbols (labels of nodes and edges) in the graphs in a configuration C during a computation step is bounded by S(i), where S(i) is the number of symbols assigned to the triple \((X^{'},Y^{'},i)\). Then, the space used by B to record the configurations and to calculate the configuration change of \(\varPi _8\) is bounded by \(t \times \mathrm{log}_b (S(i))\), where b denotes the base of the track alphabet and t denotes the number of tracks used. Finally, B checks whether any more rules can be applied. If not, and also if it reaches the configuration in F (set of final configurations), it accepts the guiding string w, otherwise it rejects. So the number of symbols (labels of nodes and edges) in the graphs present in the system is bounded by the input length and hence the accepted language is a context-sensitive language. \(\square \)

The system PGPSG is not computationally complete as it was shown in Theorem 6. In the following, we show that if \(\lambda \)-labelled rules are allowed in the system, then the guiding languages can be RE.

Theorem 7

\(LPG_{\lambda }PSG_{\star } = RE\)

Proof

The inclusion \(LPG_{\lambda }PSG_{\star } \subseteq RE\) follows from Church-Turing hypothesis. For the proof of the inclusion \(RE \subseteq LPG_{\lambda }PSG_{\star }\), it is enough to prove that \(RE \subseteq LPG_{\lambda }PSG_1\), since \(LPG_{\lambda }PSG_1 \subseteq LPG_{\lambda }PSG_{\star }\).

Let \(H = \{a_1, a_2,\dots ,a_k\}\) and let \(L \subseteq H^{*}\) be a recursively enumerable language. Let \(e: H \mapsto \{1^{1}, 1^{2}, 1^{3},\dots ,1^{k}\}\) such that \(e(a_i) = 1^{i}\), \(1 \le i \le k\). The encoding for a string \(w = a_ia_j\dots a_l\) where \(a_i, a_j,\dots ,a_l \in H\) is as follows:
$$\begin{aligned} e(w) = 0e(a_i)0e(a_j)0\dots 0e(a_l)0 . \end{aligned}$$
For any L, there exists a Turing machine Open image in new window which halts after processing the input \(i_0\) placed in its input tape if and only if \(i_0 = e(w)\) for some \(w \in \) L. So it is sufficient to show how to simulate the encoding e(w), and simulate the transitions of the Turing machine with a PGPSG. The transitions of the Turing machine are simulated by a PGPSG as follows:
  • The transition \(\delta (q, a) = (p, b, R)\) is simulated by the graph production

    \(A[(q, a), \lambda , \lambda ;(q, a), a, (p, b) ],here\) .

  • The transition \(\delta (q, a) = (p, b, L)\) is simulated by the graph production

    \(A[\lambda , \lambda , (q, a);(p, b), a, (q, a)],here\) .

We construct a PGPSG \(\varPi ^{'} = \Big (V_n, E_e, T_n, T_e, [_1]_1, w_1, R_1, 1, H, F \Big )\), where \(V_n = \{(q,a) : q\in K, a\in H \}\), \(E_e = \phi \), \(T_n = (q_f,0)\), \(T_e = \Big \{ 0, 1 \Big \}\), \(w_1\) contains a single node labelled by \((q_0, 0)\).
\(R_1 = \Big \{ a_i: A[(q_0, 0), \lambda , \lambda ;(q_0, 0), 0, (q_i, 1) ],here~\big |~ a_i \in H,~~ {1 \le i \le k} \Big \} \cup \) set of all graph productions corresponding to the transitions of the Turing machine M which are labelled with \(\lambda \). The set of final configurations F is the set of linear graphs such the first \((n-1)\) nodes can be labelled with either \((q_0, 0)\) or (q, 1), \(q\in K\) depending on the corresponding symbol of e(w). The \(n\mathrm{{th}}\) node is labelled by \((q_f, 0)\). The edges of this graph are labelled by the symbols in e(w) in that order, where \(w \in L\).
Fig. 5

The computation of spanning tree from a connected graph

The PGPSG \(\varPi ^{'}\) performs the following operations:
  1. 1.

    For a symbol \(a_i \in H\), the rule \(A[(q_0, 0), \lambda , \lambda ;(q_0, 0), 0, (q_i, 1) ],here\), labelled with \(a_i\) is used to introduce the symbol \((q_i,1)\), it is the symbol used in the first transition for generating the encoding in Step 2.

     
  2. 2.
    Perform the computation \(e(w)=e(a_iu) = e(a_i)e(u)\), \(u \in H^{*}\), for some \(a_i \in H\). The simulation of \(e(a_iu)\) is performed by the following transitions.
    $$\begin{aligned}&\delta (q_i, 1) = (q_{i-1}, 1, R)~,\\&\delta (q_{i-1}, 1) = (q_{i-2}, 1, R)~,\\&~~~\dots \dots \dots \dots ~,\\&\delta (q_2, 1) = (q_1, 1, R),\\&\delta (q_1, 1) = (q_0, 0, R) \end{aligned}$$
    The transitions of the sub-program can be simulated by the graph productions as shown in the beginning of the proof, and these rules are assigned with label \(\lambda \).
     
  3. 3.

    Repeat steps 1 and 2 non-deterministically until the last symbol of the regulated string w is read/processed.

     
  4. 4.

    The output graph of the system is in F, which is the final configuration set. We can now simulate the working of the Turing machine M in recognizing the string e(w). If the Turing machine halts in state \(q_f\) where the corresponding node in linear graph in F will be \((q_f,0)\), then \(w \in L\), else the machine goes into an infinite loop.

    \(\delta (q_0, 0) = (q_f, 0, R)\)

     
So, we can see that the computation halts after accepting a string w if and only if \(w \in L\). \(\square \)

4 Applications

This section illustrates two direct applications of PGPSG. A spanning tree is extracted from a given connected graph as input to a PGPSG with a context-sensitive guiding language. In the second application, some interesting chemical reactions are modeled via PGPSG.

4.1 Spanning tree

In the following theorem, we show how the PGPSG with one membrane and a context-sensitive language as a guiding language extracts a spanning tree.

Theorem 8

There exists a context-sensitive language L such that PGPSG accepts L and halts at a spanning tree. .

Proof

We construct a PGPSG \(\varPi _9\), which accepts a context-sensitive language \(\Big \{a^nb^{m-(n-1)}~ \big |~ n = \left| V(G)\right| ,~ m = \left| E(G)\right| ,~ n\ge 2 \Big \}\) and halts on one of the spanning tree of a connected graph G. The PGPSG \(\varPi _9\) with one membrane is given as:
$$\begin{aligned} \varPi _9= & {} \Big (\{N\},\{\phi \}, \{x\}, \{0, 1\}, [_1]_1, g_1, R_1, 1, \{a, b\}, F \Big ),\,\hbox {where} \\ R_1= & {} \Big \{1)~ a: C[x, 0, N;x, 1, x],here~>~\\&2)~ b: D[x, 0, x;x, \lambda , x],here ~>~\\&3)~ a: C[N;x],here \Big \}, \end{aligned}$$
\(g_1\) contains a connected graph G with n nodes, where each node is labelled by N and each edge is labelled by 0 (see Fig. 5) and F is the set of spanning trees of the input graph G. The regulated context-sensitive language accepted by \(\varPi _9\) is \(LPGPSG_1(\varPi _9) = \Big \{a^nb^{m-(n-1)}~ \big |~ n = \left| V(G)\right| ,~ m = \left| E(G)\right| ,~ n\ge 2 \Big \}\).

In this proof, to a given input, the system adds neither new nodes nor new edges. Only the renaming and deletion operations are applied on nodes and edges. The working of PGPSG \(\varPi _9\) is as follows: In the initial configuration, the connected graph G is in region 1. In region 1, we apply the only possible lowest priority rule ‘3’ once, rename one of the node of G as x. Now, apply \((n-1)\) times the higher priority rule ‘1’, rename all the nodes labelled by N as x and the corresponding edges are renamed by 1. Then, apply \(m-(n-1)\) times the second priority rule ‘2’, delete all the edges labelled by 0 and halt the computation. The resulting graph is a spanning tree with all nodes labelled by x and the edges labelled by 1 (see Fig. 5). Each regulated string accepted by \(\varPi _9\) corresponds to a spanning tree of graph G in F. So the system accepts the context-sensitive language for the given final configuration. \(\square \)

4.2 Chemical graphs

Chemical graphs are just graph-based descriptions of molecules, with nodes representing the atoms ( each one of them labelled by the type (i.e.,) the name of the corresponding element ), and edges representing the bonds, with a non-negative weight describing the order of the bond (0 for a non-existent bond, 1 for a single bond, 2 for a double bond, and 3 for a triple bond).

Definition 3

[13] A chemical graph is a weighted graph \((V, E, \psi )\), with (VE) an simple undirected graph where all whose nodes are labelled by means of chemical elements, and \(\psi : E \rightarrow N\) a weight function. The valence of a node in a chemical graph is the total weight of the edges incident to it.

Fig. 6

The set of all acyclic alkane with the general chemical formula \(\mathrm{{C}}_n\mathrm{{H}}_{2n+2}\)

The set of all acyclic alkane with the general chemical formula \(\mathrm{C}_n\mathrm{H}_{2n+2}\) is given in Fig. 6. For \(n = 1, 2, 3, 4, \dots \), the chemical formula \(\mathrm{CH}_4,\) \(\mathrm{C}_2\mathrm{H}_6\), \(\mathrm{C}_3\mathrm{H}_8\), \(\mathrm{C}_4\mathrm{H}_{10}\), \(\dots \) denotes the chemical compound methane, ethane, propane, butane, pentane, \(\dots \) so on. Now, we can represent these chemical components by a connected graph and we call these graphs as chemical graphs. The representation is as follows:
  • Each carbon molecule represented as a node labelled by c.

  • Each hydrogen molecule represented as a node labelled by h.

  • The bond between any of these two molecules represented by an edge labelled by 1.

Remark 4

The PGPSG always halts on a connected graph, whose nodes are labelled by a terminal symbol. But chemical compounds are usually represented either by an uppercase alphabet or by an uppercase alphabet followed by lower case alphabet. For example, sodium, carbon, calcium and oxygen are represented by Na, C, Ca and O. Hence, we represent these chemical compounds by \(n_{a}\), c, \(c_{a}\) and o.

Remark 5

Suppose, there is a double bond existing between two molecules then we represent this by an edge labelled by 2. In general, if a k bond exists between two molecules, then we represent this by an edge labelled by k. Also, an edge-labelled 0 indicates that there is no bond between two molecules but there is −ve (negative) and +ve (positive) charge in the molecules.

Fig. 7

The chemical graph representation of acyclic alkane with chemical formula \(\mathrm{{C}}_n\mathrm{{H}}_{2n+2}\)

The chemical graph representation of Fig. 6 is given in Fig. 7. The following proposition constructs a P system which will always output a chemical graph \(\mathrm{C}_n\mathrm{H}_{2n+2}\), for \(n\ge 1\). The process is guided by a regular language. The important observation is that such a chemical graph cannot be an output of a P system with one membrane. Since P system is a distributed computing model, a controlled repetitive process can be achieved by alternatively shifting the object (connected graph) from one membrane to another. To generate \(\mathrm{C}_n\mathrm{H}_{2n+2}\), in the following proposition, we first generate
and then

is generated for (\(n-1\)) times. This repetitive process requires additional membrane. Finally, it generates one H.

Proposition 1

There exists a PGPSG that halts on a chemical graph denoted by the chemical formula \(\mathrm{C}_n\mathrm{H}_{2n+2}\), \((n \ge 1)\) and accepts the guiding regular language \(\Big \{a^{3n+4}~ \big |~ n\ge 1 \Big \}\).

Proof

Let \(\mathrm{C}_n\mathrm{H}_{2n+2}\), \(n\ge 1\) be a chemical graph with \(3n+2\) nodes. Now, we construct a PGPSG \(\varPi _{10}\), which accepts the regular language \(\Big \{a^{3n+4}~ \big |~ n\ge 1 \Big \}\) and halts on a chemical graph denoted by the chemical formula \(\mathrm{C}_n\mathrm{H}_{2n+2}\), \((n \ge 1)\).

Let \(\varPi _{10} = \Big (\{S, B, D, E\},\{\phi \}, \{c, h\}, \{1\}, [_1[_2]_2]_1, g_1, g_2, R_1, R_2, 2, \{a\}, F \Big )\), where
$$\begin{aligned} R_1= & {} \Big \{1)~ a: A[\lambda , \lambda , S;h, 1, B],here~,\\&2)~ a:A[B,\lambda , \lambda ;D, 1, h],here~,\\&3)~ a:A[D,\lambda ,\lambda ;E, 1, h]~,in_2\Big \},\\ R_2= & {} \Big \{4)~ a: A[E,\lambda , \lambda ;c, 1, h],here~,\\&5)~a: A[E, \lambda , \lambda ;c, 1, B]~,out\Big \}, \end{aligned}$$
\(g_1\) contains a single node labelled by S, \(g_2 = \emptyset \) and the set of final configurations F is the set of all chemical graphs which represents acyclic alkane with chemical formula \(\mathrm{C}_n\mathrm{H}_{2n+2}\), \((n \ge 1)\) (see Fig. 7).

The working of PGPSG \(\varPi _{10}\) is as follows: Starting with a single node labelled by S in region 1, a sequence of application of rules ‘1’, ‘2’ and ‘3’ in that order, rewrites the single node S as a graph with a node labelled by E connected to three distinct nodes, each labelled by h. The edge between each node h and node E is labelled by 1. The resulting graph is expelled to region 2. In region 2, rule ‘5’ is applied to relabel the node E by a label c and is connected to a new node labelled by B. Anedge (c, 1, B) is introduced between c and B and the resulting graph is sent back to region 1. Repeating this process \((n-1)\) times leads to the chemical graph \(\mathrm{C}_n\mathrm{H}_{2n+2}\). To terminate this process, rule ‘4’ is applied instead of rule ‘5’. The output graph is retained in region 2. \(\square \)

Fig. 8

Chemical structure of the reaction of methanol and ammonia

Fig. 9

Chemical graph representation of the reaction of methanol and ammonia

4.3 Chemical reactions

Next, we show how the chemical graphs are used to represent chemical reactions. We consider the chemical reaction of \(\mathrm{CH}_3\mathrm{OH}\) (methanol) and \(\mathrm{NH}_3\) (ammonia) that yields the chemical compound \(\mathrm{CH}_3\mathrm{ONH}_4\) (ammonium methoxide).
$$\begin{aligned} \mathrm{CH}_3\mathrm{OH}~ + ~\mathrm{NH}_3 ~\rightarrow ~~~ \mathrm{CH}_3\mathrm{ONH}_4 \end{aligned}$$
More precisely, we can represent the chemical structure of the above reaction using graphs as shown in Figs. 8 and 9.
This reaction can be generalized as follows:
$$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~ + ~\mathrm{NH}_3 ~\rightarrow ~~~ \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{ONH}_4 \end{aligned}$$
The corresponding chemical graph representation of the above reaction is given in Fig. 10. In the following proposition, we model a chemical reaction by PGPSG that has three membranes.
Fig. 10

The chemical graph representation of the reaction of \(\mathrm{{C}}_n\mathrm{{H}}_{2n+1}\mathrm{{OH}}~\) (alkanol) and \(\mathrm{{NH}}_3\) (ammonia)

Proposition 2

There exists a PGPSG that simulates the chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}\) (alkanol), \((n \ge 1)\) and \(~\mathrm{NH}_3\) (ammonia), which produces the chemical compound \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{ONH}_4~\) (ammonium alkoxide) as output when it halts for a guiding regular language \(\Big \{a^{3n+2}bde~\big |~ n\ge 1 \Big \}\).

Proof

Let \(\varPi _{11} = \Big (\{S, B, D, E, H, O, N\}\),\(\{\phi \}\), \(\{c, h, o, n\}, \{0, 1\}\), \([_1[_2[_3]_3]_2]_1\), \(g_1, g_2, g_3, R_1, R_2, R_3, 3\), \(\{a, b, d, e\}, F \Big )\), where
$$\begin{aligned} R_1= & {} \Big \{1)~ a: A[\lambda , \lambda , S;h, 1, B],here~,\\&2)~ a: A[B,\lambda , \lambda ;D, 1, h],here~,\\&3)~ a: A[D,\lambda ,\lambda ;E, 1, h]~,in_2\Big \},\\ R_2= & {} \Big \{4)~ a: A[E,\lambda , \lambda ;c, 1, O],here~,\\&5)~a: A[O, \lambda , \lambda ;o, 1, H]~,in_3,\\&6)~a: A[E, \lambda , \lambda ;c, 1, B]~,out\Big \},\\ R_3= & {} \Big \{7)~ b: A[H,\lambda , N;h, 1, n],here~,\\&8)~d: A[o,\lambda , N;o, 0, n],here~,\\&9)e: D[o, 1, h;o, \lambda , h],here~\Big \}, \end{aligned}$$
\(g_1\) contains a single node labelled by S, \(g_2 = \emptyset \), \(g_3\) contains a chemical graph corresponding to the chemical compound \(~\mathrm{NH}_3\) as shown in Fig. 10 and \(F = \Big \{(\phi , \phi , G^{'}) ~ \big |~ G^{'}\) is a chemical graph corresponding to the chemical compound \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{ONH}_4~\), \(n \ge 1\) (as indicated by X, see Fig. 10) \(\Big \}\). The computation of \(\varPi _{11}\) is guided by a regular language \(LPGPSG_3(\varPi _{11}) = \Big \{a^{3n+2}bde~ \big |~ n\ge 1 \Big \}\).

The working of PGPSG \(\varPi _{11}\) is as follows: We divide the simulation of the reaction into two steps. In the first step, simulate the chemical graph corresponding to the chemical compound \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~\) (alkanol) for any \((n \ge 1)\) and in the second step we simulate the reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~\) (alkanol) and \(~\mathrm{NH}_3\) (ammonia).

The simulation of the chemical graph corresponding to the chemical compound is similar to that of the graph in \(\varPi _{10}\) and the resulting chemical graph corresponding to \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}\) is expelled to region 3.

In region 3, rule ‘7’ is applied to establish the edge (h, 1, n) between the nodes H and N. Next rule ‘8’ is applied to connect the nodes o and n with an edge (o, 0, n). Finally, the deletion rule ’9’ is applied to delete the edge (o, 1, h) between the nodes o and h. The computation halts and the desired output graph is retained in membrane 3. \(\square \)

Remark 6

The following chemical reactions can also be modeled in a similar fashion by a PGPSG with a regular language as guiding language.
  1. 1.
    The chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~\) (alkanol), \((n \ge 1)\) and \(~\mathrm{PH}_3\) (phosphine), produces the chemical compound \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OPH}_4~\) (phosphonium alkoxide).
    $$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~ + ~\mathrm{PH}_3 ~\rightarrow ~ \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OPH}_4 \end{aligned}$$
     
  2. 2.
    The chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~\) (alkanol), \((n \ge 1)\) and \(~\mathrm{SiH}_3\) (silane), produces the chemical compound \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OSiH}_4~\) (silanium alkoxide).
    $$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH} + \mathrm{SiH}_3 ~\rightarrow ~ \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OSiH}_4 \end{aligned}$$
     
  3. 3.
    The chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}~\), (alkanoic acid) \((n \ge 1)\) and \(~\mathrm{NH}_3\) (ammonia), produces \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COONH}_4~\) (ammonium alkanoate). That is
    $$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}~ + ~\mathrm{NH}_3 ~\rightarrow ~ C_nH_{2n+1}COONH_4 \end{aligned}$$
     
  4. 4.
    The chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}\),(alkanoic acid) \((n \ge 1)\) and \(~\mathrm{PH}_3\) (phosphine), produces \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOPH}_4~\) (phosphonium alkanoate). That is
    $$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}~ + ~\mathrm{PH}_3 ~\rightarrow ~ \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOPH}_4 \end{aligned}$$
     
  5. 5.
    The chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}~\), (alkanoic acid) \((n \ge 1)\) and \(~\mathrm{SiH}_3\) (silane), produces \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOSiH}_4~\) (silanium alkanoate). That is
    $$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}~ + ~\mathrm{SiH}_3 ~\rightarrow ~ \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOSiH}_4 \end{aligned}$$
     

5 Concluding remarks

In this paper, we have defined PGPSG. The language accepted by such systems was called as guiding languages. These languages are compared with the Chomskian hierarchy. We have also established that RE languages can be guiding languages if \(\lambda \)-labels are allowed. The paper also contains some examples of such systems which exclusively halts on path graphs, cycles, complete graphs and complete bipartite graphs with regular and context-sensitive languages as guiding languages. As an immediate application, a PGPSG which halts on a spanning tree of a given as input graph, is also given. The model is found to be suitable for discussing the steps involved in a chemical reaction. Designing of some chemical graphs is shown. This is the first study that primarily connects P systems and chemical graphs.

Notes

Acknowledgements

This work was funded by the Project No: SB/S4/MS-865/14, Department of Science and Technology, Government of India.

References

  1. 1.
    Păun, Gh., Rozenberg, G., Salomaa, A. (eds.): The Oxford Handbook of Membrane Computing. Oxford University Press, Oxford (2010)Google Scholar
  2. 2.
    Freund, R., Oswald, M.: P systems with local graph productions. New Gener. Comput. 22, 365–375 (2004)CrossRefMATHGoogle Scholar
  3. 3.
    Khaira, T., Yamina, M.: Colouring graph by the Kernel P system. Int. J. Reason. Intell. Syst. 7, 286–295 (2015)Google Scholar
  4. 4.
    Fernández, M., Kirchner, H., Pinaud, B..: Strategic Port Graph Rewriting: An Interactive Modelling and Analysis Framework. Research Report, Inria, France (2016)Google Scholar
  5. 5.
    Păun, Gh, Sakaibara, Y., Yokomori, T.: P systems on graphs of restricted forms. Publicationes Mathematicae Debrecen 60, 635–660 (2002)MathSciNetMATHGoogle Scholar
  6. 6.
    Maribel, F., Hélène, K., Oliver, N.: A strategy language for graph rewriting. In: International Symposium on Logic-Based Program Synthesis and Transformation, pp. 173–188 (2011)Google Scholar
  7. 7.
    Ramanujan, A., Krithivasan, K..: Control words of transition P systems. In: Proceedings of Seventh International Conference on Bio-Inspired Computing: Theories and Applications (BIC-TA 2012), Advances in Intelligent Systems and Computing, vol. 201, pp. 145–155 (2013)Google Scholar
  8. 8.
    Ramanujan, A., Krithivasan, K.: Control languages associated with spiking neural P systems. Romanian J. Inf. Sci. Technol. 15(4), 301–318 (2012)Google Scholar
  9. 9.
    Sureshkumar, W., Rama, R.: Chomsky hierarchy control on isotonic array P systems. Int. J. Pattern Recognit. Artif. Intell. 30(1650004), 1–20 (2016)MathSciNetGoogle Scholar
  10. 10.
    Zhang, X., Liu, Y., Luo, B., Pan, L.: Computational power of tissue P systems for generating control languages. Inf. Sci. 278, 285–297 (2014)MathSciNetCrossRefMATHGoogle Scholar
  11. 11.
    Mahalingam, K., Paul, P., Mäkinen, E.: On derivation languages of a class of splicing systems. Acta Cybern. (2017, Accepted)Google Scholar
  12. 12.
    Rozenberg, G., Salomaa, A. (eds.): Handbook of Formal Languages. Springer, Heidelberg, pp. 1–3 (1997)Google Scholar
  13. 13.
    Rosselló, F., Valiente, G.: Chemical graphs, chemical reaction graphs, and chemical graph transformation. In: Proceedings of the International Workshop on Graph-Based Tools (GraBaTs 2004) Graph-Based Tools 2004–2005), Electronic Notes in Theoretical Computer Science, vol. 127, no. 1, pp. 157–166 (2005)Google Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Department of Computer Science and EngineeringSaveetha UniversityChennaiIndia
  2. 2.Department of MathematicsIndian Institute of Technology MadrasChennaiIndia

Personalised recommendations