# 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 2 Number Subtraction
Input the spiking in \(\sigma_{aux_{1,3}}\), \(\ldots\), \(\sigma_{aux_{1,k+1}}\), \(\sigma_{aux_{2,0}}\) and \(\sigma_{aux_{2,1}}\) of the auxiliary module in each time slice and clear them sequentially. At \(t=2k+1\) time slice, \(\sigma_{aux_{2,0}}\) and \(\sigma_{aux_{2,1}}\) stops generating spiking output. 4. \(t=2k+2\), in the input auxiliary module, \(\sigma_{aux_{2,2}}\) send 1 spiking to \(\sigma_{aux_{3}}\). And the spiking in \(\sigma_{aux_{2,2}}\) is cleared. At this time, 8 spikings are accumulated in \(\sigma_{aux_{3}}\), and the input auxiliary module stops generating spiking inputs. 5. \(t=2k+3\), there are no rules can be firing in the input auxiliary module. 6. \(t=2k+2\), in the input auxiliary module, \(\sigma_{aux_{2,2}}\) send 1 spiking to \(\sigma_{aux_{3}}\). And the spiking in \(\sigma_{aux_{2,2}}\) is cleared. At this time, 8 spikings are accumulated in \(\sigma_{aux_{3}}\), and the input auxiliary module stops generating spiking inputs. 7. \(t=2k+3\), there are no rules can be firing in the input auxiliary module. 8. \(t=2k+3\), there are no rules can be firing in the input auxiliary module. 9. \(t=2k+2\), in the input auxiliary module, \(\sigma_{aux_{3}}\) send 1 spiking to \(\sigma_{aux_{3}}\). And the spiking in \(\sigma_{aux_{3}}\) is cleared. At this time, 8 spikings are accumulated in \(\sigma_{aux_{3}}\), and the input auxiliary module stops generating spiking inputs. 10. \(t=2k+3\), there are no rules can be firing in the input auxiliary module. 11. \(t=2k+2\), in the input auxiliary module, \(\sigma_{aux_{3}}\) send 1 spiking to \(\sigma_{aux_{3}}\). And the spiking in \(\sigma_{aux_{Subtriehend Input The bits of the subtrahend sent by \(\sigma_{in}\) are passed to \(\sigma_{Sub}\) through \(\sigma_{s}\) to participate in the subtraction operation. At \(t=k+1\) to \(2k\) time slice, all subtrahend bits are received by \(\sigma_{in}\). At \(t=k+3\) to \(2k+2\) time slice, \(\sigma_{s}\) sends the subtrahend bits to \(\sigma_{Sub}\) at each time slice. The input process for subtrahend is as follows: (1) \(t=1\) to \(k+1\), \(\sigma_{s}\) does not generate spiking output. (2) \(t=k+1\) to \(2k\), the corresponding spiking of the subtrahend is received by \(\sigma_{in}\) in order from low to high. At \(t=2k\) time slice, the subtrahend input is completed. At each time slice, these spikings are sequentially transmitted along \(\sigma_{s}\) to \(\sigma_{Sub}\). (3) \(t=k+2\) to \(2k+1\), \(\sigma_{s}\) receives spiking sent by \(\sigma_{in}\) and 1 spiking sent by \(\sigma_{aux_{2,0}}\), \(\sigma_{aux_{2,1}}\) at each time slice. (4) \(t=k+3\) to \(2k+2\), the spiking corresponding to the subtrahend is received by \(\sigma_{Sub}\) in order from low to high. At \(t=2k+2\) time slice, there is no spiking in \(\sigma_{s}\). (4) Subtraction Operation (1) \(t=1\) to \(k+2\), \(\sigma_{Sub}\) has no spiking input. (2) \(t=k+3\) to \(2k+2\), the spiking corresponding to the minuend and subtrahend bits received by \(\sigma_{Sub}\) in order from low to high. (3) \(t=k+4\) to \(2k+3\), \(\sigma_{Sub}\) will send the settlement results to the environment in order from low to high. At \(t=2k+2\) time slice, the highest order of the two subtractions is calculated in \(\sigma_{Sub}\). At \(t=2k+3\) time slice, \(\sigma_{Sub}\) receives 5 spiking sent by \(\sigma_{aux_{2}}\). If a carry is generated at \(2k+2\) time slice, then there are 6 spikings in \(\sigma_{Sub}\). In the \(2k+4\) time slice, the environment will receive 4 spikings sent by \(\sigma_{Sub}\) after using rule \(a^{6}\to a^{4}\), indicating data overflow. If there is no carry generation at \(2k+2\) time slice, then there are 5 spiking in \(\sigma_{Sub}\) without using any rules. In summary, the LHSNP system composed of \(\Pi_{Sub2}\) can correctly calculate the difference between two \(k\)-bit binary numbers. \(\square\)  
To illustrate the operation process of \(\Pi_{Sub2}\), the difference between 13 and 7 is calculated.