# 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  
Combining the design idea of the P System and the principle of Section 3.2, the P System of fraction simplification by division algorithm mainly consists of calculating the sequence of larger values \(\{a_{i}\}\), the sequence of smaller values \(\{b_{i}\}\), the maximum convention \(x_{1}\), the numerator \(k\) after reduction, and the denominator \(l\) after reduction. The initial state of the multiset \(m^{x},n^{y},c,t\) is first put into the membrane \(M_{1}\), where \(x\) denotes the number of numerators and \(n\) denotes the number of denominators. Then, after comparing the size of the numerator and denominator in membrane \(M_{1}\), the larger and smaller values are passed into membrane \(A_{1}\), respectively, and the maximum convention number calculated according to the rule, and then \(x_{1}\) is passed into membrane \(M_{1}\) to calculate the final approximate result \(k/l\). Following this idea, a specific flow chart can be obtained, as shown in Figure 6.  
The following is a specific description of the membrane rules. (1) Calculate the sequence \(\{\text{a}_{\text{i}}\}\), \(\{\text{b}_{\text{i}}\}\) and the maximum convention \(x_{1}\)  
\(m^{x}n^{y}ct\) is the initial state of membrane \(M_{1}\). The numerator \(x\) and denominator \(y\) are compared in membrane \(M_{1}\) and then the larger and smaller values are passed to object \(a\) and object \(b\) in membrane \(A_{1}\), respectively. The specific conversion rules are similar to membrane \(M_{1}\) in the more phase derogation algorithm, which can be found in Section 4.1.1. The membrane rule within this System improves the division into multiple additions and subtractions; the initialized multiset in membrane \(A_{1}\) is \(a^{a_{1}}b^{b_{1}}cNum^{a_{1}}\)\(CreateSubMem\), where \(a_{1}\) is the value of the larger number in the numerator denominator, and \(b_{1}\) is the value of the smaller number. The rule for calculating the maximum convention \(x_{1}\) is as follows:  
\(\text{r}_{1}:(\text{a}\text{b}\rightarrow\text{x},1)\)\(\text{r}_{2}:(\text{c}\rightarrow\text{y}|_{\text{x}},1)\)\(\text{r}_{3}:(\text{a}\text{y}\rightarrow\text{a},2)\)\(\text{r}_{4}:(\text{x}\rightarrow\text{b}|_{\text{d}},3)\)\(\text{r}_{5}:(\text{d}\rightarrow\text{c},4)\)\(\text{r}_{6}:(\text{b}\text{y}\rightarrow\text{b}\text{e}\text{g},2)\)\(\text{r}_{7}:(\text{CreateSubMem}\text{Num}\rightarrow\text{A}:\text{a}\{\}|_{\text{b}},3)\)\(\text{r}_{9}:(\text{x}\rightarrow(\text{b},\text{in})|_{\text{h}},4)\)\(\text{r}_{10}:(\text{b}\rightarrow(\text{a},\text{in})|_{\text{h}},4)\)\(\text{r}_{11}:(\text{h}\rightarrow(\text{c},\text{in})|_{\text{h}},5)\)\(\text{r}_{12}:(\text{y}\rightarrow\text{z}\text{e},3)\)\(\text{r}_{13}:(\text{x}\rightarrow(\text{z}\text{x},\text{out})|_{\text{z}},4)\)\(\text{r}_{14}:(\text{Num}\rightarrow(\text{Num},\text{in})|_{\text{lCreateSubMem}})\)  
(i) When \(a_{i}-nb_{i}>b_{i}(i=1,2,\ldots,t-1,n=0,1,\ldots,t-1)\) the rules are executed in the following order: \(\{\text{r}_{1},\text{r}_{7}\}\rightarrow\{\text{r}_{2},\text{r}_{14}\} \rightarrow\text{r}_{3}\rightarrow\text{r}_{4}\rightarrow\text{r}_{5}\). Figure 5: Initial pattern of the P System in the division algorithm. Figure 6: Flow diagram of the division algorithm P System.