# P System with Fractional Reduction
## 4 Fractional Simplification P System
### P System for Fraction Simplification in the Division Algorithm
#### 4.2.2 Membrane Rule of Division Algorithm
* Execution of rule \(r_{1}\) within membrane \(A_{i}\): consume the multiset \(a^{b_{i}}b^{b_{i}}\), generating \(x^{b_{i}}\), which means that the values of the denominator and numerator are consumed in \(b_{i}\) copies at the same time, leaving \(a_{i}-b_{i}\) copies of the object \(a\), while executing \(r_{7}\) to generate a new submembrane \(A_{i+1}\); execution of rule \(r_{2}\): object \(c\) evolves into \(y\) under the condition that object \(x\) exists; this step is used to control the loop, while execution \(r_{14}\) passes the remaining Num into the submembrane \(A_{i+1}\);
* Then execute \(r_{3}\), the object \(y\) evolves into object \(d\), where \(a\) plays a catalytic role; under the condition that \(d\) exists, execute rule \(r_{4}\); the object \(x\) evolves into object \(b\) and returns \(x^{b_{i}}\) to \(b^{b_{i}}\). At this time, the existing multiset in the membrane is \(a^{a_{i}-b_{i}}b^{b_{i}}dNum^{a_{i}}\), and the System satisfies the execution conditions of \(r_{1}\) and continues to generate \(x\). * Execute \(r_{5}\), object \(d\) evolves into object \(c\); at this time, there are \(x\) generated in the membrane \(A_{i}\), so the execution conditions of \(r_{2}\) are satisfied again. Because there is only one \(CreateSubMem\) object in the membrane, \(r_{7}\) and \(r_{14}\) in a membrane can only be executed once, but the rule \(r_{1}\to r_{2}\to r_{3}\to r_{4}\to r_{5}\) may be cyclically executed \(n\) times, until \(a_{i}-nb_{i}<b_{i}\) stops the cycle of execution, or \(a_{i}-nb_{i}=b_{i}\) proves that the remainder is 0; then, the System has found the maximum convention \(x\) and stops the cycle of execution. * When \(a_{i}-nb_{i}<b_{i}\) in the membrane \(A_{i}\), the rules are executed in the following order: \(r_{1}\to r_{2}\to r_{6}\to\{r_{7},r_{8}\}\to\{r_{9},r_{10},r_{11},r_{14}\}\). * Execution rule \(r_{1}\): the multiset \(a^{a_{i}-nb_{i}}b^{a_{i}-nb_{i}}\) is consumed to generate the multiset \(x^{a_{i}-nb_{i}}\). This means that the values of the denominator and numerator are consumed in both \(a_{i}-nb_{i}\) copies, leaving \(b_{i}-(a_{i}-nb_{i})\) copies of object b. At this time, the number of \(x\)\(a_{i}-nb_{i}\) is the remainder of \(a_{i}\) divided by \(b_{i}\). * Under the condition that object \(x\) exists, rule \(r_{2}\) is executed to evolve object \(c\) into \(y\). This step is used to control the loop; rule \(r_{6}\) is executed, and object \(y\) evolves into objects \(e\) and \(g\) under the action of catalyst \(b\). * Execute rules \(\{r_{7},r_{8}\}\): consume CreateSubMem with a \(Num\) to generate a new submembrane \(A_{i+1}\) under the condition that object \(b\) exists, while \(g\) evolves into object \(h\) for synchronization control. * Then execute the rules \(\{r_{9},r_{10},r_{11},r_{14}\}\): under the condition that the object \(h\) exists, convert the multiset \(x^{a_{i}-nb_{i}}\) to multiset \(b^{b_{i+1}}\) directly into the submembrane \(A_{i+1}\) and the multiset \(b^{b_{i}-(a_{i}-nb_{i})}\) to multiset \(a^{a_{i+1}}\) into the submembrane; at this time, \(b_{i+1}=a_{i}-nb_{i}\) and \(a_{i+1}=b_{i}-(a_{i}-nb_{i})\), while the object \(h\) evolves into \(c\) into the membrane \(A_{i+1}\) to continue the execution. In membrane \(A_{i+1}\), we continue to judge the size relationship between \(a_{i+1}\) and \(b_{i+1}\) and execute the corresponding rules. * When \(a_{t-1}-nb_{t-1}=b_{t-1}\), the rules are executed in the following order: \(r_{1}\to r_{2}\to r_{12}\to r_{13}\). * Rule \(r_{1}r_{2}\) is executed as above. At this time, there is no excess \(a\) or \(b\) in the membrane, proving that the two numbers have no remainder, which also means that they have been integregated; therefore, the execution of rule \(r_{12}\): the object \(y\) evolves into \(z\) and \(e\). Under the condition that there is \(z\), the execution of rule \(r_{13}\) converts the multiset \(x^{b_{t-1}}\) into the multiset \(x^{z_{1}}x^{z_{1}}\) directly into the parent membrane, i.e., \(b_{t-1}\) is the maximum common divisor.