# 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
* In membranes \(A_{t-2},A_{t-3},\ldots,A_{1}\), after receiving the \(x^{z_{1}}x^{z_{1}}\) of the submembrane, rule \(r_{13}\) is executed to output the maximum common divisor, and finally output it from membrane \(A_{1}\) to membrane \(M_{1}\). Calculate \(k\) and \(l\) according to the rules in membrane \(M_{1}\). (2) Calculate \(k\), \(l\)  
The calculation of \(k\) and \(l\) begins when membrane M\({}_{1}\) receives the maximum convention x\({}_{1}\) from membrane A\({}_{1}\). The specific calculation rules are as follows:  
\[ \begin{array}{llll}\text{r}_{5}:&(\text{x}\to\text{w}\text{v})&\text{r}_{6}:& (\text{a}\text{w}\to\text{i},1)&\text{r}_{7}:&(\text{c}\to\text{y}|_{\text{i}},1 )\\ \text{r}_{8}:&(\text{a}\text{y}\to\text{a}\text{d},2)&\text{r}_{9}:&(\text{i} \to\text{w}|_{\text{d}},3)&\text{r}_{10}:&(\text{d}\to\text{k}\text{c},4)\\ \text{r}_{11}:&(\text{y}\to\text{k},3)&\text{r}_{12}:&(\text{b}\text{v}\to\text {f},1)&\text{r}_{13}:&(\text{t}\to\text{e}|_{\text{f}},1)\\ \text{r}_{14}:&(\text{b}\text{e}\to\text{b}\text{h},2)&\text{r}_{15}:&(\text{ f}\to\text{v}|_{\text{h}},3)&\text{r}_{16}:&(\text{h}\to\text{l},4)\\ \text{r}_{17}:&(\text{e}\to\text{l},3)&\end{array} \]  
The main job of membrane M\({}_{1}\) (at this point) is to divide the numerator and denominator by the maximum common divisor, respectively, and finally arrive at the result. Firstly, rule r\({}_{5}\) is executed: the multiset \(x^{x_{1}}\) is converted into a multiset \(w^{x_{1}}v^{x_{1}}\) for backup, so that the numerator and denominator can be synchronously simplified and parallelism can be improved. (i): The rules involved in simplifying the molecule \(x\) and the order of execution are as follows: \(\text{r}_{6}\to\text{r}_{7}\to\text{r}_{8}\to\text{r}_{9}\to\text{r}_{10}\to \text{r}_{11}\). (a): Execute rule r\({}_{6}\): The multiset \(a^{x_{1}}w^{x_{1}}\) evolves into \(i^{x_{1}}\). At this point, object i retains the number of conventions \(x_{1}\), and there are \(x-x_{1}\) objects \(a\) remaining in the System. Because \(x_{1}\) is the largest convention of the numerator denominator, object \(a\) must be an integer multiple of \(x_{1}\). (b): In the condition that object \(i\) exists, execute rule r\({}_{7}\): object \(c\) evolves into object \(y\). This step is used to control the loop; execute r\({}_{8}\): object \(y\) evolves into object \(d\) under the action of catalyst \(a\). This step proves that there is no end to integer division in the System, at this time; (c): Execute rule r\({}_{9}\) under the condition that object \(d\) exists: object \(i\) evolves into object \(w\), and then the value of the convention number is passed to \(w\); at this point, r\({}_{6}\) execution conditions are met, and rule r\({}_{10}\) is executed while continuing to execute r\({}_{6}\): object \(d\) evolves into objects \(k\) and \(c\), i.e., the convention number is subtracted once for one more \(k\), which is equivalent to a counter. (d): The above steps can be executed several times. Until there is no object \(a\) in the System after executing r\({}_{6}\) again, it indicates that the molecules have been completely divided. Execution rule r\({}_{7}\) and r\({}_{11}\): object \(y\) evolves into object \(k\). The last number of \(k\) is the value of the numerator after the approximate simplification, and also, the number of times the subtraction is used. (ii): The rules involved in simplifying the denominator and the order of execution are as follows: \(\text{r}_{12}\to\text{r}_{13}\to\text{r}_{14}\to\text{r}_{15}\to\text{r}_{16} \to\text{r}_{17}\). The execution rules are similar to the steps for dividing the numerator by the greatest common divisor, and the final number of \(l\) is the value of the denominator after simplification. Due to the maximum parallelism of the membrane calculation, the number of steps required to implement the division function is the number of steps in the larger value simplification. The final result of the approximate fractional simplification in the division algorithm P System is \(k/l\).