Conormal Spaces and Whitney Stratifications

We describe a new algorithm for computing Whitney stratifications of complex projective varieties. The main ingredients are (a) an algebraic criterion, due to L\^e and Teissier, which reformulates Whitney regularity in terms of conormal spaces and maps, and (b) a new interpretation of this conormal criterion via primary decomposition, which can be practically implemented on a computer. We show that this algorithm improves upon the existing state of the art by several orders of magnitude, even for relatively small input varieties. En route, we introduce related algorithms for efficiently stratifying affine varieties, flags on a given variety, and algebraic maps.


Introduction
The quest to define and study singular spaces counts among the most spectacular success stories of twentieth century mathematics. Much of the underlying motivation arose from algebraic geometry, where the spaces of interest -namely, the vanishing loci of polynomials -contain singular points even in the simplest of cases. Without the benefit of hindsight, it remains a Herculean task to construct good models of singular spaces that are simultaneously broad enough to include all analytic varieties and narrow enough to exclude various pathological spaces which arise as zero sets of arbitrary smooth functions. The standard solution to this conundrum, which we describe below, was first proposed by Whitney [51] and subsequently refined by Thom [44,45], Mather [34], 23,24], Lê-Teissier [32], Fulton [17], Cappell-Shaneson [7], Weinberger [50] and others.

Whitney's Condition (B).
As a natural starting point, one can at least require each candidate space X under consideration to embed in some Euclidean space R n and to admit a partition into smooth submanifolds, say with dim M i = i. An entirely reasonable first attempt at constructing such M i from X might proceed as follows. For each dimension 0 ≤ i ≤ n and subset Y ⊂ R n , let E i (Y) denote the set of points p in Y which admit an open neighbourhood U p ⊂ Y homeomorphic to R i . Then, recursively define M n := E n (X), and where M >i denotes the union j>i M j . Unfortunately, this recursive strategy does not produce a desirable partition. Perhaps the simplest way to see the underlying problem is to try constructing these M i by hand when X ⊂ R 3 is the singular surface depicted in Figure 1. 0 FIGURE 1. The Whitney cusp depicted above is the hypersurface of R 3 given by y 2 + z 3 − x 2 z 2 = 0. The entire x-axis, drawn horizontally, is singular.
Since M 3 is empty, one identifies M 2 ⊂ X as the set of points with two-dimensional Euclidean neighbourhoods; and upon removing these, only the x-axis remains. This axis must therefore equal M 1 , and we obtain a partition of X into one and two-dimensional smooth manifolds. The issue here is that the origin has a singularity type which is different from all other points lying on M 1 -a small neighbourhood in X around the origin is not homeomorphic to a small neighbourhood around any other point lying on the x-axis. More precisely, let G be the group of homeomorphisms f : X → X so that f is isotopic to the identity and its restriction to each M i is a diffeomorphism. It turns out that G acts transitively on the two connected components of M 1 − {0} while fixing 0 itself. Thus, our recursive strategy must be amended so that the M i are G-equisingular in this sense, which would automatically separate 0 from M 1 into a separate stratum.
Whitney's ingenious approach from [51] was to consider the behaviour of limiting tangent spaces as one approaches a point in some Y := M i in two different ways: one in a tangential direction along Y itself, and another in a normal direction along some other X := M j for j > i. Let {x i } and {y i } be sequences of points in X and Y respectively which both converge to the same y in Y. Write T i for the tangent space of X at x i and i for the secant line [x i , y i ] joining each x i to the corresponding y i in the ambient R n . The pair (X, Y) is said to satisfy Whitney's Condition (B) if the limiting tangent space T = lim T i contains the limiting secant line = lim i whenever both limits exist. In our example, one can find sequences of points in X := M 2 and Y := M 1 , both limiting to the problematic point 0, for which ⊂ T -these are illustrated in Figure 2.
It is a foundational result in stratification theory that equisingularity is satisfied by any decomposition X = i M i for which all pairs (M j , M i ) satisfy Whitney's Condition (B) -see [34] or [24, Part I Ch 1.5]. Since their very inception, such Whitney stratifications From the perspective of analysing limiting tangent spaces, the Nash blowup is an optimal object. However, the geometry of the Grassmannian is rather intricate, and this makes it difficult to explicitly compute defining equations of N(X) from those of X. One remedy is to systematically replace Gr(k, n + 1) with the dual projective space (P n ) * in the construction described above. With this modification in place, we consider the set of all hyperplanes in P n -or equivalently, points in the dual projective space (P n ) * -that contain the tangent space at each x in X reg . Passing to the closure in X × (P n ) * produces the conormal space Con(X) of X, and the natural projection κ X : Con(X) X is called the conormal map. The conormal space retains essential information about limiting tangents; and crucially, Con(X) is also a projective variety whose defining equations can be easily extracted from those of X. This Paper. Here we introduce an algorithm for building Whitney stratifications of complex projective varieties. The main reason for restricting our focus to such varieties rather than the far more general class of real semialgebraic sets (which are equally easy to represent on a computer) is that the ingredients required to implement our algorithm are only available in the complex algebraic setting. In any event, the immediate obstacle is that it appears hopeless to try verifying Condition (B) directly for a pair of smooth quasiprojective varieties, since this would require computation of limiting tangent planes and secant lines over arbitrary pairs of infinite sequences. Attempting to bypass this problem by constructing the Nash blowup also appears to be a daunting task. Thus, we turn to the conormal space Con(X) of the given input variety X.
The good news comes in the form of a result by Lê and Teissier, which provides a complete characterisation of Condition (B) for projective varieties in terms of their conormal spaces [32,Proposition 1.3.8]. This criterion asserts that for any projective variety X ⊂ P n and smooth quasiprojective subvariety Y ⊂ X, the pair (X reg , Y) satisfies Condition (B) if and only if the associated primes of the integral closure of the ideal sheaf of κ −1 X (Y) are contained among the associated primes of the ideal sheaf of Con(X) ∩ Con(Y) ∩ κ −1 X (Y). There are now two caveats to consider -first, as remarked above, we are not aware of any analogous criterion for pairs of smooth real (semi)algebraic sets. Second, and more serious from our perspective, is the fact that even the most basic algorithmic tasks involving integral closures are computationally prohibitive [47,Sec 9.3].
Our main result circumvents the latter issue by making use of a carefully chosen primary decomposition. Let R be the coordinate ring of P n × (P n ) * , and consider a projective variety X ⊂ P n with conormal map κ X : Con(X) X. For any subvariety Y ⊂ X, the ideal sheaf of κ −1 X (Y) constitutes an honest homogeneous ideal in R and is given by I Y + I Con(X) , and it therefore makes sense from an algorithmic perspective to perform a primary decomposition [10,Chapter 4.8] of this ideal. Given such a homogeneous ideal I R, we will denote the associated projective subvariety of P n × (P n ) * by V(I). With this preamble in place, we now state our main theorem.
THEOREM. Let X ⊂ P n be a pure dimensional projective variety and Y a nonempty irreducible subvariety of its singular locus X sing . Consider a primary decomposition (of R-ideals) Then the pair (X reg , Y − A) satisfies Condition (B).
Computing a primary decomposition of an ideal reduces to standard Gröbner basis calculations [12,18] and is widely implemented in computer algebra systems, so this result directly leads to our recursive algorithm for stratifying complex projective varieties. Before describing the details, we highlight three relevant features. First, given a k-dimensional input variety X ⊂ P n , the output Whitney stratification is produced in the form of (defining equations for) a nested sequence X • of subvarieties so that the desired manifold partition X = i M i is given by M i := X i − X i−1 . Second, this algorithm can easily be used to produce Whitney stratifications of affine complex varieties as well -first pass to the projective closure X, build its Whitney stratification X • , then dehomogenize the resulting X i 's. And third, given any flag F • of projective subvarieties: F 0 X ⊂ F 1 X ⊂ · · · ⊂ F X = X, our algorithm can be adapted so that its output is subordinate to this flag. In other words, we can guarantee that each connected component of a given M i lies in a single successive difference F j X − F j−1 X (see Section 5). As a consequence, we are also able in Section 6 to stratify generic morphisms of projective varieties by availing of their Thom-Boardman flags [5,44].
Related Work. The current state of the art in this area appears to be the recent work of Ðinh and Jelonek [31]. To the best of our knowledge, given a complex algebraic variety X embedded in n-dimensional affine or projective space, all prior stratification methods (such as [38,41] for instance) require quantifier elimination in approximately 4n real variables. While critical points based algorithms for quantifier elimination, such as that of Grigoriev and Vorobjov [26], have existed in the theoretical literature for many years these remain unimplemented (see the discussion in Subsection 7.3). Therefore, quantifier elimination is generally accomplished using some version of the cylindrical algebraic decomposition algorithm of Collins [1,4,9], which is known to be extremely difficult in practice. For stratifications of real varieties given by unions of transversely-intersecting smooth subvarieties, the theoretical complexity of quantifier elimination can be somewhat improved [48]. As far as we are aware, no implementation of any such quantifier elimination based Whitney stratification algorithms has ever been produced.
The work of Dinh and Jelonek [31] improves upon such cylindrical algebraic decomposition (CAD) approaches by requiring only Gröbner basis (GB) computations in approximately 4n complex variables. The advantage enjoyed by GB methods over their CAD counterparts in practice has been well-documented [14,52]. In fact, it is remarked in [14, III.D] that "Although like CAD the calculation of GB is doubly exponential in the worst case, GB computation is now mostly trivial for any problem on which CAD construction is tractable." In fairness, it should be noted that cylindrical algebraic decompositions apply to a much wider class of singular spaces (i.e., real semialgebraic sets), where Gröbner basis methods are entirely unavailable.
Our algorithm further reduces the Whitney stratification problem to Gröbner basis type computations in approximately 2n complex variables, and additionally, is able to preserve the sparsity structure of the input in ways that make a significant difference to real-world performance. By contrast, the algorithm of [31] requires various choices of generic linear forms, which end up removing a lot of sparsity from the systems being considered. As an added bonus our algorithm is deterministic, while the algorithm of [31] is probabilistic. We have implemented both algorithms, and provide a performance comparison in the final Section of this paper.
Outline. In Sections 1 and 2, we briefly review conormal spaces and Whitney stratifications respectively, with a view towards describing the Lê-Teissier criterion for Whitney's Condition (B). Section 3, which is focused on the primary decomposition approach to this criterion, forms the technical heart of this paper and contains a proof of our main result. We describe our recursive algorithm for constructing Whitney stratifications of complex projective varieties in Section 4 and verify its correctness. In Section 5 we modify this algorithm to produce flag-subordinate stratifications, which are then used to stratify projective morphisms in Section 6. Finally, Section 7 provides both complexity estimates and empirical evidence that the algorithm described here readily outperforms the existing state of the art.
Acknowledgements. VN is grateful to Mark Goresky and Robert MacPherson for several valuable discussions on the local geometry of singular spaces; his work was supported by EPSRC grant EP/R018472/1 and by DSTL grant D015 funded through the Alan Turing Institute. We thank the anonymous referee for their careful reading of the paper as well as their helpful comments and corrections. We are particularly grateful to the research group comprising Lihong Zhi, Nan Li, Zhihong Yang and Zijia Li for alerting us to an error in the published version of this paper [29]. They discovered that the accompanying software package did not perform correctly on the projective Whitney Cusp. This error has been corrected in this version of the paper and in the new version of the code. Finally, we would like to thank Bernard Teissier for alerting us to a mistake in our description of the integral closure of an ideal in an earlier version of this manuscript.

Conormal Spaces
For each pair of positive integers n and k with n + 1 ≥ k, let Gr(k, n + 1) denote the complex Grassmannian whose points correspond to all the k-dimensional linear subspaces of (n + 1)-dimensional affine space C n+1 . The usual projective space P n equals Gr(1, n + 1) while its dual (P n ) * is Gr(n, n + 1). Let X ⊂ P n be a connected k-dimensional complex analytic space whose regular and singular loci will be written X reg and X sing := (X − X reg ) respectively. Recall that the tangent space to the smooth manifold X reg at a given point x is a subspace T x X reg in Gr(k, n + 1). DEFINITION 1.1. The conormal space of X is the subset of P n × (P n ) * determined by the closure Con(X) = (x, ξ) | x ∈ X reg and T x X reg ⊂ ξ . Thus, a point (x, ξ) in P n × (P n ) * lies in Con(X) if and only if there exists a sequence of points {x i } ⊂ X reg which converge to x in P n and a sequence of hyperplanes {ξ i } ⊂ (P n ) * which converge to ξ in (P n ) * so that T x i X reg ⊂ ξ i holds for all i 1.
The map κ X : Con(X) → X induced by the evident projection (x, ξ) → x is called the conormal map of X; the fiber κ −1 X (x) of κ X over a point x in X is the set of all hyperplanes in (P n ) * which contain a limiting tangent space at x. Conormal spaces and maps are well-studied classical objects of substantial interest in complex geometry, with deep connections to polar varieties, Nash blowups, microlocal analysis and beyond [16]. Here we will be interested exclusively in conormal maps of complex projective subvarieties X ⊂ P n -in this special case, Con(X) is an n-dimensional complex subvariety of X × (P n ) * , the conormal map κ X is algebraic, and the dimension of each fiber κ −1 X (x) is no larger than n (see [16,Proposition 2.9] and references therein). PROPOSITION 1.2. Let X ⊂ P n be a pure dimensional complex variety. If X ⊂ X is any Zariski-dense subset, then Con(X) = Con(X ).
PROOF. Since X is dense in the closed connected algebraic subspace X ⊂ P n , for any point (x, ξ) ∈ Con(X) there exists a sequence of points {x i } in X reg converging to x and an induced sequence of hyperplanes ξ i containing T x i X reg which converge to ξ. Since Con(X) is closed by definition, we have Con(X) = Con(X ).

Whitney Stratifications
Let X, Y ⊂ C n+1 be smooth complex manifolds with dim(Y) < dim(X). A point p in Y is said to satisfy Whitney's Condition (B) with respect to X if the following property [51,Sec 19] holds: for any sequences of points {x i } ⊂ X and {y i } ⊂ Y both converging to p, if the secant lines i = [x i , y i ] converge to some limiting line in P n and if the tangent spaces T x i X converge to some limiting plane T in the Grassmannian Gr(dim X, n + 1), then ⊂ T.
More generally, we say that the pair (X, Y) satisfies Condition (B) if the above property holds for every point p in Y. Note that (X, Y) vacuously satisfies Condition (B) if the closures X and Y do not intersect in C n+1 . The result below is also elementary, and we have only highlighted it here since we appeal to it rather frequently. PROPOSITION 2.1. Assume that a pair (X, Y) of smooth complex manifolds satisfies Condition (B). If X ⊂ X is a dense submanifold of X and Y ⊂ Y an arbitrary submanifold of Y, then (X , Y ) also satisfies Condition (B).
PROOF. Since X ⊂ X and Y ⊂ Y, every sequence ({x i }, {y i }) ⊂ X × Y is automatically a sequence in X × Y. And since X is dense in X, we have an equality T x i X = T x i X of tangent planes in the appropriate Grassmannian. Thus, (X , Y ) satisfies Condition (B) because (X, Y) does.
Condition (B) serves as a regularity axiom which can be used to induce a particularly well-behaved and useful class of decompositions of analytic spaces into submanifolds.
where each difference M i := W i − W i−1 is a complex analytic i-dimensional manifold subject to the following conditions. The connected components of M i , called the i-dimensional strata, must obey the following axioms: Whitney showed in [51,Section 19] that every variety X admits a Whitney stratification X • for which each constituent X i ⊂ X is a subvariety. His original definition from that paper contains an additional Condition (A), which is now known by Mather's work to be superfluous [34,Proposition 2.4]. In fact, even the frontier axiom follows from Condition (B) for locally finite stratifications [34,Corollary 10.5], so Condition (B) will remain our sole focus in this paper. The inherent difficulty here is that verifying Condition (B) involves testing the behavior of limiting tangent spaces and secant lines over arbitrary families of infinite sequences.
Fortunately, there is a beautiful alternate characterization in terms of conormal maps due to Lê and Teissier [32, Proposition 1.3.8], which we describe below. The following notation has been employed in its statement: for each closed subscheme Z of P n (or of P n × (P n ) * ), the defining sheaf of ideals is written I [Z]; note that I [Z] is simply an ideal in the appropriate coordinate ring R, however it may fail to be radical. In contrast, the radical ideal associated to a variety V in either of our ambient spaces will be written I V . We also recall that for a polynomial ideal I R with primary decomposition I = Q 1 ∩ · · · ∩ Q r , the set Assoc(I) of I's associated primes consists of prime ideals given by taking the radical of each primary component { √ Q 1 , . . . , √ Q r }. LEMMA 2.3. Let X ⊂ P n be a projective variety with conormal map κ X : Con(X) X, and consider a subvariety Y of X satisfying Y ⊂ X sing . Let I p be the maximal ideal of a point p ∈ Y reg considered in the coordinate ring of P n × (P n ) * . Then Condition (B) holds for the pair (X reg , Y reg ) at p if and only if we have a containment If A ⊂ Y is a closed proper subvariety that contains Y sing but not the point p, then the above criterion for the pair (X reg , Y reg ) at p gives an identical criterion for the pair (X reg , Y − A) at p. Our goal here is to derive from this local result a global algorithmic criterion for checking whether or not (X reg , Y − A) satisfies Condition (B) at all points y ∈ Y − A. In the statement below, of associated primes.
We now claim that requiring such a containment for each p in Y , is equivalent to the containment in (1).
Note that, since p is not in A by assumption, we have that κ −1 A (p) is not contained in any primary components supported on κ −1 (A) and hence, when summing with I p , we can replace Similarly, the integral closure on the right side may as well be replaced by ; thus, if we have containment (2) for every p ∈ Y , this verifies that the desired condition holds everywhere in κ −1 X (Y − A), and thus we automatically have the corresponding containment for the Zariski closures, hence we obtain (1).
Conversely, suppose that (1) holds and consider any p / ∈ A. All associated primes of Since all these primes are also contained in the left hand set, and since we have We recall for the reader's convenience that the integral closure I of an ideal I in a commutative ring R is defined as follows. Let I i denote the i-th power of I, i.e., the set of all a ∈ R which can be expressed as the product of i elements of I. Now I consists of all r in R for which there exists some integer k > 0 and elements a i ∈ I i satisfying r k + a k−1 · r k−1 + · · · + a 1 · r + a 0 = 0.
In general, if we are only given access to a set of generating elements for I, then various algorithmic operations involving I become computationally prohibitive even in the relatively benign case R = C[x 0 , . . . , x n ]. These hard tasks include, for instance, extracting a list of defining polynomials for I and testing whether a given r ∈ R lies inside I (see [46,Sections 6.6 and 6.7] or [47, Section 9.3]). Thus, its considerable aesthetic appeal notwithstanding, Proposition 2.4 does not furnish an efficient algorithmic mechanism for verifying Condition (B). We are therefore compelled to employ a Corollary of this Proposition, where the integral closure has been replaced by a far more tractable object.

An Effective Version of Condition (B)
In this section we prove our main result. Let R be the coordinate ring of P n × (P n ) * , and consider a projective variety X ⊂ P n with conormal map κ X : constitutes an honest homogeneous ideal I Y + I Con(X) of R, and it therefore makes sense from an algorithmic perspective to perform a primary decomposition [10, Chapter 4.8] of this ideal. Given such a homogeneous ideal I R, we will denote the associated projective subvariety of P n × (P n ) * by V(I).
THEOREM 3.1. Let X ⊂ P n be a pure dimensional projective variety and Y a nonempty irreducible subvariety of its singular locus X sing . Consider a primary decomposition (of R-ideals) Then the pair (X reg , Y − A) satisfies Condition (B).
PROOF. By the remarks following [40, Thm 3.12], we have where Applying (4) with A replaced by B, we note that ρ B must contain ρ A because we have we note that Condition (B) automatically holds for (X reg , Y − C) since B is contained in C, whence by Proposition 2.4 we have The argument which gave us ρ A ⊆ ρ B also yields ρ A ⊆ ρ C . We now claim that the opposite containment also holds, whence ρ A = ρ C . To see this, note that C contains ] are identical since both equal i∈ρ A Q i . Using (6), one final appeal to Proposition 2.4 confirms that the pair (X reg , Y − A) satisfies Condition (B), as desired.
We note that the argument given above adapts readily to the scenario where Y is puredimensional but not necessarily irreducible. In this case, one defines ρ A to consist precisely of those i ∈ {1, . . . , s} for which κ X (V(Q i )) equals an irreducible component of Y, all of which are equidimensional. Similarly any valid choice of B must be a proper subvariety of some irreducible component of Y and hence satisfy dim(B) < dim(Y). The proof then proceeds identically. EXAMPLE 3.2. Consider the projectivized Whitney Cusp X ⊂ P 3 given by The singular locus X Sing equals V(x 0 , , and the usual (affine) Whitney cusp X ⊂ C 3 is obtained by setting x 0 = 1. The singular locus of X is the line Y := V(x 2 , x 3 ); note we slightly abuse notation and write Y for both the affine and projective variety defined by x 2 = x 3 = 0. Now, we have a primary decomposition Thus, applying Theorem 3.1 and setting x 0 = 1 establishes Condition (B) for the pair , which in turn gives the following strata: X reg , Y , and V(x 1 , x 2 , x 3 ).

Stratifying Projective Varieties
In this section we describe a recursive algorithm which uses Theorem 3.1 to compute Whitney stratifications of pure-dimensional projective varieties. Since each irreducible component of an arbitrary projective variety can be stratified separately, this is by no means a severe restriction. And since various intermediate varieties which get constructed in our algorithm won't satisfy this purity criterion, it will be convenient to let Pure d (Z) denote the set of all the pure d-dimensional irreducible components of a given projective variety Z. These components can be algorithmically extracted by computing the minimal associated primes of the defining ideal I Z , and the main cost is a Gröbner basis computation -see [12].

Computing Conormal Ideals.
In light of Theorem 3.1, we will often be required to compute (the equations which define) the conormal space Con(Z) of a given projective variety Z ⊂ P n . The ideal I Con(Z) C[x, ξ] is extracted in practice as follows. First, we let I Z = f 1 , . . . , f r be any defining ideal of Z, and let c be its codimension n − dim(Z). One computes the Jacobian ideal Jac Z of Z which is generated by all the c × c minors of the matrix of partial derivatives  see [36, pg. 27-28]. The singular set Z sing ⊂ Z is (by definition) the zero locus of the Jacobian ideal, namely: then I Con(Z) is given by the saturation (I Z + Jac ξ Z ) : (Jac Z ) ∞ , see [13, Eq. (5.1)] or [30, §2] for instance. Algorithms for computing ideal sums and saturations are standard fare across computational algebraic geometry, and may be found in [10] for instance.

The Decomposition Subroutine.
For any pair of projective varieties X, Y ⊂ P n with Y ⊂ X sing , the following subroutine, called Decompose, implements the primary decomposition based constructions of Theorem 3.1. Although we present the inputs and outputs of all our algorithms as projective varieties, in practice these must be represented on a machine by some choice of generating polynomials of their defining ideals.

Decompose(Y, X)
The notation in Line 6 is meant to indicate that V is added to Y i for all i ≥ dim V. This subroutine terminates because the For loop in line 3 is indexed over primary components of a polynomial ideal, of which there can only be finitely many. The following result is a direct consequence of Theorem 3.1. PROPOSITION 4.1. Let Y ⊂ X be a pair of projective varieties in P n so that Y ⊂ X sing and dim Y = d. If Decompose is called with input (Y, X), then: PROOF. The first assertion holds because of Line 6: whenever a Z : For the second assertion, from Line 2, J is the ideal of the scheme κ −1 X (Y) and hence the image of any primary component under κ X must be contained in Y, but Y is irreducible and dim(V(K)) < dim(Y), hence all V(K) are proper subvarieties of Y. The third assertion follows directly from Theorem 3.1.
The output Y • of Decompose described above need not constitute a Whitney stratification of the input variety Y -Proposition 4.1 does not guarantee that Condition (B) holds among successive differences of the form Y i − Y i−1 .

The Main Algorithm.
Let X ⊂ P n be a pure k-dimensional complex projective variety defined by a radical homogeneous ideal I X . The algorithm WhitStrat, described below, takes in X as input and returns a nested sequence of its subvarieties X • . An essential part of this algorithm is a Merge statement, which accepts two nested sequences of varieties V • and W • of lengths k and d, with k > d. To Merge V • with W • , one updates the longer sequence V • via the following rule: The property V i ⊂ V i+1 continues to hold after such an operation. The following algorithm WhitStrat uses Decompose in order to construct Whitney stratifications of puredimensional projective varieties.

WhitStrat(X)
To verify that this algorithm terminates, we note that the For loop on Line 3 runs once per irreducible component of X sing , of which there can only be finitely many. And the For loop on Line 5 will terminate provided that the recursive call on Line 7 terminates; but the dimension of the variety X d is bounded above by µ < k, i.e., it is strictly less than the dimension of the input variety. Thus, the recursion terminates after finitely many steps and produces a nested sequence X • of subvarieties of X. Our goal in the next section is to establish that X • constitutes a valid Whitney stratification of X.

Correctness.
Let X • (d) denote the nested sequence of varieties X • as they stand at the end of the d-th iteration of For loop (in Line 5 of WhitStrat) where d ranges over (µ, µ − 1, . . . , 1, 0). These X i (d) fit into a (µ + 1) × (k + 1) grid of projective varieties and inclusion maps: The vertical inclusion maps arise since each X • (d) is obtained from the previous X • (d + 1) by performing two Merge operations (in Lines 6 and 7 respectively). Note that each iteration of the For loop in Line 5 moves us from one row to the next, until at last the bottom row (corresponding to index d = 0) contains the output. REMARK 4.2. Before entering the For loop of Line 5, the sequence X • contains the input variety X in the top dimension (i.e., X k = X) and irreducible components of X sing in lower dimensions. It follows that the columns of our grid (7) come in three flavours, depending on the index i: (1) the left-most column (with index i = k) identically equals X, i.e., X k (d) = X regardless of the row index d in {0, . . . , k}; (2) the next few columns (with index k > i ≥ µ) are also constant -independent of the row index d, each X i (d) in this range equals X sing ; and finally, (3) the i-th column for µ > i ≥ 0 stabilizes below its (i + 1)-indexed entry: These three assertions follow from the observation that during the d-indexed iteration of the For loop in Line 5, the two Merge operations (from Lines 6 and 7) which produce the row X • (d) are only allowed to merge subvarieties of X d (d + 1) to the preceding row X • (d + 1).
Define the successive differences across the rows of the grid (7), i.e., It follows from Lines 2-4 of WhitStrat that we have the containment In the remainder of this Section, we will now show that S i (0) constitutes the i-strata of a Whitney stratification X • (0) of the input variety X. Here is a first step in this direction.
In other words, X d−1 (i) contains all points of X d (i) reg where Condition (B) fails with respect to S k (i).
PROOF. By Remark 4.2, we may safely restrict to the case 0 ≤ i ≤ d ≤ µ since we have  2), we know that V d is a subvariety of X d (d + 1) of dimension strictly smaller than d. Since V • is merged with X • (d + 1) in Line 6 en route to producing X • (d), we know that V d must in fact be a subvariety of X d−1 (d). Now note that Since dim X k−1 (d) < k, we know that S k (d) is dense in X reg . Moreover, since V d is entirely contained in X d−1 (d), we may apply Proposition 2.1 to the pair P above and conclude that the new pair also satisfies Condition (B). Now let W • be the output of the recursive call to WhitStrat in Line 7 during the d-th iteration of the For loop in Line 5. From Lines 2-4, we deduce that X d (d + 1) sing ⊂ W d−1 , and after the Merge operation of Line 7 we are also guaranteed Putting these containments together gives Using this in the pair P guarantees that the pair (S k (d), S d (d)) satisfies Condition (B). Finally, the conclusion for the pair (S k (i), S d (i)) follows since subsequent iterations of the the For loop (corresponding to lower d values) do not alter X ≥d .
Next, we will establish that Condition (B) is satisfied by arbitrary pairs of successive differences in (7) for sufficiently small row index. PROPOSITION 4.4. The pair (S j (i), S i (i)) satisfies Condition (B) for all 0 ≤ i < j ≤ k.
PROOF. From Remark 4.2, we have S j (i) = S j (j) since i < j. Let W • be the output of the recursive call in Line 7 of WhitStrat during the d = j iteration of the For loop in Line 5, so we have W j = Pure j (X j (j)). Recall by (9) Now W j−1 lies in X j−1 (j) because of the Merge operation in Line 7 of WhitStrat, and in turn X j−1 (j) is a subvariety of X j−1 (i) as described in (7). Since both varieties W j−1 ⊂ X j−1 (i) have dimension strictly smaller than j, we have that S j (i) is dense in W j − W j−1 . Thus, it suffices to show that all points in W j ∩ X i (i) where Condition (B) fails with respect to S j (i) lie within W j ∩ X i−1 (i). To confirm this, note that by construction X i (i) is a union of the form W i ∪ Z, where the subvariety Z ⊂ X i (i) has dim(Z) ≤ i. First we consider the case where Z is empty; in this case, we know from Proposition 4.1(3) that the pair satisfies Condition (B), so the desired result follows immediately from Proposition 2.1. On the other hand, if Z is nonempty, we can assume without loss of generality that Z is not contained in W i . Now any point of  We can now confirm that the output of WhitStrat constitutes a valid Whitney stratification of X. THEOREM 4.5. When called on a pure k-dimensional complex projective variety X ⊂ P n , the output X • of WhitStrat forms a Whitney stratification of X.
PROOF. As remarked after (9), each S i (d) is smooth for d ≤ i. The conclusion follows immediately from Proposition 4.4 since for any pair (S j (i), S i (i)) with 0 ≤ i ≤ j ≤ k we have S i (i) = S i (0) and S j (i) = S j (0) by Remark 4.2. Thus, Condition (B) holds for every This algorithm can also be used to stratify affine complex varieties via the following dictionary: for each affine complex variety X ⊂ C n , we write PX ⊂ P n for its projective closure [36, Proposition 2.8], which is constructed as follows. Let { f 1 , . . . , f r } be a Gröbner basis for the defining ideal I X C[x 1 , . . . , x n ]. For each i in {1, . . . , r}, write F i for the homogenisation of f i in C[x 0 , x 1 , . . . , x n ]. Then, the projective closure PX ⊂ P n is the complex projective variety given by V(F 1 , . . . , F r ). Conversely, one can recover X from PX by dehomogenizing, i.e., by setting x 0 = 1 in each defining polynomial F i . COROLLARY 4.6. Let X ⊂ C n be a pure k-dimensional affine complex variety and let PX ⊂ P n be its projective closure. If PX • is the output of WhitStrat(PX), then a valid Whitney stratification of X is given by X • , where each X i is the dehomogenization of PX i . PROOF. Since PX • defines a Whitney stratification of PX, it follows from Proposition 2.1 that intersecting each PX i with a dense subset D ⊂ PX constitutes a Whitney stratification of D. The conclusion follows by considering D = PX − V(x 0 ).
It should be noted that the stratifications produced by WhitStrat may not be minimal; and moreover, the stratification of X described in the preceding Corollary may not be minimal even if the output stratification of PX is minimal.

Flag-Subordinate Stratifications
By a flag F • on a variety X we mean any finite nested set of subvarieties of the form If X is projective, we implicitly require each F i X to also be projective. We call the length of the flag F • . Aside from these containments, there are no restrictions on the dimensions of the individual F i X; and in particular, we do not require successive differences F i X − F i−1 X to be smooth manifolds, let alone satisfy Condition (B). DEFINITION 5.1. Let X ⊂ P n be a projective variety and F • a flag on X of length . A Whitney stratification It is crucial to note that the number j(S) from the preceding Definition need not equal dim S, and that one does not require j(S) = j(S ) whenever dim S = dim S .
Fix a pure-dimensional complex projective variety X ⊂ P n as well as a flag F • on X of length < ∞. The following subroutine accepts as input any (not necessarily pure dimensional) subvariety W ⊂ X along with the flag F • , and constructs the induced flag F • on W defined by F j W := W ∩ F j X for all j in {0, 1, . . . , }.

InducedFlag(W, F • )
Input: A subvariety W ⊂ X and a flag F • on X of length .
The strategy for producing an F • -subordinate stratification of X is to modify the algorithms of Section 4 as follows: whenever one wishes to Add an irreducible i-dimensional subvariety W ⊂ X to the output sequence X ≥i , one Merges X • with InducedFlag(W, F • ) instead. For completeness, we have written out the modified versions of both Decompose and WhitStrat (the originals can be found in Sections 4.2 and 4.3 respectively).

Flag-Subordinate Stratification Algorithms.
Here is the flag-subordinate avatar of Decompose; as promised, it only differs from the original in Line 6: the statement which Added an irreducible variety to a sequence has now been replaced with a Merge.
And here is the variant of WhitStrat which produces an F • -subordinate stratification of X ⊂ P n . Again, the only difference occurs in Line 4.

Correctness.
The following result confirms that WhitStratFlag produces valid flag-subordinate Whitney stratifications. THEOREM 5.2. Let X ⊂ P n be a pure dimensional complex projective variety and F • a flag on X. When called with input (X, F • ), the algorithm WhitStratFlag terminates and its output X • is an F • -subordinate Whitney stratification of X.
PROOF. Termination follows for the same reasons as the ones used for WhitStrat, and since X • is a valid Whitney stratification follows from Theorem 4.5. Thus, it remains to show that each connected component S of X i − X i−1 is contained entirely in a single F j X − F j−1 X. Any such S can be written as Y − X i−1 , where Y is an irreducible component of X i . Note that, in particular, this Y will appear as a V in Line 3 of the InducedFlag subroutine when it is called with first input X i . Let j be the smallest index of the flag F • for which Y ⊂ F j X holds. Then dim(Y ∩ F X) < i for every < j, and so Y = Y ∩ F X is Added to X • via Line 5 of the InducedFlag subroutine and hence Y is contained in X m for some m < i. Since X m ⊂ X i , it follows that But since S ⊂ F j X and Y is irreducible, we have Y ⊂ F j X, whence Y ⊂ F p X for all p ≥ j. Thus, S also has empty intersections with F p X − F p−1 X for p > j, and the desired result follows.
We note in passing that the algorithms described in this Section can also be used to produce flag-subordinate stratifications of affine complex varieties. As before, we will write PX for the projective closure of each affine variety X; and given a flag F • on X, we write PF • for the flag on PX defined by The following result forms a natural flag-subordinate counterpart to Corollary 4.6. COROLLARY 5.3. Let X ⊂ C n be a complex variety and let F • be a flag on X. Writing PX • for the output of WhitStratFlag when called with input (PX, PF • ), its dehomogenization X • constitutes an F • -subordinate Whitney stratification of X • .
PROOF. This follows immediately from Corollary 4.6 and Theorem 5.2 since the containment relations between varieties are preserved by both projective closures and dehomogenizations.
Our motivation for computing flag-subordinate Whitney stratifications stems from the desire to algorithmically stratify algebraic maps between projective varieties.

Stratifying Algebraic Maps
A continuous map between topological spaces is called proper if pre-images of compact sets are compact. Reproduced below is the content of [6, Definition 3.5.1], which highlights a natural class of maps between Whitney stratified spaces; we recall for the reader's convenience that the tangent space at each point p on a smooth manifold S is denoted T p S. DEFINITION 6.1. Let X and Y be Whitney stratified spaces. A proper map f : X → Y is called a stratified map if for each stratum S ⊂ X there exists a a stratum R ⊂ Y so that (1) the image f (S) is wholly contained in R; and moreover, (2) at each point x in S, the Jacobian J We refer to any pair (X • , Y • ) of Whitney stratifications of X and Y which satisfy the above requirements as a stratification of f . It follows from Thom's first isotopy lemma [34, Proposition 11.1] that if f : X → Y is a stratified map in the sense of this definition, then for each stratum R ⊂ Y the restriction has the structure of a fibration (with possibly singular fibers).
Our aim here is to algorithmically construct stratifications tailored to algebraic maps between projective varieties. We describe these maps in terms of the coordinate ring C[x] := C[x 0 , . . . , x n ] of P n . DEFINITION 6.2. A projective morphism f : X → P m consists of an (m + 1)-tuple of homogeneous polynomials f i in C[x], i.e., Projective morphisms as defined above are always proper [28,Ch II,Thm 4.9], so at least that requirement of Definition 6.1 holds automatically. We will restrict to the case where X is pure dimensional; and for each projective morphism f : X → P m as defined above, we can always consider some pure-dimensional projective variety Y ⊂ P m which contains the image f (X), whence f constitutes an algebraic map X → Y. We now seek to describe an algorithm which will produce a stratification (X • , Y • ) for any generic triple (X, Y, f ). Both the genericity condition and the algorithm itself make essential use of the Thom-Boardman flag of f , which is described below.

The Thom-Boardman
Flag. Let f : X → P m be a projective morphism and consider its Jacobian operator This matrix of polynomials is not well-defined on P n in the sense that its evaluation J x f need not equal J y f for a pair of projectively equivalent points x ∼ y in C n+1 . However, we always have rank J x f = rank J y f in this case. For each p ∈ P n , we will denote by rank J p f the rank of J x f for any (necessarily nonzero) x ∈ C n+1 which maps to p under the canonical surjection (C n+1 − {0}) P n . Let k ≤ min(n + 1, m + 1) be the largest rank attained by J p f as p ranges over P n and consider, for each i in {0, . . . , k + 1}, the homogeneous ideal Jac i f of C[x] generated by all i × i minors of J f . It follows by cofactor expansion that these ideals fit into a descending sequence, and so the corresponding projective varieties T + i P n := V(Jac i f ) form a flag of length k + 1 on P n . By construction, we have for 0 ≤ i ≤ k + 1. We call T + • the the Thom-Boardman flag [5,44] of f on P n . Our main focus here is not on the flag T + • , but rather on the flag induced by T + • on the domain variety X ⊂ P n . The desired genericity condition on f is described below. DEFINITION 6.3. The projective morphism f : X → P m is generic if the varieties X and T + i P n intersect transversely in P n for each i in {0, . . . , k + 1}.
Although we will not require this fact here, it is known that for a dense subset of algebraic morphisms, each T + i P n is a subvariety of P n of dimension dim T + k +1−i P n = (n + 1) − i · (i + |m − n|), is the defining ideal of X.
Applying f to the T • produces a flag on f (X) which extends to a flag on Y. DEFINITION 6.5. Given the Thom-Boardman flag T • on X, its image is the flag B • of length k + 2 on Y defined by setting (Note that by assumption B k+1 Y := f (X) is a subvariety of B k+2 Y := Y.)

Computing Images and Pre-Images.
To compute the flag B • in practice, we require a mechanism for producing equations for f (X ) where X ⊂ X is a subvariety of X -note that this image f (X ) is Zariski closed in P m because X is projective (see [36,Theorem 4.22]). This can be accomplished using elimination. To this end, consider the ideal We will also require the dual operation to implement our algorithm; i.e., given some subvariety Y ⊂ Y, we wish to algebraically compute its pre-image f −1 (Y ) within X. Let γ be the natural map X → P n × P m sending each x to the pair (x, f (x)), so the image of γ coincides with the graph Γ(X). Consider the coordinate projections π x and π y Γ(X) onto the first and second factor, respectively. By construction, for each point x in X we have the equality f (x) = π y • γ(x); and since all spaces and maps in sight are projective, the images of closed sets remain closed. Now consider a subvariety Y ⊂ f (X) and note that its pre-image under f is Treating I Y C[y] as an ideal in C[x, y], the desired pre-image f −1 (Y ) may be computed algebraically as the intersection 6.3. Algorithm. Assume that f : X → Y is a generic projective morphism in the sense of Definition 6.3, where X ⊂ P n and Y ⊂ P m are pure dimensional projective varieties with f (X) ⊂ Y, and let k ≤ min(n + 1, m + 1) as in Section 6.1. The following algorithm relies on WhitStratFlag (from Sec 5.1) to build Whitney stratifications X • of X and Y • of Y via the following basic strategy. First we construct the image B • of the Thom-Boardman flag T • as described in Definition 6.5. Next, we create a B • -subordinate stratification Y • of the codomain Y and pull it back across f to obtain a flag F • on the domain X. Finally, we create an F • -subordinate stratification X • of X.
WhitStratMap(X, Y, f ) Input: Pure dimensional varieties X, Y and a generic morphism f : As we have not described the Refine subroutine invoked in the penultimate line, we are not yet able to check whether this algorithm terminates, and whether it returns a correct stratification of f in the sense of Definition 6.1. The next result, which involves the Whitney stratifications X • and Y • produced in Lines 10 and 7 respectively, will explain why this additional subroutine is needed. PROPOSITION 6.6. For each stratum S of X • , there exists a unique stratum R of Y • satisfying f (S) ⊂ R. Moreover, at each point x in S, the Jacobian J x f | S : T x S → T f (x) R of the restricted map f | S : S → R has full rank, i.e., PROOF. Noting that of X • is subordinate to the flag F • by Line 10, we know that for each stratum S of X • there is a number i := i(S) satisfying S ⊂ (F i X − F i−1 X). Now by Line 9, for any such stratum we have f (S) ⊂ (Y i − Y i−1 ). By Definition 2.2 we know that S is connected, and so its image under the continuous map f must also be connected; thus there is a unique stratum Since Y • is B •subordinate by Line 7, there exists a number j := j(R) satisfying R ⊂ (B j Y − B j−1 Y). By Definition 6.5, we have f −1 (R) ⊂ (T j X − T j−1 X), where T • is the Thom-Boardman flag of f from Definition 6.4. In particular, this gives S ⊂ (T j X − T j−1 X) and it follows that X • is subordinate to T • . Consequently, for each x ∈ S we know that rank J x f = (j − 1). Consider the commuting diagram of vector spaces Here the vertical arrows depict inclusions of tangent spaces, e.g., on the left we have the natural inclusion of T x S in T x P n C n+1 . Since S ⊂ (T j X − T j−1 X), we know from (10) that the rank of J x f is precisely (j − 1) at every x ∈ S; and by genericity of f it follows that the subspaces T x S and ker J x f , whose intersection equals ker J x f | S , meet transversely inside C n+1 . Thus, we obtain There are now two cases to consider -either dim S < (j − 1), or dim S ≥ (j − 1). In the first case, J x f | S is injective and hence already has full rank. In the latter case, we have ; but since the rank of f on ∆ j is (j − 1) by (10), the implicit function theorem guarantees that dim f (∆ j ) = (j − 1). So, we have dim R ≤ (j − 1), and combining this inequality with our calculation of dim ker(J x f | S ) above gives Since we have assumed dim S ≥ dim R, the kernel of J x f | S can not have dimension smaller than the codimension dim S − dim R, so the above inequality is an equality in this case and J x f | S has full rank, as desired.
When comparing the requirements of Definition 6.1 to the properties guaranteed by the preceding result, we note that the stratifications X • and Y • are insufficient for our puposes. While every stratum S of X • does indeed have a unique stratum R of Y • containing f (S), the crucial Jacobian-surjectivity requirement is not satisfied. Instead, we might have dim S < dim R with the Jacobian J x f | S being injective at every point x in S. The Refine subroutine invoked in Line 13 of WhitStratMap, which we describe in the next Section, has been designed to rectify this defect.

Refinement and Correctness.
Before Line 13 of WhitStrat has been executed, we have stratifications X • and Y • of X and Y respectively. In light of Proposition 6.6, consider the set of problematic strata-pairs P = P(X • , Y • ) given by: The purpose of the Refine subroutine described here is to modify the stratifications X • and Y • until this problematic set P becomes empty. By Proposition 6.6, each stratum S of X • can appear in a pair of P with at most one stratum R of Y • . However, the converse need not hold -a given stratum R of Y • might be paired with several different strata of X • within P. Recalling that X • is F • -subordinate, for each index we will use S = S (X • ) to denote the set of all strata S of X • which lie in the difference F +1 X − F X.
and a generic morphism f : X → Y so that Prop. 6.6 holds.
Set r := dim Z 10 Add Z to X ≥r 11 Merge X • with WhitStrat(Pure r (X r )) 12 Set This subroutine processes the problematic strata-pairs (S, R) from P(X • , Y • ) one at a time, in descending order of dim R. For each such pair, Lines 2-5 further partition R by forcing the closure of the image f (S) to form (one or more) new strata. As a result of subdividing R along f (S), some of the strata S of X • satisfying f (S ) ⊂ R no longer have their images contained in a single stratum. Lines 6-11 are designed to correct this problem by finding and further subdividing all such S appropriately. PROPOSITION 6.7. The Refine subroutine terminates, and its output (X • , Y • ) constitutes a valid stratification (as in Definition 6.1) of the generic projective morphism f : X → Y.
PROOF. If P is empty, then the algorithm terminates immediately with a correct stratification, so let (S, R) be a strata-pair in P with R of maximal dimension; thus, we have dim S < dim R. In Lines 2-5, WhitStratMap constructs a new Whitney stratification Y + • of Y by subdividing the closure of R into finitely many new strata so that all points lying in the (closure of the) immersed image f (S) ⊂ R lie within strata of dimension no larger than dim S. Thus, for each point x ∈ S, there is a unique index i(x) for which f (x) ∈ R i(x) . Moreover, we have Since R i(x) ⊂ R, we know by Proposition 6.6 that the Jacobian J x f : T x S → T f (x) R i(x) is surjective for all x ∈ S as desired. Unfortunately, the act of partitioning R into smaller strata might violate the other property required by Definition 6.1, i.e., we may have strata S of X • whose images f (S ) were entirely contained in R, but which now intersect several new R i 's. Therefore, in Lines 6-11, the algorithm paritions all such S along their intersections with f −1 (R i ) for all i -this creates new Whitney strata and hence refines X • . Finally, in Line 12 we also update Y • to the new stratification Y + • . After this update, there might be several new problematic strata pairs in P; but the key observation here is that none of these new pairs (S * , R * ) can have dim R * > dim R since all of the new strata R * of Y • have dimension bounded above by dim R. Moreover, even when dim R * = dim R, it is impossible to have any (S * , R * ) in P where S * ⊂ S is a newly-created stratum of X • -any such S must have its image f (S ) entirely contained in a stratum of dimension < dim R. Thus, WhitStratMap eventually terminates and outputs a valid stratification of f : X → Y. REMARK 6.8. An analogous algorithm for stratifying proper algebraic maps between affine varieties can be produced by making a few standard modifications to WhitStratMap. Implicit in (the proofs of) Corollaries 4.6 and 5.3 are routines which would compute (flagsubordinate) Whitney stratifications of a complex affine algebraic variety. These routines accept as input affine equations, homogenize the associated Gröbner basis, run the projective stratification algorithms described here, and then dehomogenize the output to produce the final result. Let WhitStratAff and WhitStratFlagAff be the resulting algorithms. If X ⊂ C n and Y ⊂ C m are affine varieties and f : X → Y is a proper morphism, then an analogous definition of the map being generic and of a Thom-Boardman flag on X may be given. To obtain a stratification of the generic proper morphism f : X → Y in the sense of Definition 6.1, one simply replaces each occurence of WhitStrat and Whit-StratFlag by WhitStratAff and WhitStratFlagAff, respectively in the WhitStratMap and Refine algorithms described above.

Performance and Complexity
In this section, we briefly describe the real-life performance as well as the computational complexity of the basic algorithm WhitStrat from §4. Our implementation is in Macaulay2 [25], and can be found along with documentation at the link below: http://martin-helmer.com/Software/WhitStrat 7.1. Performance. As remarked in the Introduction, the state of the art for Whitney stratification algorithms appears to be the recent algorithm of Dinh and Jelonek [31, §2]. We are not aware of any existing implementations of earlier algorithms based on quantifier elimination, and in any event, since implemented quantifier elimination methods rely on cylindrical algebraic decomposition we would expect their performance to be slower than that of [31] overall. Since the authors of [31] did not provide an implementation of their algorithm, we have implemented it ourselves in Macaulay2. This implementation can be found at: http://martin-helmer.com/Software/WhitStrat/DCG.m2.
In Table 1

INPUT
Run time The variety in the first entry of this table is (the projective analogue of) the Whitney umbrella, which was one of the earliest examples of singular spaces used to illustrate the need for Condition (B). We ran the algorithm of [31] on this variety for over 29 hours. In this time, it was unable to find strata of codimension > 1, i.e., the strata lying below the singular locus. All computations involving this algorithm used at least 27 GB of RAM during their 8 hour run. In sharp contrast, WhitStrat used between 0.0005 and 0.347 GB of RAM, with all but the last entry in the table requiring no more than 0.0037 GB. While it is certainly possible that a more optimized implementation of [31] than ours could be produced, in our view it is unlikely to significantly alter these general trends.

Complexity. By far the biggest computational burden incurred when running
WhitStrat comes from various intermediate Gröbner basis calculations. In particular, these are required when running the Decompose subroutine in Line 3 (computing all primary components), and in Line 4 (computing elimination ideals), for more on how these tasks are accomplished via Gröbner basis see [11,12]. Throughout the remainder of this section, we write GB(n, δ) to denote the complexity of performing Gröbner basis computation on an ideal consisting of polynomials in n variables of degree at most δ, in the worst case this bound is approximately O(δ 2 n ), as described for instance in [35,37]. However, more recent analysis [2,15] has revealed that this worst case bound tends to be overly pessimistic in general.
The bulk of our complexity estimates will be provided in terms of the following input parameters: we assume that the defining radical ideal I X of our input variety X has been given in terms of a finite generating set of homogeneous polynomials in n complex variables with maximal degree δ. To avoid trivialities we assume δ ≥ 2 and n ≥ 2. Let k be the dimension of X, let c = n − k be the codimension of X, and µ < k the dimension of the singular locus X sing . PROPOSITION 7.1. The degree of X sing is no larger than δ n . If Z ⊂ X sing is any irreducible µ-dimensional subvariety, then the degree of the affine subvariety V µ ⊂ C n × C n defined by the ideal sum I Con(X) + I Z is bounded as PROOF. We begin with the observation that deg(X sing ) is bounded from above by the degree of any µ-dimensional complete intersection that contains X sing -such complete intersections may be generated as zero sets of an appropriate number of random linear combinations of the defining polynomials of X sing (see [17,Example 8.4.12] since the singular locus can have codimension at most k in X. Again using Bezout's theorem, the expression on the right may be bounded above by δ n−k · δ k , which equals δ n as desired. Turning now to V µ , note that the minors of the augmented Jacobian which generate Con(X) have bidegree no larger than ((δ − 1) n−k , 1) inside P n × (P n ) * , while those which generate Z have degree no larger than δ n inside P n by our bound on deg(X sing ) given above. Thus, (δ n , 1) bounds from above the bidegree for the generating polynomials of V µ . Passing to affine charts, V µ may be generated by polynomials of degree at most δ n + 1 as a subvariety of C 2n . Appealing once again to a complete intersection which contains V µ and has the same dimension, we obtain the following degree bound by Bézout's theorem: Since the right side is bounded from above by δ 3n 2 , the argument is complete.
The degree of V µ estimated above bounds several quantities of interest from above when Decompose is first invoked from WhitStrat. In Decompose, we loop over all primary components of an ideal. Note that the desired quantities, i.e. degrees and number of generators of the resulting ideals, are bounded by an expression which is polynomial in δ 2 n . In Proposition 7.2 below we are led to consider various ideals in C[x 1 , . . . , x n ] and C[x 1 , . . . , x n , ξ 1 , . . . , ξ n ]. For an arbitrary polynomial ideal J with generators of degree at most d in N variables (we will have either N = n or N = 2n) we therefore bound both the degree and number of primary components of J by d 2 N , for some fixed positive integer that is independent of the input. An analysis of the primary decomposition algorithm of [18], see also [12], yields a (not sharp) upper bound ≤ 36N 2 .
PROPOSITION 7.2. The following quantities are bounded by δ (3 ) µ n 2µ 2 nµ when Decompose is called from WhitStrat during the any step of the algorithm: (1) the number of primary components of J; (2) the degrees of the generating polynomials of J and K.
PROOF. We have from Proposition 8.1 that deg(V µ ) is bounded by δ 3n 2 . For all d in {µ − 1, . . . , 0} we similarly let V d be the degree of the ideal J = I Con(X) + I Y in Line 2 of Decompose when it is called during the (µ − d + 1)-st iteration of the For loop of WhitStrat. Thus, when d = µ − 1, the variety represented by X in Line 3 of Decompose is µ-dimensional and lives in the singular locus of the original input variety, whereas Z ⊂ X has dimension at most µ − 1.
Starting from Y = X Sing we may call Decompose upto µ times. In the first instance we run line with an input of degree at most δ 3n 2 , this will yield up to (δ 3n 2 ) 2 n = δ 3 n 2 2 n primary components, whose degree is bounded by this same number and this number also bounds the degree of K since the ideal elimination cannot increase degree. Each iteration will increase the bound on the degree and number of components by exponentiating to 3n 2 2 n the bounds from the last iteration, this can happen to δ 3 n 2 2 n at most µ − 1 additional times, so we obtain δ (3 n 2 2 n ) µ .
A very similar argument shows that this quantity also bounds the degrees of varieties arising in Decompose from the recursive calls in Line 7 of WhitStrat.
In order to fully describe WhitStrat's complexity, we require the following additional runtime parameters. Assume, for each d ∈ {µ, µ − 1, . . . , 1, 0}, that r d ≥ 0 is the largest number of generators encountered among the ideals J, K, and √ K (which is the ideal of V(K)) in Lines 3-5 of Decompose when extracting the d-dimensional strata of X (which are then used in subsequent conormal variety calculations). We have introduced these secondary r d parameters because we are unaware of any sufficiently general and reasonably tight bounds on the number of generators of J, K, and √ K in terms of the primal quantities n, δ and the number of generating polynomials for the input variety X. Any such bound must account for pathological cases and hence be at least doubly exponential in n, see for instance [8]. Such estimates do not accurately reflect the vast majority of inputs.
If a given ideal I Z has r generating polynomials in n variables, then the number of minors in the generating ideal of Con(Z) equals r + 1 n − dim(Z) · n + 1 n − dim(Z) ≤ (16rn) n−dim(Z) < (16rn) n .
We will assume henceforth that (16r d n) n is in O(δ (3 ) µ n 2µ 2 nµ ) for all d, so that the cost of computing the required minors to obtain the ideals of conormal varieties is dominated by the cost of subsequent Gröbner basis calculations. With this assumption in place, the estimates in Proposition 7.2 give us the desired complexity bounds. THEOREM 7.3. Let X be a complex projective subvariety of P n whose defining polynomials have degree at most δ and whose singular locus has dimension µ. The time complexity of running WhitStrat on X is bounded in O (µ + 2) 2 · (D + 2) · GB(n, D) , where D = δ (3 ) µ n 2µ 2 nµ and GB(n, D) is the cost of computing Gröbner bases for an ideal generated by polynomials in n variables of degree at most D.
PROOF. Taking into account the recursive call in Line 7 of WhitStrat, the subroutine Decompose can be called at most (µ + 1) + (µ) + · · · + 1 = (µ+1)(µ+2) 2 times. Each call results in a Gröbner basis computation at Line 2 to find I Con (X) and the computation of a primary decomposition prior to the loop executing on Line 3; the computational complexity of this primary decomposition is polynomial in the cost of Gröbner basis computation as discussed above. Each iteration of the For loop in Line 3 of Decompose runs over at most D primary components and computes an elimination ideal in Line 4 requiring one Gröbner basis computation; the computation of the dimension at Line 5 can be done using linear algebra operations using the output of Line 4 and hence has complexity bounded by the operation at Line 4. Hence we have at most D + 2 operations each have complexity in at most the order of GB(n, D). Bounding (µ+1)(µ+2) 2 by (µ + 2) 2 gives the claimed result.
The practical efficiency of WhitStrat comes from the fact that the parameter D from the above theorem lies in O(deg(X)) for typical input varieties X, rather than scaling super-exponentially with δ. For the purposes of describing theoretical complexity, we are forced to increment the power of n in the exponent each time the For loop of WhitStrat iterates, as this is the only way to guarantee that the worst-case degree bounds hold. In practice, however, we have observed that the degrees of the intermediate varieties stay roughly constant and even reduce as the For loop iterates from d = µ down to d = 0.

Comparison with Quantifier-Elimination based Stratification Methods.
We are aware of one other approach for computing Whitney stratifications which does not use Gröbner basis calculation, namely the algorithm of [39,41]. This method has complexity bounds derived from the asymptotically fast critical points based quantifier elimination methods of Grigoriev-Vorobjov [26] and Renegar [42]. Although these critical point methods were first introduced over three decades ago and have been extensively studied thereafter, to the best of our knowledge there is no software implementation for general polynomial systems. All general purpose quantifier-elimination software we are aware of uses some form of cylindrical algebraic decomposition, [1,4,9], which has complexity bounds doubly exponential in the number of variables. Quantifier-elimination algorithms based on critical points have been described in [4,Chapter 14]; on page 7 of this text, the authors state that: "For most of the algorithms presented in Chapter 13 to 16 there is no implementation at all. The reason for that is that the methods developed are well adapted to complexity results but are not adapted to efficient implementation." Nevertheless, had an implementation of the critical points based quantifier-elimination methods of Grigoriev-Vorobjov [26] and Renegar [42] existed, then an implementation of the stratification algorithm of [39,41] based on this would achieve a complexity bound of the form δ O(n) 6ω , where ω is the length of the canonical (i.e., coarsest) Whitney stratification of the input variety, see, for example, [39, page 289]. For high dimensional inputs which admit strata in all dimensions, this bound is asymptotically quite similar to those from Gröbner basis based methods. However, it has been suggested that the O(n) in the exponent conceals a rather large constant that is likely to make these quantifier-elimination methods infeasible in practice [3,Remark 2.28].