# Performing Arithmetic Operations with Locally Homogeneous Spiking Neural P Systems
## 3 An Locally Homogeneous Spiking Neural P System for Addition
### An LHSNP System with 1 Input Neuron for 2 Numbers Addition  
An LHSNP system \(\Pi_{Add2}\) with one input neuron as Formula (4). The structure of \(\Pi_{Add2}\) is shown in Figure 1. In Figure 1, the solid arrows represents the directed connection between two neurons. The dashed arrows indicates the omission of connections between multiple neurons. \(\Pi_{Add2}\) design idea is as follows: 1 Input part of the system is divided into two modules, which are the input module and the input cache module. The input module is composed of an input assist module and an input selection module. The input module controls the input of the summand and addend. It controls the summand through the auxiliary neuron \(\sigma_{aux_{3}}\) transmitted, and the addend through the additive neuron \(\sigma_{addend}\) transmitted. When the summand input is completed and the addend input begins, with the assistance of the input auxiliary module, blocking addend pass through \(\sigma_{aux_{4}}\), and firing addend auxiliary neuron \(\sigma_{\text{addend}}\) to transmit addend numbers. 2 Auxiliary neuron \(\sigma_{aux_{4}}\) monitors the input of the highest bit of two binary numbers. When the highest bit of these two binary numbers arrived in the addition neuron \(\sigma_{Add}\). Auxiliary neurons \(\sigma_{aux_{4}}\) mark the highest bit corresponding spiking. 3 Summand and addend are calculated in the adder \(\sigma_{Add}\) and the calculation result is sent to the environment. 4 Overflow monitoring neuron \(\sigma_{OF}\) monitors the calculation results whether overflow. The rules of \(\Pi_{Add2}\) are divided into four groups: (1) Homogeneous neurons: auxiliary neurons, summand catch neurons, and input neurons use rule set \(R_{aux_{4}}=[a\to a]\). (2) Overflow monitoring neurons \(\sigma_{aux_{4}}\) uses rule set \(R_{aux_{4}}=[a\to clambda;a^{2}\to clambda;a^{3}\to a]\). (3) Addend uses rule set \(R_{addend}=[a\to clambda;a^{2}\to clambda;a^{3}/a^{2}\to a]\). (4) Adder neuron \(\sigma_{Add}\) uses ruleset \(R_{Add}=[a\to a;a^{2}/a\to clambda;a^{3}/a^{2}\to a;a^{5}\to a^{4}]\). The formal definition of \(\Pi_{Add2}\) is as Formula (4):  
\[\  
where: \begin{tabular}{l l} (1) & \(O=[a]\); \\ (2) & \(\sigma_{in}=(0,R_{aux})\); \\ (3) & \(\sigma_{addend}=(0,R_{addend})\); \\ (4) & \(\sigma_{aux_{1,b}}=(1,R_{aux})\), \(i=0,1\); \\ (5) & \(\sigma_{aux_{1,b}}=(0,R_{aux})\), \(i=2,\ldots,k+1\); \\ (6) & \(\sigma_{aux_{2,b}}=(0,R_{aux})\), \(i=0,1\); \\ (7) & \(\sigma_{aux_{3}}=(0,R_{aux})\); \\ (8) & \(\sigma_{aux_{4}}=(0,R_{auxA})\); \\ (9) & \(\sigma_{sum_{i}}=(0,R_{sum})\), \(i=0,\ldots,k-1\); \\ (10) & \(\sigma_{Add}=(0,R_{Add})\); \\ (11) & \(syn=\{(in,aux_{3}),(in,addend),(added,Add),(aux_{1,b},aux_{1,b})\), \((aux_{1,b+1},aux_{2,0})\), \((aux_{1,b+1},\)\(aux_{2,1})\), \((aux_{2,0},aux_{3})\), \((aux_{2,1},\)\(aux_{3})\), \((aux_{2,0},\)\(addend)\), \((aux_{2,1},\)\(addend)\), \((aux_{2,0},\)\(aux_{1,0})\), \((aux_{2,0},\)\(aux_{1,0})\), \((aux_{2,0},\)\(aux_{1,1})\), \((aux_{2,1},\)\(aux_{4})\), \((aux_{4},\)\(Add)\), \((aux_{3},\)\(sum_{k-1})\), \((sum_{0},\)\(Add)|\cup\{aux_{1,i},aux_{1,i+1}\}\,|\,i\in\{0,1,\ldots,k\}\cup\{sum_{i+1},sum_{i}\}\,|\,i\in\{0, 1,\ldots,k-2\}\); \\ (12) & \(in=\)\(\emph{Input}\); \\ (13) & \(out=\)\(\emph{Add}\). \\ \end{tabular}  Analysis of \(\Pi_{Add2}\) and its rule set shows that \(\Pi_{Add2}\) contains \(8\) rules and \(2k+9\) neurons. Performing the addition operation of \(2\)\(k\)-bit binary numbers requires \(2k+3\) time slices. Furthermore, we have the following conclusions:  
**Theorem 1**. : \(\Pi_{Add2}\) _with \(1\) input neuron can perform any \(2\)\(k\)-bit binary number addition. In other words, \(\Pi_{Add2}\) after receiving the spiking corresponding to each binary number bit in order from low to high, \(\Pi_{Add2}\) can correctly perform addition and output the results to the environment._  
Proof of Theorem 1.: Let \(t\) represent time slice. At the initial state \(t=0\), there is one spiking in \(\sigma_{aux_{1,0}}\) and \(\sigma_{aux_{1,1}}\).