# P System with Fractional Reduction
## 4 Fractional Simplification P System
### P System for Fractional Simplification of More Phase Derogation Algorithm
#### 4.1.2 Membrane Rules for the More Phase Derogation Algorithm  
According to Section 4.1.1, the fraction simplification using the more phase derogation algorithm consists of calculating the sequences \(\{x_{i}\}\), \(\{y_{i}\}\), \(\{u_{i}\}\), \(\{z_{i}\}\), \(\{p_{i}\}\), \(\{q_{i}\}\). The value of each sequence indicates the number of corresponding objects in each layer of the membrane. For example, \(x_{1}=12\) means the number of \(x\) in membrane \(A_{1}\) is 12. Combined with the idea of Algorithm 1 in Section 3.1.3, it can be seen that membrane \(A_{1}\) and the dynamically created submembrane only need to use the addition and subtraction method to complete the calculation, and the specific process is shown in Figure 3.  
The following is a specific description of the membrane rules. Figure 3: Flowchart of the fraction simplification solution of the more phase derogation algorithm P System. (**a**) Flowchart of the sequence \(\{x_{i}\}\), \(\{y_{i}\}\) by more phase derogation algorithm; (**b**) Flowchart of the sequence \(\{p_{i}\}\), \(\{q_{i}\}\) by more phase derogation algorithm. (1) Compare the values of the numerator and denominator  
According to the principle and algorithm of the more phase derogation algorithm, it is necessary to ensure that the subtracted number is larger than the subtracted number in the class A membrane, so the size of the numerator \(x\) and the denominator \(y\) are compared in the membrane \(M_{1}\) first. The multiplicity set in the initial state is \(m^{x}n^{y}\), and the comparison rules are as follows:  
\[ \begin{array}{l}\text{r}_{1}:(\text{m}\;\text{n}\;\text{n}\;\text{g},1)\\ \text{r}_{3}:(\text{n}\;\text{n}\;\text{b}\;\text{(a}\;\text{Num},\text{in all)}|_{\text{g}},2)\\ \text{r}_{4}:(\text{g}\;\text{-}\;\text{(a}\;\text{b}\;\text{Num},\text{in all)},3) \end{array} \]  
(i) When \(x>y\), the membrane rules are executed in the following order: \(r_{1}\to r_{2}\to r_{4}\). Execution of rule \(r_{1}\), which corresponds to converting object \(n\) to \(g\), also leaves \(x-y\;m\) in the membrane System. Executing \(r_{2}\) under the condition that both \(g\) and \(m\) are present backs up the difference of \(x-y\) in the membrane as a multiset \(a^{x-y}\), while generating a multiset \(a^{x-y}Num^{x-y}\) to pass into the submembrane \(A_{1}\). (ii) When \(x<y\), the membrane rules are executed in the following order: \(r_{1}\to r_{3}\to r_{4}\). Executing rule \(r_{1}\), there is no remaining \(m\) in the membrane, so executing \(r_{3}\) backs up the excess \(n\) in the membrane as multiset \(b^{y-x}\), while generating multiset \(a^{y-x}Num^{y-x}\) to pass into submembrane \(A_{1}\). The execution of \(r_{4}\) continues in both cases, passing the smaller of the two, \(g\), to \(a\) and \(b\) in the submembrane, so that the number of objects \(a\) in membrane \(A_{1}\), \(x_{1}\), is equivalent to performing a calculation of \(x-y+y\) or \(y-x+x\). The number of objects \(b\) in membrane \(A_{1}\), \(y_{1}\) is the smaller of the numerator and denominator, \(a\) and \(b\) in membrane \(M_{1}\) still represent the numerator and denominator. (2) Compute the sequence \(\{x_{i}\}\), \(\{y_{i}\}\), \(\{u_{i}\}\), \(\{z_{i}\}\)  
After first comparing the size of the numerator denominator in \(M_{1}\), the multiset \(a^{x_{1}}b^{y_{1}}\) is placed in membrane \(A_{1}\), at which point the complete multiset within the membrane is \(a^{x_{1}}b^{y_{1}}cNum^{x_{1}}CreateSubMem\). Within membrane \(A_{1}\) and other dynamically generated submembranes, object \(c\) evolves into \(k\) and \(f\), which is used to control the loop; each layer of the generated membrane is initialized with \(a\) and \(b\). To avoid confusion, the sequences \(\{x_{i}\}\) and \(\{y_{i}\}\) are designed to hold the number of \(a\) and \(b\) in the \(i\)th layer of the membrane, respectively, with \(x_{1}\) and \(y_{1}\) representing the initial larger and smaller values. The rules for computing the sequence \(\{x_{i}\}\), \(\{y_{i}\}\), \(\{u_{i}\}\), \(\{z_{i}\}\) are as follows:  
\[