# Producing a minimal Gröbner base

Mathematica has the command GroebnerBasis[{p_1,...},{x_1,...}] that returns a Gröbner base for some set of polynomials. I want to know if there is a command to do the following: take a monomial ordering and given two polynomials $f,g$ consider their leading monomial terms $f_1,g_1$. If $M$ is the least monomial multiple of $f_1,g_1$, let $S(f_1,f_2)=M/f_1 \;f-M/g_2\; g$. This has the effect of cancelling out the leading monomial terms. I would also need to implement the following: suppose I have a Gröbner base $G=\{g_1,\ldots,g_n\}$. This base is called minimal if the leading monomial term of $g_i$ is not divisible by the leading monomial term of $g_j$ for $i\neq j$. Once one obtains such base, we can obtain a (unique) reduced base by dividing $g_i$ by $G\smallsetminus \{g_i\}$ with PolynomialReduce. Summarizing, giving a finite set of polynomials $f_1,\ldots,f_n$:

$1.$ Obtain a Gröbner base, $G$.

$2.$ If some $g_i$ has leading term divisible by another $g_j$; delete $g_i$ from $G$. Obtain a minimal base $G'$.

$3.$ Reduce each $g_i$ by $G'\smallsetminus \{g_i\}$ to obtain a unique reduced base $G''$.

• Is this for a class project? – Daniel Lichtblau Nov 7 '14 at 15:53
• No, it is just personal study. – Pedro Tamaroff Nov 7 '14 at 16:06
• Ah, that makes sense. My guess is it can be accomplished by iterating the idea in the response by @AlexanderGruber (possibly even the actual code, I have not tested it). After each iteration, form a new set of S-polynomials. Might be more efficient though to process one new S-polynomial at a time and, if it does not reduce to zero, form all new ones from it and prior polynomials. Be warned that this is not going to run very fast; Groebner bases can be that way. – Daniel Lichtblau Nov 7 '14 at 16:26

Does this do what you want?

GroebnerReduce[L_, order_: Lexicographic] := Module[{G, V},
G = Union[L,
SameTest -> (PolynomialMod[MonomialList[#1, order][],
MonomialList[#2, order][]] === 0 &)];
V = Union@Flatten@(Variables /@ G);
#[] & /@ (PolynomialReduce[#, Complement[G, {#}], V] & /@ G)
]

• Probably not. What is wanted is a complete code to compute a (minimal, reduced) Groebner basis. I should mention that GroebnerBasis itself does this except it does not in general normalize lead coefficients to unity. – Daniel Lichtblau Nov 7 '14 at 15:52
• I should clarify, here I have only followed steps 2 and 3 described in the question. The input L should just be a list of polynomials, so you'd want them to be a Groebner basis first (minimal or not). So, for example, one could use this by GroebnerReduce[GroebnerBasis[{some polynomials}]]. – Alexander Gruber Nov 7 '14 at 18:25
• I thought possibly you had in mind just the post processing. Anyway, if GroebnerBasis is called first, only the coefficient normalization would be needed. – Daniel Lichtblau Nov 7 '14 at 18:42