# Spiking Neural P Systems for Basic Arithmetic Operations
## 3 Arithmetic Operation in Spiking Neural P Systems
### Binary Division in SNP Systems
\(\sigma_{\textit{ctrl}1}\) sends one spike to \(\sigma_{\textit{diss}2}\) and \(\sigma_{\textit{dind}1}\) and \(\sigma_{\textit{ctrl}2}\), respectively. (ii) \(t=2k+5\), the difference operation between \(\textit{sp-x}_{0}\) and \(\textit{sp-y}_{0}\) is being performed in \(\sigma_{\textit{dind}1}\), and the operation result is kept in \(\sigma_{\textit{dind}1}\). If a borrow occurs, four spikes will be sent to \(\sigma_{\textit{dind}2}\) to participate in the calculation of \(\textit{sp-x}_{1}\) and \(\textit{sp-y}_{1}\) at the next time slice.\(\sigma_{\textit{diss}2}\) receives four spikes from \(\sigma_{\textit{diss}1}\) and one spike from \(\sigma_{\textit{ctrl}1}\), and prepares to send \(\textit{sp-y}_{1}\) to \(\sigma_{\textit{diss}2}\). \(\sigma_{\textit{ctrl}2}\) sends one spike to \(\sigma_{\textit{diss}3}\) and \(\sigma_{\textit{dind}2}\) and \(\sigma_{\textit{ctrl}3}\), respectively. (iii) \(t=2k+6\), the difference operation between \(\textit{sp-x}_{1}\) and \(\textit{sp-y}_{1}\) is being performed in \(\sigma_{\textit{dind}2}\), and the operation result is kept in \(\sigma_{\textit{dind}2}\). If a borrow occurs, four spikes will be sent to \(\sigma_{\textit{dind}3}\) to participate in the calculation of \(\textit{sp-x}_{2}\) and \(\textit{sp-y}_{2}\) at the next time slice. (iv) Similarly, it is not difficult to verify that \(t=3k+4\), the difference operation of \(\textit{sp-x}_{k-1}\) and \(\textit{sp-y}_{k-1}\) is going on in \(\sigma_{\textit{dindk}}\). So far, the first subtraction operation is completed. If \(\sigma_{\textit{dindk}}\) does not send 4 spikes to \(\sigma_{\textit{aux}12}\) (X \(\geq\) Y), \(\sigma_{\textit{aux}11}\) will send one spike to \(\sigma_{\textit{aux}12}\), and \(\sigma_{\textit{aux}12}\) will send this spike to \(\sigma_{\textit{ans}1}\) at the next time slice. (v) Because the neurons of \(\sigma_{\textit{dind}}\)(\(1\leq i\leq k\)) work in parallel, when \(t=3k+5\), the second subtraction operation is completed. If \(\sigma_{\textit{dindk}}\) does not send four spikes to \(\sigma_{\textit{aux}12}\) (X \(\geq\) Y), \(\sigma_{\textit{aux}11}\) will send one spike to \(\sigma_{\textit{aux}12}\), and \(\sigma_{\textit{aux}12}\) will send this spike to \(\sigma_{\textit{ans}1}\) at the next time slice. (vi) The system will keep running until \(\sigma_{\textit{dindk}}\) sends four spikes to \(\sigma_{\textit{aux}12}\), indicating that the current dividend is smaller than the divisor. (vi)Through the above description, it is not difficult to see that the number of subtractions performed by this system will be sent to the neuron \(\sigma_{ans1}\) successively over time, and the rule in the neuron \(\sigma_{ansi}\) (\(1\leq i\leq k\)) is \(a^{2}{\rightarrow}a\), which means every 2 enters 1; then, when the system reaches the termination pattern, the result of X quotient Y is stored in the neurons \(\sigma_{ans1}\), \(\sigma_{ans2}\), \(\ldots\), \(\sigma_{ansk}\) in binary form from low to high. Based on the above description, readers can verify that for k \(\geq\) 2 the SNP divider constructed above can correctly solve the quotient of two natural numbers with binary length k, and the proof is completed. \(\square\)  
Figure 13 shows the structure of a \(\mathbf{\Pi_{BDSNP}}\) for three-digit binary division. Based on this \(\mathbf{\Pi_{BDSNP}}\), the division process of natural numbers 6 and 2 is listed in Table 4 which shows the number of spikes contained in each neuron in \(\mathbf{\Pi_{BDSNP(6,2)}}\). These two natural numbers are expressed in binary form: \(110_{2}\), \(010_{2}\), \(110_{2}\) \(\div\)\(010_{2}\) = \(011_{2}\). In Figure 13, the dividend and the divisor are input through the neuron Input, and both the dividend and the divisor are input to the cache neuron through the input auxiliary neuron group Tuple (\(s_{1}\), \(s_{2}\), \(s_{3}\)).