# Spiking Neural P Systems for Basic Arithmetic Operations
## 3 Arithmetic Operation in Spiking Neural P Systems
### Binary Multiplication in SNP Systems
* \(\sigma_{aux6}\) receives the \(sp\)-\(y_{1}\) sent by \(\sigma_{Input}\) and applies the corresponding rules in \(\sigma_{aux6}\) to send \(sp\)-\(y_{0}\) to \(\sigma_{mut1}\). * \(\sigma_{mut1}\) receives \(sp\)-\(y_{0}\) sent by \(\sigma_{aux6}\). * There is no spike in \(\sigma_{candj}\) (\(1\leq i\leq k\)), \(\sigma_{mutj}\) (\(2\leq j\leq k\)). * \(sp\)-\(x_{i-1}\) is received in \(\sigma_{bitj}\) (\(1\leq i\leq k\)). * From t = k + 4 to 3k + 5, the rule execution of \(\Pi_{\mathbf{BMSNP}}\) and the change of spikes in each neuron include:
* \(\sigma_{mut1}\) accepts \(sp\)-\(y_{0}\) to \(\sigma_{mut1}\). * \(\sigma_{mut1}\) receives \(sp\)-\(y_{0}\) to \(\sigma_{mut1}\). * \(\sigma_{mut1}\) receives \(sp\)-\(y_{0}\) sent by \(\sigma_{aux6}\). * There is no spike in \(\sigma_{candj}\) (\(1\leq i\
\(\sigma_{Input}\) sequentially accepts \(sp\)-\(y_{j}\) (\(3\leq j\leq k-1\)) and simultaneously use the rules to send \(sp\)-\(y_{j-1}\) to \(\sigma_{aux5}\) and \(\sigma_{aux6}\). 2. When the number of spikes in \(\sigma_{aux5}\) is 3, the rule \(a^{3}/a\)\(\rightarrow\)\(\lambda\) is activated and consumes one spike, so there will always be two spikes in \(\sigma_{aux5}\) and no spikes will be sent. 3. There is no spike in \(\sigma_{candi}\) (\(1\leq i\leq k\)). 4. \(\sigma_{aux6}\) sends \(sp\)-\(y_{j}\) (\(1\leq j\leq k-1\)) to \(\sigma_{mut1}\) sequentially. 5. \(\sigma_{mut1}\) (\(1\leq i\leq k\)) sends \(sp\)-\(y_{i+i}\)(\(k+5\)) to \(\sigma_{mut1}\)+1 and \(\sigma_{bit1}\) respectively. Where t is the current moment of \(\mathbf{\Pi_{BMSNP}}\). If t + \(i-(k+5)<0\), it means that there is no spike in \(\sigma_{muti}\), and no spike will be sent to \(\sigma_{muti+1}\) and \(\sigma_{biti}\). 6. t = k + 4, \(\sigma_{bit1}\) receives the \(sp\)-\(y_{0}\) sent by \(\sigma_{mut1}\), and performs the product operation of \(sp\)-\(y_{0}\) and \(sp\)-\(x_{0}\) in \(\sigma_{bit1}\), and sends the operation result to \(\sigma_{Add}\) at the next time slice. Note that after the operation in \(\sigma_{bit1}\), \(sp\)-\(x_{0}\) is still stored in the neuron. 7. t = k + 5, \(\sigma_{bit1}\) receives the \(sp\)-\(y_{1}\) sent by \(\sigma_{mut1}\), performs the product operation of \(sp\)-\(y_{1}\) and \(sp\)-\(x_{0}\) in \(\sigma_{bit1}\), and sends the operation result to \(\sigma_{Add}\) at the next time slice. 8. \(\sigma_{Add}\) receives the product operation result of \(sp\)-\(y_{0}\) and \(sp\)-\(x_{0}\), namely \(z_{0}\), and sends \(z_{0}\) to the environment at the next time slice. 9. t = k + 6, \(z_{0}\) is received in the environment. \(\sigma_{Add}\) is summing the following operation results: \(sp\)-\(y_{0}\)\(\times\)\(sp\)-\(x_{1}\), \(sp\)-\(y_{1}\)\(\times\)\(sp\)-\(x_{0}\), the summation result is \(z_{1}\), and the carry is kept in \(\sigma_{Add}\). The ongoing multiplication operation of \(\mathbf{\Pi_{BMSNP}}\): \(sp\)-\(y_{0}\)\(\times\)\(sp\)-\(x_{2}\), \(sp\)-\(y_{1}\)\(\times\)\(sp\)-\(x_{1}\), \(sp\)-\(y_{2}\)\(\times\)\(sp\)-\(x_{0}\) they will be sent to \(\sigma_{Add}\) for summing operation at the next time, and the operation result is \(z_{2}\). 10. Similarly, t = k + 7, \(z_{1}\) is received in the environment. t = k + 8, \(z_{2}\) is received in the environment. t = k + 4, \(z_{2k-2}\) is received in the environment. Considering that a carry may occur when operating \(z_{2k-2}\), the system reaches the termination configuration at t = 3k + 5. Based on the above description, readers can verify that, for \(k\geq 2\), the SNPS multiplication constructed above can correctly solve the product of two natural numbers with a binary length of \(k\), and the proof is complete. \(\square\)  
Figure 10 shows a \(\mathbf{\Pi_{BMSNP}}\) structure for three-bit binary multiplication. Based on this \(\mathbf{\Pi_{BMSNP}}\), the multiplication process of the natural numbers 7 and 5 is listed in Table 3, which displays the spike counts in each neuron for each configuration in \(\mathbf{\Pi_{BMSNP}}\).