# Performing Arithmetic Operations with Locally Homogeneous Spiking Neural P Systems
## 4 An Locally Homogeneous Spiking Neural P System for Subtraction
### An LHSNP System with 1 Input Neuron for n-Subtraction
At \(t=21\) time slice, \(\sigma_{aux_{1,0}}\), \(\sigma_{aux_{1,1}}\), \(\sigma_{aux_{1,2}}\), \(\sigma_{aux_{1,3}}\), \(\ldots\), \(\sigma_{aux_{1,8}}\) simultaneously receives 4 spikings sent by \(\sigma_{OF}\), truncating the transmission of spiking in the input auxiliary module. 4. \(\check{\text{minuend Input}}\) The corresponding spiking of the minuend bit is received by \(\sigma_{in}\) and transmitted along \(\sigma_{aux_{4}}\), \(\sigma_{my}\), \(\sigma_{m_{6}}\), \(\ldots\), \(\sigma_{m_{0}}\) to the \(\sigma_{sub}\). The transmission process of the minuend is as follows: 1. \(t=1\) to 8, the corresponding spiking of the minuend bit is received by \(\sigma_{in}\), and these spikings are transmitted along \(\sigma_{aux_{4}}\), \(\sigma_{my}\), \(\sigma_{m_{6}}\), \(\ldots\), \(\sigma_{m_{0}}\). 2. \(t=2\) to 9, \(\sigma_{in}\) simultaneously sends spiking to \(\sigma_{aux_{4}}\) and \(\sigma_{s}\). After receiving the spiking, \(\sigma_{aux_{4}}\) passes the spiking to the minuend cache module. After receiving spiking, \(\sigma_{s}\) does not generate spiking output, and these spiking are consumed by the forgetting rule \(a\to crlambda\) in \(\sigma_{s}\). 3. \(t=10\) to 17, the corresponding spiking of the first minuend bit is sequentially received by \(\sigma_{m_{0}}\). And at each time slice, \(\sigma_{m_{0}}\) also receives 1 spiking sent by \(\sigma_{aux_{2,0}}\) and \(\sigma_{aux_{2,1}}\). In \(\sigma_{m_{0}}\), the spiking corresponding to the minuend binary number 0 is changed to 2 through the rule \(a^{2}\to a^{2}\), in order to distinguish it from the spiking corresponding to the subtraend binary number 0. 4. \(t=11\) to 18, the spikings 1, 2, 1, 1, 2, 2, 2 corresponding to the first minuend bit are sequentially received by \(\sigma_{Sub}\). A total of 1 spiking represents the minuend number \(1_{2}\), and 2 spikings represent the minuend number \(0_{2}\). 5. From \(t=12\) to the system stops, \(\sigma_{m_{6}}\) receives spikings (i.e., calculation results) sent by \(\sigma_{Sub}\) at each time slice. And these spikings are transmitted along \(\sigma_{my}\), \(\sigma_{m_{4}}\), \(\ldots\), \(\sigma_{m_{0}}\) to \(\sigma_{Sub}\) achieve accumulate plus with the next subtrahend. At \(t=20\) time slice, \(\sigma_{m_{6}}\) receives 4 spikings sent by \(\sigma_{Sub}\), and \(\sigma_{m_{6}}\) no longer generates spiking output in the following time. At \(t=21\) time slice, \(\sigma_{m_{5}}\), \(\sigma_{m_{4}}\), \(\ldots\), \(\sigma_{m_{0}}\) simultaneously receives 4 spikings sent by \(\sigma_{OF}\). These spikings truncate the transmission of spiking in the minuend module. And \(\sigma_{m_{6}}\) receives 1 spiking sent by \(\sigma_{Sub}\). 6. \(\check{\text{1}}\) Subtrahend Input The spiking corresponding to the subtrahend bit is received by \(\sigma_{in}\) and transmitted along \(\sigma_{s}\) to \(\sigma_{Sub}\). The transmission process of the subtrahend is as follows: 1. \(t=1\) to 8, \(\sigma_{s}\) does not generate spiking output. And the spiking \(\sigma_{s}\) received at each time slice has been consumed by the forgetting rule \(a\to crlambda\). 2. \(t=9\) to 16, the corresponding spiking 1, 1, 1, 1, 0, 0, 0, 0 of the first subtrahend bit are sequentially received by \(\sigma_{in}\). These spikings are transmitted along \(\sigma_{s}\) to the \(\sigma_{in}\). 3. \(t=10\) to 17, \(\sigma_{s}\) receives the spiking corresponding to the first subtrahend bit sent by \(\sigma_{in}\). At the same time, \(\sigma_{s}\) receives 1 spiking sent by \(\sigma_{aux_{2,0}}\) and \(\sigma_{aux_{2,1}}\) at each time slice. \(\sigma_{s}\) uses rule \(a^{2}\to crlambda\) or \(a^{3}\to a\) to consume spikings and send spikings to \(\sigma_{Sub}\). From \(t=10\) to system stop, \(\sigma_{aux_{4}}\) receives spiking from \(\sigma_{in}\), \(\sigma_{aux_{2,0}}\), and \(\sigma_{aux_{2,1}}\) at each time slice, these spikings are stacked in \(\sigma_{aux_{4}}\). \(t=13\) to 20, the spiking corresponding to each of the first subtrahend bits, 1, 1, 1, 1, 0, 0, 0, 0 are sequentially received by \(\sigma_{Sub}\).