When is a polynomial ideal binomial after an ambient automorphism?

Can an ideal I in a polynomial ring k[x] over a field be moved by a change of coordinates into a position where it is generated by binomials $x^a - cx^b$ with c in k, or by unital binomials (i.e., with c = 0 or 1)? Can a variety be moved into a position where it is toric? By fibering the G-translates of I over an algebraic group G acting on affine space, these problems are special cases of questions about a family F of ideals over an arbitrary base B. The main results in this general setting are algorithms to find the locus of points in B over which the fiber of F - is contained in the fiber of a second family F' of ideals over B; - defines a variety of dimension at least d; - is generated by binomials; or - is generated by unital binomials. A faster containment algorithm is also presented when the fibers of F are prime. The big-fiber algorithm is probabilistic but likely faster than known deterministic ones. Applications include the setting where a second group T acts on affine space, in addition to G, in which case algorithms compute the set of G-translates of I - whose stabilizer subgroups in T have maximal dimension; or - that admit a faithful multigrading by $Z^r$ of maximal rank r. Even with no ambient group action given, the final application is an algorithm to - decide whether a normal projective variety is abstractly toric. All of these loci in B and subsets of G are constructible; in some cases they are closed.


Introduction
Ideals generated by binomials define schemes with much simpler geometry than arbitrary polynomial ideals [ES96], largely yielding to analysis by combinatorial methods [DMM10,KM14,KMO16].Similarly, ideals homogeneous with respect to some grading or multigrading are simpler than general ideals.In principle, much of this simplicity persists after linear change of coordinates, or any other automorphism of the ambient affine space.Therefore, it seems natural to ask for an algorithm to decide whether a given ideal has any of these properties after applying an ambient automorphism.
Here we present algorithms for this and related tasks.Let G be an algebraic group acting on affine space A n = Spec k[x 1 , . . ., x n ] via a morphism α : G × A n → A n .For a given ideal I ⊆ k[x] = k[x 1 , . . ., x n ], we provide algorithms for the following tasks, where I.γ means the image of under the corresponding (right) action of γ ∈ G on k[x].
(A1) Find the elements γ ∈ G such that I.γ is generated by binomials (Algorithm 4.2).(A2) Find the elements γ ∈ G such that I.γ is unital, meaning generated by monomials and differences of monomials (Algorithm 4.5).(A3) Find the elements γ ∈ G such that I.γ admits a faithful Z r -grading with r as large as possible (Algorithm 3.13).(A4) Given a second algebraic group T which also acts on A n , find the elements γ ∈ G such that I.γ is stabilized by as large a subgroup of T as possible (Algorithm 3.11).
In each item, we can in particular determine whether there exists γ ∈ G such that I.γ has the respective property.
The case of G = GL n in (A1) originated with Eisenbud and Sturmfels [ES96, page 6], who raised the issue of determining when a given ideal is the image of a binomial ideal under an ambient linear automorphism.
It would be desirable to have algorithms for these questions with G being the entire automorphism group of affine space.However, as this group is currently a mystery [Ess00,SU04], it seems only fair to require that G be specified beforehand.In fact, the reader will lose none of the flavor or difficulty by assuming that G = GL n consists of all linear changes of coordinates.
The most important class of binomial ideals consists of those that are toric, meaning unital and prime.They define affine toric varieties, so (A2) can be used to find automorphims in G under which the image of a given affine variety is (equivariantly embedded as) a toric variety.For varieties that are projective, we can even do better and detect whether they are toric without having to specify a group G beforehand: (A5) Given a normal, projective variety X ⊆ P n , decide if it is toric (Algorithm 5.4).
Even if it is not toric, taking the group T in (A4) to be the algebraic torus (k * ) n , our method finds a large subtorus acting on V (I.γ), turning the latter optimally into a T -variety.(If your definition of T -variety requires normality, then of course it can only work if V (I) is normal to begin with.) Here are two examples where "hidden" toric structures turned out to be useful.
Example 1.1 (Phylogenetics and group-based models).Group-based models are special statistical models: maps from the parameter space to the space of probability distributions [Eri + 05].In their original coordinates the maps are not monomial, so the Zariski closures of the images do not seem toric.However, a clever linear change of coordinates, known as the Discrete Fourier Transform, turns the varieties to equivariantly embedded toric varieties [HP89,SS05].This fact inspired numerous mathematicians both in statistics and in algebraic geometry [BW07, DK09, CFS11, MV17].
Example 1.2 (Secant and tangential varieties of Segre-Veronese).Secant and tangential varieties are classical topics in algebraic geometry [Zak93].As an example of the difficulty of their geometric and algebraic properties, finding the defining equations of the secant variety of any Segre-Veronese variety was an open conjecture of Garcia, Stillman, and Sturmfels [GSS05], solved only recently by Raicu [Rai12].Thus, it is surprising that both secant and tangential varieties of Segre-Veronese are covered by open toric varieties-complements of hyperplane sections [SZ13,MOZ15,MPS16].Here a nonlinear change of coordinates, inspired by computation of cumulants in statistics [Zwi15] played a crucial role.
Methods.The principle that guides our algorithms concerns the comparison of families parametrized over a common base.When G acts on A n , the G-translates of I fiber over G (Definition 3.1 and Remark 3.2).If a second group T acts on A n and it is desired to find a subgroup of T that stabilizes a G-translate of X ⊆ A n , then ask for τ ∈ T and γ ∈ G such that γ.X is stabilized by τ .This problem fibers over T × G (Section 3.2), the point being to find the locus Y ⊆ T × G over which τ.(γ.X) = γ.X.
In the context of (A4), where the goal is to move X so as to make its stabilizing subgroup as large as possible, the algorithm then finds the locus of points in G over which the fiber of Y → G has maximal dimension.This locus is closed (Proposition 3.9).Note that Algorithm 3.13 for (A3) is the special case where T = (k * ) n is the algebraic torus acting diagonally on A n (Section 3.3).The upshot is that our computational engine consists of two algorithms for a family of ideals over an arbitrary base B: find the locus of points in B over which the fiber (A6) is contained in the fiber of a second given family of ideals over B (Algorithm 2.9) or (A7) defines a variety of dimension at least d (Algorithm 2.11).
These rely on geometry of constructible sets (Section 2.1) and a bit of flatness, when it is desired that the constructible outputs of the algorithms be closed (Theorem 2.5).Deterministic algorithms for (A7) are known [Kem07], but Algorithm 2.11 is probabilistic and likely faster.
Having already the context of an arbitrary base B at our disposal, the algorithms for (A1) and (A2) work as well for a family of ideals over B.
(A1 ′ ) Find the locus of points in B over which the fiber is binomial (Algorithm 4.2).(A2 ′ ) Find the locus of points in B over which the fiber is unital (Algorithm 4.5).
The reason is that the criterion for binomiality simply detects whether the reduced Gröbner basis is binomial (Section 4.1); it has nothing to do with a group action on the ambient affine space.Similarly, an ideal is unital precisely when its scheme is closed under coordinatewise multiplication (Proposition 4.4); while this employs the monoid structure on k n , which is defined only once a basis of k n has been given, that monoid action is fixed from the outset, so it remains only to calculate which fibers respect it.
The final application, (A5), observes that high Veronese embeddings of normal projective varieties are projectively normal, after which an ambient automorphism must make the variety toric if anything can (Theorem 5.5).Thus our method applies (A2) with G being the general linear group acting on projective space.A speedup (Algorithm 5.1) for (A6) is available in this case because the fibers are known to be prime.

Conventions.
Everything throughout the paper is over a field k.Implementation of the algorithms would require that k be "computable" in some appropriate sense, but most of our discussions are independent of this hypothesis.That said, we do assume, without further comment, that all algebras and schemes are of finite type over k.
Functions, variables, and spaces are denoted by English letters.Group elements or points in spaces are denoted by Greek letters.Thus f (x) for x = x 1 , . . ., x n is a function on a subscheme X of affine n-space A n whose action on a k-valued point ξ ∈ X is ξ → f (ξ).Hopefully this eliminates confusion regarding left vs. right actions on spaces vs. functions, the details of which are covered in Section 3.1.When we wish to think of points algebraically, as prime ideals in rings, then we use Fraktur letters.Thus p γ ⊆ k[G] is the prime ideal corresponding to the point γ ∈ G.For any prime ideal p, its residue field is written κ p .If p = p ξ , say, then we also write κ ξ = κ p ξ .
Acknowledgments.We are grateful to the Mathematical Society of Japan for hosting its 8th Seasonal Institute in Osaka, "Current trends on Gröbner bases" and inviting two of us (MM and EM) in July, 2015; this work originated with questions raised there in discussions with Thomas Kahle.We thank the Italian Istituto Nazionale di Alta Matematica for sponsoring the meeting on "Homological and computational methods in commutative algebra" in honor of Winfried Bruns's 70th birthday in Cortona, June 2016; that remains the sole instance when all three of us were physically in the same location.We are grateful to the European Mathematical Society and the Foundation Compositio Mathematica for supporting the 24th National School on Algebra and EMS Summer School on Multigraded Algebra and Applications, where two of us (LK and EM) had extended discussions.Further, we thank the Research Institute for Mathematical Sciences (RIMS) and the Kyoto University for hosting the meeting on "Computational Commutative Algebra and Convex Polytopes" in August 2016, which again gave two of us (LK and MM) the opportunity for discussions.EM is grateful to the Max Planck Institute für Mathematik in den Naturwissenschaften in Leipzig, Germany for funding a stay that largely pushed this work to conclusion.MM was supported by Polish National Science Centre grant no.UMO-2016/22/E/ST1/00574 and the Foundation for Polish Science (FNP).LK was funded by the German Research Foundation (DFG), grant no.KA 4128/2-1.

Algorithms for families of schemes
Generally speaking, our algorithms are aimed at schemes over groups, thought of as families of schemes (or ideals) parametrized by the group.But many of our results hold over more arbitrary base schemes; we phrase those in terms of a commutative k-algebra S. The polynomial ring S[x], where x = x 1 , . . ., x n denotes the sequence of variables, has spectrum A n S = A n × Spec S, the affine space of dimension n over (the spectrum of) S.An ideal J ⊆ S[x] corresponds to a subscheme X ⊆ A n S , usually thought of as a family of subschemes of A n = A n k parametrized by (the k-valued points of) Spec S, or as a family of ideals of k[x].But if p is any prime ideal of S, maximal or not, then the ideal defining the fiber X p ⊆ A n p over p is a specialization of J, namely the extension Jκ p [x] of J to the polynomial ring over the residue field κ p = S p /pS p of p.
2.1.Constructible sets.Let S be a commutative k-algebra.A subset of Spec S is constructible if it is a finite union where each U i ⊆ Spec S is open and each C i ⊆ Spec S is closed.We assume access to algorithms that 1. compute unions and intersections of constructible sets, and 2. determine whether a constructible set is empty.See [BM16], for example.
The following is used in the proof of Theorem 2.5.
Lemma 2.1.Let S be a commutative k-algebra.For any n × m-matrix A with entries in S and column vector b ∈ S m , the set of primes p ⊆ Spec S such that the system Ax = b of linear equations has a solution over the residue field κ p is constructible in Spec S. If A has the same rank over every prime p ∈ Spec S, then this set is closed.
Proof.Let A ′ be the matrix obtained by appending the column b to A. For fixed p, the equation Ax = b is solvable over κ p if and only if A ′ has the same rank as A over κ p .Let U i and U ′ i be the subsets of Spec S where A and A ′ have rank at most i, respectively.As rank A ′ ≥ rank A in any case, the set of primes where the system is solvable is Each U i and U ′ i is closed, being the zero set of some minors, so this set is constructible.Finally, if the rank of A is constant, say rank(A) = r, then the system is solvable exactly over U ′ r , which is closed.Example 2.2.The linear equation t • x = 1 over S = k[t] is solvable if and only if t = 0, so this locus need not be closed when the rank of A in Lemma 2.1 varies.
For the sake of completeness we recall an algebraic version of Baire's theorem needed in the proof of Lemma 2.4, which is in turn used in the proof of Proposition 4.6.
Theorem 2.3 (Baire's Theorem).No irreducible scheme X of finite type over an uncountable field k is, as a topological space, a countable union of closed proper subsets.
Proof.As only the topology is in play, there is no harm in assuming that all of the schemes involved are reduced.Intersecting each subset in such a union ∞ i=1 Z i with the members of an affine open cover reduces to the case where X is affine.Hence X is a closed subscheme of A n , and its coordinate ring is a domain because it is reduced and irreducible.Noether normalization therefore reduces to the case X = A n , because it guarantees a finite surjective morphism to A dim X while preserving the fact that each Z i is a closed proper subset.
The goal is to show that ∞ i=1 Z i is a proper subset of A n given that each Z i is a proper closed subset.The proof is by induction on n, the case n = 1 following from the uncountability of k.Let H be a hyperplane that contains none of the (countably many) irreducible components of the Z i ; such an H exists-simplest is to choose it parallel to some given hyperplane-because k is uncountable.The induction is concluded by i=1 Z i be the union of disjoint nonempty constructible sets Z i .The proof is inductive on dim U , the case dim U = 0 being trivial.
For contradiction, suppose U is a finite union of intersections C j ∩ O j of closed irreducible sets C j and open sets O j .One of the intersections, say But this contradicts the hypothesis that the Z i are disjoint and infinitely many of them intersect C 1 .
2.2.The locus of fiber containment.For two schemes fibered over a fixed base scheme B, the methods in later sections rely on an ability to compute the locus of points in B where the fibers of the first scheme are contained in the fibers of the second one.In an affine setting, this locus is described by the Theorem 2.5.For terminology, a ring is connected if it has no nontrivial idempotents-or equivalently, if its spectrum is connected.For a polynomial f of total degree d in variables x = x 1 , . . ., x n , its homogenization is the homogeneous polynomial x n x 0 of degree d in x = x 0 , . . ., x n that yields f when x 0 is set equal to 1.The homogenization of an ideal I in a polynomial ring with variables x is the ideal I in the polynomial ring in x generated by If the quotient S[x]/ I 2 by the homogenization I 2 is flat over S, then this set is closed.
, and this is in turn equivalent to f i ∈ I 2 S p [x]+pS p [x] for all i.Therefore it suffices to treat the case where I 1 is principal, say . Suppose that I 2 is generated by the homogeneous polynomials q 1 , . . ., q r ∈ S[x] with degrees d 1 , . . ., d r , and let d = deg f .Consider the ansatz: The coefficients c i,a are considered as new unknowns, so Equation (1) can be regarded as a system of linear equations for the c i,a with coefficients in S. By construction, if and only if this system has a solution modulo p.Hence, the desired constructibility follows from Lemma 2.1.Now assume that S[x]/ I 2 is flat over S. Then the Hilbert function of S[x]/ I 2 ⊗ S κ p = κ p [x]/ I 2 κ p is locally constant as a function of p [Eis95, Ex 20.14], so it does not depend on p at all because S is connected.The short exact sequence implies that the Hilbert function of I 2 κ p also does not depend on p.But the value of this Hilbert function in degree d is the rank of the matrix on right-hand side of Equation (1) at p. Hence the closedness claim follows from the last part of Lemma 2.1.
Definition 2.6.The constructible set in Theorem 2.5 is the containment locus for I 1 in I 2 (or for X 2 in X 1 , where I i = I(X i )).Its intersection with the containment locus for I 2 in I 1 is the coincidence locus of I 1 and I 2 (or of X 1 and X 2 ).
Example 2.7.The loci considered in Theorem 2.5 need not be closed.Indeed, let S = k[s, t] and I 1 , I 2 ⊆ S[x] be defined by I 1 = x and I 2 = sx − t .Geometrically, V (I 1 ) is just the st-plane, while V (I 2 ) is the affine part of a blow-up of this plane at the origin.The fibers coincide exactly when t = 0 and s = 0. We now present an algorithmic version of Theorem 2.5.Algorithm 2.9.Compute the containment locus for two families over same base Input: ideals I 1 , I 2 ⊆ S[x] of families over a commutative k-algebra S Output: containment locus for x a q j of linear equations • indexed by monomials of degree d and • with coefficients in S matrix A with coefficients in S to represent L vector b with coefficients in S to represent f i (so L is given by Ac = b) A ′ := [A|b], the matrix obtained by appending the column b to A J 2.3.The locus of large fibers.Given a morphism of schemes X → B, we need to compute the locus B ≥d ⊂ B of fibers of dimension at least d.A deterministic algorithm for this task was given by Kemper [Kem07].The probabilistic algorithm presented here is therefore not theoretically required for algorithms in the rest of paper, but it is much easier to implement and we expect it to run faster.In particular, Algorithm 2.11 has allowed us to compute explicit examples, some of which are presented here.Note on conventions: Algorithm 2.11 and its proof assume (and implicitly use) that the field k is algebraically closed.The engine of the algorithm-and the only interesting part-is the following subroutine that takes a scheme affine over the base as input; it inherits the hypotheses from its parent algorithm where it is applied.
Routine 2.10.(affine case of fiber dim ≥ d) Proof of the claim.This is deduced by taking closures in projective space, where subvarieties of complementary dimension always intersect.Of course the projective closure of L is only guaranteed to intersect the projective closure of the fiber, but the difference between an affine algebraic subset and its projective closure has lower dimension.
The claim implies that L ′ ∩X in Routine 2.10 contains general points of Z, so B ≥d ⊆ B i .
It remains to prove that the output B i cannot be strictly bigger.Consider a component Q of any B i (not necessarily the output one).Assume the fiber over a general point of Q has dimension smaller than d.To finish, we have to prove that B i+1 = B i .Consider a fiber F over a general point q ∈ Q.Since dim F < d, a general subspace of codimension d in P n fails to meet the closure of F in P n , and this remains true in a neighborhood of q.Thus the general point of Q is not in the projection of L ′ ∩ X. Hence Q is not a component of B i+1 .
Remark 2.13.The algorithms in this paper do not assume that constructible sets are presented using radical ideals.In particular, the algorithm outputs might not be radical ideals.However, when comparing two constructible sets to discover containment or equality, it is sometimes simplest to take radicals.In the case of Routine 2.10, radicals could be used (this occurs explicitly in Example 5.3, which uses Algorithm 2.11); but for us it was faster to first run the subroutine a few times-with different linear formswithout computing radicals, and only later compare sets by computing radicals.

Detecting big group actions and multigradings
3.1.Group actions and families.Let G be an algebraic group (over k, as always), acting on affine n-space A n over k.The action is a morphism α : G×A n → A n , and it is assumed to be a left action, so γ.(γ ′ .ξ)= (γγ ′ ).ξ for points γ, γ ′ ∈ G and ξ ∈ A n over k.
The geometric action on A n is equivalent to an algebraic action on k[x]; for γ ∈ G and f ∈ k[x], the function f.γ sends ξ → f (γ.ξ) for all ξ ∈ A n .More formally, α induces a ring homomorphism α * : k where k[G] is the coordinate ring of G (not its group algebra over k), satisfying the axioms dual to the group action axioms.For any point γ ∈ G let ev γ : k[G] → κ γ be the evaluation map, meaning the algebra morphism corresponding to the inclusion {γ} ֒→ G. Then for a k-valued group element γ, the composition (ev γ ⊗ id) In the setting of schemes over G, the crucial families are the orbits.To define them, one more bit of general notation helps: for any two schemes X and B over k, write X B = B × X and consider it as a family over B. The reader will lose little by thinking always of B = G, as in the following definition.
Remark 3.2.On k-valued points, the orbit morphism is (γ, ξ) → (γ, γ.ξ).Geometrically, the orbit of X is a family over G whose fibers are the translates of X by group elements.The terminology comes from the case where X is a point ξ, because the projection of O G ξ to A n is indeed the G-orbit of ξ.
More formally, if X ⊆ A n is a subscheme, then γ.X is the fiber of O G X over γ ∈ G. Algebraically, X is defined by an ideal I ⊆ k[x], and O G X is defined by the ideal J ⊆ S[x], where S = k[G] and J = (ω * ) −1 (I).The ideal I.γ −1 defining the subscheme γ.X of the affine space A n γ over the residue field κ γ is a specialization of J, namely the extension Jκ γ [x] of J to the polynomial ring over the residue field of γ.
Remark 3.3.Images of ideals are much easier to compute than preimages.Therefore, in order to compute the ideal J above in a concrete case, it might be a good idea to first compute the inverse map of ω, which amounts to computing the map γ → γ −1 on G, and then obtain J as push-forward of I along that map.
The locus where an orbit is contained in any given family is always closed.
Corollary 3.4.If a subscheme X ⊆ A n is given and X 2 is the constant family X G or orbit O G X, then the containment locus of X 2 in X 1 is closed for any family X 1 over G.
Proof.The homogenization of a trivial family is trivial and hence flat; therefore the X G case follows immediately from Theorem 2.5.The O G X case follows by first applying the inverse ω −1 of the orbit morphism, then applying the X G case, and then applying ω.
Remark 3.5.Neither Corollary 3.4 nor its proof claims that the homogenization of an orbit must necessarily be flat over the group; that is, we do not require (or claim) that homogenizations of orbits satisfy the flatness hypothesis in Theorem 2.5.But inverse multiplication brings an orbit into a position where flatness does hold, and hence the closedness conclusion follows even if the flatness hypothesis does not.

3.2.
Finding big group actions.In this section, T is an algebraic group acting on affine space via a map β : T × A n → A n .We are interested in finding those elements of G which make a given subscheme X ⊆ A n invariant under T , or invariant under a subgroup of T whose dimension is as big as possible.For terminology, we say that a group acting on a space stabilizes a subspace if the subspace is preserved by the action (not necessarily pointwise); in contrast, we say that the group fixes a subspace if every point in the subspace is fixed by the group action.
Example 3.6.Let T = (k * ) n be the n-dimensional torus acting diagonally on A n .If X ⊆ A n is a subvariety (reduced irreducible subscheme) such that for some γ ∈ G the subvariety γ.X ⊆ A n is stabilized by a subtorus T ′ ⊂ T with dim T ′ = dim X, then by some definitions γ.X is already toric, and by others it becomes so after further rescaling the variables [ES96, Corollary 2.6].In the latter case, γ ′ .X is toric for some other γ ′ ∈ G if G ⊇ T .(Yet other definitions require X to be normal; we do not.) We start with the following useful lemma.
Lemma 3.7.The stabilizer of any ideal I ⊆ k[x] is a closed subgroup of T .Proof.For the scheme X ⊆ A n defined by I, the containment loci both for X T in O T X and for O T X in X T are closed by Corollary 3.4, so their coincidence locus is closed.If a subgroup T ′ ⊆ T stabilizes a subscheme X ⊆ A n , then the action of T restricts to an action of T ′ on X.We now consider the question for which γ ∈ G there is a large subgroup of T stabilizing γ.X.Proposition 3.9.Let X ⊆ A n be a closed subscheme.Let further G ′ ⊆ G be the locus of those γ ∈ G where the dimension of the stabilizer subgroup T (γ.X) ⊆ T is maximal.
Upper semicontinuity of fiber dimension locally on the source [Gro66, 13.1.3]implies that the subset Z ⊆ Y with maximal local fiber dimension is closed in Y .Therefore 1 Example 3.10.Proposition 3.9 says that stabilizer dimensions for fibers of orbits O G X G are upper semicontinuous.In contrast, semicontinuity can fail for families that are not orbits.The simplest instance has T = k * , S = k[s], and I = sx, x(x − 1) ⊂ S[x].Then V (I) is the union of the s-axis with the point (0, 1).So for s = 0, V (I) is stable under T , while for s = 0 it is only stable under the trivial subgroup of T .Thus, the locus where the stabilizer has maximal dimension is not closed.Algorithm 3.11.Act to make stabilizing subgroup of maximal dimension Input: two algebraic groups T and G acting on A n a closed subscheme coincidence locus Y ⊆ T ×G for X 1 and X 2 (Algorithm 2.9; see also Remark 3.8) maximal fiber dimension locus is specified by n vectors a 1 , . . ., a n ∈ Z r to serve as degrees of the variables: deg Remark 3.12.Details on multigraded algebra in general can be found in [MS05,Chapter 8].A Z r -multigrading on k[x] corresponds uniquely to the action on k n of the r-torus (k * ) r .(References for this are hard to locate.An exposition appears in Appendix A.1 of the first arXiv version of [KM05], at http://arxiv.org/abs/math/0110058v1.)An abelian group homomorphism Z n → Z r sending the standard basis to a 1 , . . ., a n corresponds (by applying the Hom Z (−, k * ) functor) to an algebraic group homomorphism (k * ) r → (k * ) n that is injective precisely when the multigrading is faithful.The assertion that deg x i = a i means that the j th generator τ j of the r-torus acts on x i by x i .τj = τ a ij j x i .Geometrically speaking, multigraded (i.e., homogeneous) ideals correspond to subschemes of k n that carry (k * ) m -actions.
The following is the detailed algebraic phrasing of Algorithm 3.11 when T is the standard algebraic n-torus acting diagonally on k n .Algorithm 3.13.Act to find a faithful multigrading of maximal rank Input: a nonnegative integer r, and vectors a 1 , . . ., a n ∈ Z r defining a faithful multigrading that makes I.γ homogeneous and r as big as possible define R : is generated by binomials, and 2. unital (cf.[KM14]) if it is generated by monomials and differences of monomials, meaning binomials x a − λx b with λ ∈ {0, 1}. 3. toric if it is unital and prime.
4.1.Algorithm to locate binomial models.We start by recalling the construction of comprehensive Gröbner bases [Wei92,MW10] and adapting it to our case.Let S be a domain which is a commutative k-algebra and let I ⊆ S[x] be an ideal.Fix any term order.Buchberger's algorithm for I over the generic point-that is, in the polynomial ring κ 0 [x] over the fraction field κ 0 of S-finds a reduced Gröbner basis.It finishes in a finite number of steps.In step i of the algorithm, one needs to assume that a leading coefficient f i ∈ S is nonzero.The output of the algorithm is a finite set of functions g j ∈ I. Consider the ideal J = i f i ⊆ S. We claim that over any point p ∈ Spec S V (J), the reduction of g j is the reduced Gröbner basis for the reduction of I. Indeed, over such a point the usual Buchberger algorithm makes exactly the same steps as the algorithm run over the generic point.Repeating the procedure for each irreducible component of V (J) yields: • a partition of Spec S into irreducible, relatively open sets U i ; and • for each U i a finite set of polynomials g ij in I that specializes over any point of U i to a reduced Gröbner basis of the reduction of I.
We call this data structure a relative reduced Gröbner basis.
The following algorithm forces all coefficients except for the leading coefficient and (at most) one other to be 0; more precisely, it computes the locus where this is possible.The result is the binomial locus because an ideal is binomial if and only if some (equivalently, every) reduced Gröbner basis consists of binomials [ES96, Corollary 1.2].
Algorithm 4.2.Find the locus of binomial fibers Input: commutative k-algebra S that is an integral domain ideal If z = 0 then the only point in V (I) is p 1 = (0, 2, 1), and if x = 0 then the only point is p 2 = (1, 1, 0).The map that fixes x and y but sends y → y + z makes I unital.
On the other hand, if τ ∈ (C * ) 3 then y(τ.p 1 ) = 1 or y(τ.p 2 ) = 1.As both cases are analogous, say y(τ.p 1 ) = 1.Any monomial evaluated on (0, 1, 1) is either 0 or 1.Further it is equal to 0 if and only if it is equal to 0 when evaluated on τ.p 1 .Thus if two monomials are equal when evaluated on τ.p 1 then they are also equal when evaluated on (0, 1, 1).Hence, any unital binomial or monomial that vanishes on τ.p 1 vanishes also on (0, 1, 1).If I.τ were unital, this would contradict the fact that τ.p 1 is the only point with z = 0.
The main idea of our algorithm is that unital ideals I can be characterized by the fact that the variety V (I) is closed under coordinatewise multiplication.It turns out to be more convenient to work with the algebraic counterpart of the multiplication, which is the diagonal map ∆.
Precisely, let ∆ : be the algebra homomorphism defined by ∆(x i ) = x i ⊗x i .This makes k[x] into a bialgebra.The induced map ∆ * : A n ×A n → A n is the coordinatewise multiplication map. 1.I is unital.2. I is a coideal with respect to ∆; that is, Proof.The implication "1 ⇒ 2" follows from the definitions, because The implication "2 ⇒ 1" is essentially due to Artin, cf.
Algorithm 4.5 works over an arbitrary base.The Section 3 setup, where the base is a group of ambient automorphisms, yields a further structural property of unital loci.
Proposition 4.6.The set of points γ ∈ G such that I.γ is unital is a finite union γ∈U G(I)γ of cosets of the stabilizer G(I).In particular, this set is closed.
Proof.First, k[x] has only countably many monomials.As every unital ideal is generated by finitely many monomials and differences of monomials, there are also only countably many unital ideals of the form I.γ.The set of points γ ∈ G such that I.γ is unital has the form γ∈U G(I)γ and is constructible by Theorem 2.5 and Proposition 4.4.Lemma 2.4 implies that the union has to be finite.Finally, stabilizers are closed by Lemma 3.7, so their cosets are, as well, and so are finite unions thereof.
Example 4.7.Under the componentwise action of the usual torus, any binomial prime ideal becomes unital-and hence toric-after rescaling the variables appropriately [ES96, Corollary 2.6].The prime assumption here is essential, as Example 4.8 shows.
Example 4.8.It need not be possible to find a group action-or any family with isomorphic fibers-taking a given ideal to a unital one, even if the original is a binomial ideal.Indeed, the ideal I = u 5 (u − v), v 5 (u − 2v) is binomial but C[u, v]/I is not (abstractly) isomorphic to a quotient of a polynomial ring R by a unital ideal J.
To see why, suppose such a J exists and consider R of smallest possible dimension.Since C[u, v]/I is supported at the origin (both u 11 and v 11 lie in I), the quotient R/J is supported at a single point.As J is unital, the variables can be numbered so that its support point is ξ = (1, . . ., 1, 0, . . ., 0).Extending J by all x i such that x i (ξ) = 0 then yields a reduced ideal [KM14, Theorem 9.12].Hence x 1 (ξ) = 1 ⇒ x 1 − 1 ∈ J, which contradicts minimality of dim R. Thus ξ = 0. Note that R/J has tangent space of dimension 2. Consequently, R = C[x 1 , x 2 ].Indeed, if dim R > 2 then J contains a binomial of the form x − g, where g is a monomial and x is a variable.If x ∤ g then x − g eliminates x, contradicting minimality of dim R.And if x | g then repeatedly replace x in g to get binomials of the form x − g i ∈ J with deg g i → ∞; the fact that R/J is Artinian proves that x ∈ J, again leading to a contradiction.
Since I is a complete intersection, J = f 1 , f 2 .Since R/J is supported at the origin, it equals its localization at x 1 , x 2 .As J is unital, Nakayama's lemma produces unital binomials b 1 , b 2 such that J = b 1 , b 2 as ideals of the localization R.More generally, minimal systems of generators of an ideal in a local ring have the same cardinality.
The local Hilbert function of C[u, v]/I implies that (i) neither b 1 nor b 2 has nonzero monomials of degree less than 6, and (ii) each of them contains a monomial of degree 6.Now note that there are, up to scaling, precisely two distinct pairs of nonzero elements ℓ ) for a + b = 6.Further, the exponents satisfy a = 1 and b = 5 or a = 5 and b = 1.Indeed, suppose ℓ 1,i , ℓ 2,i satisfy the above condition.If ℓ 1,i = u and ℓ 2,i = u − v (which provides one possible pair) it must be that for some λ ∈ C. Dividing by u 6 and setting t = v/u, the equality above means that the polynomial P (t) = λ(1 − t) + t 5 − 2t 6 has two roots of multiplicity a and b, respectively.Swapping if necessary, assume a ≥ 3. Vanishing of the second derivative forces the root to satisfy 20t 3 − 60t 4 = 0, i.e. t = 0 or t = 1/3.If t = 0 is the root of P (t), then λ = 0 and a second pair of linear forms {v, u − 2v} arises.When t = 1/3, nonvanishing of (d 4 P (t)/dt 4 )(1/3) means it can be a root of multiplicity at most three, and a second root of multiplicity three would be required, but none exists.The next goal is to exclude cases where b 1 , b 2 are monomials or fail to be homogeneous.So assume b 1 is a monomial or inhomogeneous binomial.Then b 1 has image x a 1 x 6−a 2 in R/ x 1 , x 2 7 ; without loss of generality assume it is x 5 1 x 2 , providing the first pair {ℓ 1,1 , ℓ 2,1 } = {x 1 , x 2 }.This forces b 2 to be homogeneous, as it would otherwise provide a second monomial, necessarily equal to x 1 x 5 2 , contradicting the fact that the pairs ℓ 1,i , ℓ 2,i are distinct for i = 1, 2. Hence, b 2 is a homogeneous degree 6 binomial.
Hence b 2 cannot be divisible by x 1 or x 2 and thus must equal x 6 1 − x 6 2 .But then there is no second pair of linear forms ℓ ) such that ℓ 5 1,2 ℓ 2,2 = 0, because a polynomial of the form λt + t 6 − 1 cannot have a root of multiplicity 3, so it must have more than two distinct roots.This concludes the proof that b 1 and b 2 are both homogeneous and that neither is a monomial.But this means that x 1 − x 2 divides both b 1 and b 2 , which contradicts dim R/J = 0.

Detecting toric ideals and varieties
This section presents an algorithm to check whether a given homogeneous prime ideal defines a variety that is abstractly isomorphic to a toric one (Section 5.2).While this could be done using our earlier algorithms, the hypothesis that I is prime allows significant simplifications (Section 5.1).5.1.Faster algorithm for fiber containment of an irreducible family.The procedure in Section 5.2 is made faster by the following alternative to Algorithm 2.9 in the special case that the ideal that is requested to be smaller (that is, I 1 ) has fibers that are known to be prime.The advantage is that we expect this algorithm to run much faster than Algorithm 2.9.
Algorithm 5.1.Compute containment locus families when one has prime fibers Input: ideal I 1 ⊆ S[x] with prime fiber I 1 κ p [x] for every prime ideal p ∈ Spec S ideal I 2 ⊆ S[x] Output: containment locus for I 1 in I 2 as a constructible set 5.2.Toric varieties.This section shows how to detect whether a projective variety is toric without any prespecified group or other family of ambient automorphisms.
Algorithm 5.4.Decide whether a normal projective variety is abstractly toric Input: normal projective variety X ⊆ P n Output: a projective toric embedding of X if it is toric, else false compute a projectively normal Veronese embedding of X [Har77, Exercise II.5.14] a homogeneous prime ideal I ⊆ S such that X = Proj(S/I) γ ∈ GL N such that I.γ −1 is toric (Algorithm 4.5) return γ.X or false, accordingly Theorem 5.5.Algorithm 5.4 is correct.
Proof.The re-embedding can be done by attempting successively higher Veronese maps and checking whether each is projectively normal.The cited source guarantees that this procedure terminates.
It remains only to show that if X is toric, then there really exists γ ∈ GL N such that γ.X is equivariantly embedded.The embedding of X distinguishes a very ample divisor L on X.If X is toric, then L is equivalent to a toric divisor L ′ by [CLS11, Theorem 4.2.1].Therefore, the projectively normal embedding yields a surjection Γ(P N , O(1)) → Γ(X, L).In particular, X is toric if and only if there exists an automorphism of P N under which I(X) goes to a toric ideal.But all automorphisms of P N are (projectively) linear, so the desired one is represented by some matrix γ ∈ GL N .
Remark 5.6.To check if a variety X is toric it is essential that X be projective.For example, it is an open problem to decide whether the affine variety defined by the ideal x + x 2 y + z 2 + t 3 ⊂ C[x, y, z, t, w] is isomorphic to A 4 [Mic17, Remark 5.3].

Conclusion
In retrospect, many of our algorithms apply not only to a group of automorphisms of an affine space but to an arbitrary family of transformations.To be precise, fix an arbitrary morphism α : Y × A n → A n , thought of as a family of maps A n → A n parametrized by Y .For a k-valued closed point η ∈ Y denote by α η : A n → A n the morphism obtained by composition of the isomorphism A n → {η} × A n and (the restriction of) α.Given an affine variety X ⊆ A n one may ask for the locus of points η ∈ Y such that α −1 η (X) is defined by a unital ideal.In the group action setting, where Y = G is a group and α is an action (Section 3.1), working with images and preimages are more or less equivalent: they amount to taking orbits for γ or γ −1 .But in this more general setting, working with preimages means computing inverse images of subschemes (images of ideals), which is trivial, instead of computing images of schemes (kernels of ring maps), which is a hard problem known as implicitization.Furthermore, the inverse image is closed, whereas for images of morphisms the global closure may be not compatible with closure fiberwise, which creates additional problems.Remark 6.1.Even using preimages of subschemes instead of images, extending our algorithms to this more general setting requires special attention.For example, although two families over Y can still be compared as in Algorithm 4.5, the dimension argument in Section 5.1 no longer necessarily applies.Remark 6.2.In contrast, the methods to test binomiality in Section 4.1 adapt verbatim to the case of arbitrary maps, as they only rely on comprehensive Gröbner bases.Remark 6.3.It is similarly easy to check if an ideal is generated by monomials in a similar way to Algorithm 4.2.Indeed, for each U i one only needs to check if it is possible for all coefficients of nonleading monomials to vanish.Alternatively, note that an ideal I ⊆ k[x 1 , . . ., x n ] is monomial if and only if it is stable under the whole torus T = (k * ) n and apply Algorithm 3.11.
In view of our results, we find the following three problems of particular importance.
Problem 1.Is the problem of determining if an affine variety is affine space decidable?Equivalently, is it decidable to test if a finitely generated k-algebra is a polynomial ring?Problem 2. Is the problem of determining if a projective (nonnormal) variety admits a torus action with a dense orbit decidable?Problem 3. Is the problem of determining if a given affine variety is toric decidable?
The last problem may be asked both for normal and arbitrary affine varieties.
Example 2.8.The flatness hypothesis in Theorem 2.5 is on I 2 and not simply on I 2 because flatness of S[x]/I over S does not imply that the homogenization S[x]/ I is flat over S. Take S = k[a, b] and I = ax − 1, by − 1 ⊆ S[x, y].Then S[x, y]/I ∼ = S[a −1 , b −1 ] is flat over S because it is a localization of S. But the homogenization of I is I = ax − z, by − z , and S[x, y, z]/ I = k[a, b, x, y]/ ax − by , which fails to be flat over the ab-plane for the same reason that (a, b) fails to be a regular sequence.
Algorithm 2.11.Find locus of big fiber dimension Input: integer d and morphism f : X → B of schemes over algebraically closed field k Output: closure B ≥d of the locus of points in B over which the fiber has dimension ≥ d compute open cover X = k j=1 X j by subschemes X j affine/B (note: X j affine suffices) define B ≤d j := affine case of fiber dim ≥ d applied to X j for j = 1, . . ., k returnB ≤d 1 ∪ • • • ∪ B ≤d kProposition 2.12.Algorithm 2.11 is correct.Proof.It suffices to prove Routine 2.10 works on an affine morphism because a fiber is large if and only if it is large in (at least) one member of an open cover of the source.So assume X ⊆ A n B .Fix an irreducible component Z of B ≥d .Claim.For a general point z ∈ Z and a general affine subspace L ⊆ A n of codimension d, the fiber f −1 (z) intersects L.

Remark 3. 8 .
The two containment loci in the proof of Lemma 3.7 are in fact equal, because I.τ ⊆ I ⇒ I.τ = I for τ ∈ T .Indeed, I.τ I implies I.τ i I.τ i−1 for all i ∈ Z (including negative i), contradicting the noetherian property of k[x].
and n images of standard basis elements in Z n /L expressed in the computed basis 4. Detecting binomial and unital ideals This section presents algorithms to decide whether I ⊆ k[x] can be made binomial or unital by an automorphism of k[x].Let us recall the relevant definitions.

4. 2 .
Algorithm to locate unital models.It is possible for a group G to have the power to transform a given ideal I into binomial form without G being able to transform I into unital form, even though a larger group G could succeed in making I unital.Trivial examples exist: any principal non-unital binomial ideal with G = {1} suffices.But it is even possible for G to contain the entire torus.(See also Example 4.8.)Example 4.3.Consider the binomial ideal I = xz, z(z−1), z(y−2), x(x−1), x(y−1) .

Proposition 4. 4 .
The following are equivalent for an ideal I ⊆ k[x].