Ans\"atze for Scattering Amplitudes from $p$-adic Numbers and Algebraic Geometry

Rational coefficients of special functions in scattering amplitudes are known to simplify on singular surfaces, often diverging less strongly than the na\"ive expectation. To systematically study these surfaces and rational functions on them, we employ tools from algebraic geometry. We show how the divergences of a rational function constrain its numerator to belong to symbolic powers of ideals associated to the singular surfaces. To study the divergences of the coefficients, we make use of $p$-adic numbers, closely related to finite fields. These allow us to perform numerical evaluations close to the singular surfaces in a stable manner and thereby characterize the divergences of the coefficients. We then use this information to construct low-dimensional Ans\"atze for the rational coefficients. As a proof-of-concept application of our algorithm, we reconstruct the two-loop $0 \rightarrow q\bar q\gamma\gamma\gamma$ pentagon-function coefficients with fewer than 1000 numerical evaluations.


Introduction
Precise theoretical predictions for collider experiments rely on increasingly higher order and higher multiplicity calculations of scattering amplitudes. The standard method of computation is to express the amplitudes in a basis of dimensionally-regulated master integrals, reducing the calculation to determining the associated prefactors. These are rational functions of the external kinematics and of the dimensional regularization parameter. However, due to the algebraic complexity of both intermediate stages and final results of analytic calculations, this poses a considerable challenge. To combat the difficulty of rational prefactor computations, in recent years it has become commonplace to compute loop amplitudes numerically over so-called "finite fields" [1,2], and subsequently obtain the analytic form of the result by making use of an appropriate Ansatz. By now there exist a number of advanced approaches for fitting specialized Ansätze from numerical evaluations. In cases where the target function is a rational function of an independent set of variables, then there exist "functional reconstruction" algorithms for an arbitrary number of variables [1][2][3][4]. In the multivariate case, these approaches reduce rational function interpolation to the simpler polynomial case where either Newton [2] or Vandermonde [4,5] approaches are used. By now these are sufficiently well understood that there exist public implementations [3,4,6]. An important recent success of the Ansatz approach is the calculation of a plethora of two-loop, five-point scattering amplitudes -both for fully massless configurations [7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][22] and for configurations involving one massive particle [5,[23][24][25]. Furthermore, we have also seen ground-breaking computations of three-loop four-point amplitudes made possible by these tools [26][27][28].
In this work, we focus on an important problem found when applying the Ansatz formalism to processes with a large number of scales. Specifically, as one considers scattering amplitudes that depend on an increasing number of scales, the complexity of functional reconstruction approaches grows exponentially. For example, the Ansätze used in the computation of the twoloop finite remainders for five-parton scattering required O(10 5 ) evaluations [12], while those for four partons and a W -boson required O(10 6 ) evaluations [5]. Despite these examples, there is growing evidence that more compact Ansätze for rational prefactors should exist. Firstly, if we look towards highly supersymmetric theories, we see that an Ansatz consisting of leading singularities made it possible to construct the full-color, two-loop, five-point amplitudes in N = 4 super-Yang-Mills theory with only 6 numerical evaluations [7,8]. Secondly, in Ref. [12], it was observed that, when amplitudes are expressed in a basis of "pentagon functions" [29], the denominators of the rational prefactors can be derived from the symbol alphabet of the associated integrals. This observation has led to efficient algorithms for determination of the denominator factors [12,30,31]. Finally, it has been observed that two-loop, five-point amplitudes in quantum chromodynamics (QCD) simplify when the rational prefactors are cast in different types of partial-fraction decompositions, see Refs. [13,23,32]. The Leȋnartas representation [33][34][35][36] has received particular attention with a number of algorithms for its computation [13,31,37].
Given this large body of evidence for the existence of compact Ansätze for rational prefac-tors, our aim is to develop an approach to algorithmically construct such Ansätze and thereby enable the analytic computation of two-loop, multi-scale amplitudes with dramatically fewer numerical evaluations over finite fields. To this end, we wish to exploit the well-known fact that gauge-theory amplitudes admit more compact representations when expressed in terms of spinor-helicity variables. This leads us to develop a framework based on the approach of Ref. [30], which has been applied to a number of other amplitudes [38][39][40]. In this approach, one takes a perspective on the organization of rational prefactors based on their behavior on singular surfaces. Specifically, rational prefactors are studied numerically near surfaces where one or more of the denominator factors vanish and this information is incorporated into an Ansatz. In order to set up this approach algorithmically, we formalize a number of its ingredients using methods from computational algebraic geometry. These methods have already found ample application in the scattering-amplitude literature (see, for example, applications to integrand reduction [41][42][43] and integration-by-parts relations [44]). Firstly, we interpret the spinor-helicity formalism in the language of algebraic geometry, allowing us to use the tools of Gröbner bases to understand and solve the problem of constructing linearly-independent polynomials of spinor brackets. Secondly, we discuss how singular surfaces often have multiple branches and we show how to systematically identify these branches by constructing the primary decomposition of an ideal associated to the singular surface. Thirdly, we show how the behavior of a rational function when approaching surfaces where multiple denominators are singular is encoded in its analytic structure. Specifically, we show that the numerator of the rational function must belong to a certain ideal, controlled by the geometry of the singular surface. The relevant tool is provided to us by the Zariski-Nagata theorem [45][46][47], which tells us to consider the so-called "symbolic power" of an associated ideal. In order to determine the singular behavior of the rational prefactors, we introduce a new numerical tool. Modern methods for two-loop amplitude calculation rely on the absence of precision loss when working over finite fields. However, finite fields lack a concept of scale separation that is required to probe singular configurations. To this end, we work in a middle ground provided to us by number theoretical techniques: the p-adic numbers (see Ref. [48] for an introduction). While these objects are a rich source of number theory, with their own notion of calculus, here we will only scratch the surface and use their properties as a field. One can regard them as bridging the gap between finite fields and floating-point numbers: p-adic numbers have natural expansions in powers of a prime p, and the first digit in such an expansion behaves like a finite field. This set of numbers comes associated with a concept of size, which allows us to perform numerical studies in singular configurations. At the same time, by working with large primes p, there is a low probability of numerical p-adic calculations involving a spurious scale hierarchy in intermediate stages. This makes it possible to control accidental precision loss in numerical computation. Combining this numerical tool with the algebro-geometric understanding, we then present an algorithm for the construction of Ansätze for rational prefactors, that can in principle be automated and applied to the computation of novel two-loop scattering amplitudes.
This article is organized as follows. In Section 2, we present algebro-geometric tools that allow us to understand functions on spinor space and perform a systematic study of the singular varieties of rational prefactors. Next, in Section 3, we give an introduction to p-adic numbers and explain how to generate numerical phase-space points on or near singular varieties. Thereafter, in Section 4 we collect the theoretical work of the previous section into an algorithm to generate compact Ansätze which leverage the singularity information. In Section 5 we make an example application of the algorithm to the 0 → qqγγγ finite remainder coefficients at two loops. Finally, we summarize and conclude in Section 6.

Algebraic Geometry and Spinor Space
Scattering amplitudes are transcendental functions of the external kinematics, which are typically evaluated on the set of four-momenta associated to the external states. For an n-point process, these are a collection of momenta {k 1 , . . . , k n } which satisfy on-shell and momentumconservation relations, that is where we use the all-outgoing convention. In the case of massless scattering, where m i = 0, it is natural to employ spinor variables instead of Mandelstam variables to describe scattering amplitudes. The connection between a massless four momentum k i and a pair of Weyl spinors (λ i ,λ i ), is made through the relation where σ µαα = (1, σ) denotes an Infeld-Van der Waerden symbol, and σ are the three Pauli matrices. We take the metric on spinor space to be the 2 × 2 Levi-Civita symbol ǫ αβ = ǫαβ = iσ 2 . The metric with lowered indices is then ǫ αβ = ǫαβ = (iσ 2 ) T , such that ǫ αβ ǫ βγ = δ γ α , where δ is the Kronecker delta. Raising and lowering of the indices is achieved by contraction with the metric, that is λ iα = ǫ αβ λ β i andλ iα = ǫαβλβ i . Spinor-helicity variables trivialize on-shell relations, while momentum conservation becomes a quadratic relation Invariant quantities can be built by contracting the spinors in so-called spinor brackets. We define them through the following contractions ij = λ α i λ jα and [ij] =λ iαλα j , (2.4) where the Einstein summation convention is implied over the spinor indices. Furthermore, we will make use of simple spinor chains, specifically we define For brevity, we will often denote an n-point phase-space point as (λ,λ). Physical functions of spinor variables satisfy a number of properties. Specifically, they have well-defined mass dimension and little-group weights. Working with some function E(λ,λ) with well-defined mass dimension means that if we uniformly scale all of the spinors by z then we find that E(zλ 1 , zλ 2 , . . . , zλ 1 , zλ 2 , . . .) = z 2[E] E(λ 1 , λ 2 , . . . ,λ 1 ,λ 2 . . .) , (2.7) where [E] is the mass dimension of E. If E has well-defined little-group weight k then this means that if we scale λ k by z andλ k by 1/z we find E(. . . , zλ k , . . . ,λ k /z, . . .) = z {E} k E(. . . , λ k , . . . ,λ k , . . .) , (2.8) where {E} k is the k th little-group weight of E. Importantly, this rescaling does not affect the validity of Eq. (2.2). We will always work with functions E with well-defined mass dimension and little-group weights. Finally, note that for such functions, it can be useful to compute the mass-dimension and little-group weights numerically via Eqs. (2.7) and (2.8).
Scattering amplitudes have well-defined mass dimension and little-group weights. The mass dimension depends only on the multiplicity of the process. For an n-point amplitude A n it is well known that the mass dimension is given by (2.9) The little-group weights depend on the helicity states 1 of the scattered particles, more precisely the k th little-group weight depends on the helicity state of the k th particle, denoted as h k . In the all-outgoing convention, the k th little-group weight is given by Beyond tree level, when working in dimensional regularization, a scattering amplitude can be decomposed as a linear combination of so-called "master integrals". Such a decomposition can be written as where the B i are rational functions of the spinors (λ,λ) and of the dimensional regulator ǫ, and the I i are transcendental functions thereof. It is well understood that amplitudes in gauge theory diverge in a universal way [49][50][51][52], (see Ref. [53] for a recent review). Specifically, after renormalization, these divergences can be written in terms of lower loop amplitudes and universal operators. That is, one can write n,R is the renormalized l − loop amplitude and we have introduced the so-called "finite remainder" H (l) n , which captures the new information at each perturbative order. In practice, one computes the finite remainder by inserting the ǫ expansion of the master integrals into Eq. (2.11) and subtracting the lower loop contributions in Eq. (2.12). The resulting expression for the finite remainder can be expressed in a basis of special functions. That is, in general we can write where the C i are rational functions of the spinors and the F i are special functions of the spinors. In this work, we consider the C i in common denominator form. Specifically, we write where n i is the number of denominator factors and the N i and D j are polynomials of spinors. As is well known, the amplitude only picks up a little-group rescaling under Lorentz transformations and so it can only depend on the spinors indirectly through the spinor brackets of Eq. (2.4). In practice, it is trivial to choose the basis of transcendental functions F i to also have this property, and so the coefficient functions inherit it as well. Importantly, the N i and D j all have well-defined mass dimension and little-group weights.
For the rest of this work, we shall work in a framework where we are able to numerically evaluate the C i over an arbitrary field. In practice, this may be when one has an explicit analytic form available, or an appropriate algorithm to compute the C i . Our aim is then to use this numerical information in an efficient way to determine the analytic form of the functions C i .

Rudiments of Algebraic Geometry
The coefficients C i in a scattering amplitude have been introduced in the previous section as ratios of polynomials, which are to be evaluated on inputs that satisfy momentum-conservation relations. In this section, we introduce basic technologies of algebraic geometry which will allow us to understand polynomials in this context in detail. We intend our presentation to be self-contained and we refer the reader to Refs. [54][55][56] for an introductory account of the requisite algebraic geometry.

Polynomials, Ideals and Varieties
The central object of study will be polynomials in spinor variables. Therefore, we consider the polynomial ring of spinor variables for n massless particles, S n = F λ 10 , λ 11 , . . . , λ n0 , λ n1 ,λ 10 ,λ 11 , . . . ,λ n0 ,λ n1 , (2.15) where F is the coefficient field and the variables are the various λ iα andλ jα . All polynomials in spinor variables are elements of S n . For example, the spinor brackets defined in Eq. (2.4) can be identified as elements of S n . Furthermore, constraints on the spinors, such as momentum conservation (2.3) or being on a particular surface, are expressed using elements of S n . Here, and throughout this work, we shall abstract over the field F. In practice, we can consider F to be the rational numbers Q, the real numbers R, the complex numbers C, a finite field F p or the p-adic numbers Q p , which we will discuss in Section 3.1. For theoretical considerations, such as considering the geometry, we will always work in an algebraically closed field such as the complex numbers. For practical calculations, we will be working over finite fields or p-adic numbers. Throughout this work, we will take this polynomial perspective as our foundation. This perspective explicitly breaks Lorentz covariance in intermediate stages of our calculation, as we work in a given frame. Furthermore, the ring S n contains unphysical polynomials, such as ones without well-defined mass dimension and little-group weight. We will return to the question of imposing these constraints in Section 2.2.

Ideals.
The key algebraic object that we use is a so-called ideal. We will work with rings, such as polynomial rings, in which ideals are finitely generated. Specifically, we consider a set of elements {p 1 , . . . , p k } ∈ A called generators and define an ideal of A as Here, as we will work in a number of rings, we extend the . . . notation of Ref. [54] with a subscript to denote the ring under consideration. When discussing an ideal we typically label it as J or K. From the definition in Eq. (2.16), it is clear that an ideal always forms a subset of the ring A. In the case where the subset is proper, that is when we have an ideal J such that J A, we say that J is a proper ideal. We refer to the set {p 1 , . . . , p k } as a generating set of the ideal. In practice we will always consider physical generating sets, i.e. sets in which each p i has well-defined mass dimension and little-group weight. Furthermore, we will often consider ideals that are generated by multiple elements which can be grouped into an object with some open spinor index. In this case we will use a natural shorthand where we do not write the individual generators, but only the object with an open index. As a simple example consider λ jα Sn Multiple generating sets may correspond to the same ideal, i.e. they are not unique, and different generating sets of the same ideal may have a different number of elements. For any ideal J, there exist generating sets with a minimal number of elements and any such generating set is called a minimal generating set. The size of a minimal generating set is denoted by µ(J) = min |G| : G is a generating set of J , (2.18) where |G| denotes the number of elements of the generating set G. While still not unique, we will always present ideals through minimal generating sets. For ideals generated by homogeneous polynomials, such as those which we consider, minimal generating sets can be determined algorithmically 2 . In practice, we will always have a generating set of the ideal at hand. A trivial example of an ideal is the ideal generated by the zero element of the ring. This is the set containing only the zero element, that is As algebraic objects, ideals have natural algebraic operations associated to them. For example, we will make use of the ideal sum, which we define through Furthermore, one can take the ideal product. Given two ideals J = p 1 , . . . , p a A and K = q 1 , . . . , q b A , we define the ideal product JK as that is, the generators of JK are the products of the generators of J and K. It is clear that the ideal product is commutative, i.e. JK = KJ. It will also be useful to consider the ideal power J k , which we define recursively through When working with an ideal J in S n , we will often be interested in other ideals which can be constructed from J by parity or permutations of the associated spinors. We define a permuted ideal through where σ is a permutation of {1, . . . , n}. We will also consider the parity conjugate ideal J defined by a swap of the λ andλ spinors, that is In practice, one computes generating sets of the these ideals by applying the permutation/parity conjugation to the generators of J.
Algebraic Varieties. Now, note that for n-point spinor space, we can regard the tuple of spinor variables {λ 10 , λ 11 , . . . , λ n0 , λ n1 ,λ 10 ,λ 11 , . . . ,λ n0 ,λ n1 } as taking values in the 4n-dimensional space F 4n . Physical spinors are constrained to satisfy momentum conservation according to Eq. (2.3). It is therefore natural to consider the set of solutions of momentum conservation in F 4n , which defines a so-called algebraic variety. In general, we can associate a variety to any ideal in S n . That is, given an ideal J = p 1 , . . . , p k Sn , the associated algebraic variety is defined as From this definition it is clear that V (J) ⊆ F 4n for any ideal J. While we have defined an algebraic variety over an arbitrary field F, many powerful theorems of algebraic geometry can be applied only when F is an algebraically closed field, such as the complex numbers. In this paper, we will always work over these fields when considering geometry. We remark that the definition of a variety in Eq. (2.25) allows varieties to be "reducible", an important fact we shall return to in detail in Section 2.3. We note two trivial cases: V ( 1 Sn ) corresponds to the empty variety and V ( 0 Sn ) corresponds to all of F 4n .
In the same way that we have just associated a variety to an ideal, we can naturally associate an ideal to a variety. Specifically, for a variety U in F 4n it turns out that the set of polynomials that vanish on U forms an ideal, which is defined as (2.26) Application to Momentum Conservation. To understand these ideas in a physical context, consider the ideal of S n generated by the four momentum-conservation polynomials of Eq. (2.3), which we denote as (2.27) We will refer to J Λn as "the momentum-conservation ideal". Physically, J Λn is the set of all polynomials in spinor variables which are rewritings of zero. The associated variety is the set of points in spinor space that satisfy momentum conservation. We dub this the "momentum-conservation variety" and it is denoted as V (J Λn ). All varieties of interest in this work will be sub-varieties of V (J Λn ), as physical configurations of spinors must satisfy momentum conservation. We note that That is, the momentum-conservation ideal contains all polynomials which vanish on the momentum-conservation variety. In an algebraically closed field, the operation in Eq. (2.28) of taking the ideal associated to the variety associated to an ideal corresponds to taking the radical of an ideal [54,Chapter 4], which we will denote as √ J = I(V (J)) .

(2.29)
If it is the case that √ J = J, then the ideal J is said to be "radical" (see Appendix A for the algebraic definition). Therefore, we see that Eq. (2.28) says that J Λn is radical.

Independent Sets and Dimension
A natural question to ask of any geometric structure is its dimension. Varieties, as surfaces defined by algebraic equations, indeed have a concept of dimension that we can associate to them. Furthermore, one can also associate a concept of dimension to an ideal. In this section, we introduce the concepts relevant for our work and refer the reader to Ref. [56,Section 6.3] for a deeper treatment.
In order to ease the discussion, we will work over the polynomial ring F[X 1 , . . . , X n ]. We will denote the collection of variables as X = {X 1 , . . . , X n }. We will further denote a subset of the variables as Y ⊆ X. To begin phrasing the question of dimension we ask if the variables Y can be chosen independently on the variety V (J). The important observation is that the answer will be 'no' if there is some polynomial in the ideal J which depends only on the variables Y . If there is no such polynomial, then the variables are not constrained in terms of each other, and so the variables Y can be chosen independently. We can formally state the question of the existence of such a polynomial by considering the associated elimination ideal defined as 3 that is, the intersection of the ideal J with the set of all polynomials which depend only on the variables Y . An independent set Y of a proper ideal J is defined by requiring that the associated elimination ideal J Y contains only the zero element, that is Furthermore, an independent set is said to be maximally independent if there exists no other independent set which contains it. That is, Note that, in the general case, not all maximally independent sets need be of the same length.
With the definition of independent sets in hand, we can now discuss dimension. Specifically, for a proper ideal J of a polynomial ring F[X], the dimension of J is defined as That is, the dimension of the ideal is the length of the largest independent set. It is clear that this length is unique, as there will always exist at least one independent set (the empty set) and we take the length of the largest independent set. The dimension of the variety associated to J is defined as dim V (J) = dim(J) . (2.34) To build intuition, consider the trivial ideal 0 A . In the case where A is a polynomial ring, as there are no constraints, dim 0 A naturally coincides with the number of variables. As a second example, consider a case where V (J) corresponds to a finite set of points, then all variables are fixed on each point and so there is no non-empty independent set. One thus finds that dim(J) = 0. Naturally, J is called a zero-dimensional ideal. Importantly, efficient algorithms exist to compute both the maximally independent sets of an ideal J and dim(J) given a Gröbner basis of J, see e.g. Ref. [56,Proposition 9.29] 4 . Finally, we introduce the notion of codimension of an ideal. Specifically, for a proper ideal J in a ring A, we define (2.35) With this language then we see that Intuitively, this can be regarded as the number of constraints imposed by the generators of an ideal. We remark that the number of constraints may be less than the number of generators.
If the codimension of an ideal is equal to the length of its minimal generating set, we say that this ideal has maximal codimension, that is For example, the momentum-conservation ideal J Λn is of maximal codimension.

Gröbner Bases
In order to make practical use of the concepts that we present in this paper, two major tools are polynomial reduction and Gröbner bases. Here we review these objects in order to set up notation but, as these are common tools in the particle physics literature, we refer the reader to Ref. [54] for a pedagogical introduction. As we work in a number of polynomial rings, in this section we shall maintain the generic notation introduced in the previous section. A polynomial ring F[X], with X = {X 1 , . . . , X n }, can be viewed as a (countably) infinitedimensional vector space -the direct sum of one-dimensional spaces corresponding to the monomials, which we denote as where α ∈ Z n ≥0 . That is, each α i is a non-negative integer. A polynomial p in F(X) takes the form where only a finite number of c α are non-zero. A useful structure to put on the space is a socalled monomial ordering, denoted by . This is a (total) ordering of the exponents α of the monomials. Common orderings are "lexicographic" and "degree reverse lexicographic". Both of these orderings depend on an underlying ordering of the variables X. Unless otherwise stated, throughout this work we use the degree reverse lexicographic ordering. Given an ordering , one can organize the terms of any polynomial and thereby define a lead monomial, given by where the maximum is taken over the set with respect to the ordering . An important application of the lead monomial of a polynomial is to define the concept of reducibility of one polynomial by another. Specifically, one says that p is reducible by h if the lead monomial of h is a factor of the lead monomial of p, that is where we use x | y to denote that y is a factor of x. If y does not factor x we write x ∤ y.
If the lead monomial of h is not a factor of the lead monomial of p then we say that p is irreducible by h. Given a set of generators H = {h 1 , . . . , h k } of an ideal J, one can then discuss polynomial reduction. Specifically, it turns out that one can always write a polynomial p as where ∆ H (p) is irreducible by any of the h i . The object ∆ H (p) is of fundamental importance and is known as the remainder modulo H. An important feature of remainders is that they are linear combinations of monomials that are irreducible by the given generating set, that is Here irreds(H) is the set of exponents whose associated monomial is not a (polynomial) multiple of the lead monomial of any element of the set H. The aim of introducing the remainder ∆ H (p) is to define a canonical form of p when working modulo elements of the ideal J. However, it turns out that the remainder modulo H is not uniquely determined by the ordering and the ideal J that it generates. It also depends on the details of the set H. Specifically, if a polynomial is reducible by an element of the ideal J it may not be reducible by an element of the generating set H. However, given an ordering , there exist special generating sets of J that do uniquely determine the remainder. These are known as Gröbner bases. We denote a Gröbner basis of an ideal J as G(J). General algorithms exist to compute Gröbner bases, which are implemented in many computer algebra systems. Remainders modulo a Gröbner basis have the important property that if p is in the ideal, then the remainder is zero. That is, (2.44) Organizing Vector Spaces by Ideals. A useful application of Gröbner bases is to split a subspace of a polynomial ring into a subspace that belongs to an ideal, and a remaining subspace. Specifically, consider the polynomial ring F[X], an ideal J of F[X] and a finitedimensional vector space W that is a subspace of F[X]. Using J, one can split the space W into a direct sum as The left summand (W ∩ J) is the subspace of W formed by all elements that are also elements of J. The right summand W/(W ∩ J) is the quotient of W by this subspace. W/(W ∩ J) can be considered as the space of elements of W modulo the elements of J. To make practical use of the decomposition in Eq. (2.45), we now discuss how to find a basis of the two summand spaces.
Let us first consider how to find a basis of W ∩ J given a basis Ω = {Ω 1 , . . . , Ω dim(W ) } of W . We recall from Eq. (2.44) that all elements of J have zero remainder modulo G(J). As polynomial division acts linearly on W , we consider the remainders of the basis elements, ∆ G(J) (Ω j ). Recall that these remainders can be expressed in terms of monomials irreducible by G(J), that is , Ω) is the F-valued matrix of coefficients of the remainder of Ω j when expressed in terms of the monomials X β i . Note that for ideals that are not zero dimensional, irreds(G[J]) is an infinite set. However, as in practice the degree of Ω j is bounded, the sum is always finite. Clearly, one can linearly express the remainder of any element of W in terms of the ∆ G(J) (Ω j ). Therefore, we see that any element w of W ∩ J takes the form where c j ∈ F. Eq. (2.47) states that the c j live in the nullspace of the F-valued matrix ∆ ij (G[J], Ω). A basis of this nullspace can be computed with standard linear algebra techniques. Through Eq. (2.47), we then arrive at a basis of W ∩ J. Next, we consider how to construct a set of elements of W that form a basis of W/(W ∩ J) when considered modulo elements of W ∩ J. Specifically, we show that one can choose a subset of the basis elements of W using standard linear-algebra techniques. To see this, note that W/(W ∩ J) is isomorphic to the space spanned by the remainders modulo G(J) of the elements of W . Furthermore, considering i as a row index and j as a column index, this space is isomorphic to the column space of the matrix ∆ ij (G[J], Ω). We then see that , Ω). We note that the subset of Ω that is chosen as a basis by this algorithm depends on the ordering of the elements of Ω. Specifically, elements of Ω that occur earlier in the set are prioritized.

Quotient Rings
When considering physical polynomials in spinor variables, i.e. polynomials subject to momentum conservation, it is easy to see that the polynomial ring S n is redundant. Specifically, we wish to consider a number of elements of S n as equivalent: those which can be converted into each other by application of the momentum-conservation identity. In numerical applications, where one only has access to evaluations of functions on points (λ,λ) ∈ V (J Λn ), this is essential: any two polynomials p, q ∈ S n that are equivalent under momentum conservation will evaluate to the same value on such a point. Hence, the momentum-conservation ideal induces an equivalence class of polynomials: we wish to consider two polynomials in S n which can differ by some element of J Λn as equivalent. That is, for p, q ∈ S n Working in a polynomial ring up to equivalence by an ideal means that we work in a quotient ring. Specifically, all independent spinor polynomials given momentum conservation belong to the quotient ring R n = S n /J Λn . (2.50) Returning to Eq. (2.49), both p and q belong to the same equivalence class in R n , and we say that p and q are representatives of this equivalence class. In order to represent elements of quotient rings, one can make use of Gröbner bases. Specifically, if two elements p and q are equivalent then their difference belongs to the ideal J Λn and so Rearranged, this means that the remainders of p and q are equal. Therefore, elements of a quotient ring are uniquely (canonically) represented by their remainders modulo a Gröbner basis. For a recent application of polynomial quotient rings in other areas of particle physics see Ref. [58]. In this work, we will refer to R n as the set of "physically inequivalent" polynomials.
Ideals and Varieties in Quotient Rings. It is clear from the definition in Eq. (2.16) that we can consider ideals in polynomial quotient rings. Ideals in polynomial quotient rings are also finitely generated and one can represent generators by a representative of the equivalence class. Let us denote a polynomial ring by A, an ideal of A by J and consider the polynomial quotient ring A/J. It turns out that, for computations involving an ideal K of A/J, we can perform the computation using an ideal in the polynomial ring A which corresponds to K. Therefore, we are able to continue to use Gröbner basis technology when working with polynomial quotient rings. Let us concretize the correspondence as follows. Let us denote the generators of J as {q 1 , . . . , q l }. We introduce a map π A,A/J which takes an ideal of A to an ideal of the quotient ring A/J. Explicitly we have where the p i on the right hand side are understood as representatives of the equivalence class. The map π A,A/J is many-to-one, but if one restricts the domain to ideals K of A which contain J, then the map is one-to-one [56,Lemma 1.63]. Given this restriction, the π A,A/J has a unique inverse given by Consider R n , this means that, given an ideal J of R n , one appends the generators of J Λn to find the corresponding ideal in S n . The map π A,A/J has a number of applications. For instance, given a representative q of an element of A/J and an ideal K of A/J, we define the remainder of q modulo a Gröbner basis of K through where the right hand side is again a representative of an element of A/J. This allows us to apply the vector space organization technology of Section 2.1.3 also in quotient rings. Moreover, π A,A/J induces a definition of dimension of ideals in the quotient ring. Specifically, we define dim p 1 , . . . , p k A/ q 1 ,...,q l A = dim ( p 1 , . . . , p k , q 1 , . . . , q l A ) . Furthermore, π A,A/J gives a natural way to understand the geometry of ideals in a quotient ring. Specifically, we can apply the correspondence and consider the variety associated to the associated ideal in S n , i.e. we define Therefore, all varieties associated to ideals in R n are sub-varieties of the of the momentumconservation variety V (J Λn ).
Finally, we point out that we will also make use of ideals of R n generated by the application of a permutation or parity operation as denoted in Eq. (2.23). Similar to the S n case, one can compute generating sets of these ideals by applying the permutation and/or parity operation to the generators in R n . This follows as the momentum-conservation ideal J Λn is invariant under permutations and parity.

Linearly Independent Polynomials in Spinor Brackets
In the previous subsection, we set up an algebro-geometric framework to understand spinor space. We have seen that all polynomial functions on V (J Λn ) are contained in R n . In practice, when discussing scattering amplitudes, we are only interested in a subset of these functions: those which are Lorentz invariant up to a little-group rescaling. In this sense, the ring R n is a superset of the polynomial functions relevant for scattering amplitudes. Furthermore, R n is the set of spinor polynomials up to equivalences induced by momentum conservation. For the purposes of making an Ansatz, it is necessary that there are no linear dependencies between the Ansatz elements. In this section, we discuss how we resolve these two issues.
The Bracket Subring. Our aim is to understand the set of physically inequivalent polynomial functions which are Lorentz invariant, up to a little-group rescaling. These form a subset of R n , which we denote by where Λ is a Lorentz transformation which is continuously connected to the identity and Z (Λ,a) is an element of GL(1) corresponding to a little-group rescaling of a when acted on by Λ. One can show that R n is a ring. Therefore, as a subset of R n which is also a ring, R n is a subring of R n . From a physical perspective, it is clear that R n is composed of polynomials which can be described in terms of spinor brackets. Therefore, we refer to R n as the bracket subring. In order to work with R n in practice, it is convenient to reformulate it in a way that manifests the Lorentz transformation properties of its elements. To this end, we will observe that we can describe R n as a polynomial quotient ring. In this formulation, one can then use Gröbner basis technology for standard operations, such as finding a canonical form of elements of R n , checking equivalence of elements of R n and intersecting a subspace of R n with an ideal of R n . Let us consider a polynomial ring where we label the variables by the independent spinor brackets for n particles, S n = F 12 , 13 , . . . , (n − 1)n , [12], [13], . . . , [(n − 1)n] . (2.59) We note that S n is a polynomial ring in 2 n 2 variables, that is we choose our variables to be ij and [ij] for i < j. We stress that, in the context of S n , the spinor brackets are to be considered as variables and not as polynomials in R n . It can be shown (see Appendix C) that R n is isomorphic to a polynomial quotient ring as Here, for ease of notation, for brackets with j ≥ i we make use of the identities Physically, J Λn is the set of relations between spinor brackets generated by the momentumconservation identities, and K Λn and K Λn are the set of relations generated by the Schouten identities. Eq. (2.60) says that R (q) n is the set of inequivalent spinor bracket polynomials under this set of identities.
It is natural to ask what happens if we consider of the set of elements of an ideal J of R n that can be expressed in terms of spinor brackets. Mathematically, we are inquiring about the object J ∩ R n . Importantly, it can be shown that J ∩ R n is an ideal of R n . To be able to perform practical computations with J ∩ R n , we wish to find the ideal in R (q) n to which J ∩ R n maps. Specifically, we need to be able to construct a generating set of this ideal. To this end, we will make use of the correspondence between ideals of polynomial rings and polynomial quotient rings discussed in Section 2.1.4 and begin by working with the polynomial rings S n and S n . Consider the augmented polynomial ring that is, a polynomial ring whose variables are both the spinor brackets and the spinor variables. It is clear that Σ n contains both S n and S n as subrings. Given an ideal J = p 1 , . . . p k Sn we construct the ideal Here, κ[J] is generated by the generators of the ideal J, as well as by the relations between the spinor brackets and spinor variables 5 . It can be shown (see Appendix C) that the set of elements of J that can be written in terms of spinor brackets correspond to the ideal of S n given by This intersection is an example of elimination of variables and can be computed in practice via Gröbner basis techniques, see e.g. Section 2.4.3 of Ref. [55]. We can then use the correspondence map to understand the ideals of R (q) n associated to ideals of R n . Combining this with the isomorphism in Eq. (2.60), for an ideal J of R n we have that where the right hand side is the ideal in the polynomial quotient ring formulation of R n . As a first example of this technology, one can consider the situation where we wish to find the ideal in S n corresponding to 0 Sn . A Gröbner basis calculation shows that that is, we have only generated the Schouten identities. A less trivial example is to find the ideal in S n which corresponds to J Λn . One finds that Here, we now pick up both momentum-conservation and Schouten identities.
Physical Polynomial Space. In this work, our aim is to construct compact Ansätze for the rational prefactors. So far, we have discussed the polynomials relevant for the numerators of rational prefactors in scattering amplitudes as living in the spinor bracket ring R n . However, this is an infinite dimensional vector space, and so this information is insufficient for the construction of a finite Ansatz. Nevertheless, physical polynomials, such as numerators of rational prefactors, have well-defined mass dimension and little-group weight. This leads us to define the space of independent bracket polynomials with a well-defined mass dimension d and little-group weights φ k , Note that as the mass dimension d is fixed, M d, φ is a finite-dimensional vector space over F. If we can find a basis of M d, φ , we can use this basis as an Ansatz for the numerator polynomial. Furthermore, any Ansatz for the numerator polynomial must be expressible in terms of a basis of M d, φ . Therefore, this basis is a natural starting point for refined Ansätze with special properties. We will now describe an algorithm to construct a basis of M d, φ . There are two problems we need to solve. First, we must construct elements of R n which are linearly independent. It is clear from the definition of R (q) n that monomials in M d, φ are related by momentum-conservation and Schouten identities. Second, we must impose the constraints of fixed mass dimension and little-group weight. We note that other methods have been put forward to build a basis of M d, φ , see e.g. Ref. [59,60]. Our methods make use of general features of the algebra of polynomials and we expect them to have wide applicability to many problems. The approach that we employ here was previously also used in Ref. [42], where the problem was finding a linearly independent set of monomials in loop momentum on a given generalized unitarity cut.
As R n is isomorphic to a polynomial quotient ring in spinor brackets, all elements can be expressed as linear combinations of monomials in the spinor brackets, which we denote as where α ij and β ij belong to Z ≥0 . It will turn out that we can pick a subset of the monomials in spinor brackets as basis elements. Specifically, we will show that That is, M d, φ is the set of all F-linear combinations of the elements of M d, φ , the set of spinor bracket monomials whose exponents lie in the finite set X d, φ . Our task is to determine the set of exponents X d, φ such that the associated monomials have mass dimension d, little-group weights φ and are linearly independent elements of R n . To begin, we discuss the structure of R n as an F-vector space. As it is a ring, it is an infinite-dimensional vector space. Physically, a basis of R n as an F-vector space gives a set of linearly independent polynomials in spinor brackets when one takes into account the momentum-conservation and Schouten identities. To resolve these identities, consider a polynomial quotient ring A/J, where A is a polynomial ring over the field F and J is an ideal of A. We recall from Section 2.1.3 that elements of A/J can be uniquely expressed as an F-linear combination of monomials that are irreducible by the Gröbner basis G(J). Therefore, we see that the monomials which are irreducible by G(J) form a basis of A/J as an F-vector space [54, Chapter 4.3, Proposition 4]. Recall from Eq. (2.60) that R n is isomorphic to the polynomial quotient ring R (q) where G(J Λn + K Λn + K Λn ) is the Gröbner basis associated to momentum-conservation and Schouten identities. Note that the statement that a polynomial is reducible can be stated as a set of simultaneous linear inequalities. That is, all of the elements of (α, β) must be greater than or equal to the corresponding entry in the exponent of LM(g). The irreducibility constraint, Eq. (2.74), is the complement of this. In summary, monomials m (α,β) which satisfy the irreducibility constraint form a basis of R n as an F-vector space. The constraints of fixed little-group weight and mass dimension translate to linear constraints on the exponents (α, β). First, we consider mass dimension: all spinor brackets have unit mass dimension, so we can easily write the mass dimension of a monomial m (α,β) as (2.75) Next, we consider little-group weight of a monomial m (α,β) . It is clear that are the little-group weights of the angle and square brackets respectively. It is interesting to note that, as the α ij and β kl are non-negative, Eqs. (2.75) and (2.76) cut out a convex polytope.
Together with the irreducibility constraints (2.74), the constraints of mass dimension (2.75) and little-group weights (2.76) on (α, β) define the set of exponents X d, φ . To solve these equations, first note that the exponents (α, β) are non-negative integers. The space cut out by our equations is bounded, and therefore X d, φ is finite. Solving these equations is then reduced to enumerating their solutions. Efficient algorithms to enumerate such non-negative integer solutions are commonly implemented in computer algebra systems 6 .

Geometry of Singular Varieties
Let us consider the rational functions C i from Eq. (2.14) and in particular the set of all their possible denominator factors D = {D 1 , . . . , D n i }. In general, this set will depend on the specifics of the considered external kinematics, together with the definitions of the functions F. As an example of typical elements of the set D we can consider all spinor brackets from Eq. (2.4). We wish to study the behavior of the rational coefficients when considered near varieties on which some subset of the denominators D vanishes. We dub these varieties "singular varieties" 7 . Conventional examples are configurations where external particles become soft or collinear. We denote a singular variety as for some subset of the denominators {D γ 1 , . . . , D γm } ⊆ D. We note that, by definition, the variety U γ corresponds to an ideal which we dub a "singular ideal". In practice, we will only be considering ideals generated by one or two denominator factors, i.e. the cases m = 1 or m = 2.
A key feature of the algorithm we present in this paper will be to generate numerical configurations of spinors which lie close to singular varieties in order to determine how fast a given rational expression diverges close to the singular variety. This procedure is complicated by the fact that the singular varieties may branch and that the degree of divergence may differ close to different branches of the same variety. Therefore, we will find it necessary to be able to control which branch we are approaching numerically. The remainder of this section reviews in general terms the geometric and algebraic concepts related to branching. We refer the reader to Section 4 of Ref. [54] for more details.
Irreducible Varieties. The key geometric concept related to branching is that of reducibility of a variety. The object that we wish to consider is that of an irreducible variety. A variety U is defined to be irreducible if (2.80) In our case, the varieties U γ in Eq. (2.78) may well be reducible. A reducible variety U can be written as a proper union of sub-varieties and there exists a minimal decomposition where n B (U ) is the number of varieties in the decomposition, each U k is irreducible and U i ⊆ U j for all i = j. We call each U k a "branch" of U and this last condition is that no branch is contained within another. A minimal decomposition is unique, up to the order of the branches U k [54, Section 4.6, Theorem 4]. Importantly, the reducibility of a variety may not be manifest from the set of equations used to define it. Our task is now to discuss how to understand the decomposition of Eq. (2.81) algebraically so that one can perform the decomposition systematically.
Ideals Associated to Irreducible Varieties. To understand the decomposition of varieties in an algebraic fashion, let us start by considering an ideal J, its associated variety U = V (J) and its minimal decomposition U = Here we have judiciously labeled the ideal as P , which hints at the fact that the ideal associated to an irreducible variety is prime (see Appendix A for the algebraic definition).
A reasonable expectation could be to express J in terms of the P k 's. However, recall that in general J = I(V (J)), as this requires the ideal to be radical (see Eq. (2.29)). In fact, it turns out that the algebraic analogue of a minimal decomposition of U , called a minimal primary decomposition, expresses J as where each Q l is primary (see Appendix A for the definition), all √ Q l are distinct, and no Q l can be removed from the intersection without changing the result, i.e. Q m l =m Q l . We stress that the intersection of ideals should be viewed considering the ideals as infinite sets of polynomials. We call each Q l a primary component of J and we denote the number of primary components as n Q (J). The radical of each primary component Q l is a prime ideal i.e. a primary ideal is also prime only if it is radical. As P l is the prime associated to Q l , we say that Q l is P l -primary. We call the set of primes associated to all the primary components of J the set of associated primes. To this end, we write assoc(J) = P 1 , . . . , P n Q (J) . (2.85) It can be shown that the associated primes in a minimal primary decomposition are unique [61,Theorem 4.5]. We call an associated prime P i of J a minimal prime if P i ⊇ P j for all i = j.
We define the set of minimal associated primes of J as It can be shown that the set of primary components Q k of J for which √ Q k is a minimal prime of J is unique [61,Theorem 4.10].
Let us now address the relation between the minimal primary decomposition of an ideal J and the minimal decomposition of its associated variety U = V (J). First of all, note that the dimension of each primary component may not be the same. In fact, it can be shown that (2.87) If we now interpret Eq. (2.83) geometrically by taking the variety of both left-and righthand side and using the fact that the variety associated to an intersection of a set of ideals corresponds to the union of the varieties associated to each ideal, we obtain In general, the union of Eq. (2.88) may not be a minimal decomposition of V (J), because the variety associated to a primary component may be contained in the variety associated to another. Therefore, we can split set of varieties V (Q l ) into two distinct subsets: those who can be removed from the intersection of Eq. (2.88) without changing the result and those that cannot. We refer to these as "embedded" and "isolated", respectively. It can be shown that the prime ideals P k in the set minAssoc(J) are in one-to-one correspondence with the irreducible varieties U k from Eq. (2.81), i.e. U k = V (P k ). Therefore, it is clear that n Q (J) ≥ n B (V (J)). Geometrically, one can see that the non-uniqueness in a minimal primary decomposition is associated to the primary ideals Q l such that V (Q l ) is embedded. Before moving on to some explicit examples in spinor space, let us remark that there exist general algorithms for the computation of primary decompositions, see for instance Ref. [62]. A further useful comment is that for a prime ideal, all maximally independent sets are of the same size [56,Proposition 7.26]. This observation can provide a simple way to show that an ideal is not prime.

Examples of Irreducible Singular Varieties At Three and Four Points.
To understand Eqs. (2.83) and (2.88) in a more physical context, let us turn to simple examples of the problem at hand: understanding surfaces in spinor space. As a first warm-up, we consider there-point phase space. A well-known fact is that either all angle or all square brackets must be zero. Formally, this means that the zero ideal in R 3 (or equivalently the ideal in S 3 generated by momentum conservation alone) is not primary. That is, one can compute the primary decomposition of 0 R 3 to find [13], [23] (2.89) In contrast, four-point phase space, V ( 0 R 4 ), is irreducible. However, a number of interesting varieties associated to codimension-one ideals do decompose. This is again a statement that we can demonstrate with the help of a primary decomposition. For instance, we have , [13], [14], [23], [24], [ i.e. 34 [34] is a member of [12] R 4 , but this is not the case for 34 nor [34]. Therefore, we must have at least two branches, each one containing one of the two factors of s 34 .
A well-known fact that can be interpreted in terms of this splitting is that four-point massless amplitudes have non-unique common denominators in terms of spinor brackets. To better understand this let us consider as a concrete example the Parke-Taylor expression [63] for maximally-helicity-violating (MHV) and MHV trees, say . (2.92) As shown in Eq. (2.92), at four points MHV and MHV coincide. Thus, the denominator is clearly not unique. To see this algebro-geometrically, let us begin by posing an apparently legitimate question; that is, whether 23 is a pole of this amplitude. We can now say that this question is ill-posed because the surface is reducible. The amplitude A g − g − g + g + has a simple pole on V 23 , [14] R 4 but it is regular on V 12 , 13 , 14 , 23 , 24 , 34 R 4 ; that is, it has a different behavior on the different branches of V 23 R 4 . Therefore, 23 is both a physical and a spurious singularity, depending on the branch we look at. In conclusion, the physical statement about the singularity is that A g − g − g + g + has a simple pole on V 23 , [14] R 4 and algebraically we can represent this in two different ways, either via 23 or via [14] in the denominator.
As a final warm-up, let us consider the set of ideals at four points generated by pairs of invariants, together with their primary decompositions. We present a set of such ideals from which all others can be derived by permutations of the n momenta and parity. 12 , [13], [14], [23], [24], [34]  Here, on the left-hand side, we show ideals generated by pairs of invariants together with their primary decompositions; on the right-hand side, we give minimal bases for their primary components. We remark that P 3 , P 4 and P 5 have codimension two, while P 1 and P 2 have codimension one.

Functions Vanishing to Higher Order on Singular Varieties
Now that we have discussed how to construct the set of irreducible singular varieties of rational prefactors, our aim is to use these varieties to study the prefactors and interpret their behavior close to singular varieties as constraints on the analytic structure of their numerators. In this section, we review a well-studied class of ideals that we can use to parameterize these constraints. Specifically, we introduce the so-called "symbolic power" of an ideal (see Ref. [64] for a recent survey and Chapter 3.9 of Ref. [65] for a textbook discussion). Importantly, we can use the symbolic power to define what we mean by "behavior close to a variety". Our ultimate goal is to present a numerical algorithm for this study. However, in this section we content ourselves with the mathematical preliminaries, and delay the discussion of the numerical procedure to Section 3.
Vanishing to Higher Order at a Point. Our goal is to discuss a set of elements of R n that vanish to k th order on a variety U ⊂ V (J Λn ). Before we tackle this problem, we begin by studying the simpler case where the variety is a single point. Let us consider a point (η,η) in spinor space that satisfies momentum conservation, i.e. (η,η) ∈ V (J Λn ). The set of elements of R n that vanish on this point is given by an ideal m (η,η) = λ 10 − η 10 , λ 11 − η 11 , . . . ,λ 10 −η 10 ,λ 11 −η 11 , . . .

Rn
. (2.94) Here we label such an ideal as m (η,η) , hinting that it is actually a so-called "maximal ideal" (see Appendix A for the algebraic definition). To better understand Eq. (2.94), let us consider computing the remainder of an element q ∈ R n modulo a Gröbner basis of m (η,η) . From Eq. (2.94), it is easy to see that the remainder modulo G(m (η,η) ) of q is equivalent to the evaluation of q at the point (η,η), that is ∆ G(m (η,η) ) (q) = q(η,η) . With the ideal m (η,η) in hand, we are now in a position to define a set of elements of R n that vanish to k th order at the point (η,η). To motivate the definition, let us start by noting that it is natural to say that elements of m (η,η) vanish to (at least) first order at the point (η,η). One way to think of this is to consider a point for some small quantity ǫ and a point (δ,δ) in spinor space which is not required to satisfy momentum conservation itself, but is chosen such that (η (ǫ) ,η (ǫ) ) satisfies momentum conservation. At this shifted point (η (ǫ) ,η (ǫ) ), the generators of m (η,η) are all proportional to ǫ and we can interpret this as vanishing to first order. It is easy to see that if we raise m (η,η) to k th power then all of the generators of this power ideal will be proportional to ǫ k . This leads us to define that an element q ∈ R n vanishes to k th order at a point (η,η), if it is an element of m k (η,η) , i.e. q ∈ m k (η,η) ⇒ q vanishes to k th order at (η,η) . (2.97) We remind the reader that the ideal power is computed by repeated multiplication of the generators, see Eqs. (2.21) and (2.22).
Vanishing to Higher Order on a Variety. Let us now consider elements of R n that vanish not just at a single point, but on an entire variety W . We ask an analogous question to the case where the variety was a single point, that is whether we can construct the set of elements that vanish to k th order at every point on W . Given our previous discussion, we therefore want to understand elements which belong to m k (η,η) for every (η,η) ∈ W . This is the intersection of each of these ideals, that is We will refer to this intersection as the set of elements of R n which vanish to k th order on W . As the set of points in W is potentially infinite, the computation of this intersection is a non-trivial exercise. A natural expectation is that the set of elements which vanish to k th order on W is related to I(W ) k . However, it turns out that I(W ) k is insufficient: there can exist elements of R n which vanish to k th order but do not belong to I(W ) k . We must introduce a refined definition of ideal power: the so-called symbolic power (see Chapter 3.9 [65]). Let us begin with an irreducible variety U . In the case of a prime ideal such as I(U ), the symbolic power can be defined as the I(U )-primary component of the ideal power. More precisely, we consider the minimal primary decomposition of I(U ) k which we can write as 8 (2.99) The k th symbolic power of an ideal associated to an irreducible variety U is defined as (2.101) We are now prepared to describe the set of elements of R n which vanish to k th order on a variety. The key theorem we need is the so-called "Zariski-Nagata theorem" [45,46], in the general form introduced by Eisenbud and Hochster [47]. For our purposes, it states that for a radical ideal J in R n where we stress that the powers of the maximal ideals, and the symbolic power of J, are computed in R n . We see that Zariski-Nagata tells us that the set of elements of R n that vanish to k th order on the variety V (J) is contained within the k th symbolic power of J. Therefore, we see that if we wish to compute the set of polynomials that vanish on a variety W to k th order, it is sufficient to compute I(W ) k .
Computing Symbolic Powers. A natural question is how one computes the symbolic power in practice. It is clear from Eq. (2.100) that, for a prime ideal P , one can calculate the k th symbolic power P k by computing the primary decomposition of P k . However, obtaining the primary decomposition can be computationally demanding. In order to circumvent this, we now introduce a useful lemma. First, we note an important technical property of R n .
As it is a quotient of a polynomial ring by a maximal codimension ideal, R n is "Cohen- (2.105) That is, the second ideal power corresponds to the second symbolic one in all cases except for P 5 . Let us then consider the case of P 5 , where the symbolic power does not coincide with the normal power. The associated primes are and the primary decomposition reads One finds that the size of the minimal generating sets are given by µ(Q 5 ) = 16 and µ(Q x ) = 49.
We, therefore, do not print these ideals in the text, but they are easily obtainable with computer algebra techniques. We note that there must be some polynomial which belongs to the symbolic power P 2 5 but not to Q x , and hence not to P 2 5 . It is easy to check that (2.108)

Numerical Points near Singular Varieties
In the previous section, we introduced the class of polynomials which vanish to a k th order on a variety. We now wish to understand how to generate numerical configurations of spinors that are close to irreducible singular varieties. This will allow us to numerically determine the degree of vanishing of a numerator polynomial. One of the important properties of finite fields that makes them useful in computer algebra applications is that, in contrast to real or complex numbers, they can be exactly represented on a computer without approximation. However, if we wish to use finite fields to construct configurations of spinors which are close to some other configuration, this is not possible as it turns out that the available measure of size is not sufficiently powerful. To understand this mathematically, we now review the idea of an absolute value on a field F which will allow us to formalize the notion of size. Absolute values on fields are a basic idea in the theory of number fields and we refer to Ref. [48] for an introduction. Mathematically, when we wish to discuss the size of elements of a field F we make use of a map | · | F from a field F to the non-negative real numbers R ≥0 , known as an absolute value 9 . Well-known absolute values include the standard ones on the real and complex numbers. If we have two elements x and y of a field F, we will say that x is smaller than y if Note that the result of | · | F is always a real number, so the comparison in Eq. (3.1) takes place in the real numbers. An absolute value also induces a metric d on F, given by where x and y are two elements of F. We will mostly make use of Eq. (3.1)-the ability to compare sizes of elements of a field-in order to discuss points close to a variety. Let us return to the finite-field case. It can be shown that the only absolute value on F p is the so-called trivial absolute value which takes one of two values [48]. That is, for all a ∈ F p one can show that 10 |a = 0| Fp = 0 or |a = 0| Fp = 1 . (3.3) Considering the induced metric on F p , one can then say that two elements x and y of F p are either 0 or 1 units apart. This implies that in F p we can only generate phase-space points which are either on or away from a given surface. Therefore, the induced metric does not admit a non-trivial hierarchy of distances.
In order to bypass this issue, in Section 3.1 we introduce another number-theoretical field that admits a more powerful measure of distance: the p-adic numbers. Then, in Sections 3.2 and 3.3, we show how to start from a finite-field-valued configuration of spinors that is on a variety to then construct a p-adic configuration of spinors which is close to said variety, by perturbing the finite-field configuration.

Beyond Finite Fields: p-adic Numbers
In this section, we review mathematical details of the p-adic numbers that are relevant for our applications. These are well-studied objects in the mathematical literature and we refer the reader to textbooks such as Ref. [48] for a pedagogical introduction to the topic. We begin by introducing the so-called p-adic integers, which we denote as Z p . These are not to be confused with a finite field with p elements, which we denote as F p . An element z ∈ Z p can be considered as a power series in a prime number p, i.e.
where the a i take integer values in the range [0, p − 1]. We call the coefficients a i the p-adic digits of z, in analogy to a decimal representation of a real number. Multiplication and addition of elements of Z p can be defined using the standard multiplication and addition rules for power series. However, one must also take into account that the digits of the resulting series must still live in the range [0, p − 1]. This can always be achieved by carry rules, analogous to performing arithmetic with decimal numbers. With this in mind, the first non-zero p-adic digit behaves like an element of F p . It can be shown that the set of p-adic integers forms a ring under multiplication and addition. However, Z p is not a field: there exists no multiplicative inverse for any element of Z p with zero as its first p-adic digit. Let us reconsider the power series representation of a p-adic integer given in Eq. (3.4). Note that extending this representation to allow for negative powers of p solves the issue that prevents the p-adic integers from being a field. This leads us to the p-adic numbers, which we denote as Q p . Specifically, an element x ∈ Q p takes the form where again a i is an integer in the range [0, p−1]. Multiplication and addition are again defined by power series operations with carries. It is important to note that the p-adic numbers are not an algebraically closed field. As promised, the p-adic numbers are a field with a more powerful way to measure size. To discuss this, given a p-adic number x, we first introduce the p-adic valuation of x, which we denote by ν p (x). Considering the power series representation of x ∈ Q p of Eq. (3.5), the valuation of a non-zero x is the integer k such that a k is the first non-zero p-adic digit of x. That is, ν p (x) = k such that a i = 0 for all i < k . For x = 0 it is conventional to take ν p (x) = ∞. The p-adic absolute value, which we denote by |x| p , is defined as for x = 0, and |0| p = 0. It is this absolute value on Q p that we will use to discuss size. This measurement of size has a number of interesting implications. Firstly, we see that p-adic numbers which are proportional to p are p-adically small, and those proportional to 1 p are p-adically large. That is, considering p as a p-adic number, we have We emphasize that, when considered p-adically, the quantity p is to be regarded as small. Note that the p-adic integers form a subset of the p-adic numbers whose absolute value is bounded from above. That is, Next, note that the p-adic absolute value is discrete and unbounded when considered over the set of p-adic numbers. This is in contrast to the trivial absolute value, which is discrete but bounded to either 0 or 1; or the standard absolute value over R which is unbounded but continuous. Finally, we note that, while numbers in R satisfy the triangle inequality those in Q p satisfy the strong triangle inequality Eq. (3.11) states that when one sums two p-adic numbers, the result cannot be larger than either of the two summands. In practice, this can be helpful for establishing bounds on the size of intermediate stages of calculations, which can be important for numerical stability. Furthermore, it is important to note that, for large p, the bound in Eq. (3.11) is frequently saturated in practice. This can be seen by analogy to finite-field computations. Specifically, in F p it is well-understood that a quantity accidentally evaluating to zero can be made less probable by raising the value of p. As the first digit of a p-adic number behaves like an element of a finite-field, we see that this implies that, by working with large p, one can make it improbable that such a quantity becomes accidentally small. As quantities accidentally becoming small is an important source of precision loss in many algorithms, this has important practical implications for numerical stability.
p-adics on a Computer. Since computers have finite memories, one can consider truncating the power series expansion of a p-adic number. Recalling the form of a p-adic number x from Eq. (3.5), one can truncate the series and write x = a −l p −l + . . . + a −1 p −1 + a 0 + a 1 p + · · · + a m−1 p m−1 + O(p m ) . To make use of this on a computer, we use a floating-point representation 11 . Specifically, we write a truncated p-adic number x as where we call the prefactor p νp(x) the exponent, the summation part the mantissa and k ∈ Z >0 the working precision. The mantissa can be stored as a positive integer modulo p k and so practical floating-point p-adic arithmetic is very similar to working modulo p k . Let us consider basic arithmetic operations in the floating-point representation. First, consider multiplying x by another p-adic number y, whose digits we denote as b i . This is given by (3.14) Here, we can clearly identify the exponent of the product as the sum of the exponents, and the mantissa of the product as the product of the mantissae modulo p k . The multiplicative inverse of x can computed as where x is an integer satisfying for some auxiliary integer n. Such a pair (x, n) can easily be computed through the extended Euclidean algorithm applied to the mantissa and p k , in analogy to the finite-field case (see, for example, Ref. [2,Appendix A]). Note that, as p is prime, both multiplication and the computation of multiplicative inverse have the property that the mantissa of the result cannot be proportional to p, as required in the floating-point representation of Eq. (3.13).
Let us now consider addition in the floating-point representation. In contrast to multiplication, questions of stability arise. Without loss of generality we can consider ν p (y) ≥ ν p (x) and write the summation of x and y as (3.17) In comparison to multiplication, it is more subtle to compute the exponent and mantissa of the sum from this form. Specifically, for the case where ν p (x) = ν p (y), the part in square brackets in Eq. (3.17) may be proportional to p. This violates the assumption in Eq. (3.13) that the leading digit of the mantissa is non-zero. To return to the floating-point representation, one must then shuffle factors of p from the mantissa to the exponent. However, as the mantissa is only known to k digits, this procedure introduces an arbitrary choice into the last digits of the new mantissa. In more traditional terms, one may lose precision when performing addition. In practice, similarly to working in F p , this can be made unlikely to accidentally happen by increasing the size of the prime p. We note that this is a generalization of the issue of accidental division by zero in finite fields.

Finite-Field Points on Singular Varieties
Let us now discuss how one can generate a point on a variety when working in F p . To ease the discussion, we will work over the polynomial ring F p [X 1 , . . . , X n ], and denote the tuple of variables as X = {X 1 , . . . , X n }. Given an ideal J = q 1 , . . . , q m Fp[X] , we wish to generate a numerical point X (0) ∈ F n p that is a solution to the equations q i (X) = 0 for i = 1, . . . , m .

(3.18)
That is, X (0) ∈ V (J). Clearly, for a variety that is not zero dimensional, there are many such points X (0) . In the following we will focus on constructing a single point X (0) ∈ V (J). Geometrically, our strategy is to intersect the variety with a randomly chosen collection of hyperplanes so that this intersection is a zero-dimensional variety. The zero-dimensional variety then corresponds to a finite collection of points. We explicitly construct one such point and take this to be X (0) . In order to build the set of hyperplanes, we begin by constructing a maximally independent set of J, as discussed in Section 2.1.2. We denote the maximally independent set as Y and the corresponding dependent variables as Z = X \ Y . We remind the reader that Y is a tuple of dim(J) variables and that Z is a tuple of codim(J) variables. By definition, the elements of the set Y can be chosen independently. If we choose values for Y generically, then they specify a variety such that its intersection with V (J) is a zero-dimensional sub-variety of V (J). To this end, we construct a point Y (0) ∈ F dim(J) p by choosing each component uniformly as integers from the range [0, p − 1]. With this point in hand, we now consider the system q i (Z, Y (0) ) = 0 for i = 1, . . . , m . (3.19) This system of equations defines our zero-dimensional subvariety of V (J). Note that the polynomials in Eq. (3.19) q i depend only on the Z variables, as the components of Y (0) take values in F p . It is useful to introduce the corresponding ideal in the polynomial ring F p [Z], as Clearly, any Z (0) ∈ V (J (0) ) can be combined with Y (0) to find our desired point X (0) . Our problem is now reduced to the simpler task of finding an element of V (J (0) ). However, in general the system of Eqs. (3.19) is non-linear in Z, which makes this a non-trivial exercise. To this end, we make use of standard tools of elimination theory, which we now review. We refer the reader to Chapter 3 of Ref. [54] for a pedagogical introduction. The key tool we will use is a Gröbner basis with a special monomial ordering. The ordering that we need is the so-called lexicographic ordering on the variables Z, which we denote as lex. . Specifically, we order the variables as lex. : Z codim(J) ≻ · · · ≻ Z 1 . (3.21) To highlight the use of this monomial order, we will denote the lexicographic Gröbner basis of J (0) as G lex. (J (0) ). We now consider the subset of G lex. (J (0) ) which depends only on the variables Z 1 through Z l . That is, we define The sets of polynomials G l allow one to find a zero of G lex. (J (0) ) in an iterative manner, constructing it variable by variable. We will call a zero {Z l } is an l th partial solution. We will refer to this as extending the (l − 1) th partial solution. Clearly, repeatedly extending a partial solution will lead to an element of V (J (0) ).
To discuss how to extend a partial solution, let us consider the ideal generated by the evaluations of G l on an (l − 1) th partial solution. That is, we consider the ideal . (3.23) It can be shown that J l,eval is generated by a single polynomial g o (see Chapter 3.5 of Ref. [54]). That is, one can write J Note that a zero of g o is a Z (0) l that allows us to extend the (l − 1) th partial solution. Importantly, g o can be read from G l . Specifically, let us write each element g of G l in the form g = c g (Z 1 , . . . , Z l−1 )Z Ng l + terms in which Z l has degree < N g . (3.25) If we consider the set of polynomials g ′ ∈ G l such that c g ′ does not evaluate to zero on the (l − 1) th partial solution, then g o can be taken to be a g ′ which is a non-constant polynomial and has lowest degree in Z l amongst all such g ′ . To extend a partial solution, we must therefore find a zero of the univariate polynomial g o . This can be solved systematically over F p by general, efficient algorithms such as the Cantor-Zassenhaus algorithm [69]. Note that, in principle, there may be multiple zeros. As we only want a single point on the variety, it is sufficient to take a single such zero. In summary, starting from the trivial 0 th partial solution, we repeatedly extend the partial solution until we have constructed the codim(J) th partial solution, which is the desired Z (0) which satisfies Eq. (3.19). This is then combined with Y (0) , to give the desired X (0) . In general, this procedure of extending a partial solution is only guaranteed to succeed when working in an algebraically closed field, as this means g o must have a zero in the field. This is relevant to our case as we work over F p which is not algebraically closed. We find a practical solution to this problem is to repeat the procedure with different choices of the Y (0) .
We make some final remarks. Firstly, we consider applying this procedure in the case where V (J) is reducible. This procedure will still generate a point belonging to V (J), however it provides no guarantee as to which branch of V (J) the point belongs. In practice we solve this issue by only applying the approach to prime ideals. Secondly, there exist other algorithms to enumerate the elements of V (J (0) ) that avoid the use of the lexicographic monomial ordering: see, for example, Section 2.4 of Ref. [70]. This can prove more efficient. However, we do not find this to be necessary in this work.

p-adic Points Close to Singular Varieties
As already mentioned, we aim to evaluate rational functions on points in spinor space which are p-adically close to singular varieties. This will allow us to numerically probe rational functions to learn how fast they diverge or vanish. It this section we discuss how to obtain a p-adic point close to a given variety by perturbing an exact finite-field solution. Thereafter, we discuss how one can interpret this behavior in the language of algebraic geometry.
Lifting F F F p Solutions to the p-adic Integers. Consider an ideal J of S n that takes the form J = q 1 , . . . , q m , r 1 , . . . , r 4 Sn , (3.26) where {r 1 , . . . , r 4 } generate J Λn . Naturally, V (J) ⊂ V (J Λn ) and we further assume that J is prime. We wish to construct a point (η (ǫ) ,η (ǫ) ) ∈ Z 4n p , such that where k is a positive integer. We stress that a p-adic integer point will be suitable for our purposes. As the evaluations of the generators q i are p-adically small, we consider such a point to be close to V (J). As discussed in Section 3.1, when working with a computer we work with truncated p-adic numbers. Therefore a solution to Eq. (3.27) is a point that is close to V (J), but on V (J Λn ) when working to k digits of precision.
To construct our desired point, we will work digit by digit in the p-adic expansion. Specifically, the p-adic point in spinor space reads where each of the (η (ǫ),i ,η (ǫ),i ) are integers in the range [0, p − 1]. We will determine the (η (ǫ),i ,η (ǫ),i ) starting from i = 0 and moving up to the working precision. The starting observation is that for (η (ǫ) ,η (ǫ) ) to be near V (J), it must be on V (J) when truncated to first digit. We, therefore, begin with a finite-field-valued configuration which lives on the variety analogous to V (J) over the finite fields, that is an (η,η) Fp ∈ F 4n p . Clearly, we can use the algorithm of Section 3.2 to generate such a configuration. Importantly, (η,η) Fp is a zero of the generators of J when considered modulo p. Therefore, we can reinterpret each finite-field value as the first digit of a p-adic integer. That is, we choose where we consider the components of (η,η) Fp to be integers in the range [0, p − 1]. We now have a p-adic configuration which is a zero of the q i and r i up to O(p) corrections. That is, Note that Eq. (3.30) implies that whatever the value of the digits (η (ǫ),i ,η (ǫ),i ) for i > 0, the q i conditions of Eq. (3.27) will be satisfied. Therefore, we will not need to consider the polynomials q i further. However, the present p-adic point in spinor space does not yet satisfy momentum conservation to working precision. Our task, therefore, is to choose the remaining digits of (η (ǫ) ,η (ǫ) ) such that momentum conservation is satisfied to k digits. To achieve this, we work iteratively order by order in p. For convenience, let us define This represents the first ν + 1 digits of (η (ǫ) ,η (ǫ) ). Let us assume that we have determined the p-adic spinors (η (ǫ),i ,η (ǫ),i ) up to i = ν. That is, we assume that we have already fixed ν + 1 digits such that Our aim is to find a value for the next digit, (η (ǫ),ν+1 ,η (ǫ),ν+1 ) such that each r i will vanish to one order higher in p. It turns out that (η (ǫ),ν+1 ,η (ǫ),ν+1 ) satisfies a system of linear equations in a finite field. Let us expand the four r i polynomials around (η (ǫ),ν ,η (ǫ),ν ) to O(p ν+2 ). One finds where ∇ is the vector of derivatives with respect to (λ,λ). If we now require that (η (ǫ) ,η (ǫ) ) is a zero of r i up to O(p ν+2 ) then we have a linear equation for the next digit. That is, This is a linear system of equations for the next digit (η (ǫ),ν+1 ,η (ǫ),ν+1 ). At a practical level, note that the constraints are modulo p, so they effectively give a linear system in F p . Importantly, the constraints in Eq. (3.34) always have a solution, given an appropriate choice of (η (ǫ),0 ,η (ǫ),0 ). We can see this as follows. Note that the derivatives of the r i are being evaluated close to the variety V (J Λn ) and so up to O(p) corrections we can replace them with their evaluations on the variety. That is, where (η,η) is a point on V (J Λn ). Therefore, up to O(p) corrections, the derivative vectors in Eq. (3.34) span the cotangent space of V (J Λn ) at (η,η). As J Λn is a maximal codimension ideal this implies that, if (η,η) is not a singular point of V (J Λn ), the linear system of equations in Eq. (3.34) is of full rank and a solution exists. In practice it is easy to avoid such singular points. Nevertheless, the system does not uniquely define the value of (η (ǫ),ν+1 ,η (ǫ),ν+1 ) as it can be freely changed by any element of the tangent space of the V (J Λn ) at the point (η,η). We make use of this freedom and pick a random solution to Eq. (3.34).
Having determined the value of (η (ǫ),ν+1 ,η (ǫ),ν+1 ), we are now in a position where we have a solution of Eq. (3.32) but with ν replaced with ν + 1. It is therefore clear that we can iterate this procedure until we find a solution with ν = k − 1, which is thus a solution to Eq. (3.27).
We close with a few remarks. Firstly, we point out that an analogous procedure could be followed to generate points close to singular varieties when working over R or C. Secondly, let us also remark the similarity of this multivariate procedure to the univariate Hensel's lifting lemma. Thirdly, it would be interesting to consider extending this procedure to generate points in "asymmetric" approaches to a variety as employed in Ref. [30].
Interpretation of p-adic Evaluations. Let us now consider how to interpret the evaluation of a numerator N ∈ R n at a point close to an irreducible singular variety U . Let k be the largest integer such that N ∈ m k (η,η) holds for all points (η,η) ∈ U . For specific points (η,η), it may be the case that N belongs to m k+1 (η,η) , but these must always live on higher codimension sub-varieties. We define κ(N , U ) = k s.t. N ∈ m k (η,η) ∀ (η,η) ∈ U and ∃ (η,η) ∈ U : N ∈ m k+1 (η,η) . (3.36) Note that κ(N , U ) ≥ 0, as N ∈ m 0 (η,η) holds trivially. Importantly, it is clear from the definition of κ(N , U ) that we have , (3.37) and we cannot replace κ(N , U ) with any higher integer. By the Zariski-Nagata theorem we conclude that N ∈ I(U ) κ(N ,U ) . (3.38) We will now argue that, for large p, a p-adic evaluation of N near U allow us to determine κ(N , U ) with high probability. Specifically, we will make use of a p-adic point in spinor space (η (ǫ) ,η (ǫ) ) as constructed earlier in this section to satisfy Eq. (3.27). The corresponding point (η,η) on the variety U can be thought of as any of the infinitely many p-adic points on U with the same first p-adic digit as (η (ǫ) ,η (ǫ) ). We will argue that the probability of evaluating N at the point (η (ǫ) ,η (ǫ) ) and finding that its p-adic valuation exceeds κ(N , U ) is small. We begin by noting that, by Eq. (3.37), N is an element of m κ(N ,U ) (η,η) . We can therefore write N as where the summation runs over all sets of powers β andβ such that the total degree of the product part of Eq. (3.39) is κ(N , U ) and n β,β (λ,λ) is a polynomial in the spinor variables. The indices i, j run from 1 to n, with n being the multiplicity of phase space, and α,α are either 0 or 1. Evaluating N at (η (ǫ) ,η (ǫ) ) we obtain It is then clear that we can extract κ(N , U ) from the numerical evaluation N (η (ǫ) ,η (ǫ) ), if we can understand the valuation ofÑ (η (ǫ) ,η (ǫ) ). We will now argue that if p is large, then with high probability Firstly, we argue that there exists, with high probability, some n β,β (η (ǫ),0 ,η (ǫ),0 ) that is not , for some point (η ′ ,η ′ ) whose first p-adic digit is given by (η (ǫ),0 ,η (ǫ),0 ). However, recalling the discussion around Eq. (3.36), points such as (η ′ ,η ′ ) belong to higher codimension varieties.
The point (η (ǫ),1 ,η (ǫ),1 ) could then be close to a zero of this polynomial. However, as this point was also chosen randomly and p is large, this also occurs with low probability as well.

Ansatz Construction Algorithm
In this section, we leverage the technology described so far to build an algorithm to construct Ansätze for rational functions in scattering amplitudes. Specifically, for each coefficient C i we discuss an algorithm to construct a set of rational functions {a i,1 , . . . , a i,d i } of spinor variables such that where the c i,k are rational numbers. Importantly, this Ansatz has fewer terms than those commonly considered in the literature based on functional reconstruction techniques as it will take into account the analytical properties of the rational functions. We consider the coefficients in least common denominator form. That is, where N i and D j are elements of R n and where n i is the number of distinct denominator factors D j . We note that we allow the exponents q ij to be negative, denoting numerator factors. For our procedure, we assume that the set of denominator factors {D 1 , . . . , D n i } in Eq. (4.2) is known a priori. In physical applications, where the transcendental functions are pure, it is conjectured that this set can be constructed from the symbol alphabet [12]. We further assume that we can numerically evaluate the C i p-adically, e.g. either from some analytic formula or from an appropriate numerical algorithm.

Study of Singular Varieties
We begin by considering the behavior of the coefficient function C i on singular varieties. This procedure has two parts: first, we find all relevant irreducible singular varieties; second, we perform numerical evaluations near these varieties and interpret the result. where the indices j 1 , . . . , j m are all distinct and take values in 1, . . . , n i . We remind the reader that ideals generated by m elements are not necessarily of codimension m. The varieties associated to the ideals in D (m) may be reducible. To this end, we consider the set of irreducible varieties is given by Where we recall from Section 2.3, that the set of irreducible varieties can be extracted from the primary decomposition of the associated ideal. The first step of our algorithm is to construct generating sets of the ideals associated to each variety in V (m) , for m ranging from 1 to some largest codimension of interest. In this work, we study the rational functions in Eq. (4.2) only on varieties of codimension one and two, and leave the impact of higher codimension studies to further work. Therefore, we begin by performing the requisite primary decompositions to construct V (1) and V (2) .
Numerical Warm-up. Given the two sets of varieties, V (1) and V (2) , we now use p-adic numerical evaluations in order to determine strongly constraining information about the function C i . We do this in a two step procedure, first working at codimension one, and then at codimension two.
1. Codimension One: The first step is to evaluate C i near all codimension-one irreducible varieties whose associated ideals are generated by one element, D j . To each of these we associate an element of V (1) , namely U j = V ( D j Rn ). For each U j , we employ the procedure in Section 3.3 to generate a point (η U j ) that is p-adically close to U j . As the associated ideal is generated by the single irreducible element D j and we work with large p, we infer that That is, we deduce the exponent of the denominator factor from the p-adic valuation of the coefficient when evaluated on a random point nearby the associated variety.

Codimension Two:
The second step is to study the behavior of C i near all codimensiontwo irreducible varieties U ∈ V (2) . Specifically, we make use of the numerical techniques of Section 3.3 to compute κ(N i , U ), i.e. to show membership of N i to some symbolic power of I(U ), where we recall that I(U ) is an ideal of R n . To do this, for each U we again generate a point (η , which is close to U . As we know all q ij from the codimension-one study, we can use Eq. (4.2) to evaluate N i on this point and thereby numerically compute ν p N i (η (ǫ) U ,η (ǫ) U ) . As we perform this procedure for large p, by Eq. (3.43), we have calculated κ(N i , U ). Gathering all of these constrains, we conclude that

The Space of Vanishing Functions
We have now shown that N i belongs to both the ideal J defined in Eq. (4.6) and to the space of polynomials of M d, φ , defined in Eq. (2.71). We wish to use these two statements in order to construct an Ansatz of the form given in Eq. (4.1). To this end, we construct a basis of the space Once the denominators are restored, a basis of M d, φ (J) can be used as the set of rational functions {a i,1 , . . . , a i,d i } in Eq. (4.1). There are a number of ways one can construct a basis of M d, φ (J), and they can differ strongly in computational complexity. For example, direct computation a generating set of J using Gröbner basis methods can be intractable. Instead, we find it more efficient to reduce the problem to one of vector space intersection. Specifically, given a set of ideals {J 1 , . . . , J m } in R n , it is clear that This allows us to avoid computing a generating set for the ideal J by Gröbner basis methods. Instead, we construct a basis of each M d, φ (J k ) and perform the intersection of vector spaces in Eq. (4.8) to find a basis of M d, φ (J).
To practically construct a basis of each of the M d, φ (J k ), we first note that as M d, φ is a subspace of R n . This allows us to construct a basis of M d, φ (J k ) by Gröbner basis techniques. Specifically, we exploit the isomorphism in Eq. (2.60) and work with the polynomial quotient ring R k that map to J k ∩ R n under the isomorphism (see Eq. (2.68)). By computing a basis of the intersection in R (q) n , we construct a set of spinor bracket polynomials that can be understood as a basis of M d, φ (J k ) by the isomorphism. To construct this basis we recall the technology of Section 2.1.3 for intersecting ideals with vector spaces. First we compute the remainders modulo G(J (q) k ) of the elements of M d, φ . In practice, the calculation of these remainders can prove computationally intensive. Nevertheless, we find that the remainders themselves are often simple. By Eq. (2.47), we then construct a basis of the nullspace of ∆ ij G[J Organizing the Space. We now have a basis for M d, φ (J). However, the techniques of Section 2.1.3 to intersect a vector space with an ideal make extensive use of (sparse) linear algebra. This introduces an arbitrary choice into the basis elements given by the pivoting scheme made in the linear algebra algorithms. This has a practical downside as, for large dim M d, φ (J) , expressing the numerator N i in Eq. (4.2) in terms of this basis leads to large rational numbers. We wish to address this by constructing a more compact basis of M d, φ (J). To this end, we will organize the basis in a way reminiscent of a partial-fraction decomposition.
We begin by recalling that an element of M d, φ (J) is to be interpreted as the numerator of a rational function. In a partial-fraction decomposition, one attempts to cancel the numerator against the denominator. In order for a numerator to cancel against a factor of D k in the denominator, this numerator must itself come with a factor of D k . Naturally, numerators which factorize D k form a subspace of M d, φ (J). Specifically, they are given by (4.10) Note that, due to the codimension-one study of Section 4.1, the space of functions M d, φ (J) have no common factors given by the D k . Therefore that is, it is a proper subspace. Next, we recall Eq. (2.45) and note that the M d, φ (J) can be related to the subspace of terms belonging to the ideal D k Rn by where We can therefore use a denominator factor D k to break down the space into two smaller spaces.
In the context of partial fractions, we can interpret Eq. (4.12) as the standard observation that the choice of numerator of D k is only fixed up to terms proportional to D k . To make practical use of Eq. (4.12), we again employ the isomorphism in Eq. (2.60). This allows us to construct a basis of the two spaces in the sum using the Gröbner basis technology for organizing spaces by ideals described in Section 2.1.3. When constructing the basis of Q d, φ (J, D k ), we order the basis elements by the number of terms in their expressions to prioritize simpler basis elements. We refer to this as the naive approach to constructing a basis of Q d, φ (J, D k ). To organize M d, φ (J) we can recursively applying Eq. (4.12) to its left summand with different choices of D k . In practice, we order the choice of the D k heuristically, such that the Q d, φ (J, D k ) are kept of low dimension at each step.
Generating Simple Basis Elements. While the space of functions M d, φ (J) ∩ D k Rn is simpler than M d, φ (J), the naive approach for choosing a basis of Q d, φ (J, D k ) can still result in complicated basis elements. To avoid this problem, we introduce a procedure to generate simple elements of Q d, φ (J, D k ). Specifically, we choose to construct monomials of the denominator factors that are linearly independent modulo D k Rn . It is clear that such a monomial of denominators cannot be proportional to D k , so we construct where the product over j runs over the full list of n i denominator factors, the β j ∈ Z ≥0 . It is not clear a priori if, considered modulo D k Rn , this set of monomials of the denominator factors spans Q d, φ (J, D k ), and indeed we find this not to always be the case. Nevertheless, as we have generated a basis of Q d, φ (J, D k ) from the naive approach, we can always supplement the set of independent denominator-factor monomials with elements of the naive basis to obtain a basis. In practice, we find that this is rarely necessary in our applications. In the following, to generate the β described in Eq. (4.14), we take a two-step procedure. We first generate denominator-factor monomials and then find a subset that is linearly independent modulo D k Rn .
To begin, we discuss our approach to generating an overcomplete set of denominatorfactor monomials without imposing independence modulo D k Rn . Let us consider exponent vectors β ∈ Z n i ≥0 that satisfy the equations Here, Eq. (4.15) guarantees that the monomial D β is an element of the ideal J, while Eqs. (4.16) and (4.17) require that D β have little-group weights φ and mass dimension d respectively. Let us denote the set of solutions β to these equations as B d, φ (J, D k ). In principle, the set B d, φ (J, D k ) can be enumerated by a computer algebra system. This is analogous to the enumeration of independent spinor bracket exponents, X d, φ , in Section 2.2.
In practice, we find that direct enumeration of the elements of B d, φ (J, D k ) can be computationally prohibitive. To address this, we instead consider constructing B d ′ , φ for d ′ < d and multiplying these elements by appropriate functions to arrive at a set of denominator monomials of mass dimension d. Note that Eq. (4.15) and Eq. (4.16) are already satisfied by any element of B d ′ , φ (J, D k ). Therefore, we can generate a valid monomial by multiplying by any little-group-invariant monomial of spinor brackets of mass dimension d − d ′ . Specifically, consider the set of monomials where we recall from Eq.
forms a subset of all possible monomials in denominator factors in Eq. (4.14). We note that there exists a d min ≥ 0 such that for all d ′ < d min the set Γ d,d ′ , φ (J, D k ) is empty. When considered modulo D k Rn , the monomials in Γ d,d ′ , φ (J, D k ) are linearly dependent. We must therefore find a linearly independent subset. To this end, we again recall the Gröbner basis technology of Section 2.1.3. Specifically, we apply Eq. (2.48) and construct the matrix (4.19) where i and j are the row and column indices of and the inequality is In practice, we often find that this occurs even for d ′ < d.
it is therefore often more efficient to search for such a d ′ < d. In practice, this d ′ can be found by searching from d ′ = 0 and increasing d ′ in unit steps until either Finally, we note an important feature when determining a subset of Γ d,d ′ , φ (J, D k ) that is linearly independent modulo D k Rn : we can prioritize elements when choosing a basis by ordering Γ d,d ′ , φ (J, D k ) when constructing ∆ d,d ′ , φ (J, D k ) in Eq. (4.19). In practice, we choose an ordering criteria that is inspired by partial fractions. Specifically, we choose to order Γ d,d ′ , φ (J, D k ) by the mass dimension of the numerator, after cancellation against the denominator, which is known from the co-dimension one study. That is, given a numerator exponent β, and the denominator exponent α, the rational function associated to β takes the form D β−α . The mass dimension of the numerator of D β−α can be calculated through (4.21) By ordering the elements of Γ d,d ′ , φ (J, D k ) with respect to the criteria of Eq. (4.21) when constructing ∆ d,d ′ , φ (J, D k ), the pivot columns will be such that chosen basis of denominator factor monomials will cancel against the denominator as much as possible.

Application to Two-Loop 0 → qqγγγ Finite-Remainder Coefficients
As a proof-of-concept application of our approach, we reconsider the collection of pentagonfunction remainder coefficients for the leading-color process 0 → qqγγγ at two loops, obtained in Ref. [17]. In this way, we will demonstrate that our approach requires fewer evaluations than the original functional reconstruction technique. We follow the notation of Ref. [17] and consider the remainders R  Table 1. Improvements in the number of basis functions and in the mass dimension of the numerators with known factors pulled out when moving from a basisr (±) i with definite parity to a basisr i with mixed parity.
The reconstruction approach of Ref. [17] works with parity even functions. For this reason, the r i were decomposed as 2) and the functional reconstruction approach was applied to the parity even functions r ± i . The result was then presented in terms of a basisr (±) i of the combined space spanned by the r + i and r − i . Furthermore, the r i in Ref. [17] were normalized by an amplitude-dependent helicity weight Φ h in order to make them little-group invariant. Our method is able to handle functions that are not little-group invariant and therefore benefit from simplifications arising from manifesting this behavior. Therefore, we apply our approach to the functions As is by now standard practice, we exploit the fact that the r i are linearly dependent and thus can be written as where ther j are a subset of the r i such that they form a basis of the space spanned by the r i and M ji is a matrix of rational numbers. We choose the basis elementsr i such that their numerator mass dimension in common denominator form is minimized. We then determine the matrix M ji from numerical evaluations of the r j and standard linear algebra techniques.
As is natural to expect, we observe that the number of linearly independent coefficients drops by approximately a factor of two when considering the mixed-parity r i as opposed to the parity-even r ± i . Furthermore, we observe that the mass dimension of the associated numerators is improved. We summarize these observations in Table 1. Finally, we note that the rational numbers appearing in M ji are smaller than those appearing in the analogous matrix in the work of Ref. [17], with the largest denominators being ∼ 10 7 and ∼ 10 9 respectively.

Five-Point Phase-Space Geometry
In this section, we report on the set of irreducible singular varieties up to codimension two that are relevant for the 0 → qqγγγ amplitudes at two loops. That is, we describe V (1) and V (2) of Eq. (4.4). This set is expected to be sufficient for any five-point massless scattering process at two loops, if the basis of transcendental functions from Ref. [71] is employed. The required primary decompositions were computed making use of Singular. While Singular implements a number of general algorithms for primary decomposition, we found it necessary to supplement such algorithms to perform and prove the decompositions in the harder cases. We describe the details of our techniques in Appendix B.
At five point the set of denominator factors that we use to construct D (1) and D (2) are of the form ij , [ij] , i|j + k|i] . (5.5) In total there are 35 such invariants: 5 2 = 10 angle brackets, an equal number of square brackets, and 5 4 2 / 2 = 15 three-particle spinor chains. This is the same set of invariants employed for planar five-parton scattering in Ref. [32] with 5 additional three-particle spinor chains obtained from non-cyclic permutations.
Let us now discuss the irreducible varieties in this space, up to the symmetries. The symmetries of five-point massless phase space are given by all 5! = 120 possible permutations of the external legs, as well as parity. At codimension one, the set D (1) is generated by two ideals not related by symmetry, namely Using Singular it can be shown that these ideals are prime. Hence, the associated varieties are irreducible and generate V (1) . At codimension two, D (2) is generated by the action of the symmetries on 11 ideals. Five of these ideals are generated by a pair of two-particle spinor contractions. They, alongside their primary decompositions, are given by (5.8) P 1 P 2 P 3 P 4 P 5 P 6 P 7 P 8 P 9 P 10 20 10 2 30 10 60 120 15 30 20 Table 2. Counting of the number of distinct irreducible varieties generated by each of the P i that, under the action of parity and permutations of the external momenta, generate the set V (2) .
Three of the generators of D (2) are ideals that are generated by a two-particle and a threeparticle contraction. These ideals, alongside their primary decompositions, are given by Finally, the last three generators of D (2) are ideals that are generated by a pair of three-particle spinor contractions. They, alongside their primary decompositions, are given by 1|2 + 3|1], 2|1 + 4|2] R 5 = P 3 ∩ P 3 ∩ P 10 , In the above ideal definitions, λ ↔λ means to add another generator obtained by applying the parity operation to the previous one. We use the notation P i as it can be shown that all the P i are prime (see Appendix B.3). This implies that the elements of D (2) are all radical. We note that while there are 11 inequivalent ideals up to symmetries generated by two denominator factors, there are only 10 inequivalent irreducible varieties up to symmetries. By permuting the external momenta, and/or applying the parity operation, the varieties associated to the P i generate V (2) . In Table 2, we list the counting of the number of varieties generated by each of the prime ideals P 1 through to P 10 . In total there are 317 distinct irreducible varieties.
P i 1 2 3 4 5 6 7 8 9 10 k i 10 9 18 3 1 4 3 1 3 1 Table 3. List of highest k i such that it is required to compute the symbol power P ki i in order to construct the Ansatz for the rational prefactors in R (2,0) −++ . The P i are given in Eqs. (5.7) to (5.12).

Symbolic Powers
In this section, we discuss the practical computation of symbolic powers of the P i in Section 5.1. The maximal symbolic power of each ideal P i that we compute is controlled by the structure of ther i , which is determined numerically. We list the largest power of each P i that we need to compute in Table 3. We remark that for P 5 , P 8 and P 10 , no computation is required as J 1 = J for any ideal J. We also note that the constraints coming from the symbolic power of P 3 can be seen to be trivial. Specifically, one can rearrange the constraints of little group and mass dimension on monomial exponents, (2.76) and (2.75), to give That is, the total degree of both the angle bracket and square bracket variables are fixed independently by little group and mass dimension. This implies that (5.14) This allows us to avoid constructing explicit symbolic powers for P 3 . To construct the remaining symbolic powers, we make use of the Cohen-Macaulay property of R n in the following two ways.
1. Relation to Maximal-Codimension Ideals: The ideals P 2 and P 6 are maximal codimension. Therefore, by Eq. (2.103), the symbolic powers are equivalent to the ideal powers. Specifically, we use Next, as ideal intersection is associative, by Eq. (5.14) we have that for any P i alongside the analogous equation for P 3 . In practice, if we wish to compute P k i , then k is such that the inequality in Eq. (5.16) holds. Therefore, for the purposes of our algorithm, it is sufficient to compute P k i ∩ P k 3 . For two ideals, P 4 and P 7 , we see from Eqs. (5.7) and (5.9) that this intersection is again of maximal codimension. By definition, the symbolic power commutes with the intersection (see Eq. (2.101)). This allows us to apply Eq. (2.103) and compute the symbolic power through the ideal power. Specifically, we use 2. Saturation of Maximal Codimension Ideals: In order to compute symbolic powers of the remaining two ideals, P 1 and P 9 , we make use of ideal saturation. We refer the reader to Appendix B.1 for theoretical details on saturation. In this context, we exploit that ideal saturation removes primary components. Specifically, we compute the symbolic power of a (radical) ideal whose set of associated primes contains P 1 or P 7 and remove extraneous components of the symbolic power by saturation. If we can find a relevant maximal-codimension radical ideal, then its symbolic power is again the ideal power. This strategy is natural as the P i are constructed from the primary decompositions of maximal-codimension ideals. In particular, we use that and these saturations can be computed with Gröbner basis methods.
Finally, with generating sets of each of these ideals in hand, we contract each generator in all possible ways with spinors to reach a set of polynomials in spinor brackets and thereby find a generating set of the associated ideal in R (q) 5 .

Implementation and Results
We now retrace the steps of the Ansatz construction algorithm presented in Section 4, and provide details regarding their implementation. To perform the algebro-geometric operations we make extensive use of the computer algebra system Singular [57] through its Mathematica interface [72] and through the Python interface syngular [73]. We note a generally useful facility in Singular: the qring declaration. This allows one to work directly in the quotient rings R n and R n .
Let us start from the analytic study of codimension-one and codimension-two varieties. For one primary decomposition, we used the algorithm of Gianni, Trager and Zacharias [62] as implemented in Singular under the command primdecGTZ. For the other decompositions, we supplemented this algorithm with the techniques described in Appendix B. To remove sub-varieties, we made use of the command sat, as described in Appendix B.1. To check primality, we made use of the test presented in Appendix B.3.
For the numerical warm-up, we implemented in Python both the algorithm for generating finite-field points on irreducible varieties, described in Section 3.2, and the lifting procedure to obtain p-adic solutions close to singular varieties, described in Section 3.3. The required  maximally independent sets were computed with the Singular command indepSet. In order to solve the univariate polynomial equations of Eq. (3.24) over a finite field, we used the command factor from the package sympy [74]. In practice, we observed that it is always possible to choose a maximally independent set such that the system of equations for the dependent variables is linear, which guarantees the existence of a solution in F p . The algorithm for building the Ansatz from the gathered numerical data, described in Section 4.2, was implemented in Mathematica. When performing polynomial reductions, e.g. when applying Eq. (2.46) to intersect vector spaces with ideals, we found it important to tune the choice of variable ordering to minimize the size of the Gröbner bases. This increases the speed of polynomial reduction. In order to perform the linear algebra when constructing the Ansatz we employed private codes for sparse linear algebra over a finite field 12 . The p-adic and finite-field evaluations of the rational prefactors that we used in this work were performed using in-house implementations of the respective fields and the analytic results of Ref. [17].
The results of our Ansatz construction procedure are summarized in Table 4. For all helicity amplitudes, we observe a large decrease in the size of the Ansatz when applying our procedure. As a result of using this Ansatz, we therefore find a large reduction in the size of the expressions for the rational functions in the helicity amplitudes. We provide our results in the form of ancillary files of two types: (a) Machine-readable expressions for the primary decompositions of Eqs. (5.7) to (5.12) and, in particular, for the generating sets for the associated prime ideals. These can be found in the files generatingIdeals.m and generatingIdeals.py, in the languages Mathematica and Python 3.8 respectively. The Python file also computationally checks the equalities in Eqs. (5.7), (5.9) and (5.11). Furthermore, it employs the method described in Appendix B.3 to check the primality of all ideals P i in Section 5.1.  4). The term coo refers to the notation used to store the matrix, which is the coordinate list format, i.e. a map from tuples of indices (j, i) to the values M ji for all non zero entries of the matrix.
(b.2) Files ending in _spinors.m contain the basesr j from Eq. (5.4). The notation used is SP for spinor angle brackets, and SPT for spinor square brackets. Using a package such as S@M [75] it is straightforward to match at a random phase-space point the productr j M ji to the functions r i as given in Ref. [17].

Summary and Outlook
In this work, we have developed an algorithm to construct compact Ansätze for rational prefactors of master integrals and transcendental functions in gauge theories. To this end, we made use of tools of algebraic geometry to further our understanding of rational functions of Weyl spinors associated to complexified momentum space. We began by interpreting the spinor-helicity formalism in the language of algebraic geometry, discussing that physical polynomials of Weyl spinors belong to a polynomial quotient ring associated to the variety induced by momentum conservation. We then showed that elements of this set with appropriate Lorentz transformation properties live in a further polynomial quotient ring, which we used to systematically account for the relations arising from momentum-conservation and Schouten identities. Next, we discussed the singularities of rational prefactors in terms of irreducible varieties. In particular, we began a systematic study of the singular structure of these rational functions via primary decompositions. We understood the singular structure of a rational function in terms of a set of irreducible varieties and the order of vanishing/divergence of the function on those varieties. Importantly, this allows us to study the singular structure of a rational function not only on codimension-one varieties but also on higher codimension varieties. We understood the analytic consequences of this higher codimension data by connecting it to an important set of polynomials with well-defined vanishing behavior on these surfaces: the symbolic power of an ideal. This allowed us to construct refined Ansätze for rational prefactors that match the singular behavior on higher codimension varieties. In order to practically apply this strategy, we introduced p-adic numbers, which make it possible to balance the stability benefits of finite fields with the a non-trivial measure of size in the number field. With this numerical tool, we constructed an algorithm to classify the set of symbolic powers to which the numerators of rational prefactors belong, thereby allowing us to construct the refined Ansätze. These Ansätze have a strongly reduced number of free parameters that need to be fixed by numerical evaluations over finite fields. As an example application, we recon-sidered the two-loop finite remainders for the production of three photons at hadron colliders. We studied them on both codimension-one and codimension-two singular varieties, and built Ansätze that we organized in a way reminiscent of a partial-fraction decomposition. We then constrained these Ansätze using remarkably few evaluations to reconstruct the analytic form of the rational prefactors. A number of future directions deserve to be explored. Firstly, it is clear that the behavior of rational prefactors in gauge theory amplitudes on higher codimension singular varieties is highly non-trivial. It would be interesting to understand the physical origin of this behavior. Secondly, it would be interesting to investigate other techniques for constructing primary decompositions, such as those discussed in Ref. [76]. Thirdly, an important question that we leave to future work is to understand how modern numerical algorithms for scattering amplitude calculation, such as numerical unitarity, behave when then number field is taken to be the p-adic numbers. Finally, it would also be interesting to consider evaluating rational prefactors near higher codimension varieties, simplifying the linear system which needs to be solved to fit the Ansatz in an approach similar to that of Ref. [30]. Altogether, we foresee applications to as-yet unknown scattering amplitudes.

The algebraic definition is
While radical ideals can be uniquely decomposed as the intersection of prime ideals, the same is not true for non-radical ideals. This leads us to the third property we discuss here, as we recall from Eq. (2.83) that an arbitrary ideal can be decomposed as an intersection of primary ideals. The algebraic definition is Note that this definition is secretly symmetric because if A is commutative, then the roles of a and b can be reversed. We see from considering Eqs. (A.1) and (A.2) that a prime ideal is both radical and primary. Also, while the radical of a primary ideal is a prime ideal, not all primaries are necessarily powers of primes, e.g. x 2 , y is primary with associated prime x, y , but the former is not a power of the latter. Finally, in Eq. (2.94) we introduced a special class of prime ideals: maximal ideals. The algebraic definition of such an ideal is If the field is algebraically closed then the variety associated to a maximal ideal corresponds to a single point.
Operations We can say that J is radical if J = √ J . Starting from this definition, the equivalence in Eq. (2.29) is Hilbert's Strong Nullstellensatz (see Chapter 4 of [54]).
Second, we discuss the ideal quotient J : K of two ideals J and K, defined as If J is a radical ideal, then there is a geometric interpretation of the ideal quotient J : K. Specifically, for ideals J and K over an algebraically closed field, where J is a radical ideal, it can be shown that [54, Section 4.4, Corollary 11] where the overline on the right hand side denotes the Zariski closure. Geometrically, one can see that the ideal quotient can be useful to simplify primary decompositions (see Appendix B.1).
Third, as not all ideals J are radical, it is useful to introduce also the concept of ideal saturation. It consists of iterated ideal quotienting until the result is unchanged J : K ∞ = J : K s such that J : K s = J : K s+1 . (A.8) The smallest such exponent s is called the saturation index. We find it useful to define J : a ∞ for a single element a of A as J : a ∞ . The geometric analogue of saturation is set difference of varieties. Specifically, for two ideals J and K over an algebraically closed field we have [54, Section 4.4, Theorem 10] V (J : where the overline on the right hand side again denotes the Zariski closure. Note that Eq. (A.9) generalizes Eq. (A.7), in that there is no requirement of radicality of J.

B Primary-Decomposition Techniques
In this section, we provide details of the techniques used to perform the primary decompositions presented in Eqs. (5.7) to (5.12). While there exist general algorithms for primary decomposition (see e.g. Chapter 8 of Ref. [56]), due to the high dimensionality of the ideals we consider, it is often convenient to exploit more tailored but less algorithmic approaches. We show that to reproduce the results of Section 5.1 it is sufficient to apply a primary decomposition algorithm, to just the ideal 12 , 13 R 5 . Using the implementation of the algorithm of Gianni, Trager and Zacharias (GTZ) [62] under the primdecGTZ command of Singular, this operation only takes a few seconds. Subsequently, one can use ideal saturation alongside a check of primality to find the remaining primary components. We begin in Section B.1 with a discussion of the effect of ideal saturation on primary decompositions. In Section B.2 we review the concepts of extension and contraction. This then allows us to construct a test for proving that an ideal is prime in Section B.3.

B.1 Primary Decompositions and Saturation
Ideal saturation is intimately related to removal of sub-varieties from a larger variety. It is then interesting to consider how we can use this geometric intuition to simplify a primary decomposition calculation when we already have some understanding of the involved varieties.
Let us first set up the problem in the algebraic context, and then consider the geometric interpretation. In the following we will work in a polynomial ring, and suppress the ring label on ideals for simplicity. Consider an ideal J, its primary decomposition reads where each Q i is a primary ideal. At this stage, we may or may not know explicit generating sets of the primaries Q i and the associated primes P i . We wish to consider the effect that saturation by an ideal K has on J and on its primary decomposition. To this end, we recall that ideal saturation commutes with ideal intersection, i.e. for any ideal K we can write It is therefore sufficient to understand the effect of ideal saturation on each primary component. Consider now the case where K is generated by a single polynomial f . It follows from Ref. [61,Lemma 4.4] that there are only two possible outcomes of saturation by f , either Let us consider this geometrically. In case 1, the variety V (f ) contains V (P i ). Hence, by Eq. (A.9) it removes the variety. In case 2, V (f ) does not contain V (P i ), but it may still intersect it on some higher codimension variety. The removal of this higher codimension variety is, however, "filled back in" by the Zariski closure, and we get the same result back. If we consider these results in the context of Eq. (B.2), we see that we can quite generally use saturation to remove primary components in a controlled manner. We now discuss how we derived the results of Eqs. (5.7) to (5.12). We make use of the following heuristic procedure. Consider an ideal J and a sequence of primary ideals {K 1 , . . . , K n }. Define We know from the above discussion that each of the J i admits a primary decomposition with potentially fewer primary components J i−1 . This occurs because the saturation by K i has potentially removed a subset of the primary components. We consider the final element of the sequence, J n , as a candidate for a primary component of J. We (heuristically) check that J n is primary by checking that it is prime using the test in Appendix B.3. If this is the case, we also consider the K i for which J i = J i−1 as other good candidates for primary components of J and construct a tentative primary decomposition of J given by We then check if Eq. (B.7) is indeed a primary decomposition of J by computing J ′ and checking if J ′ = J. To derive the results of Section 5.1, we apply the procedure to each co-dimension two ideal of which we wish to obtain a primary decomposition, taking the set of K i to be the set of permutations/parity conjugates of assoc( 12 , 13 R 5 ), which we compute using the command primdecGTZ in Singular. While this procedure is heuristic, it was sufficient to derive and prove the results of Eqs. (5.7) to (5.12).

B.2 Extension and Contraction
In order to set up our approach to check if an ideal is prime, we first introduce two concepts of fundamental importance, namely extension and contraction. In this appendix, we mostly follow Ref. [56,Chapter 8.7]. Let us consider the polynomial ring F[X] with X = {X 1 , . . . , X n }, an ideal J ⊆ F[X] generated by the polynomials {p 1 , . . . , p n }, and let us split X into two disjoint sets Y and Z. The extension of J, denoted as J e , is defined as the ideal generated by the infinite set J in F(Y ) [Z], that is in the polynomial ring in Z over the field of fractions F(Y ). A more practical but nevertheless equivalent definition of J e can be taken to be We stress that here G(K) is now being used to generate an ideal in the original ring, rather than the extended ring. Here f is a polynomial defined as f = lcm{HC(g) ∈ F[Y ] : g ∈ G(K)} , (B.12) J is equi-dimensional [77,Theorem 17.6]. Crucially, as all ideals P i in Eqs. (5.7) to (5.12) can be computed as saturations of an equi-dimensional ideal, they must also be equi-dimensional.
To determine if an equi-dimensional ideal J is prime, we recall that where the polynomial f is defined according to Eq. (B.12) and J e ⊂ F(Y ) [Z]. For the purposes of our test, we stress that Y is a maximally independent set of J, such that J e is a zero-dimensional ideal. We are going to test the left-hand term (J + f s ) for redundancy in the intersection, and the right-hand term J ec for reducibility. Given equi-dimensionality, by definition no primary component of J can have lower dimensionality. Therefore, if either term in the intersection is of lower dimensionality then it must be redundant. This implies that J is prime iff J ec is prime and dim(J + f s ) < dim(J) . where ζ i ∈ F(Y ). If this is the case then J e is a maximal ideal and maximal ideals are prime. This check can be done semi-numerically by taking Y in a finite field, as in Section 3.2.
We then want to show that (J + f s ) is redundant in the intersection. Since J is equidimensional, this is the case if (J + f s ) is of lower dimension. So redundancy can be reduced to dimension testing for (J + f s ). However, computing the dimensionality of (J + f s ) can be quite computationally expensive if the polynomial f is of high degree. However, we can make use of a further splitting lemma embedded in Ref. [56,Lemma 8.52]. Consider ab ∈ I. Let µ be the saturation index of b in I, then I = (I + a) ∩ (I + b µ ) .
(B.18) Therefore, it is sufficient to check that the dimensionality of (J + f i ) drops for each factor f i of f . Furthermore, there may be several Y such that the associated J e is manifestly maximal. Thus, there is some freedom in the choice of Y . It can be helpful to iterate through all choices of Y such that J e is maximal and choose that with the simplest f . Lastly, let us stress that failure to find a linear Gröbner basis for J e does not imply reducibility of V (J), while it can be shown that failure of (J + f s ) to drop in dimension does imply reducibility of V (J). Using this test, together with ideal intersection, one can easily and efficiently prove the primary decompositions given in Section 5.1.

C The Bracket Polynomial Quotient Ring
In Section 2.2, we claimed that the ring of polynomials that only pick up little-group scalings under Lorentz transformations, R n , is isomorphic to R (q) n , a quotient ring of the polynomial ring S n . In this appendix, we develop this statement mathematically.
We begin by connecting S n to R n . We use a ring homomorphism φ : S n → R n , that acts on the variables in S n as φ( ij ) = λ i1 λ j0 − λ i0 λ j1 and φ([ij]) =λ i0λj1 −λ i1λj0 . (C.1) We note that as φ is a ring homomorphism, for all a, b ∈ S n it satisfies φ(ab) = φ(a)φ(b) and φ(a + b) = φ(a) + φ(b). Therefore it is sufficient to define the action of φ on the variables of S n . Physically, it is clear that the map φ is re-expressing any polynomial in spinor brackets in terms of the spinor variables. That is, φ implements Eq. (2.4). Let us now consider the image of the map φ in R n . By construction, it is the requisite subset of R n , i.e. That is, the image of φ, R n , is isomorphic to the quotient of S n by the kernel of the map φ.
In other words, physically inequivalent polynomials in spinor brackets can be identified with the elements of S n which are inequivalent modulo the elements of S n which φ maps to zero. Given an ideal J of R n , let us now consider how to construct the ideal J ∩ R n of R n . To this end, consider a homomorphism φ ′ : S n → S n /[π −1 Sn,Rn (J)], where φ ′ takes the same form as Eq. (C.1), but where the right hand side is considered in S n /[π −1 Sn,Rn (J)]. The kernel of φ ′ is an ideal of S n consisting of all polynomials in spinor brackets that map to elements of J. Importantly, ker(φ ′ ) contains ker(φ) and so π Sn,Sn/ker(φ) [ker(φ ′ )] is the associated ideal in the quotient ring S n / ker(φ). We have therefore constructed an ideal of R n by Eq. (C.3).
To be able to make practical computations with functions of spinor brackets, we must be able to identify the kernel of ring homomorphisms. It turns out that kernels of homomorphisms similar to φ and φ ′ can be computed with Gröbner basis techniques. In full generality, consider a ring homomorphism