Keywords

1 Introduction

This work can be considered as a contribution to the area of Natural Computing, which is a field of research that investigates both human-designed computing inspired by nature and computing that occurs in nature.

In virology, a virus is a parasitic biological agent that can only reproduce after infecting a host cell. Every animal, plant, and protist species on this planet has been infected by viruses. Viruses can transmit from one host to another through various routes (e.g., conjunctival route, mechanical route, etc.). For additional details on viruses, refer to [2].

In this study, a new computing paradigm, introduced in [1], based on the transmissions and replications of viruses, is introduced. This paradigm provides non-deterministic computing models that consist of several cell-like hosts connected to one another by channels. Viruses are placed in the hosts and can transmit from one host to another by passing through a channel, and can replicate itself while transmitting. These processes are controlled by several instructions, which are attached to the channels. These systems can be considered as a heterogeneous network that consists of:

  • A virus transmission network: a weighted directed graph, wherein each node represents a hostand each arc represents a transmission channel through which viruses can transmit between hosts or exit to the environment. In addition, each arc has associated a weight (natural number \(w > 0\)), which indicates the number of viruses that will be transmitted.

  • An instruction transfer network: a weighted directed graph, wherein each node represents a control instruction unit and each edge represents an optional instruction transfer path with a positive integral weight.

  • An instruction-channel control network: an undirected graph, wherein each node represents either a control instruction or a transmission channel and each edge represents a relationship between an instruction and a channel.

The computing models of this paradigm are universal (equivalent in power to Turing machines) when there is no limit on the number of viruses present in any host during a computation. The paper is organized as follows. Next section, the computing paradigm of virus machines is presented. In Sect. 3, the different modules concerning the basic arithmetic operators are presented. The paper ends with some open problems and concluding remarks.

2 Virus Machines

In what follows we formally define the syntax of the Virus Machines.

Definition 1

A Virus Machine of degree \((p, q), p \ge 1, q \ge 1\) is a tuple \(\varPi = (\varGamma , H, I, D_{H}, D_{I}, G_{C}, n_{1}, \ldots , n_{p}, i_{1}, h_{out})\), where:

  • \(\varGamma = \{v\}\) is the singleton alphabet;

  • \(H = \{h_{1}, \ldots , h_{p}\}\) and \(I = \{i_{1}, \ldots , i_{q}\}\) are ordered sets such that \(v \not \in H \cup I\), \(H \,\cap \,I = \emptyset \) and \(h_{out} \not \in I \,\cup \,\varGamma \): either \(h_{out} \in H\) or \(h_{out}\) represents the environment (denoted by \(h_{0}\));

  • \(D_{H} = (H \cup \{h_{out}\}, E_{H}, w_{H})\) is a weighted directed graph, where \(E_{H} \subseteq H \times (H \cup \{h_{out}\})\), \((h, h) \not \in E_{H}\) for each \(h \in H\), out-\(degree(h_{out}) = 0\) and \(w_{H}\) is a mapping from \(E_{H}\) onto \(\mathbb {N} \setminus \{0\}\);

  • \(D_{I} = (I, E_{I}, w_{I})\) is a weighted directed graph, where \(E_{I} \subseteq I \times I\), \(w_{I}\) is a mapping from \(E_{I}\) onto \(\mathbb {N} \setminus \{0\}\) and the out-degree of each node is less than or equal to 2;

  • \(G_{C} = (V_{C}, E_{C})\) is an undirected bipartite graph, where \(V_{C} = I \cup E_{H}\) being \(\{I, E_{H}\}\) the partition associated with it: every edge connects an element from I with, at most, an arc from \(E_{H}\);

  • \(n_{j} \in \mathbb {N} (1 \le j \le p)\).

A Virus Machine (VM, for short) \(\varPi = (\varGamma , H, I, D_{H}, D_{I}, G_{C}, n_{1}, \ldots , n_{p}, i_{1}, h_{out})\) of degree (pq), can be viewed as an ordered set of p hosts labelled with \(h_{1}, \ldots , h_{p}\), where host \(h_{j}\) initially contains exactly \(n_{j}\) viruses, and an ordered set of q control instruction units labelled with \(i_{1}, \ldots , i_{q}\). Symbol \(h_{out}\) represents the output region: it can be a host in the case that \(h_{out} \in H\) or \(h_{out}\) can refer to the environment in the case that \(h_{out} = h_{0}\). Arcs from the directed graph \(D_{H}\) represent transmission channels through which viruses can transmit from one host \(h_{s}\) (different from \(h_{out}\)) to another different host \(h_{s'}\), or to the environment. If \(s' = 0\), viruses may exit to the environment. In any moment, at most one instruction is activated and then the channel \((h_{s}, h_{s'})\) (arc in \(G_{C}\)) with weight \(w_{s,s'}\) attached with it, will be opened. Then, \(w_{s,s'}\) viruses will be transmitted/replicated from \(h_{s}\) to \(h_{s'}\). By default, each channel is closed.

Arcs from the directed graph \(D_{I}\) represent instruction transfer paths, and they have associated within a weight. Finally, the undirected bipartite graph \(G_{C}\) represents the instruction-channel network by which an edge \(\{i_{j}, (h_{s}, h_{s'})\}\) indicates a control relationship between instruction \(i_{j}\) and channel \((h_{s}, h_{s'})\).

Graphically, a virus machine of degree (4, 6) with 4 hosts and 6 control instructions can be represented as a heterogeneous network consisting of three graph, as illustrated in Fig. 1. Each host is depicted as a rectangle and each instruction is depicted as a circle. Each arrow is either a virus transmission channel linking the hosts (or pointing to the environment), or an instruction transfer path linking the instructions; in both cases, each arrow is assigned with a positive integral weight (the weight 1 is not marked for simplicity). The control relationships between instructions and channels are represented as dotted lines.

Fig. 1.
figure 1

Structure of a Virus Machine

In what follows, the semantics associated with the computing model of the virus machines is described. An instantaneous description or a configuration \(\mathcal {C}_{t}\) at an instant t of a virus machine is described by a tuple \((a_{0,t}, a_{1,t}, \ldots , a_{p,t}, u_{t})\) where \(a_{0,t}, a_{1,t}, \ldots , a_{p,t}\) are natural numbers, \(u_{t} \in I \cup \{\#\}\), where \(\# \not \in H \cup h_{0} \cup I\) is an object for characterizing halting configurations. The meaning of \(\mathcal {C}_{t}\) is the following: at instant t the environment contains exactly \(a_{0,t}\) viruses and the host \(h_{s}\) contains exactly \(a_{s,t}\) viruses, and if \(u_{t} \in I\), then the instruction \(u_{t}\) will be activated at step \(t+1\) (otherwise, if \(u_{t} = \#\), then no instruction will be activated). The initial configuration of the system \(\varPi = (\varGamma , H, I, D_{H}, D_{I}, G_{C}, n_{1}, \ldots , n_{p}, i_{1}, i_{out})\) is \(\mathcal {C}_{0} = (0, n_{1}, \ldots , n_{p}, i_{1})\). A configuration \(\mathcal {C}_{t} = (a_{0,t}, a_{1,t}, \ldots , a_{p,t}, u_{t})\) yields configuration \(\mathcal {C}_{t+1} = (a_{0,t+1}, a_{1,t+1}, \ldots , a_{p,t+1}, u_{t+1})\) in one transition step if we can pass from \(\mathcal {C}_{t}\) to \(\mathcal {C}_{t+1}\) if we can pass from \(\mathcal {C}_{t}\) to \(\mathcal {C}_{t+1}\) in the following form.

  1. (a)

    First, given that \(\mathcal {C}_{t}\) is a non-halting configuration we have \(u_{t} \in I\). Then the control instruction unit \(u_{t}\) is activated.

  2. (b)

    If \(u_{t}\) is attached to a channel \((h_{s}, h_{s'})\) then the channel will be opened and:

    • If \(a_{s,t} \ge 1\) then only one virus is consumed from host \(h_{s}\) and \(w_{s,s'}\) copies of v are produced in the region \(h_{s'}\).

    • If \(a_{s,t} = 0\) then no virus is consumed from host \(h_{s}\) and no virus is produced in the region \(h_{s'}\).

  3. (c)

    If \(u_{t}\) is not attached to any channel then there is no transmission of viruses.

  4. (d)

    Object \(u_{t+1} \in I \cup \{\#\}\) is obtained as follows:

    • If out-\(degree(u_{t}) = 2\) then there are two different instructions \(u_{t'}\) and \(u_{t''}\) such that \((u_{t}, u_{t'}) \in E_{I}\) (with weight \(w_{t,t'}\)) and \((u_{t}, u_{t''}) \in E_{I}\) (with weight \(w_{t,t''}\)).

      • If instruction \(u_{t}\) is attached to a channel \((h_{s}, h_{s'})\):

        \(*\):

        If \(a_{s,t} \ge 1\) then \(u_{t+1}\) is the instruction corresponding to the highest weight path (\(max\{w_{t,t'}, w_{t,t''}\}\)). If \(w_{t,t'} = t_{t,t''}\), the next instruction is selected in a non-deterministic way.

        \(*\):

        If \(a_{s,t} = 0\) then \(u_{t+1}\) is the instruction corresponding to the lowest weight path (\(min\{w_{t,t'}, w_{t,t''}\}\)). If \(w_{t,t'} = w_{t,t''}\), the next instruction is selected in a non-deterministic way.

      • If instruction \(u_{t}\) is not attached to a channel, then the next instruction \(u_{t+1}\) (\(u_{t'}\) or \(u_{t''}\)) is selected in a non-deterministic way.

    • If out-\(degree(u_{t}) = 1\) then the system behaves deterministically and \(u_{t+1}\) is the instruction that verifies \((u_{t}, u_{t+1}) \in E_{I}\).

    • If out-\(degree(u_{t}) = 0\) then \(u_{t+1} = \#\), and \(\mathcal {C}_{t+1}\) is a halting configuration.

Definition 2

A Virus Machine with input, of degree \((p, q, r), p \ge 1, q \ge 1, r \ge 1\) is a tuple \(\varPi = (\varGamma , H, H_{r}, I, D_{H}, I, D_{H}, D_{I}, G_{C}, n_{1}, \ldots , n_{p}, i_{1}, h_{out})\), where:

  • \((\varGamma , H, I, D_{H}, D_{I}, G_{C}, n_{1},\ldots , n_{p}, i_{1}, h_{out})\) is a Virus Machine of degree (pq).

  • \(H_{r} = \{h_{i_{1}}, \ldots , h_{i_{r}}\} \subseteq H\) is the ordered set of r input hosts and \(h_{out} \not \in H_{r}\).

If \(\varPi \) is a virus machine with input of degree \((p, q, r), p \ge 1, q \ge 1, r \ge 1\) and \((\alpha _{1}, \ldots , \alpha _{r}) \in \mathbb {N}^{r}\), the initial configuration of \(\varPi \) with input \((\alpha _{1}, \ldots , \alpha _{r})\) is \((0, n_{1}, \ldots , n_{i_{1}} + \alpha _{1}, \ldots , n_{i_{r}} + \alpha _{r}, \ldots , n_{p}, i_{1})\). Thus, each r-tuple \((\alpha _{1}, \ldots , \alpha _{r}) \in \mathbb {N}^{r}\), is associated with an initial configuration \((0, n_{1}, \ldots , n_{i_{1}} + \alpha _{1}, \ldots , n_{i_{r}} + \alpha _{r}, \ldots , n_{p}, i_{1})\).

A computation of a virus machine \(\varPi \) with input \((\alpha _{1}, \ldots , \alpha _{r})\), denoted by \(\varPi + (\alpha _{1}, \ldots , \alpha _{r})\), starts with configuration \((0, n_{1}, \ldots , n_{i_{1}} + \alpha _{1}, \ldots , n_{i_{r}} + \alpha _{r}, \ldots , n_{p}, i_{1})\) and proceeds as stated above. The result of a halting computation of \(\varPi + (\alpha _{1}, \ldots , \alpha _{r})\) is the total number of viruses sent to the output region during the computation.

Next, a particular kind of virus machines providing function computing devices, is introduced.

Definition 3

Let \(f: \mathbb {N}^{k} - \rightarrow \mathbb {N}\) be a partial function. We say that function f is computable by a virus machine \(\varPi \) with k input hosts if for each \((x_{1}, \ldots , x_{k}) \in \mathbb {N}^{k}\) we have the following:

  • If \((x_{1}, \ldots , x_{k}) \in dom(f)\) and \(f(x_{1}, \ldots , x_{k}) = z\), then every computation of \(\varPi + (x_{1}, \ldots , x_{k})\) is a halting computation and the output is z.

  • If \((x_{1}, \ldots , x_{k}) \in \mathbb {N}^{k} \setminus dom(f)\), then every computation of \(\varPi + (x_{1}, \ldots , x_{k})\) is a non-halting computation.

3 Arithmetic Operation Modules

In this section, we provide different modules for the different basic arithmetic operations; that is, addition, substraction, multiplication and division (both quotient and remainder). In these types of machines, the encoding of natural numbers will be given by an unary encoding; that is, the input number \(n \in \mathbb {N}\) will be encoded by \(v^{n}\); that is, n copies of the object v. In what follows, we introduce the different modules and some of their properties.

3.1 Add Module

This module is a Virus Machines with two input hosts, where the two terms of the addition are introduced as an input. The Virus Machine

$$\varPi _{add} = (\varGamma , H, H_{r}, I, D_{H}, D_{I}, G_{C}, n_{1}, n_{2}, i_{1}, h_{out})$$

of range (2, 3, 2) where:

  1. 1.

    \(\varGamma = \{v\}\), \(H = H_{r} = \{h_{1}, h_{2}\}\), \(I = \{i_{1}, i_{2}, i_{3}\}\);

  2. 2.

    \(D_{H} = (\{h_{0}\} \cup H, E_{H}, w_{H})\), where \(E_{H} = \{(h_{1}, h_{0}), (h_{2}, h_{0})\}\) and \(w_{H}(h_{1}, h_{0}) = w_{H}(h_{2}, h_{0}) = 1\);

  3. 3.

    \(D_{I} = (I, E_{I}, w_{I})\), where \(E_{I} = \{(i_{1}, i_{1}), (i_{1}, i_{2}), (i_{2}, i_{2}), (i_{2}, i_{3})\}\) and \(w_{I}(i_{1}, i_{1}) = w_{I}(i_{2}, i_{2}) = 2, w_{I}(i_{1}, i_{2}) = w_{I}(i_{2}, i_{3}) = 1\);

  4. 4.

    \(G_{C} = (I \cup E_{H}, E_{C})\), where \(E_{C} = \{\{i_{1}, (h_{1}, h_{0})\}, \{i_{2}, (h_{2}, h_{0})\}\}\);

  5. 5.

    \(n_{i} = 0, i \in \{1, 2\}\);

  6. 6.

    \(h_{out} = h_{0}\).

A visual representation of this Virus Machine can be found in Fig. 2a. The idea is that all the viruses present in the initial configuration to the environment (i.e. the output region). Let (ab) be the input of \(\varPi \); then the following invariants hold in this machine.

Fig. 2.
figure 2

Virus Machines for addition and subtraction operations

\(\phi (k) \equiv \mathcal {C}_{k} = (k, a - k, b, i_{1})\), for \(0 \le k \le a\)

In the first k steps, a viruses go from \(h_{1}\) to the environment. Then, in configuration a no viruses are available in \(h_{1}\), therefore the next instruction is \(i_{2}\).

\(\phi '(k) \equiv \mathcal {C}_{a+1+k} = (a + k, 0, b - k, i_{2})\), for \(0 \le k \le b\)

From configuration \(\mathcal {C}_{a+1}\), instruction \(i_{2}\) is executed until no more viruses are available in the host \(h_{2}\), and thus \(i_{3}\) will be selected as the next instruction.

Finally, in configuration \(\mathcal {C}_{a+b+2}\), instruction \(i_{3}\), that is not attached to any channel, thus next instruction is \(\#\) and the computation halts. Therefore, \(\mathcal {C}_{a+b+3} = (a+b, 0, 0, \#)\).

3.2 Sub Module

The Virus Machine presented computes the reduced difference, represented with the symbol \({\mathop {-}\limits ^{\bullet }}\) operation; that is, \(a {\mathop {-}\limits ^{\bullet }}b = a - b\) if \(a \ge b\), 0 otherwise. The Virus Machine

$$\varPi _{sub} = (\varGamma , H, H_{r}, I, D_{H}, D_{I}, G_{C}, n_{1}, n_{2}, n_{3}, i_{1}, h_{out})$$

of range (3, 4, 2) where:

  1. 1.

    \(\varGamma = \{v\}\), \(H = \{h_{3}\} \cup H_{r}\), where \(H_{r} = \{h_{1}, h_{2}\}\), \(I = \{i_{1}, i_{2}, i_{3}, i_{4}\}\);

  2. 2.

    \(D_{H} = (\{h_{0}\} \cup H, E_{H}, w_{H})\), where \(E_{H} = \{(h_{1}, h_{3}),(h_{1}, h_{0}), (h_{2}, h_{3}) \}\) and \(w_{H}(h_{1}, h_{0}) = w_{H}(h_{2}, h_{0}) = 1\);

  3. 3.

    \(D_{I} = (I, E_{I}, w_{I})\), where \(E_{I} = \{(i_{1}, i_{2}), (i_{1}, i_{3}), (i_{2}, i_{1}), (i_{2}, i_{4}), (i_{3}, i_{3}), (i_{3}, i_{4})\}\) and \(w_{I}(i_{1}, i_{2}) = w_{I}(i_{2}, i_{1}) = w_{I}(i_{3}, i_{3}) = 2, w_{I}(i_{1}, i_{3}) = w_{I}(i_{2}, i_{4}) = w_{I}(i_{3}, i_{4}) = 1\);

  4. 4.

    \(G_{C} = (I \cup E_{H}, E_{C})\), where \(E_{C} = \{\{i_{1}, (h_{2}, h_{3})\}, \{i_{2}, (h_{1}, h_{3})\}, \{i_{3}, (h_{1}, h_{0})\}\}\);

  5. 5.

    \(n_{i} = 0, i \in \{1, 2, 3\}\);

  6. 6.

    \(h_{out} = h_{0}\).

A visual representation of this Virus Machine can be found in Fig. 2b. The idea is that viruses from \(h_{1}\) are “countered” by viruses from \(h_{2}\) and, if any virus remains in \(h_{1}\), then goes to the environment. Let (ab) be the input of \(\varPi \), and let mod(ab) be the modulus operator; then the following invariants hold in this machine.

\(\phi (k) \equiv \mathcal {C}_{k} = (0, a - \lfloor \frac{k}{2}\rfloor , b - \lceil \frac{k}{2}\rceil , k, i_{1+mod(k,2)})\), for \(0 \le k \le min\{2(a+1)-1, 2b)\}\).

Here, two different cases can arise. If \(a < b\), then the first \(2(a+1)-1\) steps, instructions \(i_{1}\) and \(i_{2}\) will alternate one after the other, in order to send to \(h_{3}\) (a “garbage” host) one virus each host alternaly. As \(h_{1}\) will run out of viruses before \(h_{2}\), in the configuration \(\mathcal {C}_{2(a+1)-1}\), since no more viruses are available in host \(h_{1}\), instruction \(i_{4}\) is selected as the next instruction, and configuration \(\mathcal {C}_{2(a+1)+1}\) is a halting configuration. Otherwise, if \(a \ge b\), then the first 2b steps, instructions \(i_{1}\) and \(i_{2}\) will alternate one after the other. In this case, \(h_{2}\) will run out of viruses before \(h_{1}\), thus in the configuration \(\mathcal {C}_{2b}\), instruction \(i_{3}\) will be the next instruction. Then, from that point, the following invariant holds:

\(\phi '(k) \equiv \mathcal {C}_{2b+k} = (k, a - b - k, 0, k, i_{3})\), for \(0 \le k \le a - b\)

After \(a - b\) steps, \(a - b\) viruses will be sent to the environment and, since no more viruses are available in host \(h_{1}\), next instruction is \(i_{4}\), that will lead to a halting configuration \(\mathcal {C}_{2b+a-b+2}\).

3.3 Mul Module

A Virus Machine capable of returning the multiplication of two given numbers is given below. The Virus Machine

$$\varPi _{mul} = (\varGamma , H, H_{r}, I, D_{H}, D_{I}, G_{C}, n_{1}, n_{2}, n_{3}, n_{4}, i_{1}, h_{out})$$

of range (4, 5, 2) where:

  1. 1.

    \(\varGamma = \{v\}\), \(H = \{h_{3}, h_{4}\} \cup H_{r}\), where \(H_{r} = \{h_{1}, h_{2}\}\), \(I = \{i_{1}, i_{2}, i_{3}, i_{4}, i_{5}\}\);

  2. 2.

    \(D_{H} = (\{h_{0}\} \cup H, E_{H}, w_{H})\), where \(E_{H} = \{(h_{1}, h_{3}), (h_{2}, h_{4}), (h_{3}, h_{1}), (h_{3}, h_{0})\}\) and \(w_{H}(h_{1}, h_{3}) = 2, w_{H}(h_{2}, h_{4}) = w_{H}(h_{3}, h_{1}) = w_{H}(h_{3}, h_{0}) = 1\);

  3. 3.

    \(D_{I} = (I, E_{I}, w_{I})\), where \(E_{I} = \{(i_{1}, i_{2}), (i_{1}, i_{5}), (i_{2}, i_{2}), (i_{2}, i_{3}), (i_{3}, i_{1}), (i_{3}, i_{1}), (i_{4}, i_{3})\}\) and \(w_{I}(i_{1}, i_{2}) = w_{I}(i_{2}, i_{2}) = w_{I}(i_{3}, i_{4}) = 2, w_{I}(i_{1}, i_{5}) = w_{I}(i_{2}, i_{3}) = w_{I}(i_{3}, i_{1}) = w_{I}(i_{4}, i_{3}) = 1\);

  4. 4.

    \(G_{C} = (I \cup E_{H}, E_{C})\), where

    \(E_{C} = \{\{i_{1}, (h_{2}, h_{4})\}, \{i_{2}, (h_{1}, h_{3})\}, \{i_{3}, (h_{3}, h_{1})\}, \{i_{4}, (h_{3}, h_{0})\}\}\);

  5. 5.

    \(n_{i} = 0, i \in \{1, 2, 3, 4\}\);

  6. 6.

    \(h_{out} = h_{0}\).

We can see the idea of this Virus Machine in Fig. 3. Let (ab) the the input of \(\varPi \). The following invariant holds:

\(\phi (k) \equiv \mathcal {C}_{k(3a+3)} = (a \cdot k, a, b-k, 0, k, i_{1})\), for \(0 \le k \le b\)

From the first configuration, viruses from \(h_{2}\) will be sent to host \(h_{4}\) (a “garbage” host) in order to “count” the number of times that viruses from \(h_{1}\) must be sent to the environment. Then, instruction \(i_{2}\) will send two times the number of viruses in \(h_{1}\) to \(h_{3}\) in a steps. When it finishes, it goes to instruction \(i_{3}\), that will be executed alternately with \(i_{4}\) until no viruses remain in \(h_{3}\). This will happen in \(2a+1\) steps. When this happens, the next instruction selected is, again, \(i_{1}\). This process will go on until no viruses remain in \(h_{2}\), where instruction \(i_{5}\) is selected and leads to a halting configuration in the next step, in configuration \(\mathcal {C}_{b(3a+3)+2}\).

Fig. 3.
figure 3

Virus Machine \(\varPi _{mul} + (a, b)\)

3.4 Quotient Module

The division operation can be seen as a function \(f: \mathbb {N}^{2} \rightarrow \mathbb {N}^{2}\), such that \(f(D, d) = (q, r)\), fulfilling the following requirement: \(D = d \cdot q + r\). q is said to be the quotient of the division, while r is the remainder. The device returning the quotient is the Virus Machine

$$\varPi _{quo} = (\varGamma , H, H_{r}, I, D_{H}, D_{I}, G_{C}, n_{1}, n_{2}, n_{3}, n_{4}, i_{1}, h_{out})$$

of range (4, 5, 2) where:

  1. 1.

    \(\varGamma = \{v\}\), \(H = \{h_{3}, h_{4}\} \cup H_{r}\), where \(H_{r} = \{h_{1}, h_{2}\}\), \(I = \{i_{1}, i_{2}, i_{3}, i_{4}, i_{5}\}\);

  2. 2.

    \(D_{H} = (\{h_{0}\} \cup H, E_{H}, w_{H})\), where

    \(E_{H} = \{(h_{1}, h_{3}), (h_{2}, h_{4}), (h_{3}, h_{0}), (h_{4}, h_{2})\}\) and \(w_{H}(h_{2}, h_{4}) = w_{H}(h_{1}, h_{3}) = w_{H}(h_{3}, h_{0}) = w_{H}(h_{4}, h_{2}) = 1\);

  3. 3.

    \(D_{I} = (I, E_{I}, w_{I})\), where \(E_{I} = \{(i_{1}, i_{2}), (i_{1}, i_{3}), (i_{2}, i_{1}), (i_{2}, i_{5}), (i_{3}, i_{4}), (i_{4}, i_{1}), (i_{4}, i_{4})\}\) and \(w_{I}(i_{1}, i_{2}) = w_{I}(i_{2}, i_{1}) = w_{I}(i_{4}, i_{4}) = 2, w_{I}(i_{1}, i_{3}) = w_{I}(i_{2}, i_{5}) = w_{I}(i_{3}, i_{4}) = w_{I}(i_{4}, i_{1}) = 1\);

  4. 4.

    \(G_{C} = (I \cup E_{H}, E_{C})\), where

    \(E_{C} = \{\{i_{1}, (h_{2}, h_{4})\}, \{i_{2}, (h_{1}, h_{3})\}, \{i_{3}, (h_{1}, h_{0})\}, \{i_{4}, (h_{4}, h_{2})\}\}\);

  5. 5.

    \(n_{i} = 0, i \in \{1, 2, 3, 4\}\);

  6. 6.

    \(h_{out} = h_{0}\)

This Virus Machine can be depicted as in Fig. 4a

Fig. 4.
figure 4

Virus machines for the quotient and remainder of division operations

By definition, we will say that \(a / 0 = 0, a \in \mathbb {N}\). Let (ab) be the input of \(\varPi \). Then the following invariant holds:

\(\phi (k) \equiv C_{k(3b+3)} = (k, a - b \cdot k, b, b \cdot k - k, 0, i_{1})\), for \(0 \le k \le \lfloor \frac{a}{b}\rfloor \)

From the first configuration, instructions \(i_{1}\) and \(i_{2}\) will alternately be executed until \(h_{1}\) or \(h_{2}\) go out of viruses. If \(h_{2}\) goes out of viruses first, then it means that we can add 1 to the temporary quotient (i.e. the number of viruses in the environment). If this is the case, from \(i_{1}\), the instruction \(i_{3}\) is selected, and one virus is sent from \(h_{3}\) to the environment (taking into account that viruses in \(h_{3}\) are not useful in any other sense, therefore we use them as “counters”). When \(h_{1}\) runs out of viruses, and instruction \(i_{2}\) is executed, the instruction selected is \(i_{5}\), leading to a halting configuration in \(\mathcal {C}_{\lfloor a/b \rfloor \cdot (3b+3) + 2}\). Let us recall that in this case we say that, by definition, \(a / 0 = 0, a \in \mathbb {N}\).

3.5 Remainder Module

While in the previous subsection, the Virus Machine answering the quotient of the division of two given numbers was given, below is presented one returning the remainder of such operation. The Virus Machine

$$\varPi _{rem} = (\varGamma , H, H_{r}, I, D_{H}, D_{I}, G_{C}, n_{1}, n_{2}, n_{3}, n_{4}, n_{5}, i_{1}, h_{out})$$

of range (5, 6, 2) where:

  1. 1.

    \(\varGamma = \{v\}\), \(H = \{h_{3}, h_{4}, h_{5}\} \cup H_{r}\), where \(H_{r} = \{h_{1}, h_{2}\}\), \(I = \{i_{1}, i_{2}, i_{3}, i_{4}, i_{5}, i_{6}\}\);

  2. 2.

    \(D_{H} = (\{h_{0}\} \cup H, E_{H}, w_{H})\), where

    \(E_{H} = \{(h_{1}, h_{3}),(h_{2}, h_{4}), (h_{3}, h_{5}), (h_{3}, h_{0}), (h_{4}, h_{2})\}\) and \(w_{H}(h_{1}, h_{3}) = w_{H}(h_{2}, h_{4}) = w_{H}(i_{3}, i_{5}) = w_{H}(h_{3}, h_{0}) = w_{H}(h_{4}, h_{2}) = 1\);

  3. 3.

    \(D_{I} = (I, E_{I}, w_{I})\), where

    \(E_{I} = \{(i_{1}, i_{2}), (i_{1}, i_{3}), (i_{2}, i_{1}), (i_{2}, i_{5}), (i_{3}, i_{3}), (i_{3}, i_{4}), (i_{4}, i_{1}), (i_{4}, i_{4}), (i_{5}, i_{5}), (i_{5}, i_{6})\}\) and \(w_{I}(i_{1}, i_{2}) = w_{I}(i_{2}, i_{1}) = w_{I}(i_{3}, i_{3}) = w_{I}(i_{4}, i_{4}) = w_{I}(i_{5}, i_{5}) = 2, w_{I}(i_{1}, i_{3}) = w_{I}(i_{2}, i_{5}) = w_{I}(i_{3}, i_{4}) = w_{I}(i_{4}, i_{1}) = w_{I}(i_{5}, i_{6}) = 1\);

  4. 4.

    \(G_{C} = (I \cup E_{H}, E_{C})\), where

    \(E_{C} = \{\{i_{1}, (h_{2}, h_{4})\}, \{i_{2}, (h_{1}, h_{3})\}, \{i_{3}, (h_{4}, h_{2})\}, \{i_{4}, (h_{3}, h_{5})\}, \{i_{5}, (h_{3}, h_{0})\}\}\);

  5. 5.

    \(n_{i} = 0, i \in \{1, 2, 3, 4, 5\}\);

  6. 6.

    \(h_{out} = h_{0}\)

This Virus Machine is represented visually in Fig. 4b.

In order to fulfil the basics of the division, that is, \(D = d \cdot q + r\), we say that the remainder of the division \(a / 0, a \in \mathbb {N}\) is equal to a. Let (ab) be the input of \(\varPi \). Then the following invariant holds:

\(\phi (k) \equiv \mathcal {C}_{k(4b+3)} = (0, a - b \cdot k, b, 0, 0, b \cdot k, i_{1})\), for \(0 \le k \le \lfloor \frac{a}{b}\rfloor \)

The idea is similar to the quotient module. First, we alternate between instructions \(i_{1}\) and \(i_{2}\), until one of them run out of viruses. On the one hand, if \(h_{2}\) runs out of viruses first, then it means that b can be subtracted once again from a. When this happens, instruction \(i_{5}\) is selected, that takes back all the viruses from \(h_{4}\) to \(h_{2}\), when this process finishes, all the viruses from \(h_{3}\) are sent to the host \(h_{5}\), that is a “garbage” collector, and it goes back to instruction \(i_{1}\). This happens each \(4b+3\) steps. On the other hand, if \(h_{1}\) runs out of viruses first, the finalization protocol starts, first by activating the instruction \(i_{5}\), that sends all of the viruses from \(h_{3}\) to the environment. This whole process leads to a halting configuration \(\mathcal {C}_{\lfloor a/b \rfloor \cdot (4b+3) + remainder(a,b) + 3}\).

4 Conclusions and Future Work

The idea of this work is to establish some ideas for later applications in the framework of information fusion. In [3], the four basic arithmetical operators are used to give an explicit basic probability assignment (BPA) calculator by means of Spiking Neural P systems. Since the encoding is totally different in this framework, some changes must be introduced in order to obtain such kind of calculator.

Apart from that, and since the framework is in a very early stage, several research lines are open, as well as some ideas for extension of the model, in a similar way to extensions in the framework of Membrane Computing.