Next Article in Journal
Information-Geometric Models in Data Analysis and Physics II
Previous Article in Journal
Higher-Order Extensions of C-Hyponormality via n-Quasi-C-Hyponormal Operators
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Bio-Inspired Constant-Time Arithmetic Kernels in Hybrid Membrane–Neural Spiking P Systems

by
Eduardo Vázquez
1,*,
Josue J. Guillen
1,
Daniel-Eduardo Vázquez
2,*,
Giovanny Sanchez
1,
Juan-Gerardo Avalos
1,
Gonzalo Duchen
1,
Gabriel Sánchez
1 and
Linda Karina Toscano
1
1
Instituto Politécnico Nacional (IPN), ESIME Culhuacán, Av. Santa Ana No. 1000, Mexico City 04260, Mexico
2
Unidad Iztapalapa, División de Ciencias Básicas e Ingeniería, Universidad Autónoma Metropolitana, Mexico City 09340, Mexico
*
Authors to whom correspondence should be addressed.
Mathematics 2026, 14(5), 783; https://doi.org/10.3390/math14050783
Submission received: 31 December 2025 / Revised: 20 February 2026 / Accepted: 21 February 2026 / Published: 26 February 2026
(This article belongs to the Section E1: Mathematics and Computer Science)

Abstract

This work introduces Hybrid Membrane–Neural P systems (HMN P systems), a computational model that integrates principles from membrane computing and spiking neural P systems. The resulting framework offers a versatile foundation for the development of bio-inspired arithmetic architectures. Within this setting, we propose a compact family of arithmetic kernels capable of executing signed addition, subtraction, multiplication, and division in both modular and non-modular arithmetic domains. By leveraging intrinsic spike aggregation, spike–anti-spike annihilation, and exhaustive rule application, the proposed designs achieve efficient and reliable arithmetic computation in a constant number of simulation steps under exhaustive semantics and assuming synchronized input, independent of operand values. Addition and subtraction are executed intrinsically upon spike arrival, requiring no internal computation steps, while multiplication and division are completed in a single simulation step by one neuron. Furthermore, we introduce a modular-reduction kernel that operates in two simulation steps with a single neuron, and leverage its modular structure to construct modular multiplication and division through composition with non-modular arithmetic modules. Comparative evaluations against representative SNP and SNQ arithmetic designs demonstrate that HMN kernels achieve operand-independent execution time while requiring fewer neurons. Distinct from most existing approaches, the HMN framework natively supports signed operands through a dual-spike representation, thereby eliminating the need for auxiliary sign-handling mechanisms. Asynchronous spike arrivals can be managed by an optional synchronization membrane; since this mechanism is decoupled from the arithmetic kernels, its overhead is excluded from kernel performance and reported separately. Collectively, these results establish HMN systems as an efficient and modular platform for constant-time arithmetic computation, offering reusable arithmetic kernels that serve as a foundation for higher-level constructions, including those arising in elliptic-curve and modular arithmetic.

1. Introduction

The growing computational demands of modern applications—driven by large-scale neural models, image processing, cryptographic computation, high-performance arithmetic, and the scalability requirements of distributed systems—have motivated the development of new massively parallel computational models. Membrane computing, introduced by Păun [1], is a hierarchical, bio-inspired model of distributed computation whose Turing-complete operational semantics offer a structured alternative to classical sequential architectures, while also incorporating a flexible hierarchical organization and inherent multiset dynamics that implement aggregation and annihilation in a natural way. Within this framework, SNP [2,3] and SNQ systems [4] provide neuron-like computational abstractions in which arithmetic behavior is realized through the application of spike-handling rules. Although arithmetic can be expressed in SNP and SNQ systems, their usual dependence on selective-mode rule application restricts parallelism and leads to significant computation times [5,6,7,8]. In modular arithmetic, some existing systems compute ( b mod p ) via iterative subtraction [9], leading to execution times that depend on operand size and thereby limit scalability. These limitations prevent constant-time execution and significantly restrict the modular reuse of arithmetic components.
Recent research has further expanded the theoretical and practical scope of spiking neural and membrane computing models, particularly in relation to arithmetic processing and structured computational design. Comprehensive surveys have highlighted the sustained development of spiking neural P systems (SN P systems), including investigations into normal forms, homogeneous structures, software tools, and emerging research directions. These studies provide an updated view of the theoretical foundations and ongoing evolution of SN P systems as a mature paradigm within membrane computing and natural computing research [10].
In parallel, increasing attention has been devoted to implementation-oriented aspects of membrane computing models and their potential for massively parallel computation. Hardware-focused analyses emphasize the suitability of membrane-based computational paradigms for FPGA- and GPU-based realizations, as well as their relevance for high-performance arithmetic and data-intensive applications. Such work underscores the importance of bio-inspired distributed models as viable alternatives to classical sequential architectures in contexts requiring scalable and modular arithmetic computation [11].
Within this broader context, several works have addressed the construction of arithmetic components in spiking neural P systems. Implementations of binary adders and related arithmetic circuits demonstrate the feasibility of designing practical arithmetic modules using spike-based representations and neuron-level rule dynamics, with potential applications in cryptographic and hardware-oriented domains [12]. At the same time, recent extensions of SN P systems have explored enriched rule semantics, including stochastic and probabilistic firing mechanisms, further expanding the modeling and computational capabilities of neural membrane systems [13]. These developments reflect a growing interest in efficient arithmetic processing and modular computational design within membrane computing.
Despite these advances, most existing approaches rely on selective or sequential rule application and often exhibit execution times dependent on operand magnitude or structural complexity. Consequently, the development of compact and reusable arithmetic kernels operating in constant time, while maintaining structural simplicity and scalability, remains an open challenge in the design of membrane–neural computational architectures.
These considerations motivate the need for architectures using exhaustive semantics, together with biologically inspired mechanisms like spike aggregation, spike/anti-spike annihilation, and multiset-based computation, as these features simplify arithmetic design and lower neuron counts.
To overcome these limitations, we propose Hybrid Membrane–Neural (HMN) P systems, combining membrane hierarchies with exhaustive rule application and spiking neural computation. This integration yields compact, reusable arithmetic kernels operating in constant time, independent of operand values. The architecture includes:
  • A modular-reduction membrane  Π ( b mod p ) , which evaluates ( b mod p ) in constant time using a single neuron with exhaustive semantics. This membrane is a fundamental primitive for all modular operations.
  • A synchronization membrane  Π ( Sync ) , designed to temporally synchronize incoming spike multisets before processing. This mechanism is needed for asynchronous operands and adds at most two steps: query and synchronized emission.
  • Signed arithmetic membranes  Π ( x y ) and Π ( x / y ) , which compute signed multiplication and division via spike/anti-spike encoding.
  • Composite modular kernels  Π ( ( x y ) mod p ) and Π ( ( x / y ) mod p ) , constructed by hierarchically composing the preceding modules within the membrane structure.
A notable property of HMN systems is that addition and subtraction operate without explicit membranes, emerging naturally from spike aggregation and spike/anti-spike annihilation. Consequently, specialized architectures are only necessary for multiplication, division, and modular reduction.
By integrating execution under exhaustive semantics, hierarchical modular composition, and bio-inspired spike/anti-spike interaction within multiset dynamics, the HMN P systems perform all modular and non-modular arithmetic kernels in constant time, without dependence on operand size.
This level of efficiency makes it attractive for diverse application domains, such as elliptic-curve arithmetic, error-correcting codes, DSP, machine-learning primitives, finite-field computation, cryptographic hardware, and bio-inspired computational architectures, and for the systematic development of scalable arithmetic libraries within membrane computing.
Beyond the specific constructions presented, the Hybrid Membrane–Neural (HMN) P system introduced in this work is intended as a reusable architectural framework for constant-time arithmetic in membrane–neural computation. By enabling modular composition of arithmetic kernels under exhaustive semantics and hierarchical membrane organization, the HMN model provides a structured basis for scalable arithmetic design in bio-inspired distributed computing. This perspective positions HMN P systems not only as individual constructions but as a foundation for the systematic development of arithmetic and algebraic components within membrane computing.
The organization of the paper is as follows. Section 2 reviews the preliminaries on Spiking Neural P (SNP) systems, SNQ systems, and exhaustive semantics. Section 3 introduces the Hybrid Membrane–Neural (HMN) P systems, while Section 4 describes the arithmetic-kernel designs and their membrane-based implementations. Section 5 provides a detailed comparative analysis of the arithmetic designs formulated within the HMN architecture. Finally, Section 7 summarizes the primary contributions of the work and highlights promising directions for future research.

2. Preliminaries

2.1. Spiking Neural P Systems (SNP Systems)

Spiking Neural P (SNP) systems [2] are computational abstractions of biologically inspired spiking networks. Information is represented by spike symbols, and computation results from the rule-based consumption, generation, and transmission of spikes across directed synaptic pathways.
An SNP system extended to multiple spike types [14] is formally specified as
Π = ( O , σ 1 , , σ m , s y n , o u t ) ,
where O is a finite alphabet of spike and anti-spike symbols representing multiple spike types; each neuron σ i = ( n i , R i ) is equipped with an initial spike multiset and a finite set of firing and forgetting rules; and s y n is the set of directed synapses. A firing rule E / u v ; d consumes the multiset u, validates the enabling condition E, and releases the multiset v after delay d. Forgetting rules delete a nonempty multiset of spikes, producing no output. Neurons evolve in synchrony under a global clock, with rule application limited to one per step. The computation halts once no rule remains applicable or once the output neuron emits its final spike.

2.2. Spiking Neural P Systems with Communication on Request (SNQ Systems)

SNQ systems [4] enhance the SNP model by enabling neurons to request spikes from presynaptic neurons during rule execution. Rules are expressed as E / Q w , where E represents a regular expression and w specifies a nonempty multiset. When a rule fires, the neuron requests the multiset w from every neuron σ j for which ( j , i ) s y n . Requested spikes are conceptually replicated, enabling all requests to be fulfilled. As in SNP systems, the evolution proceeds synchronously, and neurons may apply only one rule per step. Computation halts when the system reaches a configuration in which no rule is enabled.

2.3. Exhaustive Semantics in SNP Systems

Under the exhaustive semantics model [15], a rule of the form E / a c a p ; 0 applied to a neuron containing k spikes of type a fires k / c times, producing k / c p spikes in parallel. Such massively parallel rule execution treats spike multisets as divisible computational resources, leading to a marked improvement in computational throughput.
This property makes exhaustive semantics an effective basis for arithmetic computation, due to its capacity for parallel multiset processing and spike interactions, leading to reductions in neuron count and computation time—advantages leveraged by the HMN architecture introduced in the following section.

3. Hybrid Membrane–Neural P Systems

Classical cell-like P systems [1] are based on a hierarchical membrane structure, where multisets of objects evolve through the application of rules operating within a hierarchy of nested regions. In SNP systems, biologically inspired neuronal units exchange multisets of spikes through directed synapses, and computation is performed through the application of firing and forgetting rules. SNQ systems enhance this model by enabling neurons to request spikes from neighboring neurons instead of only receiving transmitted spikes.
The HMN model presented in this work unifies these principles into a single architecture by preserving the hierarchical membrane structure and introducing multiset-driven spike/anti-spike dynamics alongside exhaustive neuronal rule execution. This synergy yields compact arithmetic modules and enables arithmetic operations to execute in constant time.

Formal Definition

A Hybrid Membrane–Neural P system (HMN P system) is a tuple
Π = ( O , H , μ , Σ , σ , s y n internal , s y n external , m o u t ) ,
where:
  • O = { a 1 , a ¯ 1 , , a n , a ¯ n } is the working alphabet, consisting of n spike types and their corresponding anti-spikes.
  • H = { 1 , , p } is the set of membrane labels, with p indicating the total number of membranes.
  • The membrane structure μ is a rooted tree on { 1 , , p } , with the root representing the skin membrane, as in classical cell-like P systems.
  • For each membrane i H , Σ ( i ) contains the labels of its direct submembranes.
  • Each membrane i is associated with a (possibly empty) set of neurons σ ( i ) = { σ i , j 1 j q i } , with q i = | σ ( i ) | 0 . In particular, a membrane may or may not contain neurons, depending on the specific HMN system design. Among these neurons, σ i , out denotes the output neuron, while the subset σ i , in σ ( i ) defines the input neurons that may receive spikes from other membranes. Each neuron σ i , j is specified by the pair
    σ i , j = ( w i , j , R i , j ) ,
    where the initial spike configuration w i , j is specified as
    w i , j = ( a 1 r 1 a ¯ 1 s 1 ) ( a n r n a ¯ n s n ) ,
    with r , s N 0 . For each , at most one of a r or a ¯ s appears; both are omitted if r = s = 0 . All incoming spike or anti-spike multisets are automatically accumulated into w i , j , regardless of their source.
  • For membrane i, the internal synaptic connections are specified by:
    s y n internal ( i ) σ ( i ) × σ ( i ) .
  • For membrane i, the synapses connecting its neurons with the neurons of membrane j are described by:
    s y n external ( i ) j i σ ( i ) × σ j , in .
  • The rule set R i , j for neuron σ i , j may include:
    • Firing and forgetting rules in SNP systems have the form ( E / u v ( d ) ) or ( u λ ) , where E is a regular expression over O and u , v are spike patterns of the form
      u = ( a 1 r 1 a ¯ 1 s 1 ) ( a n r n a ¯ n s n ) , v = a t p ,
      A firing rule E / u v ( d ) is applicable in neuron σ i , j whenever the current multiset w i , j satisfies the condition encoded by E and contains all spikes or anti-spikes required by u. When the rule is applied, it consumes the multiset u and, after a delay of d computation steps, produces the multiset v, which is then sent through all outgoing synapses of σ i , j . The produced spikes are interpreted as originating from an external environment that can provide an unbounded number of spikes. This assumption is standard in several variants of SNP and SNQ systems, including the formulation of Păun et al. [4].
    • SNQ P systems, as introduced by Păun et al. [4], extend SNP models by allowing neurons to actively request spikes from other neurons instead of only receiving them passively through synapses. Under this model, a request rule is of the form Q ( a s n , C k ) , where a s n requests n spikes of type a s (or a ¯ s ), and C k is the membrane from which they are obtained. The rule applies only if the target membrane has at least n spikes (or anti-spikes) of that type. This mechanism is used in Π ( Sync ) (Section 4.2) to collect spikes arriving at different computation steps and emit them together in a single synchronized step.
    • Synaptic SNP-like rules are associated with internal or external synapses and operate according to exhaustive semantics. It is applicable only if its synapse lies in s y n internal ( i ) or s y n external ( i ) .
    All neuronal and synaptic rules operate under exhaustive semantics.
  • The output is taken from membrane m o u t via its output neuron σ m o u t , out and is generally defined as the number of spikes of a prescribed type.
A configuration of Π provides, for every neuron σ i , j , the current multiset w i , j , and the remaining number of steps before the output of any pending rule E / a k c a r p ( d ) is released.
A computation is synchronized by a global clock and executed according to the exhaustive mode [15]. During each clock step, the following actions take place:
  • At each step, each neuron checks all applicable SNP and SNQ rules. If several are enabled, one is chosen nondeterministically and applied exhaustively.
  • For each synapse, all applicable synaptic rules are applied using exhaustive semantics.
  • Spikes and anti-spikes generated by neuronal or synaptic rules are propagated through the corresponding synapses, subject to their respective delays.
  • Within a neuron, spike–anti-spike pairs annihilate automatically according to a k a ¯ k λ whenever both appear in the same computation step.
  • Within each neuron, spikes accumulate automatically in accordance with the standard dynamics of SNP or SNQ systems.
  • The computation halts once no SNP, SNQ, or synaptic rule is applicable anywhere in the system.
Remark 1.
As in classical SNP and SNQ systems, the HMN P system model does not impose additional global restrictions on the admissible rule sets, nor does it provide global guarantees of termination, confluence, or determinism for arbitrary HMN systems. The correctness and constant-time behavior discussed in this paper are properties of the specific arithmetic membranes designed herein and are not claimed as global properties of the HMN model in its full generality.
Although nondeterministic rule selection is allowed by the HMN operational semantics, the arithmetic kernels presented in this work are designed so that such nondeterminism has no effect on either the computed result or the total number of execution steps. In these constructions, rule applicability within each neuron is either mutually exclusive or all enabled rules belong to the same implicit computation phase and are equivalent under exhaustive semantics. Moreover, exhaustive rule application induces an implicit phase structure (e.g., a reduction phase followed by output emission), which guarantees deterministic, convergent, and constant-time behavior independently of the operand values.
In our Hybrid Membrane–Neural P system (HMN P system), the membrane structure provides a multilayer hierarchical arrangement of membranes and neurons, while the internal dynamics of each membrane follow spiking neural P system (SNP) rules under exhaustive semantics, achieving high computational efficiency. Anti-spikes make it possible to encode and manipulate signed values, which allows the system to implement fundamental arithmetic operations. Additionally, SNQ and synaptic rules introduce mechanisms that enable the synchronization of spike multisets. The hybrid membrane–neuron framework facilitates the systematic construction of complex neuronal circuits, such as those arising in elliptic-curve arithmetic within sophisticated computational architectures.

4. Arithmetic-Kernel Designs

This section outlines the arithmetic kernels forming the computational backbone of the Hybrid Membrane–Neural P system (HMN P system). The framework supports signed multiplication and signed division, each offered in modular and non-modular form through the membranes Π ( x y ) , Π ( x / y ) , Π ( ( x y ) mod p ) , and Π ( ( x / y ) mod p ) . Together with these operator-specific kernels, two auxiliary modules play a key role in the architecture:
  • Modular-reduction membrane  Π ( b mod p ) , responsible for computing the non-negative residue ( b mod p ) from a multiset encoding a signed integer. It serves as a reusable primitive that can be composed with other modular membranes.
  • Synchronization membrane  Π ( Sync ) , which collects and synchronizes spikes arriving at different computation steps. It guarantees that the arithmetic kernels receive operands as fully synchronized multisets, incurring at most two extra steps (query and synchronized emission).
Because addition and subtraction emerge naturally from spike aggregation and the annihilation of spike/anti-spike pairs, there is no need for explicit membrane-level modules implementing these operations. Instead, addition and subtraction occur naturally from the spiking-based semantics that govern the HMN P system.
The subsections that follow outline the design of each arithmetic kernel and illustrate how the modular composition of low-level membranes (e.g., Π ( x y ) , Π ( x / y ) , Π ( Sync ) , Π ( b mod p ) ) yields compact and reusable architectures. Each kernel is realized through a compact membrane–neuron architecture operating under exhaustive semantics and exhibiting constant-time execution. Their simplicity, reusability, and structural uniformity enable seamless integration into advanced arithmetic constructions arising in elliptic-curve computation, cryptography, finite-field arithmetic, neuromorphic architectures, DSP, and low-power embedded systems.

4.1. Membrane Π C i

This membrane, denoted by Π C i , is initially empty and serves exclusively as a spike-storage membrane, passively collecting all incoming spikes. It receives multisets of the form { a i b , a ¯ i b } , which are accumulated in neuron σ 1 while preserving both spike type and multiplicity. This membrane does not emit any output spikes. Its complete architecture is shown in Figure 1.

4.1.1. Formal Definition

Within the Hybrid Membrane–Neural P system model described in Section 3, the container membrane Π C i constitutes a specific instance of the system
Π = ( O , H , μ , Σ , σ , s y n internal , s y n external , m o u t ) .
  • Working alphabet is given by: O = { a 0 , a ¯ 0 , a 1 , a ¯ 1 , , a n , a ¯ n } .
  • Membrane labels are: H = { 1 } ; membrane 1 acts as the skin membrane.
  • Membrane structure: μ = [ 1 ] , membrane 1 contains no child membranes, i.e., Σ ( 1 ) = .
  • The neuron set is σ ( 1 ) = { σ 1 , 1 } , the single neuron of Π C i .
  • Initial multiset: w 1 , 1 = ( a i b a ¯ i b ) , indicating that the neuron may accumulate spikes or anti-spikes of type a i for 0 i n .
  • Rule set: R 1 , 1 = .
  • Synapses: s y n internal ( 1 ) = , s y n external ( 1 ) = .
  • Output membrane: m o u t = , as no output spikes are produced.

4.1.2. Computation Time

Container membranes do not introduce additional computation steps, as their internal neuron applies no rules and merely accumulates incoming spikes.

4.2. Membrane Π ( Sync )

The membrane Π ( Sync ) contains the container membranes Π ( C 2 ) , , Π ( C m ) , together with the query membrane Π ( Q w ) . Its function is to synchronize the spikes accumulated in the container membranes, independently of the simulation steps at which they are received. The number of container membranes matches the number of input multisets. A schematic representation is shown in Figure 2.

4.2.1. Formal Definition

Within the Hybrid Membrane–Neural P system model described in Section 3, the system Π ( Sync ) is instantiated as a specific instance of the general model
Π = ( O , H , μ , Σ , σ , s y n internal , s y n external , m o u t ) .
  • The working alphabet is given by O = { a 0 , a ¯ 0 , a 1 , a ¯ 1 , , a n , a ¯ n } .
  • The membrane labels are H = { 1 , , m + 1 } , with membrane 1 as the skin membrane, membranes 2–m as container membranes, and membrane m + 1 contains the synchronization neuron Π ( Q w ) .
  • The membrane structure is specified as μ = [ 1 [ 2 ] [ 3 ] [ m + 1 ] ] , with Σ ( 1 ) = { 2 , , m + 1 } and Σ ( k ) = for k 2 .
  • Each membrane has one neuron: σ ( 1 ) = ; σ ( j ) = { σ j , 1 } for j = 2 , , m + 1 .
  • Initial multisets are w j , 1 = ( a s j b j a ¯ s j b j ) for j = 2 , , m ; the synchronization neuron starts empty, w m + 1 , 1 = λ .
  • There are no internal synaptic connections: s y n internal ( j ) = for all j.
  • External synapses allow the synchronization neuron σ m + 1 , 1 to send the synchronized spikes to the m target neurons:
    s y n external ( m + 1 ) = { ( σ m + 1 , 1 , σ t 1 , 1 ) , , ( σ m + 1 , 1 , σ t m , 1 ) } ,
    and s y n external ( j ) = for all j m + 1 . Here, σ t j , 1 is the input neuron of membrane t j that receives the synchronized multiset from σ m + 1 , 1 .
  • The synchronization neuron contains the SNQ request rule
    R m + 1 , 1 = { Q ( a s 2 n 2 a ¯ s 2 n 2 , C 2 ) , , Q ( a s m n m a ¯ s m n m , C m ) } ,
    collecting the required spike multisets from the container membranes via SNQ request rules.
  • Once all queries are fulfilled, σ m + 1 , 1 emits the synchronized multiset via its synaptic SNP-like rules.
    R j : a s j + / a s j u j a s j u j , 2 j m ,
    each rule is associated with a synapse ( σ m + 1 , 1 , σ t j , 1 ) s y n external ( m + 1 ) and is applied under exhaustive semantics in a single computation step.
  • Since no output is produced, m o u t = .
In accordance with the SNQ semantics introduced by Păun et al. [4], SNQ request rules in the synchronization neuron actively request and transfer the specified spike multisets from the container membranes to σ m + 1 , 1 in a single computation step. Once all requested multisets have been collected, synaptic SNP-like rules are applied to emit the synchronized spikes toward their target neurons under exhaustive semantics.
Once all SNQ queries have been satisfied, Π ( Q w ) retrieves the spike multisets from Π ( C 2 ) , , Π ( C m ) , accumulates them in σ m + 1 , 1 , and emits the synchronized operand via rules R 2 , , R m . If multiple upstream modules provide spikes of the same type, the corresponding container membranes accumulate them independently, while the synchronization neuron queries all containers to verify completeness before emitting the synchronized output.

4.2.2. Computation Time

When Π ( Sync ) is employed, two additional steps are required: the SNQ query step and the subsequent synaptic emission of the synchronized spikes, yielding a total of
T Π ( Sync ) = 2

4.2.3. Input Synchronization

All arithmetic membranes assume synchronized input. If multisets arrive at different times, Π ( Sync ) can be used as a preprocessing step, adding at most two steps (query and synchronized emission) without changing the target membrane’s internal structure.

4.3. Membrane Π ( b mod p )

This membrane, denoted as Π ( b mod p ) , performs modular addition or subtraction of a single signed value. Addition and subtraction are performed implicitly and therefore do not require explicit rules: two membranes sending a i b and a i c to a common target, the bio-inspired mechanism aggregates them as a i b + c . Similarly, the neuron performs mutual annihilation upon the simultaneous reception of a i b and a ¯ i c , yielding a i b c when b > c and a ¯ i c b otherwise [16,17]. Thus, this membrane receives a i b if b 0 and a ¯ i b if b < 0 . This membrane computes the modular reduction ( b mod p ) independently of the spike type i; the result is emitted using the same spike type that was received (see Figure 3).

4.3.1. Formal Definition

Within the Hybrid Membrane–Neural P system model described in Section 3, the membrane Π ( b mod p ) is a particular instance of the general model.
Π = ( O , H , μ , Σ , σ , s y n internal , s y n external , m o u t ) .
  • The working alphabet is O = { a i , a ¯ i 0 i n } .
  • H = { 1 } , defining a single cell-like membrane with structure μ = [ 1 ] .
  • The membrane has a single neuron Σ ( 1 ) = σ 1 , 1 , acting as both input and output.
  • The neuron σ 1 , 1 = ( w 1 , 1 , R 1 , 1 ) , where:
    w 1 , 1 = a i b , b > 0 , a ¯ i | b | , b < 0 , λ , b = 0 , i { 0 , , n } ,
    and R 1 , 1 = { R 1 , R 2 , R 3 , R 4 0 i n } , where:
    R 1 : a i p λ , R 2 : a ¯ i p λ , R 3 : a i b a i b , R 4 : a ¯ i b a i p b , b [ 0 , p ) .
    R 3 and R 4 are parametric rule schemata defined for all b [ 0 , p ) and are counted as single rule types in the structural characterization.
  • The membrane has no synapses, i.e., s y n internal ( 1 ) = s y n external ( 1 ) = .
  • The output membrane is m o u t = σ 1 , 1 .

4.3.2. Operational Semantics

The membrane computes as follows:
  • In neuron σ 1 , 1 , the value b equals the total number of spikes received in the same computation step. If spikes of type a i or a ¯ i do not arrive simultaneously at Π ( b mod p ) , a synchronization membrane Π ( Sync ) collects same-type spikes and releases them synchronously in one step, introducing two additional steps (query and transmission).
  • Rules R 1 and R 2 are applied exhaustively, i.e., repeatedly as long as they are applicable, to delete all full multiples of p encoded in a i or a ¯ i . Consequently, when no further application of R 1 or R 2 is possible, the remaining multiplicity is necessarily b [ 0 , p ) .
  • Only after the exhaustive application of R 1 and R 2 terminates, exactly one of R 3 or R 4 is applied, emitting a i ( b mod p ) and preserving the input spike type.

4.3.3. Computation Time

Under exhaustive semantics, the computation completes in at most two steps: optional elimination via R 1 or R 2 , followed by a single application of R 3 or R 4 .

4.4. Membrane Π ( Sync ( b mod p ) )

Within the Hybrid Membrane–Neural P system model, Π ( Sync ( b mod p ) ) extends Π ( b mod p ) with a preliminary synchronization stage that temporally aligns incoming spikes prior to modular reduction.

4.4.1. Formal Definition

If the spikes encoding b do not arrive simultaneously at Π ( b mod p ) , a synchronization stage is required. Accordingly, we define the composite system
Π ( Sync ( b mod p ) ) = ( O , H , μ , Σ , σ , s y n internal , s y n external , m o u t ) ,
which combines the synchronization module Π ( Sync ) and the modular-reduction module Π ( b mod p ) under a common skin membrane. Formally:
  • O = O ( Sync ) O ( b mod p ) = { a 0 , a ¯ 0 , , a n , a ¯ n } is the unified alphabet.
  • H = { 1 , 2 , 3 } , where membrane 1 is the skin, and membranes 2 and 3 correspond to Π ( Sync ) and Π ( b mod p ) , respectively.
  • μ = [ 1 [ 2 ] [ 3 ] ] , where membrane 2 is responsible for the synchronization stage, while membrane 3 performs the modular-reduction computation.
  • Σ ( 1 ) = { 2 , 3 } and Σ ( 2 ) = Σ ( 3 ) = .
  • The neurons are inherited from the corresponding component modules: σ ( 2 ) = σ ( Sync ) and σ ( 3 ) = σ ( b mod p ) , while the skin membrane contains no neurons.
  • Internal synapses:
    s y n internal ( 2 ) = s y n ( Sync ) , s y n internal ( 3 ) = s y n ( b mod p ) .
  • External synapses:
    s y n external ( 2 ) = { ( 2 , 3 ) } , s y n external ( 3 ) = ,
    transmitting the synchronized multiset from membrane 2 to membrane 3.
  • The global rule set is given by
    R = R ( Sync ) R ( b mod p ) .
  • The output membrane is m o u t = 3 .

4.4.2. Computation Time

The architecture operates in two phases: Π ( Sync ) synchronizes the spikes in two steps, after which Π ( b mod p ) performs modular reduction in two additional exhaustive steps. Hence,
T Π ( Sync ( b mod p ) ) = 4 steps .

4.5. Membrane Π ( x y ) for Signed Multiplication

This membrane, denoted Π ( x y ) , computes the signed product of two operands x and y within the Hybrid Membrane–Neural architecture. The input is encoded as spike multisets a 2 c or a ¯ 2 c (multiplicand) and a 1 d or a ¯ 1 d (multiplier), where ( c , d ) are the spike-based instantiations of the abstract operands ( x , y ) . The dual-spike representation ( a i , a ¯ i ) enables direct handling of signed integers without auxiliary sign membranes (see Figure 4).

4.5.1. Formal Definition

Within the Hybrid Membrane–Neural P system model described in Section 3, Π ( x y ) is defined as an instance of the general HMN P system.
Π = ( O , H , μ , Σ , σ , s y n internal , s y n external , m o u t ) .
Formally:
  • O = { a 0 , a ¯ 0 , , a n , a ¯ n } is the working alphabet.
  • H = { 1 } with membrane structure μ = [ 1 ] .
  • Σ ( 1 ) = , as no internal submembranes are present.
  • The membrane contains a single neuron σ 1 , 1 , acting as both input and output.
  • s y n internal ( 1 ) = and s y n external ( 1 ) = .
  • The initial multiset encodes the signed operands as w 1 , 1 = ( a 2 c a ¯ 2 c ) ( a 1 d a ¯ 1 d ) .
  • The rule set
    R 1 , 1 = { R 11 , R 12 , R 13 , R 14 }
    implements the four sign combinations ( + , + ) , ( + , ) , ( , + ) and ( , ) under exhaustive semantics. In a single computation step, all multiplier spikes ( a 1 or a ¯ 1 ) are consumed, and ( c · d ) spikes of type a i or a ¯ i are emitted according to the resulting sign.
  • The output membrane is m o u t = σ 1 , 1 .

4.5.2. Computation Time

All rules are applied under exhaustive semantics within a single computation step, yielding T Π ( x y ) = 1 step .
If the spike multisets encoding ( c , d ) do not arrive simultaneously, a preceding synchronization phase Π ( Sync ) may be used to collect and synchronize all same-type spikes before delivery to Π ( x y ) . This optional preprocessing adds at most two additional steps (query and synchronized emission), without modifying the internal structure of Π ( x y ) .
The dual-spike representation ( a i , a ¯ i ) allows the membrane to multiply signed integer values directly through its spiking dynamics, without requiring an additional sign-handling membrane. This enhances the compactness and modularity of the system, allowing the same computational structure to be reused in higher-level tasks such as modular multiplication or differential addition.

4.6. Membrane Π ( x / y ) for Signed Division

This membrane, denoted Π ( x / y ) (see Figure 5), computes the signed division of two operands x and y within the Hybrid Membrane–Neural framework. The dividend x is encoded by a spike multiset a 2 c or a ¯ 2 c , where c is the spike-based instantiation of x, while the divisor y is encoded by a single spike whose type index represents its magnitude and whose polarity represents its sign. Specifically, a positive divisor of magnitude d is encoded by b d , whereas a negative divisor of magnitude d is encoded by b ¯ d .
The membrane emits a i q or a ¯ i q , where q = | c | d , with the output polarity encoding the sign of the quotient. As in Π ( x y ) , the dual-spike representation ( a i , a ¯ i ) allows direct manipulation of signed operands.

4.6.1. Formal Definition

Within the Hybrid Membrane–Neural P system model described in Section 3, Π ( x / y ) is instantiated as a specific instance of the general HMN P system.
Π = ( O , H , μ , Σ , σ , s y n internal , s y n external , m o u t ) .
Formally:
  • O = { a 0 , a ¯ 0 , , a n , a ¯ n } is the working alphabet. Spike types denoted by b d and b ¯ d are mnemonic names for specific elements of O, reserved to encode divisor magnitudes and assumed to be disjointed from those used for operand-value encoding.
  • H = { 1 } with membrane structure μ = [ 1 ] .
  • Σ ( 1 ) = , since membrane 1 contains no submembranes.
  • The membrane contains a single neuron σ 1 , 1 , acting as both input and output.
  • The initial multiset encodes the signed operands as
    w 1 , 1 = ( a 2 c a ¯ 2 c ) ( b d b ¯ d ) ,
    where c = | x | and exactly one of a 2 c or a ¯ 2 c is present, and exactly one of b d or b ¯ d is present.
  • The rule set consists of the following finite schema, defined for each d { 1 , , n } :
    b d + a 2 d / a 2 d a i , b d + a ¯ 2 d / a ¯ 2 d a ¯ i , b ¯ d + a 2 d / a 2 d a ¯ i , b ¯ d + a ¯ 2 d / a ¯ 2 d a i .
  • Each rule is applied under exhaustive semantics. At each application, d spikes encoding the dividend magnitude are consumed, and one output spike is produced, while the divisor spike is preserved since it appears only in the enabling condition. Under exhaustive execution, the enabled rule is applied exactly c / d times within a single global step, yielding the correct integer quotient.
  • s y n internal ( 1 ) = and s y n external ( 1 ) = .
  • The output membrane is m o u t = σ 1 , 1 .

4.6.2. Computation Time

Under exhaustive semantics, all applicable rules fire within a single computation step.
T Π ( x / y ) = 1 step .
If the spike multisets encoding ( c , d ) do not arrive simultaneously, a preceding synchronization membrane Π ( Sync ) may be employed to temporally synchronize all spikes and deliver them in a single step to Π ( x / y ) . This optional preprocessing adds at most two additional steps (query and synchronized emission), without modifying the internal structure of Π ( x / y ) .
Remark 2.
The division membrane Π ( x / y ) assumes a nonzero divisor ( d 0 ) and computes the integer quotient q = | c | d .

4.7. Membrane Π ( ( x y ) mod p )

This membrane, denoted Π ( ( x y ) mod p ) , computes the signed modular product ( ( x y ) mod p ) by composing two previously defined arithmetic modules: the signed multiplication membrane Π ( x y ) and the modular-reduction membrane Π ( b mod p ) . In this architecture, the output of Π ( x y ) is directly fed as input to Π ( b mod p ) , with both modules contained within the skin membrane (see Figure 6). This modular design avoids rule duplication and supports the reuse of low-level arithmetic components.

4.7.1. Formal Definition

Within the HMN P system model described in Section 3, Π ( ( x y ) mod p ) is defined as an instance of the Hybrid Membrane–Neural P system.
Π = ( O , H , μ , Σ , σ , s y n internal , s y n external , m o u t ) .
Formally:
  • O = O ( x y ) O ( b mod p ) = { a 0 , a ¯ 0 , a 1 , a ¯ 1 , , a n , a ¯ n } is the working alphabet.
  • H = { 1 , 2 , 3 } , where membrane 1 is the skin and membranes 2 and 3 instantiate Π ( x y ) and Π ( b mod p ) , respectively.
  • The membrane structure is μ = [ 1 [ 2 ] [ 3 ] ] .
  • The membrane contents satisfy Σ ( 1 ) = { 2 , 3 } , Σ ( 2 ) = and Σ ( 3 ) = .
  • Each internal membrane inherits its corresponding neuron set:
    σ ( 2 ) = σ ( x y ) , σ ( 3 ) = σ ( b mod p ) .
    The skin membrane 1 contains no neurons.
  • Internal synapses are inherited from the component modules.
    s y n internal ( 2 ) = s y n ( x y ) , s y n internal ( 3 ) = s y n ( b mod p ) .
  • External synapses are defined by
    s y n external ( 2 ) = { ( 2 , 3 ) } , s y n external ( i ) = for i 2 ,
    transmitting the output multiset of Π ( x y ) to the input neuron of Π ( b mod p ) .
  • The global rule set is defined as R = R ( x y ) R ( b mod p ) .
  • The output membrane is m o u t = 3 .

4.7.2. Computation Time

All submembranes operate under exhaustive semantics; consequently,
T ( ( x y ) mod p ) = T Π ( x y ) + T Π ( b mod p ) = 1 + 2 = 3 steps .
If the spike multisets corresponding to the operands arrive at Π ( x y ) at different computation steps, a preceding synchronization membrane Π ( Sync ) can be employed as a preprocessing module to collect and temporally align all spikes of the same type before they are delivered to the arithmetic kernel. This optional preprocessing introduces at most two additional steps—corresponding to the SNQ query and the synchronized emission—without modifying the internal structure of Π ( x y ) or Π ( b mod p ) .
This compositional approach preserves modularity, reduces rule overhead, and enables the direct pipeline integration of signed multiplication and modular reduction within the HMN P system framework.

4.8. Membrane Π ( ( x / y ) mod p )

This membrane, denoted Π ( ( x / y ) mod p ) , computes the signed modular division ( ( x / y ) mod p ) by composing two arithmetic modules: the division membrane Π ( x / y ) and the modular-reduction membrane Π ( b mod p ) . The output spikes produced by Π ( x / y ) are delivered directly to Π ( b mod p ) , with both modules enclosed within the skin membrane (see Figure 7). This modular scheme avoids rule duplication and enables the reuse of low-level arithmetic components.

4.8.1. Formal Definition

Within the Hybrid Membrane–Neural P system model described in Section 3, we instantiate the kernel Π ( ( x / y ) mod p ) as a specific instance of the HMN P system.
Π = ( O , H , μ , Σ , σ , s y n internal , s y n external , m o u t ) .
Formally:
  • O = O ( x / y ) O ( b mod p ) = { a 0 , a ¯ 0 , a 1 , a ¯ 1 , , a n , a ¯ n } is the working alphabet.
  • H = { 1 , 2 , 3 } , where membrane 1 is the skin and membranes 2 and 3 implement Π ( x / y ) and Π ( b mod p ) , respectively.
  • The membrane structure is μ = [ 1 [ 2 ] [ 3 ] ] .
  • The membrane contents satisfy Σ ( 1 ) = { 2 , 3 } , Σ ( 2 ) = , Σ ( 3 ) = .
  • Each internal membrane inherits its corresponding neuron set:
    σ ( 2 ) = σ ( x / y ) , σ ( 3 ) = σ ( b mod p ) .
    The skin membrane 1 contains no neurons.
  • Internal synapses are inherited from the component modules:
    s y n internal ( 2 ) = s y n ( x / y ) , s y n internal ( 3 ) = s y n ( b mod p ) .
  • External synapses are defined by
    s y n external ( 2 ) = { ( 2 , 3 ) } , s y n external ( i ) = for i 2 ,
    transmitting the output multiset of Π ( x / y ) to the input neuron of Π ( b mod p ) .
  • The global rule set is defined as
    R = R ( x / y ) R ( b mod p ) .
  • The output membrane is m o u t = 3 .

4.8.2. Computation Time

All submembranes operate under exhaustive semantics; consequently,
T ( x / y ) mod p = T Π ( x / y ) + T Π ( b mod p ) = 1 + 2 = 3 steps .
When the spike multisets corresponding to the operands are not delivered simultaneously to Π ( x / y ) , a preceding synchronization membrane Π ( Sync ) may be employed to synchronize all same-type spikes prior to their delivery to the arithmetic kernel. This optional preprocessing introduces at most two additional steps—corresponding to the SNQ query and the synchronized emission—without modifying the internal structure of Π ( x / y ) or Π ( b mod p ) .
This compositional design preserves modularity, minimizes redundancy, and enables direct coupling between division and modular reduction within the HMN P framework.

4.9. Worked Examples

In all examples, spike aggregation and spike–anti-spike annihilation follow the standard SNP semantics, where spikes of the same-type aggregate by multiplicity and simultaneous occurrences of a i and a ¯ i cancel out pairwise [16,17].
This subsection provides fully developed numerical examples that illustrate the step-by-step dynamics of the main arithmetic cores introduced in Section 4.5, Section 4.6, Section 4.7 and Section 4.8. The goal is to make the exhaustive execution semantics explicit by showing how spike and anti-spike multiplicities evolve at each global computation step for concrete signed operands.
Example 1
(Signed Modular Reduction). Consider the membrane Π ( b mod p ) with modulus p = 5 . Let b = 7 , encoded as seven spikes of type a i . The initial configuration of the unique neuron is
w 1 , 1 = a i 7 .
Under exhaustive semantics, rule R 1 : a i 5 λ is applied once, removing one full multiple of p and leaving two spikes. Since no further application of R 1 is possible, the reduction phase terminates, and rule R 3 emits the remainder:
a i 7 a i 2 .
The configuration-level evolution is:
Step a i a ¯ i 0 7 0 1 2 0
confirming that the membrane correctly computes 7 mod 5 = 2 in a single global computation step.
Example 2
(Signed Multiplication). Let x = 3 and y = 4 . In the multiplication membrane Π ( x y ) , the operands are encoded as multisets of spikes and anti-spikes of types a 2 , a ¯ 2 (for x) and a 1 , a ¯ 1 (for y). The initial multiset is
w 1 , 1 = ( a ¯ 2 3 ) ( a ¯ 1 4 ) .
Under exhaustive semantics, only the rule corresponding to the ( , ) case is enabled:
R 14 : a ¯ 1 + a ¯ 2 + / a ¯ 1 a i c , c = | x | = 3 .
This rule is applied once for each available a ¯ 1 , i.e., | y | = 4 times, producing 12 spikes of type a i in a single global step:
( a ¯ 2 3 ) ( a ¯ 1 4 ) a i 12 .
The configuration-level trace is:
Step a ¯ 2 a ¯ 1 a i a ¯ i 0 3 4 0 0 1 3 0 12 0
confirming that T Π ( x y ) = 1 and that the output polarity matches the sign of x y .
Example 3
(Signed Division). Let x = 7 and y = 2 , hence x / y = 3 under truncation-based integer division. The initial configuration of Π ( x / y ) is
w 1 , 1 = ( a ¯ 2 7 ) ( b 2 ) .
The only enabled rule is
b 2 + a ¯ 2 2 / a ¯ 2 2 a ¯ i ,
which is applied exhaustively. Each firing consumes two dividend anti-spikes and produces one output anti-spike, while the divisor spike b 2 is preserved. The rule is applied 7 / 2 = 3 times, yielding
( a ¯ 2 7 ) ( b 2 ) a ¯ i 3 .
The configuration-level trace is:
Step a ¯ 2 b 2 a i a ¯ i 0 7 1 0 0 1 1 1 0 3
which makes explicit the truncation-based quotient and the correct propagation of the output sign.
Example 4
(Signed Modular Multiplication). Let x = 3 , y = 4 , and p = 5 . The multiplication membrane Π ( x y ) first computes x y = 12 , emitting a ¯ i 12 . This multiset is then transmitted to the modular-reduction membrane Π ( b mod p ) , where exhaustive reduction rules consume 5 anti-spikes per application. Two full reductions are applied, leaving a remainder of 2 anti-spikes:
a ¯ i 12 a ¯ i 2 .
Thus, the system correctly computes ( 12 ) mod 5 , which is congruent to 3 modulo 5 under the adopted signed encoding, illustrating how previously defined arithmetic cores are composed without modifying their internal rule sets.

5. Comparative Analysis of Arithmetic Designs in the HMN Framework

Throughout this section, execution times are measured in global HMN computation steps under exhaustive semantics and are independent of the magnitude of the operands. They depend only on the fixed architecture and composition of the corresponding arithmetic kernels.
This section presents a comparative evaluation of arithmetic modules within the Hybrid Membrane–Neural (HMN) P system model under exhaustive semantics. We report neuron counts and performance in terms of simulation steps for the fundamental arithmetic modules introduced in Section 4, and contrast them with representative arithmetic constructions from the SNP and SNQ literature.

5.1. Comparison with Prior Work

Early arithmetic constructions in SNP systems [5] implement addition, subtraction, multiplication, and division using unary representations. However, they exhibit operand-dependent computation times, require multiple auxiliary neurons, and do not provide direct support for signed integers. Subsequent approaches [6,17] reduced neuron counts or relaxed timing constraints, but remained dependent on a large number of rules whose execution time grows linearly with respect to the operand values. In particular, arithmetic constant-time execution limits their scalability as reusable arithmetic components. Single-neuron arithmetic constructions [18] achieved the lowest structural complexity, but did not eliminate operand-dependent execution. Binary-encoded arithmetic constructions [8] provided explicit complexity bounds in terms of bit-length, but still required a number of simulation steps linear in the operand bit-length. For modular arithmetic, the only previous system supporting all four operations is [9], where repeated subtraction cycles result in data-dependent computation times.
In contrast, the HMN arithmetic kernels operate in constant time for both modular and non-modular arithmetic, require the fewest neurons among existing designs, and natively support signed values via dual-spike encoding.

5.2. Summary of Comparative Results

To facilitate interpretation, we note that the compared constructions differ along several orthogonal dimensions that are not always presented uniformly in the original sources, including: (i) the underlying computational model (SNP, SNQ, or HMN), (ii) the data encoding strategy (unary multiplicity-based, binary, or multi-type spike encoding), and (iii) the assumed temporal semantics (sequential, synchronous, or exhaustive execution). For this reason, these dimensions are discussed explicitly in the text accompanying the tables, rather than being collapsed into a single tabular comparison.
Specifically, the comparison text preceding and following the tables explicitly addresses these dimensions by discussing, for each group of related works, the underlying system model, the adopted data encoding strategy, and the assumed execution semantics.
The following tables summarize and compare neuron counts and simulation-step complexities for non-modular and modular arithmetic circuits across SNP, SNQ, and HMN-based systems.
Table 1 and Table 2 summarize the structural and temporal costs of non-modular arithmetic operations, quantified in terms of neuron counts and simulation steps under exhaustive semantics, respectively. Unless otherwise specified in the cited works, all designs assume that operand spikes are delivered synchronously to the corresponding neurons, a common convention in SNP and SNQ arithmetic systems that eliminates the need for explicit synchronization components. For non-modular arithmetic, addition and subtraction are realized intrinsically through spike aggregation and spike–anti-spike annihilation, requiring no internal computation steps and only a single neuron. Addition and subtraction require no internal computation steps, as spike aggregation and spike/anti-spike annihilation occur implicitly upon arrival. Multiplication and division are performed by a single neuron and terminate in one simulation step under exhaustive semantics. Consequently, the HMN arithmetic kernels achieve constant-time execution while minimizing neuron usage.

5.2.1. Modular Arithmetic Circuits over G F ( p )

Entries marked as “–” or “n/a” indicate that the corresponding metric is not reported or not defined in the original source. This occurs either because the arithmetic operation is not supported in that construction or because the underlying model does not provide a directly comparable notion of simulation steps. In particular, the SNQ-based design of Jiang et al. [7] does not include a division module, and no neuron count or execution time is therefore reported for this operation in Table 1 and Table 2.
Table 3 and Table 4 present the corresponding results for modular arithmetic over G F ( p ) , the Galois field of order p, where p is a prime number.
The modular-reduction kernel Π ( b mod p ) (operations (Add mod p) and (Sub mod p)) is realized using a single neuron and completes in two simulation steps under exhaustive semantics. Modular multiplication and division are constructed compositionally by combining this kernel with the associated non-modular arithmetic modules, resulting in architectures with two neurons and a total of three simulation steps. If operand spikes are not synchronously available, an auxiliary synchronization membrane may be introduced as a preprocessing stage; this mechanism is accounted for separately and does not alter the intrinsic structural or temporal complexity of the core arithmetic modules.
Overall, the tables indicate that the proposed HMN arithmetic kernels achieve constant-step execution for both modular and non-modular operations, while using fewer neurons than previously reported SNP and SNQ constructions and natively supporting signed operands through the dual-spike representation.

5.2.2. Non-Modular Arithmetic Circuits

Remark on Synchronization
As with most existing SNP and SNQ arithmetic designs, the results presented here assume that all spikes encoding a given operand reach the corresponding membrane within a single computation step. When this assumption does not hold, the HMN framework allows the optional use of a synchronization membrane Π ( Sync ) , which synchronizes spikes prior to arithmetic evaluation. Since such synchronization mechanisms are not explicitly accounted for in the majority of related work, their cost is reported separately and is not included in the comparative tables.
For completeness, Table 5 reports the number of evolution rules used by each HMN arithmetic membrane. Some membranes are defined by finite rule schemata, i.e., compact rule templates parameterized over the working alphabet and instantiated, for a fixed alphabet size n, into a finite set of concrete evolution rules. For such membranes, the reported counts correspond to the number of instantiated rules. A direct comparison with rule counts from existing SNP and SNQ arithmetic systems is not always feasible, as such metrics are not uniformly reported and depend on model-specific formalizations and rule granularity. The reported values are therefore intended to characterize the internal structural complexity of the proposed HMN kernels.

6. Discussion and Limitations

The Hybrid Membrane–Neural (HMN) arithmetic kernels are conceived as compact, constant-time building blocks within a formal membrane computing framework. While the results demonstrate advantages in neuron counts, execution time, and native support for signed arithmetic, the scope and limitations of the proposed approach must be carefully considered.
First, the HMN model is defined at an abstract level and is primarily intended as a theoretical model of computation. The arithmetic kernels are validated using formal semantic arguments and step-based analysis, rather than through full software or hardware implementations. As a consequence of this level of abstraction, practical issues related to low-level implementation are beyond the scope of the present work.
Second, following standard practice in SNP and SNQ arithmetic systems, the proposed designs assume that all spikes encoding a given operand arrive synchronously at the corresponding membrane. Although the HMN framework allows the optional use of a synchronization membrane to manage asynchronous arrivals, the associated preprocessing cost is not incorporated into the core arithmetic kernels and is reported separately. This assumption must be taken into account when comparing systems under conditions in which synchronization cannot be ensured.
Third, although the individual arithmetic kernels are structurally minimal and terminate in constant time, their composition into more complex systems may necessitate additional membranes and synchronization mechanisms. Consequently, the scalability of complex HMN-based architectures is determined primarily by the design of the surrounding system rather than by the individual kernels themselves.
Fourth, some arithmetic membranes, such as the signed division kernel Π ( x / y ) , assume a finite and well-defined input domain induced by the working alphabet. In particular, the divisor magnitude is encoded in the spike type index b d , with d { 1 , , n } , so the corresponding rule set is defined by finite schemata instantiated over this range, resulting in 4 n concrete evolution rules. This restriction reflects a design choice inherent to finite-alphabet HMN systems and does not affect the correctness or constant-time behavior of the kernel within its specified domain.
Finally, the scope of this work is limited to deterministic arithmetic computation under exhaustive semantics; extensions toward stochastic behavior, fault tolerance, and biologically realistic neuron models are left for future research.

7. Conclusions and Future Work

We presented a family of arithmetic kernels within the Hybrid Membrane–Neural (HMN) P system model that natively supports signed addition, subtraction, multiplication, and division, both with and without modular reduction. Exploiting the intrinsic dynamics of spike aggregation and spike–anti-spike annihilation, together with exhaustive semantics, these kernels operate in constant time under exhaustive execution and assuming synchronized input while minimizing neuron usage.
A comparison with representative SNP and SNQ arithmetic constructions demonstrates that the HMN kernels consistently require fewer neurons while achieving operand-independent execution time. In particular, non-modular addition and subtraction are performed intrinsically with zero internal computation steps, whereas multiplication and division are completed in a single simulation step using one neuron.
The proposed kernels follow a modular design that facilitates compositional arithmetic constructions while preserving low structural complexity and constant-time behavior. When operand spikes arrive at different computation steps, an auxiliary synchronization membrane may be employed to enforce the required input synchronization. This preprocessing mechanism operates independently of the arithmetic kernels and is therefore not included in the intrinsic neuron-count and time-complexity measures used for comparison.
As a result, the constant-time guarantees reported in this work apply to the arithmetic kernels themselves under exhaustive semantics and synchronized input, while the optional synchronization overhead is reported separately and does not affect the internal behavior of the kernels.

Future Work

The present work focuses on the design of constant-time arithmetic kernels within the HMN P system framework, which provide a reusable foundation for the construction of more complex computational modules within the HMN model. A natural direction for future research is the composition of these kernels into higher-level cryptographic algorithms, including elliptic-curve point addition and point doubling, as well as Montgomery-type curve arithmetic, where constant-time execution and efficient modular computation are critical.
Beyond cryptographic applications, an additional research direction concerns the investigation of hardware-oriented and neuromorphic realizations of HMN arithmetic kernels. While the exhaustive execution semantics adopted in this work are primarily intended for formal analysis, future studies may explore alternative execution strategies or hardware abstractions that preserve the functional behavior of the kernels while enabling practical implementations.
An implementation and simulation framework for HMN P systems is currently under development and will be released in a public repository to support reproducibility and experimentation.

Author Contributions

Conceptualization, E.V.; Methodology, E.V. and D.-E.V.; Investigation, J.J.G., G.S. (Giovanny Sanchez) and J.-G.A.; Formal analysis, G.S. (Giovanny Sanchez) and J.-G.A.; Validation, G.S. (Giovanny Sanchez) and J.-G.A.; Writing—original draft preparation, E.V., J.J.G. and D.-E.V.; Writing—review and editing, J.J.G., G.S. (Giovanny Sanchez), J.-G.A., G.D., G.S. (Gabriel Sánchez) and L.K.T.; Supervision, E.V. All authors have read and agreed to the published version of the manuscript.

Funding

The authors acknowledge financial support from the Instituto Politécnico Nacional.

Data Availability Statement

No new data were created or analyzed in this study.

Acknowledgments

The authors acknowledge financial support from the Consejo Nacional de Humanidades, Ciencias y Tecnologías (CONAHCYT) and the Instituto Politécnico Nacional.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Păun, G. Computing with membranes. J. Comput. Syst. Sci. 2000, 61, 108–143. [Google Scholar] [CrossRef]
  2. Ionescu, M.; Păun, G.; Yokomori, T. Spiking neural P systems. Fundam. Inform. 2006, 71, 279–308. [Google Scholar] [CrossRef]
  3. Păun, G. Membrane Computing: An Introduction; Springer: Berlin/Heidelberg, Germany, 2002. [Google Scholar]
  4. Pan, L.; Păun, G.; Zhang, G.; Neri, F. Spiking Neural P Systems with Communication on Request. Int. J. Neural Syst. 2017, 27, 1750042. [Google Scholar] [CrossRef] [PubMed]
  5. Zeng, X.; Song, T.; Zhang, X.; Pan, L. Performing Four Basic Arithmetic Operations with Spiking Neural P Systems. IEEE Trans. Nanobiosci. 2012, 11, 366–374. [Google Scholar] [CrossRef] [PubMed]
  6. Peng, X.; Liu, J.; Liang, W. Several Arithmetic Operations on Spiking Neural P Systems. In Proceedings of the 2nd International Conference on Computer Science and Electronics Engineering (ICCSEE 2013); Atlantis Press: Paris, France, 2013; pp. 270–273. [Google Scholar]
  7. Jiang, Y.; Kong, Y.; Zhu, C. Implementation of Arithmetic Operations by SN P Systems with Communication on Request. Int. J. Comput. Commun. Control 2018, 13, 353–364. [Google Scholar] [CrossRef]
  8. Chen, X.; Guo, P. Spiking Neural P Systems for Basic Arithmetic Operations. Appl. Sci. 2023, 13, 8556. [Google Scholar] [CrossRef]
  9. Rangel, J.L.I.; Arroyo, M.I.; Vázquez, E.; Avalos, J.G.; Sanchez, G. New Compact Finite-Field Arithmetic Circuits Over GF(p) Based on Spiking Neural P Systems with Communication on Request Implemented in a Low-Cost FPGA. IEEE Embed. Syst. Lett. 2024, 16, 295–298. [Google Scholar] [CrossRef]
  10. Cabarle, F.G.C. Thinking about spiking neural P systems: Some theories, tools, and research topics. J. Membr. Comput. 2024, 6, 148–167. [Google Scholar] [CrossRef]
  11. Zhang, G.; Shang, Z.; Verlan, S.; Martínez-del-Amor, M.Á.; Yuan, C.; Valencia-Cabrera, L.; Pérez-Jiménez, M.J. An overview of hardware implementation of membrane computing models. ACM Comput. Surv. 2020, 53, 90:1–90:38. [Google Scholar] [CrossRef]
  12. Ochirbat, O.; Ishdorj, T.-O.; Cichon, G. An error-tolerant serial binary full-adder via a spiking neural P system using HP/LP basic neurons. J. Membr. Comput. 2020, 2, 42–48. [Google Scholar] [CrossRef]
  13. Lazo, P.P.L.; Cabarle, F.G.C.; Adorna, H.N.; Yap, J.M.C. A return to stochasticity and probability in spiking neural P systems. J. Membr. Comput. 2021, 3, 45–57. [Google Scholar] [CrossRef]
  14. Ionescu, M.; Păun, G.; Pérez-Jiménez, M.J.; Rodríguez-Patón, A. Spiking Neural P Systems with Several Types of Spikes. Int. J. Comput. Commun. Control 2011, 6, 141–152. [Google Scholar] [CrossRef]
  15. Zhang, X.; Luo, B.; Fang, X.; Pan, L. Sequential Spiking Neural P Systems with Exhaustive Use of Rules. Biosystems 2012, 108, 52–62. [Google Scholar] [CrossRef] [PubMed]
  16. Pan, L.; Păun, G. Spiking Neural P Systems with Anti-Spikes. Int. J. Comput. Commun. Control 2009, 4, 273–282. [Google Scholar] [CrossRef]
  17. Liu, X.; Li, Z.; Liu, J.; Liu, L.; Zeng, X. Implementation of Arithmetic Operations with Time-Free Spiking Neural P Systems. IEEE Trans. Nanobiosci. 2015, 14, 617–624. [Google Scholar] [CrossRef] [PubMed]
  18. Frías, T.; Díaz, C.; Sánchez, G.; García, G.; Avalos, J.G.; Pérez, H. Four Single Neuron Arithmetic Circuits Based on SN P Systems with Dendritic Behavior, Astrocyte-like Control and Rules on the Synapses. IEEE Lat. Am. Trans. 2018, 16, 38–45. [Google Scholar] [CrossRef]
Figure 1. Container membrane Π C i used to collect and store incoming spikes within its internal neuron.
Figure 1. Container membrane Π C i used to collect and store incoming spikes within its internal neuron.
Mathematics 14 00783 g001
Figure 2. Design of the synchronization membrane Π ( Sync ) . Synchronization rules R 2 and R m ( a s k + / a s k u k a s k u k ) simultaneously emit the corresponding spike multisets to their target membranes.
Figure 2. Design of the synchronization membrane Π ( Sync ) . Synchronization rules R 2 and R m ( a s k + / a s k u k a s k u k ) simultaneously emit the corresponding spike multisets to their target membranes.
Mathematics 14 00783 g002
Figure 3. Membrane Π ( b mod p ) performing modular reduction on signed spike multiplicities.
Figure 3. Membrane Π ( b mod p ) performing modular reduction on signed spike multiplicities.
Mathematics 14 00783 g003
Figure 4. Membrane Π ( x y ) implementing the signed multiplication of two integer operands.
Figure 4. Membrane Π ( x y ) implementing the signed multiplication of two integer operands.
Mathematics 14 00783 g004
Figure 5. Membrane Π ( x / y ) implementing the signed division of two integer operands.
Figure 5. Membrane Π ( x / y ) implementing the signed division of two integer operands.
Mathematics 14 00783 g005
Figure 6. Three-membrane structure computing ( ( x y ) mod p ) . Membrane 1 is the skin; membranes 2 and 3 instantiate Π ( x y ) and Π ( b mod p ) , respectively.
Figure 6. Three-membrane structure computing ( ( x y ) mod p ) . Membrane 1 is the skin; membranes 2 and 3 instantiate Π ( x y ) and Π ( b mod p ) , respectively.
Mathematics 14 00783 g006
Figure 7. Three-membrane structure computing ( x / y mod p ) . Membrane 1 is the skin; membranes 2 and 3 instantiate Π ( x / y ) and Π ( b mod p ) , respectively.
Figure 7. Three-membrane structure computing ( x / y mod p ) . Membrane 1 is the skin; membranes 2 and 3 instantiate Π ( x / y ) and Π ( b mod p ) , respectively.
Mathematics 14 00783 g007
Table 1. Neuron counts for non-modular arithmetic circuits in SNP and SNQ systems (where k denotes operand bit-length).
Table 1. Neuron counts for non-modular arithmetic circuits in SNP and SNQ systems (where k denotes operand bit-length).
IDModelSignedAddSubMultDiv
[5]SNPYes10122125
[6]SNPYes31013
[17]SNPYes221110
[18]SNPNo1111
[7]SNQNo566
[8]SNPYes k + 8 k + 13 3 k + 8 5 k + 12
Proposed
system
HybridYes1111
Table 2. Simulation steps for non-modular arithmetic circuits in SNP and SNQ systems.
Table 2. Simulation steps for non-modular arithmetic circuits in SNP and SNQ systems.
IDModelSignedAddSubMultDiv
[5]SNPYes
[6]SNPYes k + 1 k + 2 k + 7
[17]SNPYesn/an/an/an/a
[18]SNPNo O ( x + y ) O ( x + y ) O ( m n ) O ( m / n )
[8]SNPYes 2 k + 4 2 k + 3 3 k + 5 2 k + ( q ) + 4
Proposed
system
HybridYes0011
Table 3. Neuron counts for modular arithmetic circuits over G F ( p ) .
Table 3. Neuron counts for modular arithmetic circuits over G F ( p ) .
IDModelSignedAdd Mod pSub Mod pMult Mod pDiv Mod p
[9]SNQNo4666
Proposed
system
HybridYes1122
Table 4. Simulation steps for modular arithmetic circuits over G F ( p ) .
Table 4. Simulation steps for modular arithmetic circuits over G F ( p ) .
IDModelSignedAdd Mod pSub Mod pMult Mod pDiv Mod p
[9]SNQNo O ( ( x + y ) / p ) O ( | x y | / p ) O ( x + x y / p ) O ( z / p )
Proposed
system
HybridYes2233
Table 5. Number of evolution rules for HMN arithmetic membranes.
Table 5. Number of evolution rules for HMN arithmetic membranes.
MembraneNumber of Rules
Π C i 0
Π ( Sync ) 1
Π ( b mod p ) 4
Π ( Sync ( b mod p ) ) 5
Π ( x y ) 4
Π ( x / y ) 4 n
Π ( ( x y ) mod p ) 8
Π ( ( x / y ) mod p ) 4 n + 4
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Vázquez, E.; Guillen, J.J.; Vázquez, D.-E.; Sanchez, G.; Avalos, J.-G.; Duchen, G.; Sánchez, G.; Toscano, L.K. Bio-Inspired Constant-Time Arithmetic Kernels in Hybrid Membrane–Neural Spiking P Systems. Mathematics 2026, 14, 783. https://doi.org/10.3390/math14050783

AMA Style

Vázquez E, Guillen JJ, Vázquez D-E, Sanchez G, Avalos J-G, Duchen G, Sánchez G, Toscano LK. Bio-Inspired Constant-Time Arithmetic Kernels in Hybrid Membrane–Neural Spiking P Systems. Mathematics. 2026; 14(5):783. https://doi.org/10.3390/math14050783

Chicago/Turabian Style

Vázquez, Eduardo, Josue J. Guillen, Daniel-Eduardo Vázquez, Giovanny Sanchez, Juan-Gerardo Avalos, Gonzalo Duchen, Gabriel Sánchez, and Linda Karina Toscano. 2026. "Bio-Inspired Constant-Time Arithmetic Kernels in Hybrid Membrane–Neural Spiking P Systems" Mathematics 14, no. 5: 783. https://doi.org/10.3390/math14050783

APA Style

Vázquez, E., Guillen, J. J., Vázquez, D.-E., Sanchez, G., Avalos, J.-G., Duchen, G., Sánchez, G., & Toscano, L. K. (2026). Bio-Inspired Constant-Time Arithmetic Kernels in Hybrid Membrane–Neural Spiking P Systems. Mathematics, 14(5), 783. https://doi.org/10.3390/math14050783

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop