# 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 \(n\)-addition  
\(\Pi_{Add2}\) can only add two binary numbers, which has limitations in practical applications. In practical applications, it is more necessary to complete n-addition. Therefore, this section has made improvements to \(\Pi_{Add2}\), and the structure of the improved LHSNPsystem \(\Pi_{Add3}\) with one input neuron is shown in Figure 2. In Figure 2, the solid arrows represents the directed connection between two neurons. The dashed arrows indicates the omission of connections between multiple neurons. Due to the similarity between \(\Pi_{Add3}\) and \(\Pi_{Add2}\), the formal definition of \(\Pi_{Add3}\) has been omitted. The design thought of \(\Pi_{Add3}\) is as follows: 1 The system input part is divided into two modules, namely the input module and the input cache module. The input module is composed of an input selection module and an input assistance module. The input module controls the input of the summand and addend: the summand (the first addend) is transmitted through the auxiliary neuron \(\sigma_{aux3}\), while the addend is transmitted through the addend neuron \(\sigma_{addend}\). After the input of the summand is completed, with the assistance of the input auxiliary module, the addend is stopped through \(\sigma_{aux3}\) transmitted. And \(\sigma_{addend}\) is firing to translate addend. 2 High-level monitoring neuron \(\sigma_{aux4}\) monitors the highest bit of two binary addends. When the highest bit of two binary addends are reached the addition operation neuron \(\sigma_{Add}\). \(\sigma_{aux4}\) sends 4 spiking to \(\sigma_{Add}\) to mark the highest bit. 3 Two addends complete the addition calculation in \(\sigma_{Add}\) and send the operation results to the environment and the summand cache module. The spiking waiting stored in the summand cache module completes the addition calculation with the next addend in \(\sigma_{Add}\), thereby achieving accumulate plus. 4 Overflow monitoring neuron \(\sigma_{OF}\) monitors whether the calculation overflow. If the calculation result overflow, \(\sigma_{OF}\) sends spiking to the environment and some neurons in \(\Pi_{Add3}\), the aim is terminal the operation of \(\Pi_{Add3}\). 5 Spiking control neuron \(\sigma_{aux3}\) controls \(\sigma_{aux1,0}\) and \(\sigma_{aux1,1}\) to stop generating spiking output. The rules of \(\Pi_{Add3}\) are divided into six groups: (1) Homogeneous neurons: auxiliary neurons, summand cache neurons, \(\sigma_{aux3}\), and input neurons use rule set \(R=\{a\to a\}\). (2) High-level monitoring neuron \(\sigma_{aux4}\) uses rule set \(R_{aux4}=\{a^{k}\to a^{4}\}\). (3) Spiking control neuron \(\sigma_{aux5}\) uses rule set \(R_{aux5}=\{a^{(n-1)k}\to a\}\). (4) Addened neuron \(\sigma_{addend}\) uses rule set \(R_{addend}=\{a\to crlambda;a^{2}\to crlambda;a^{3}\to a\}\). (5) Addition operator neuron \(\sigma_{Add}\) uses rule set \(R_{Add}=\{a\to a;a^{2}/a\to crlambda;a^{3}/a^{2}\to a;a^{4}\to crlambda;a^{5} \to a;a^{6}\to a^{4};a^{7}\to a^{4}\}\). (6) Overflow monitoring neuron \(\sigma_{OF}\) uses rule set \(R_{OF}=\{a\to crlambda;a^{4}\to a^{4}\}\). Figure 2: The LHSNP system \(\Pi_{Add3}\) with 1 input neuron for \(n\)\(k\)-bit binary numbers addition. Analyzing Figure 2, it can be seen that \(\Pi_{Add3}\) contains \(13\) rules, \(2k+11\) neurons, and completing \(n\)-addition operations requires \(nk+3\) time slices. Furthermore, we have the following conclusion:  
Theorem 2: \(\Pi_{Add3}\) _can perform any \(n\) k-bit binary number addition operations with 1 input neuron. That is, \(\Pi_{Add3}\) receives spiking corresponding to binary numbers in order from low to high. And it can correctly complete the addition operation and output result to the environment in order from low to high._  
Proof of Theorem 2: Let \(t\) stand the time slice. At the initial state \(t=0\), there is \(1\) spiking in \(\sigma_{aux_{1,0}}\) and \(\sigma_{aux_{1,1}}\).