Module fraction

This module provides symbolic fractions. The module is responsible for the reduction rules that perform simplification. The result can be also an integer, rational or polynom. In case some extra argument is an integer, rational or polynom, this argument is viewed as a fraction. Common factors among the numerator and denumerator are determined by a Gröbner Basis algorithm and cancelled.

Examples:
?- X is 1/A+1/B.
X is (A+B)/(A*B)
?- X is (A*B^2-B)/(A^2*B-A).
X is B/A

The reduction rules are just predicates inside the fraction module with a Python first argument for the method receiver. We provide reduction rules for basic arithmetic. Special functions are currently not supported. Error handling is rudimentary. Cancellation does not yet generate non-zero side conditions.

The following symbolic fraction predicates are defined:

-(P, Q):
The predicate succeeds in Q with the P negated.
+(P, Q, R):
The predicate succeeds in R with the sum of P and Q.
-(P, Q, R):
The predicate succeeds in R with P subtracted by Q.
*(P, Q, R):
The predicate succeeds in R with the product of P and Q.
/(P, Q, R):
The predicate succeeds in R with P divided by Q.
^(P, Q, R):
The predicate succeeds in R with P raised by Q.

Comments