 LIB "fpaprops.lib";
ring r = 0,(x,y,z),dp;
def R = freeAlgebra(r, 4);
setring R;
ideal G = x*y; // optional
poly f = 3*x*x+y*x;
ideal s1 = x, y;
ideal s2 = y*z*z, x; // i.e. x > yzz and y > x
// the substitution probably needs a higher degbound
int minDegBound = lpCalcSubstDegBound(f,s1,s2);
minDegBound; // thus the bound needs to be increased
==> 9
setring r; // back to original r
def R1 = freeAlgebra(r, minDegBound);
setring R1;
lpSubstitute(imap(R,f), imap(R,s1), imap(R,s2));
==> 3*y*z*z*y*z*z+x*y*z*z
// the last parameter is optional; above it was G=<xy>
// the output will be reduced with respect to G
lpSubstitute(imap(R,f), imap(R,s1), imap(R,s2), imap(R,G));
==> 3*y*z*z*y*z*z
