Abstract

Fraction reduction is a basic computation for rational numbers. P system is a new computing model, while the current methods for fraction reductions are not available in these systems. In this paper, we propose a method of fraction reduction and discuss how to carry it out in cell-like P systems with the membrane structure and the rules with priority designed. During the application of fraction reduction rules, synchronization is guaranteed by arranging some special objects in these rules. Our work contributes to performing the rational computation in P systems since the rational operands can be given in the form of fraction.

1. Introduction

Membrane computing (also called P systems) is a branch of natural computing introduced by Pǎun in 1998 which abstracts computing models from the architecture and the functioning of living cells [1]. Membrane computing model takes the living cell as multihierarchical structural regions which are referred to as the membranes [2]. In the compartments defined by membranes there are objects that can evolve to other objects and pass through the membranes. After Pǎun proposed and proved that P systems based on membrane division can solve SAT problems in polynomial time [3], many variants of P systems, including cell-like [4, 5], tissue-like [6], and neural-like ones [7], have been successfully used to design solutions for NP-complete problems. The introductions of the complexity, parallelism, decomposition of membrane, and hierarchical structure can be found in [8, 9].

Based on cell-like P systems which are one kind of common systems in membrane computing, Atanasiu firstly constructs arithmetic P systems to implement arithmetic operations [10]. Reference [11] designs multilayer P systems without priority rules to lower the complexity of the operations. And, in [12], the membrane structure is simplified greatly and efficiency of the computations is also improved owing to arithmetic operations being performed in a single membrane without priority rules. Furthermore, multimembrane P systems are constructed for signed arithmetic operations [13] and the operational range of P system can be extended to the whole integer field. In [14] arithmetic expression is evaluated with primary arithmetical operations implemented in single membranes. Reference [15] proposes an algorithm and builds expression P systems without priority rules for evaluating arithmetic expression. And [16] implements primary arithmetic operations of fractions in P systems and builds a bridge between rational numbers and membrane computing. In cell-like P systems, the operands of the arithmetic operations are represented by multiset, which is composed by the objects and their cardinalities. The rational number can be given by the form of fraction, whose numerator and denominator can be represented by multisets, respectively, so the fraction can be a bridge for implementing the calculations of the rational numbers in P systems.

However, [16] has not further processed the computation results which need to be reduced to lighten the load of the subsequent fraction computations. This paper proposes a suitable method of fraction reduction and implements it in P systems. The rest of this paper is organized as follows: Section 2 introduces cell-like P systems, and Section 3 proposes and proves the fraction reduction method. In Section 4, based on cell-like P system, the rules for implementing fraction reduction are described in detail with the membrane structure designed. The conclusions are drawn in the final section.

2. Foundations

2.1. Cell-Like P Systems

Our work in this paper is based on cell-like P systems, and such system (of degree ) can be defined formally as [1, 2] where(i)is the alphabet of the system. Each symbol represents one kind of object. is the finite and nonempty multiset over where is empty string; ;(ii) is a membrane structure with membrane, labeled by ;(iii) is string over representing the multiset of objects placed in membrane . For example, there are 5 copies of object and 3 copies of object in membrane ; then we have ; means that there is no object in membrane ;(iv) is output region of the system and it saves the final results;(v) are finite sets of possible evolution rules over associated with the regions of . The rules in () are of the form , with , , , or , and : here means the product remains in the same region; out means goes out of the region and enters into another membrane which includes membrane as its submembrane; and means goes into membrane which is a submembrane of membrane . Specifically, when can be abbreviated as . is a special symbol not in , and it means that the membrane which includes it will be dissolved and the contents of this membrane will be left in the outer membrane. Object is a promoter in the rule ; this rule can only be applied in the presence of object ;(vi) () defines a partial order relation among the rules in . If and both objects and are available, then only can be applied although the two rules do not compete for any objects.

Beside the above rules, we also consider rules for membrane creation, which is of the form , with , , and is a number from a given list of the labels; the idea is that the object creates a new membrane labeled by , including multiset and associated with evolution rules [17].

In each membrane, rules are applied according to the following principles.(i)Nondeterminism. Suppose rules compete for the reactants which can only support rules to be applied; then the rules are chosen nondeterministically.(ii)Maximal parallelism. All of the rules that can be applied must be applied simultaneously.

From now on we only deal with cell-like P systems with membrane creation and call them P systems for brevity.

2.2. Fraction Arithmetic Operations

Reference [16] discusses how to perform fraction arithmetic operations by P systems based on multiple membranes. In [16], the fraction arithmetical operations are written in the form as where , , , and are all integers; , , , and .

Fraction operands are converted into the format which the integer arithmetic requires when the operation is processed. The process of initialization makes the fraction operand be represented in a unified form and it simplifies the operation rules since different operands can be represented by the same objects in the P systems. After initialization, [16] designs four kinds of fraction arithmetic P systems to implement primary arithmetic operations of fractions (namely, addition, subtraction, multiplication, and division).

The computation results obtained by the systems in [16] are not in reduced form. So they are required to be processed further for lightening the load of the subsequent fraction computations. However, the current methods for fraction reductions are not available in P systems. In this paper, we propose a method of fraction reduction and discuss how to carry it out in cell-like P systems.

3. A Method for Fraction Reduction

The goal of fraction reduction is to obtain the simplest fraction, and it means the numerator and denominator are coprimes. Generally, fractions can be reduced by the following methods.(i)Numerator and denominator are divided by the prime factors that they share until their common factor is 1.(ii)Numerator and denominator are divided directly by their greatest common factor.

These two methods are simple, but both of them are not suitable for being implemented in P systems owing to the following.(i)For the first one, we need to enumerate the primes, such as 2, 3, 5,7, , to find out the common prime factors of the numerator and denominator. This method involves large calculation and cannot be processed in parallel. If it is implemented in P system, a rule or several rules should be designed for testing whether a prime is their common factor. It means that the more prime factors they share, the more rules are designed and the more complex membrane structure is.(ii)For the second one, the greatest common factor of the numerator and denominator should be calculated by Euclidean algorithm, but it cannot be performed efficiently in P systems.

For designing a set of generally universal rules to implement fraction reduction in P systems, we present a new fraction reduction method, based on which the designed system works independently on the size of the input. In this section, some theories on the new method are given and the corresponding algorithm is proposed subsequently with its correctness ensured by the present theories.

3.1. The Principles for Fraction Reduction

Assume that we have integers , () and let , , the sequences , , and can be constructed as where, for , For , we have the following.

Theorem 1. Integer sequence is monotone decreasing, and there is an integer , such that .

Proof. (i) Obviously, is monotone decreasing according to the procedure of the construction.
(ii) Assume that is the minimum in and . From the construction, we have
It is easy to see that . According to the assumption, we obtain and let , namely, .

From (3), we have

The sequence can be constructed as follows:

Generally,

So,

Generally, for ,

Specifically,

Theorem 2. and are coprimes, and is the simplest proper fraction of .

Proof. let be the common factor of and . According to the construction of , we can obtain , so is also the factor of . Similarly, is the common factor of and . It means that there are and , such that and . According to the definition of , we have That is, Namely, is the factor of 1. Hence, . So and are coprimes.
According to the construction of and (11), we have , so is the simplest proper fraction of .

The proofs of the above theories show that the proposed method is feasible for fraction reduction; namely, the simplest proper fraction can be obtained by this method for any fraction.

3.2. The Algorithm for Fraction Reduction

Assume that we want to reduce the fraction (); from the discussion in Section 3.1, the procedure for fraction reduction can be described as follows:(i)input , ;(ii)compute , , , and , ;(iii)compute , ;(iv)output ,.

We can present an algorithm for fraction reduction in Algorithm 1.

Input: , ;
Output: ( is the simplest proper fraction of );
Procedure:
 //calculate ,
   ;
   , ;
  repeat
    ;
    ;
    ;
  until ;
 //calculate ;
   ;
   ;
   ;
  while   {
    ;
    ;
   }
End.

In this algorithm, the complexity of the algorithm is when is a multiple of the . Generally, for sequence , we know if the algorithm performs mod operation for times. Comparing sequence with Fibonacci sequence , we have and . And can be obtained due to mod . So can be concluded by mathematical induction. Furthermore, we can obtain and . That is to say, must be not less than if our algorithm performs mod operation for times and vice versa. We have according to the feature of Fibonacci sequence; namely, and , so the complexity of the algorithm is in the worst case.

4. Fraction Reduction in P Systems

In this section, a kind of P systems is designed for fraction reduction based on the algorithm proposed in Section 3.2.

4.1. The P Systems for Fraction Reduction

The P systems for fraction reduction can be defined as the form of (1) given in Section 2.1, where:(i) is the (finite and nonempty) alphabet of objects which occur in the rules in the designed P system;(ii) is the structure of the system and it can be decided by the rules presented subsequently;(iii), and it means that the final result can be found in membrane 1 when the whole system halts.

Figure 1 describes the initial configuration of this P system: membrane 1 is responsible for keeping the final results and dissolving the other objects coming from membrane , while fraction reduction is processed in membrane . Except the two membranes, other membranes will be dynamically created during the reduction, and the rules in the new membranes are the same as the ones in membrane . In Figure 1, objects and are used to label the denominator and numerator, respectively; and , which are the cardinalities of and , represent the absolute value of the denominator and numerator, respectively; object is used to trigger the rules in membrane .

The algorithm proposed in Section 3.2 can be implemented by the P system as shown in Figure 2. In Figure 2, membrane and the created membranes are responsible for computing , , and . These membranes are nested one by one: the new membrane is created in membrane , and another new membrane is created in membrane . Finally, membrane is created in membrane ( is decided in Section 3.2).

As shown in Figure 2(a), the procedure of calculating and is as follows (the cardinalities of the objects are the items in and ).(i)In membrane , multiset is consumed with new multisets and produced by applying several rules. Furthermore, and are sent into membrane , and is kept in .(ii)When and are sent into , they are converted to and , respectively. In membrane , is consumed with new multisets and produced. Furthermore, and are sent into membrane , and is kept in .(iii)Generally, in membrane , multisets and coming from are transformed to and , respectively. And then is consumed with the new multisets and produced. Furthermore, and are sent into membrane , and is kept in .(iv)Finally, and leave membrane and they are transferred to and , respectively, after arriving in membrane . In membrane , is consumed with the produced.

As shown in Figure 2(b), the procedure of calculating is as follows (the cardinalities of the objects are the items in ).(i)In membrane , multiset is produced and ( is kept in membrane previously) is transformed to (here, ). Then, and are sent into membrane .(ii)When and are sent into , they are converted to and , respectively. In membrane , and ( is kept in membrane previously) are consumed with multisets produced. Then, and are sent into membrane .(iii)Generally, membrane sends and into membrane . and are transformed to and after arriving in membrane . Then and ( is kept in membrane previously) are consumed with new multisets produced.(iv)When membrane sends and into membrane 1, the cardinalities of objects and compose the result of the reduction, namely, .

For convenience, we have some conventions in the rest of the paper as follows.(i)The rules should have priority, and they are described as the form (, ), where is rewritten rule, and indicates the priority. The smaller value is set, higher priority the corresponding rule will have. When , the corresponding rule will have the highest priority. For example, there are two rules in membrane (, 1) and (, 2), and the priority of is higher than , so the will be applied firstly when both of them can be applied.(ii)The created membranes named , and and the rules in all of them are the same as the ones in membrane .(iii)The objects appearing in the rest of the paper have the same meaning, so they will not be explained any more once they are introduced previously.

4.2. The Rules for Fraction Reduction

In this subsection the rules in the P systems for fraction reduction will be discussed in detail. There are two kinds of rules: one is in membrane 1 and the other is in membranes , , , , and .

According to Section 3, we know that the fraction reduction mainly includes calculating , , and . So membrane and the created membranes , , , and should carry out the computations including division (for calculating and ), multiplication and addition (for calculating ).

4.2.1. The Rules in Membrane

(i) Calculating and . Firstly multiset is put in membrane . In this membrane and the created membranes, object evolves to for controlling the division which is used to calculate , , and objects and label the denominator and numerator: in membrane , objects and label and , respectively; in membrane , objects and label and , respectively; in membrane , objects and label and , respectively; ; in membrane , objects and label and , respectively.

The rules for calculating and should include

If , , , , , and should be applied in the order of (for convenience, the rules , and will be represented as , if they can be executed simultaneously). and are consumed by with produced; it means that the values of the numerator and denominator are subtracted by simultaneously and () copies of object will remain. Object , which is produced by , evolves to with the help of by applying . Once occurs, evolves to by applying and it means that the numerator is restored for the next division. evolves to by applying . This procedure may be repeated for several times. Finally, the cardinality of object represents the quotient of the current division.

If ,  ,  ,  ,  ,  ,  ,  , and should be applied in the order of . and are applied as described previously, and () copies of object will remain. Object , which is produced by , evolves to with the help of by applying . By applying , triggers to a new membrane to be created in the current membrane in the presence of object and the new membrane will be used to calculate new items in and . In the presence of object which is produced by , , and will be applied: by , evolves to (they will be sent into the new membrane), and it means that the numerator and denominator consumed by will be restored in the created membrane; by , evolves to ( will be sent into the new membrane). The applications of and mean that the numerator becomes the new denominator and the denominator becomes the new numerator in the new membrane for the next division since the division rules will not be triggered in the case of (there is multiset in the new membrane). Object will be produced and sent into the new membrane by applying .

If , , , , , and should be applied in the order of . evolves to by applying . In the presence of , will be dissolved by applying . Then will be dissolved by applying . When occurs in the innermost membrane, it means that the calculations of and will be ended.

(ii) Calculating . The calculations of and will be terminated when object appears and does not appear in the innermost membrane. At this moment, the operations of multiplication and addition should be triggered to calculate .

Concerning (10) in Section 3, we know that in membrane in Figure 2(b), the copies of objects and will be produced at several steps. So we can design the rules to realize that multisets and can be produced in membrane while multisets and are produced in membrane . Based on this consideration, we design the rules for calculating and they can be applied in several membranes simultaneously. For example, in membrane in Figure 2(b), several copies of objects and are sent into membrane once they are produced and they will trigger the rules in membrane . It means that the rules in membranes and will be applied together at the subsequent steps. Maximal parallelism is implemented in the P systems for fraction reduction.

The rules for the operations of multiplication and addition can be designed as follows:

Rule is only applied in the innermost membrane and is responsible for evolving to . Object evolves to by applying , and it means that 1 is assigned to in membrane as shown in Figure 2(b). and represent the numerator and denominator, respectively. Object evolves to and is sent into the outer membrane in the presence of by applying (it is only applied in membrane ); it means that is assigned to in membrane as shown in Figure 2(b). Rule is only applied in membrane and is responsible for sending out multiset to the outer membrane . Simultaneously, membrane is dissolved because of the occurrence of the special symbol when is applied.

Except for the rules ~, the rest of the rules are available in , , , and . By applying , object evolves to and is sent into the outer membrane for triggering rules , , and in the outer membrane. Object coming from the inner membrane evolves to and is sent into the outer membrane by applying . Rules and are applied to generate objects , , and both in the presence of object and the new generated object is sent into the outer membrane. Rule is applied to generate objects and ( is sent into the outer membrane). Rules , , , and are responsible for calculating as shown in Figure 2(b). Object evolves to by applying for triggering rules . Rules and are applied to consume objects and completely in the presence of object . Rule is applied to dissolve the current membranes.

4.2.2. The Rule in Membrane 1

There is only one rule in membrane 1 and it is responsible for keeping the final results and dissolving the objects coming from membrane . The rule can be designed as where objects , , and sent from membrane are dissolved.

Owing to maximal parallelism, the complexity of the P systems for fraction reduction must be not more than ().

4.3. The Instance for Fraction Reduction

In this subsection, we will give an instance to show how to implement the fraction reduction in the P system designed previously. For example, 6/10 can be reduced by the P system as shown in Figure 3.

The rules in this P system can be applied as follows.

4.3.1. Initial Configuration

Firstly multiset is put in membrane , as Figure 4(a) shows: the cardinality of object is 10, and it is the denominator of the fraction; the cardinality of object is 6 and it is the numerator.

4.3.2. Calculating and

(i)In Figure 4(a), rule is applied 6 times to generate multiset until is consumed completely, and rule is applied to generate at the same time. Then only rule can be applied to generate multiset . Rule is applied to restore to in the presence of object . At the same time, is applied to generate multiset and there is multiset in membrane . In this case, due to the fact that the cardinality of is less than the one of , the available rules are applied in the order of is applied 4 times to consume completely; is applied to generate multiset ; by applying , a new membrane is created with the label ; by applying , , and , and are sent into the new created membrane as the new numerator and denominator with object also sent into the new membrane (see Figure 4(b)).(ii)At this moment, there is multiset in membrane (see Figure 4(b)). Hence, the available rules are applied in the order of to generate multiset . Owing to the fact that the cardinality of is less than the one of , the available rules are applied in the order of : by applying , a new membrane is created with the label ; by applying , , and , and are sent into the new created membrane as the new numerator and denominator with object also sent into the new membrane (see Figure 4(c)).(iii)There is multiset in membrane ; the available rules are applied in the order of to generate multiset . Due to the fact that the cardinality of equals the one of , the available rules are applied in the order of is applied to generate multiset ; is applied 2 times to consume completely; then will be dissolved by applying (see Figure 4(d)).

4.3.3. Calculating

(i)There is multiset in membrane , and is applied to generate multiset (see Figure 4(e)).(ii)There is multiset in membrane now. At this moment, is applied to generate and is sent into the outer membrane. Then is applied 2 times to generate and is sent into the outer membrane in the presence of object . Rule is applied to generate multiset and is sent into the outer membrane. Simultaneously, membrane is dissolved (see Figure 4(f)).(iii)There is multiset in membrane . The following rules can be applied in a step: and are applied to generate objects , , , and (all of them are sent into the outer membrane); and are applied to generate objects , , and both in the presence of object and the new generated object is sent into the outer membrane; is applied to generate objects and ( is sent into the outer membrane) (see Figure 4(g)).(iv)There are multisets and in membranes and , respectively. In membrane , the following rules can be applied in a step: and are applied to generate objects , , , and (all of them are sent into the outer membrane); and are applied to generate objects , , and both in the presence of object and the new generated object is sent into the outer membrane; is applied to generate objects and ( is sent into the outer membrane). Simultaneously in membrane , the available rules can be applied: is applied to generate multiset in the presence of object and the new generated object is sent into the outer membrane; is applied to generate multiset and is sent into the outer membrane, and is applied to generate object at the same time (see Figure 4(h)).(v)There are multisets , , and in membranes 1, , and , respectively. In membrane 1, rule is applied to consume multiset completely. In membrane , the following rules can be applied in a step: is applied to generate object ( is sent into the outer membrane); is applied to generate objects and in the presence of object and the new generated object is sent into the outer membrane; is applied to generate objects and ( is sent into the outer membrane); is applied to generate object . In membrane , rules and are applied to consume objects and completely; then membrane is dissolved after applying (see Figure 4(i)). The aforementioned rules in membranes 1, , and are applied simultaneously.(vi)There are multisets and in membranes 1 and , respectively. In membrane , the following rules can be applied in a step: is applied to generate object ( is sent into the outer membrane); and are applied to generate objects , , and both in the presence of object and the new generated object is sent into the outer membrane; is applied to generate objects and ( is sent into the outer membrane). Then there is multiset in membrane , so the following rules can be applied: is applied to generate object ; and are applied to consume objects and completely; membrane is dissolved after applying (see Figure 4(j)).(vii)There is multiset in membrane 1 (see Figure 4(j)). At this time, no rules can be applied, so the whole system halts. The cardinalities of and represent the values of the denominator and numerator, respectively, so the final result of reducing 6/10 is 3/5.

5. Conclusions

Fraction (rational number) computing is foundational in most of the computing models and systems, and the computation results of the fractions often need to be reduced to lighten the load of the subsequent computations. This paper proposes and proves a new suitable reduction method and implements it in P systems. Furthermore, we give an instance to illustrate how to carry out the fraction reduction effectively in this system. For the fact that the rational number can be given by the form of fraction, whose numerator and denominator can be represented by multisets, respectively, our work will contribute to implementing the computation of the rational numbers in P systems. Further, we will research the signed fraction reduction in P systems and the fraction reduction in the case that the denominator or numerator is 0.

Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

Acknowledgments

This paper is supported by the Fundamental Research Funds for the Central Universities (no. CDJZR13185502), the National Science Foundation for Young Scholars of China (Grant no. 61201347), and Natural Science Foundation Project of CQ CSTC (2012jjA40022, 2011jjA40027).