The way to do this using a Groebner basis is to force a way to write subalgebra elements only in terms of some generating set. Well, we are given the generating set. The idea then is
(i) Create a new variable for each generator.
(ii) Order variables so these new ones are "smallest" in a well-founded term ordering. I won't go into details on what that means but suffice it to say its fairly standard in computational commutative algebra and related.
(iii) Compute a Groebner basis with respect to this term order.
(iv) To test whether a new polynomial is in the algebra, reduce it by the Groebner basis. It is in the subalgebra iff the reduced form is comprised of the new variables alone.
I'll illustrate with an example. First we need a bit of code to create the monomial orders. A type that is well suited for the task at hand makes terms in the new variables strictly less than terms that have the original variables in them, but in other respects is close to the "degree reverse lexicographic" order.
drlMatrix[n_] :=
Prepend[Table[-KroneckerDelta[j + k - (n + 1)], {j, n - 1}, {k, n}],
Table[1, {n}]]
elimMatrix[n1_, n2_] :=
Module[{row1, rest}, row1 = Join[Table[1, {n1}], Table[0, {n2 - n1}]];
rest = drlMatrix[n2];
rest = Drop[rest, {n1}];
Prepend[rest, row1]]
Now we create a simple example using three polynomials in x
and y
. I'll show the ordering matrix explicitly, as well as the augmented polynomial system.
polys = {3*x^3 + x*y^2, x + y^3, x^2*y + y};
vars = Variables[polys];
avars = Array[a, Length[polys]];
orderMatrix = elimMatrix[Length[vars], Length[vars] + Length[avars]]
genPolys = avars - polys
(* Out[46]= {{1, 1, 0, 0, 0}, {1, 1, 1, 1, 1}, {0, 0, 0, -1, 0}, {0,
0, -1, 0, 0}, {0, -1, 0, 0, 0}}
(* Out[47]= {-3 x^3 - x y^2 + a[1], -x - y^3 + a[2], -y - x^2 y + a[3]} *)
Now form the GB.
gb1 = GroebnerBasis[genPolys, Join[vars, avars], MonomialOrder -> orderMatrix];
We'll use a simple example where we know in advance that the polynomial is in the subalgebra (we create it as an explicit sum of products of generating elements).
PolynomialReduce[polys[[1]]*polys[[3]] + polys[[2]]^2, gb1,
Join[vars, avars], MonomialOrder -> orderMatrix][[2]]
(* Out[49]= a[2]^2 + a[1] a[3] *)
So we see it is indeed written appropriately in terms of the new variables.
Now a symmetric polynomial example (which we'll see is not in the subalgebra).
PolynomialReduce[x^3 + y^3, gb1, Join[vars, avars],
MonomialOrder -> orderMatrix][[2]]
(* Out[50]= -((87 x)/32) + (107 y)/288 - (55 a[1])/96 +
13/144 x a[1]^2 + 1/32 y a[1]^2 + (87 a[2])/32 - (
3225047 x a[1] a[2])/3052176 - (400235 y a[1] a[2])/508696 + (
493465 a[1]^2 a[2])/4578264 - (38311 x a[1]^3 a[2])/1017392 - (
148173 y a[1]^3 a[2])/2034784 + (6187465 x a[2]^2)/2034784 + (
32739307 y a[2]^2)/18313056 + (6579931 a[1] a[2]^2)/6104352 + (
109197 x a[1]^2 a[2]^2)/2034784 + (207697 y a[1]^2 a[2]^2)/763044 + (
38311 a[1]^3 a[2]^2)/1017392 - (163849 a[2]^3)/508696 - (
1813561 x a[1] a[2]^3)/3052176 + (206459 y a[1] a[2]^3)/2034784 - (
109197 a[1]^2 a[2]^3)/2034784 - (129837 x a[2]^4)/2034784 - (
109197 y a[2]^4)/2034784 - (107 a[3])/288 - 3/32 x a[1] a[3] -
107/288 y a[1] a[3] + (24499501 x a[2] a[3])/18313056 - (
18311051 y a[2] a[3])/6104352 + (1652099 a[1] a[2] a[3])/1017392 + (
830467 x a[1]^2 a[2] a[3])/3052176 + (
100029 y a[1]^2 a[2] a[3])/2034784 - (
50434999 a[2]^2 a[3])/18313056 - (
2918511 x a[1] a[2]^2 a[3])/2034784 + (
2115501 y a[1] a[2]^2 a[3])/2034784 - (
327377 a[1]^2 a[2]^2 a[3])/6104352 - (
1655769 x a[2]^3 a[3])/2034784 - (2292923 y a[2]^3 a[3])/6104352 - (
38311 a[1] a[2]^3 a[3])/1017392 + (109197 a[2]^4 a[3])/2034784 +
55/96 x a[3]^2 - 81/32 y a[3]^2 + (18311051 a[2] a[3]^2)/6104352 + (
159645 x a[1] a[2] a[3]^2)/2034784 + (
441266 y a[1] a[2] a[3]^2)/190761 - (
18631649 x a[2]^2 a[3]^2)/6104352 - (
982131 y a[2]^2 a[3]^2)/2034784 - (
114933 a[1] a[2]^2 a[3]^2)/508696 + (
2292923 a[2]^3 a[3]^2)/6104352 + (13 a[3]^3)/16 - (
7235327 x a[2] a[3]^3)/2034784 + (984057 y a[2] a[3]^3)/2034784 - (
344799 a[1] a[2] a[3]^3)/1017392 + (
1637527 a[2]^2 a[3]^3)/2034784 + (982131 a[2] a[3]^4)/2034784 *)
I will remark that without explicit examples it is not obvious how one might show this. Basically, I did some of your work, in making up (possibly irrelevant) examples to use for illustration. This is of course to explain why I and others were pressing for concrete examples.
Stated differently, would a response that just stated steps (i)-(iv) have been at all of use? I'm doubtful. To the point where I actually think the moderators might remove it for lacking adequate detail. Would you want a response like that? Would you write a response like that? Again, on these points I am doubtful.