Often one wishes to introduce new variables temporarily to a polynomial ring. Magma allows one to do this by use of the VariableExtension function, and also to restrict again to the original ring with elimination performed automatically.
Given an ideal I of the polynomial ring P = R[x1, ..., xn], create a polynomial ring Q as a k-variable extension of P, the ideal J of Q corresponding to I, and the embedding map f: P -> Q, and return J and f.If the argument b (standing for "before") is true, the k variables are inserted before the current variables of P, so Q is defined to be R[y1, ..., yk, x1, ..., xn] and f maps P.i to Q.(k + i) (so the xi variables of P are mapped to the xi variables of Q).
If the argument b is false, the k variables are inserted after the current variables of P, so Q is defined to be R[x1, ..., xn, y1, ..., yk] and f maps P.i to Q.i (so the xi variables of P are mapped to the xi variables of Q).
If the argument order is given, then Q is constructed with the specified order; otherwise, the grevlex order is used for Q by default. See the section on monomial orders (Section Representation and Monomial Orders) for the valid values for the argument order.
The image under f of a polynomial of P is the corresponding polynomial of Q, while the image under f of an ideal of P is the corresponding ideal of Q. The inverse image under f of a polynomial of Q is only defined if none of the extension variables of Q occur in that polynomial, in which case the inverse image is just the restriction back to P, while the inverse image under f of an ideal H of Q is always defined and is the restriction back to P of the elimination ideal H ∩R[x1, ..., xn].