$\newcommand\QQ{\mathbb{Q}}$

Considering the polynomial $$f = x^2 - a y$$ one notes, that it is irreducible in $\QQ[x,y]$ for all $a \neq 0 \in \QQ$ and factors for $a = 0$.

More generally, let $A=k[a]$ with a computable field $k$ and $B=A[x_1,\ldots,x_n]$ together with an ideal $I=(f_1,\ldots,f_r) \subseteq B$.

Now, how could one compute a polynomial $g(a) \in A$, such that

for all $a_0 \in \bar{k}$ (the algebraic closure of $k$) with $g(a_0) \neq 0$ the ideal $(I, a - a_0)$ has primary decomposition of "the same type" in $R = \bar{k}[x_1,\ldots,x_n]$ (corresponding to $x^2 - a y$ irreducible for $a \neq 0$ in the starting example) and

for $g(a_0) = 0$ the ideal $(I, a - a_0)$ has primary decomposition of an "exceptional type" in $R$ (corresponding to reducibility for $a = 0$ in the example).

It seems to me that there is no prepackaged solution for this in Macaulay2 (which I mostly use for computations in algebraic geometry).

Looking into Singular, I found out, that it can calculate "comprehensive grobner bases", which means in this concrete example it can calculate polynomials $g_1(a),\ldots,g_s(a)$, such that for $g_i(a_0) \neq 0$ the ideal $(I, a - a_0)$ has a groebner base in $B$ of a form which is unique for $g_i(a_0) \neq 0$ and differs fom the other $i$.

For the example in the beginning one gets $g_1(a) = a, g_2(a)=1$ with associated bases $(y a - x^2)$ and $(a, x^2)$ respectively. But this works only for a termorder where $y a$ is the lead monomial in $x^2 - a y$.

# Questions:

1) How to compute such a $g(a)$ mentioned above, classifying primary decomposition types into "ordinary" and "exceptional"?

2) Can it be done with a suitable form of "comprehensive grobner base" calculation?

3) Can it be done with a combination of other "standard" calculations available, say in Macaulay2?

4) What about generalizations where $A=k[a_1,\ldots,a_p]$ has more than one parameter?