# Bounds for polynomials on algebraic numbers and
application to curve topology

Daouda Niang Diatta, Sény Diatta, Fabrice Rouillier, Marie-Françoise Roy,

Michael Sagraloff

► To cite this version:

Daouda Niang Diatta, Sény Diatta, Fabrice Rouillier, Marie-Françoise Roy, Michael Sagraloff. Bounds for polynomials on algebraic numbers and application to curve topology. Discrete and Computational Geometry, 2022, 67, pp.631-697. 10.1007/s00454-021-00353-w. hal-01891417

HAL Id: hal-01891417

https://inria.hal.science/hal-01891417v1

Submitted on 10 Apr 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Bounds for polynomials on algebraic numbers and application to curve topology

Daouda Niang Diatta · Sény Diatta ·
Fabrice Rouillier · Marie-Françoise Roy ·
Michael Sagraloff

Received: date / Accepted: date

**Abstract** Let $P \in \mathbb{Z}[X, Y]$ be a given square-free polynomial of total degree $d$ with integer coefficients of bitsize less than $\tau$, and let

$$V_{\mathbb{R}}(P) := \{(x, y) \in \mathbb{R}^2, P(x, y) = 0\}$$

be the real planar algebraic curve implicitly defined as the vanishing set of $P$. We give a deterministic algorithm to compute the topology of $V_{\mathbb{R}}(P)$ in terms of a simple straight-line planar graph $\mathcal{G}$ that is isotopic to $V_{\mathbb{R}}(P)$. The upper bound on the bit complexity of our algorithm is in $\tilde{O}(d^5\tau+d^6)^1$; which matches the current record bound for the problem of computing the topology of a planar algebraic curve. However, compared to existing algorithms with comparable complexity, our method does not consider any change of coordinates, and more importantly the returned simple planar graph $\mathcal{G}$ yields the cylindrical algebraic decomposition information of the curve in the original coordinates.

Our result is based on two main ingredients: First, we derive amortized quantitative bounds on the roots of polynomials with algebraic coefficients

<footnote>D. N. Diatta
Université Assane Seck de Ziguinchor, Senegal</footnote>

<footnote>S. Diatta
Université Assane Seck de Ziguinchor, Senegal</footnote>

<footnote>F. Rouillier
INRIA Paris, IMJ-PRG - Sorbonne Universités, France</footnote>

<footnote>* M.-F. Roy
IRMAR, Université de Rennes I, Campus de Beaulieu, 35042 Rennes CEDEX, France,
33(0)223236020
marie-francoise.roy@univ-rennes1.fr</footnote>

<footnote>M. Sagraloff
HAW Landshut, Germany</footnote>

<footnote n="1">¹ The expression "the complexity is in $\tilde{O}(f(d, \tau))$" with $f$ a polynomial in $d, \tau$ is an abbreviation for the expression "there exists a positive integer $c$ such that the complexity is in $O((\log d \log \tau)^c f(d, \tau))$".</footnote>
as well as adaptive methods for computing the roots of bivariate polynomial systems that actually exploit this amortization. The results we obtain are more general that the previous literature. Our second ingredient is a novel approach for the computation of the local topology of the curve in a neighborhood of all singular points.

**Mathematics Subject Classification (2020)** 14P25 · 68W30 · 13P15 · 14Q05 · 68Q25

**Keywords** Amortized bound on algebraic numbers · Real Algebraic Curves · Exact Topology Computation

# 1 Introduction

Let $P \in \mathbb{Z}[X, Y]$ be a given square-free polynomial of total degree $d$ with integer coefficients of bitsize less than $\tau$. The problem of computing the topology of the planar algebraic curve

$$V_{\mathbb{R}}(P) := \{(x, y) \in \mathbb{R}^2, P(x, y) = 0\},$$

that is, the computation of a simple straight-line planar graph isotopic to $V_{\mathbb{R}}(P)$ inside $\mathbb{R}^2$, is a classical problem in algorithmic real algebraic geometry with many applications in Computer Aided Geometric Design. It is extensively studied in the context of symbolic or semi-numerical computation; for instance, see [2, 3, 4, 8, 10, 11, 12, 13, 14, 15, 17, 19, 21, 26] for recent references.

Almost all algorithms are based on some variant of Cylindrical Algebraic Decomposition (C.A.D.): Decompose the $X$-axis into a finite number of open intervals and points above which the curve has a cylindrical structure (i.e. the curve decomposes into disjoint function graphs above each of these intervals). The *special values* are the projections of the $X$-critical points and vertical asymptotes onto the $X$-axis. Taking points between two special values defines *regular fibers*.

<figure><img src="image_2.png" /><figcaption>Fig. 1: Example of a C.A.D. with three special values</figcaption></figure>
Computing a simple planar graph isotopic to $V_R(P)$ inside $\mathbb{R}^2$ then essentially amounts to connecting the points of a regular fiber to the points of its neighboring special fibers.

There are two main difficulties:

(1) computing the points of the special fibers, which amounts for computing the real roots of univariate polynomials with real algebraic coefficients, which are not square-free;

(2) computing the number curve segments that go to each of the points of the special fiber, to the left and to the right.

A usual strategy for dealing with (2) (see [6, 12, 13, 14, 15, 16, 19, 21]), consists in putting the curve in *generic position*. This is typically achieved by considering a *shearing* that maps $X$ to $X + s \cdot Y$ for some (small) integer $s$. For most values of $s$, the sheared curve has no asymptotes and each special fiber contains at most one $X$-critical or singular point, which considerably eases (2). Since a shearing does not change the topology of the curve, the simple planar graph returned by such algorithms is still isotopic to the curve. However, these algorithms do not compute a C.A.D. of the curve itself but only of the sheared curve. This is critical in some applications, for instance, when the variables $X$ and $Y$ represent physical values (such as length) that are always positive, or probabilities that are between 0 and 1. The topology of the curve restricted to a quadrant or a square can be easily extracted from our output but would be complicated to recover after a shearing of the form $X \mapsto X + s \cdot Y$. Another advantage of keeping the initial variables is that the sparseness of the input equation is preserved.

There exist algorithms [13,16] that go one step further by performing a shearing of the curve in the first step and an inverse shearing in the second step in order to eventually compute an isotopic simple planar graph whose vertices are located on the curve. Such algorithms compute the C.A.D. of the given curve, however the bit complexity of these methods falls clearly behind the best algorithms [19,21] for computing the topology of a planar algebraic curve, which achieve the complexity bound<fnref n="2" /> $\tilde{O}(d^5\tau + d^6)$. Our algorithm achieves the same complexity bounds, but it never performs any coordinate transformation and yields the C.A.D. information of the original curve.

**Theorem 1 (Topology)** Let $P \in \mathbb{Z}[X, Y]$ be a given square-free polynomial of total degree $d$ and integer coefficients of bitsize bounded by $\tau$. There is a deterministic algorithm<fnref n="3" /> that uses $\tilde{O}(d^5\tau + d^6)$ bit operations to compute the topology of the curve

$$V_R(P) = \{(x, y) \in \mathbb{R}^2 \mid P(x, y) = 0\},$$

<footnote n="2">² The algorithm from [19] is deterministic, whereas [21] uses randomization. Both algorithm consider a shearing of the original curve and only return the C.A.D. information of the sheared curve.</footnote>

<footnote n="3">³ We do not only prove existence of such an algorithm, but also present the algorithm in this paper.</footnote>
in terms of a simple planar graph $\mathcal{G}$ that is isotopic to $V_{\mathbb{R}}(P)$ inside $\mathbb{R}^2$. In addition, $\mathcal{G}$ yields the C.A.D. information of the curve $V_{\mathbb{R}}(P)^4$.

For our result, we use two main ingredients: The first one is a new efficient algorithm for computing the roots of a bivariate system in triangular form.

**Theorem 2 (Bivariate Root Isolation)** Let $R \in \mathbb{Z}[X]$ and $F \in \mathbb{Z}[X, Y]$ be polynomials of total degrees $N$ and $n$ and with integer coefficients of bitsize less than $\Lambda$ and $\tau$ respectively, such that

$$V_{\mathbb{C}}(R, F) = \{(x, y) \in \mathbb{C}^2 | R(x) = F(x, y) = 0\}$$

is finite. Using a total number of bit operations bounded by

$$\tilde{O}(N^2\Lambda + N^3 + n^5\tau + n^6 + n \cdot \max(n^2, N) \cdot (N\tau + n\Lambda + Nn)),$$

we can compute

(a) $\deg F(x, Y)$ as well as $\deg \gcd(F(x, Y), \partial_Y F(x, Y))$ for all complex roots $x$ of $R$,

(b) isolating disks $D_{x,y} \subset \mathbb{C}$ for all complex roots $y$ of all polynomials $F(x, Y)$ for all complex roots $x$ of $R$, as well as the corresponding multiplicities $\mathrm{mul}(y, F(x, Y))$

(b') for a given subset $V \subset \{(x, y) \in \mathbb{C}^2 : R(x) = 0 \text{ and } F(x, y) = 0\}$ and an $L \in \mathbb{N}$, we can further refine all isolating disks $D_{x,y}$, with $(x, y) \in V$, to a size less than $2^{-L}$, in an additional number of bit operations bounded by

$$\tilde{O}(N^2\Lambda + N^3 + n \cdot \max(n^2, N) \cdot (N\tau + n\Lambda + Nn) + L \cdot (N \cdot \mu + n^2 \cdot \sum_{x \in \pi_X(V)} \mu_x)),$$

where $\mu_x := \max_{(x,y) \in V} \mathrm{mul}(y, F(x, Y))$, $\pi_X(V)$ is the projection of $V$ on the $X$-axis and $\mu = \max_{x \in \pi_X(V)} \mu_x$.

The results in Theorem 2 are significantly more general than the results in the existing literature. For instance, recent work [1] makes two strong assumptions, namely that the degree of the polynomials $F(x, Y)$ stays invariant for all roots $x$ of $R$ and that each $F(x, Y)$ has only simple roots. In [17, 19, 21], the polynomials $F(x, Y)$ are allowed to have multiple roots, but the degree of $F(x, Y)$ is assumed to be the same for all $x$. In addition, the analysis restricts to the special case, where $R$ is either the resultant polynomial $\mathrm{Res}(F, \partial_Y F, Y)$ or its derivative. None of these restrictions are needed in our results.

Using Theorem 2 as our main tool, we obtain an efficient extension of the C.A.D. for an algebraic curve; see Theorem 3 and Theorem 4.

Our second ingredient is an algorithm for computing the number of branches reaching a singular point inside an adjacency box (see Section 4 for a precise

<footnote n="4">⁴ We remark that our algorithm returns a purely combinatorial representation of the C.A.D., however isolating intervals of all points in all special and regular fibers are computed in sub-steps of the algorithm. By refining these intervals, an isotopic simple planar graph whose vertices are arbitrarily close to the curve can be obtained.</footnote>
definition) from information computed on the boundary of the box (see Figure 3, Figure 4 and Algorithm 1). In order to achieve the complexity bounds we are aiming at, we need to accept that some of the desired information stays ambiguous$^5$, however we will prove that these ambiguities do not prevent us from computing the correct connectivity; see Proposition 23.

For both of the above ingredients, we make essential use of amortized quantitative bounds for polynomials with algebraic coefficients by considering adaptive algorithms that make it possible to exploit this amortization; see Proposition 3 and Proposition 14. Finally a precise combinatorial description of the information needed to draw the simple planar graph isotopic to the curve is given. Since we perform our computations without any change of variables, vertical lines and asymptotes need to be dealt with.

*Organization of the paper* The detailed description and complexity analysis of each step of our algorithm computing the isotopy type is given in Section 4.

The two preceding sections are devoted to univariate and bivariate results about roots of polynomials. In each of the two sections, a part is devoted to recalling well known results, but there are also several new results, particularly amortized quantitative bounds about algebraic numbers weighted with multiplicities (see Proposition 3 and Proposition 14) that play a key role in the proof of Theorem 2 or in the results from Section 4.

## 2 Univariate results

### 2.1 Quantitative geometry of the roots

In our complexity analysis we are going to use some quantitative results related to the geometry of the roots. We first fix some convenient notations and definitions.

**Definition 1** For a polynomial $f = \sum_{i=0}^{n} a_i X^i \in \mathbb{C}[X]$, with $a_n \neq 0$, $\text{lc}(f) = a_n$, is the leading coefficient of $f$. The length of $f$ is defined as

$$ \text{Len}(f) := \sum_{i=0}^{n} |a_i|. \qquad (1) $$

The following result is straightforward:

$$ |f(x)| \le \text{Len}(f) \cdot \max(1, |x|)^n. \qquad (2) $$

<footnote>$^5$ For instance, we aim to compute the location of the intersections of the curve with the four boundary edges of the adjacency box. However, we were not able to show how to distinguish between the special case, where the curve passes exactly the corner of a box, and the generic case, where the curve intersects one of the neighboring edges close to the corner, using only $\tilde{O}(d^6 + d^5\tau)$ bit operations. In such cases, the information at the corner of the box stays ambiguous.</footnote>
The norm of $f$ is defined as

$$ \|f\| := \sqrt{\sum_{i=0}^{n} |a_i|^2}. \qquad (3) $$

Given $x \in \mathbb{C}$, we denote by $\mathrm{mul}(x, f)$ the multiplicity of $x$ as a root of $f$. We denote by $V_{\mathbb{C}}(f)$ the set of the distinct roots of $f$ in $\mathbb{C}$ so that

$$ f = \mathrm{lc}(f) \cdot \prod_{x \in V_{\mathbb{C}}(f)} (X - x)^{\mathrm{mul}(x, f)}. $$

The square-free part $f_{\mathbb{C}}^*$ of $f$ is defined as

$$ f_{\mathbb{C}}^* = \prod_{x \in V_{\mathbb{C}}(f)} (X - x). $$

The *Mahler measure* of $f$ is defined as

$$ \mathrm{Mea}(f) := |\mathrm{lc}(f)| \cdot \prod_{x \in V_{\mathbb{C}}(f)} \max(1, |x|)^{\mathrm{mul}(x, f)}. \qquad (4) $$

Note the multiplicativity of the *Mahler measure*

$$ \mathrm{Mea}(f \cdot g) = \mathrm{Mea}(f) \cdot \mathrm{Mea}(g). \qquad (5) $$

The norm of $f$, its length and its *Mahler measure* are related as follows (see for example [6, Propositions 10.8 and 10.9]):

$$ 2^{-n} \mathrm{Len}(f) \le \mathrm{Mea}(f) \le \|f\|. \qquad (6) $$

The separation of $f$ at $x$ is defined as

$$ \mathrm{Sep}(x, f) := \min_{\substack{y \in V_{\mathbb{C}}(f), \\ y \ne x}} |y - x|. \qquad (7) $$

Given a domain $\mathbb{D}$ and two polynomials $f, g$ in $\mathbb{D}[X]$ of respective degrees $n, n'$, we denote by $\mathrm{Res}(f, g)$ their resultant and by $\mathrm{sr}_k(f, g)$ their $k$-th subresultant coefficient, with $\mathrm{sr}_0(f, g) = (-1)^{n(n-1)/2} \mathrm{Res}(f, g)$ (see for example [6, Section 4.2]). If $\mathbb{D} = \mathbb{C}$ it is well known (see for example [6, Theorem 4.16]) that

$$ \mathrm{Res}(f, g) = \mathrm{lc}(f)^{n'} \prod_{x \in V_{\mathbb{C}}(f)} g(x)^{\mathrm{mul}(x, f)}. \qquad (8) $$

The discriminant $\mathrm{Disc}(f)$ is the element of $\mathbb{D}$ such that

$$ \mathrm{lc}(f) \cdot \mathrm{Disc}(f) = \mathrm{sr}_0(f, f') = (-1)^{n(n-1)/2} \mathrm{Res}(f, f'). \qquad (9) $$

If $\mathbb{D} = \mathbb{C}$, denoting by $x_1, \dots, x_{\mathrm{deg}(f)}$ its complex roots

$$ \mathrm{Disc}(f) = \prod_{i<j} (x_i - x_j)^2 \qquad (10) $$

(see for example [6, Sections 4.1 and 4.2]).

If $\varphi$ is a ring homomorphism between $\mathbb{D}$ and $\mathbb{D}'$, the following properties are easy to prove
- if $\varphi(a_n) \neq 0$, $\varphi(\mathrm{Disc}(f)) = \mathrm{Disc}(\varphi(f))$,

- if $\varphi(a_n) = 0$, $\varphi(\mathrm{Disc}(f)) = \varphi(a_{n-1})^2 \cdot \mathrm{Disc}(\varphi(f))$,

The k-th subdiscriminant coefficient $\mathrm{sDisc}_k(f)$ is the element of $\mathbb{D}$ such that

$$ \mathrm{lc}(f) \cdot \mathrm{sDisc}_k(f) = \mathrm{sr}_k(f, f'). \qquad (11) $$

If $\mathbb{D} = \mathbb{C}$, $m$ is the biggest index such that $\mathrm{sDisc}_{n-m}(f) \neq 0$ if and only if $f$ has $m$ distinct roots in $\mathbb{C}$ (see for example [6, Sections 4.1 and 4.2]).

Now we introduce the generalized discriminant which will play a key role in the statement of several of our quantitative results. We are not aware of a clear identification of this notion earlier in the literature.

**Notation 2** Let $f \in \mathbb{C}[X]$ be a polynomial of degree $n$. Defining

$$ f^{[i]} := \frac{f^{(i)}}{i!}, \qquad (12) $$

the Taylor formula writes as

$$ f(\alpha + X) = \sum_{i=0}^{n} f^{[i]}(\alpha) X^i $$

**Definition 3** Let $\mathbb{D}$ be a domain, and let $f$ in $\mathbb{D}[X]$ of degree $n$. The generalized discriminant of $f$, $\mathrm{GDisc}(f)$ is the element of $\mathbb{D}$ such that

$$ \mathrm{lc}(f) \cdot \mathrm{GDisc}(f) = \mathrm{tcoeff}(\mathrm{Res}_X(f, \sum_{k=1}^{n} U^{k-1} f^{[k]})) $$

where $\mathrm{tcoeff}(g)$ is the tail coefficient of the polynomial $g \in \mathbb{D}[U]$, i.e. the coefficient of its non-zero term of lowest degree in $U$.

Notice that the generalized discriminant is never 0. In the special case where all the roots of $f$ are simple we have:

$$ \mathrm{GDisc}(f) = (-1)^{n(n-1)/2} \cdot \mathrm{Disc}(f) \qquad (13) $$

**Proposition 1** If $\mathbb{D} = \mathbb{C}$,

$$ \begin{aligned} \mathrm{GDisc}(f) &= \mathrm{lc}(f)^{n-2} \cdot \prod_{x \in V_{\mathbb{C}}(f)} f^{[\mathrm{mul}(x,f)]}(x)^{\mathrm{mul}(x,f)} \\ &= \mathrm{lc}(f)^{2n-2} \cdot \prod_{x,y \in V_{\mathbb{C}}(f), x \neq y} (x-y)^{\mathrm{mul}(x,f) \cdot \mathrm{mul}(y,f)}. \end{aligned} $$

*Proof.* The equality

$$ \mathrm{lc}(f)^{n-2} \cdot \prod_{x \in V_{\mathbb{C}}(f)} f^{[\mathrm{mul}(x,f)]}(x)^{\mathrm{mul}(x,f)} = \mathrm{lc}(f)^{2n-2} \cdot \prod_{x,y \in V_{\mathbb{C}}(f), x \neq y} (x-y)^{\mathrm{mul}(x,f) \cdot \mathrm{mul}(y,f)}, $$
is clear. The equality

$$GDisc(f) = \text{lc}(f)^{n-2} \cdot \prod_{x \in V_c(f)} f^{[\text{mul}(x,f)]}(x)^{\text{mul}(x,f)}$$

follows from the fact that

$$\text{Res}_X(f, \sum_{k=1}^{n} U^{k-1} f^{[k]}) = \text{lc}(f)^{n-1} \cdot \prod_{x \in V_c(f)} \sum_{k=1}^{n} U^{k-1} f^{[k]}(x)^{\text{mul}(x,f)}$$

by (8).

□

**Definition 4** For a non-zero polynomial $f \in \mathbb{C}[X]$, we define

$$\text{ILen}(f) := \log(\text{Len}(f)),$$

$$\text{IMea}(f) := \log(|\text{lc}(f)|) + \sum_{x \in V_c(f)} \text{mul}(x, f) \cdot \log(\max(1, |x|)),$$

$$\text{ISep}(f) := \sum_{x \in V_c(f)} \text{mul}(x, f) \cdot |\log(\text{Sep}(x, f))|,$$

$$\text{IGDisc}(f) := \sum_{x \in V_c(f)} \text{mul}(x, f) \cdot |\log(|f^{[\text{mul}(x,f)]}(x)|)|.$$

*Remark 1* Notice that while

$$\text{ILen}(f) = \log(\text{Len}(f)),$$

$$\text{IMea}(f) = \log(\text{Mea}(f))$$

we have, because of the absolute values,

$$\text{ISep}(f) \geq \log(\text{Sep}(f)),$$

$$\text{IGDisc}(f) \geq \log(\text{GDisc}(f)).$$

As a consequence of (6),

$$\text{ILen}(f) \leq \text{IMea}(f) + \text{deg}(f). \qquad (14)$$

In the next step, we give a bound for $\text{ISep}(f)$ relating it to $\text{IMea}(f)$, and $\text{IGDisc}(f)$.

**Proposition 2** Let $f \in \mathbb{C}[X]$ be a polynomial of degree $n$. If $|\text{lc}(f)| \geq 1$,

$$\text{ISep}(f) \in O(n(n + \text{IMea}(f)) + \text{IGDisc}(f)) \qquad (15)$$

For the proof of Proposition 2, we need the following lemma:
**Lemma 1** Let $S$ be a finite subset of $\mathbb{C}$. Consider a mapping $\phi: S \to S$ that maps any element $x$ of $S$ to an arbitrary element $y \in S \setminus \{x\}$ that minimizes the distance to $x$. Then, each element $y \in S$ has at most 6 preimages under the mapping $\phi$.

*Proof.* As the distance between two preimages must be greater than or equal to the distances between $y$ and each of its preimages, the claim follows directly from the fact that if $OAB$ is a triangle and $AB \ge \max(OA, OB)$, then the angle $\widehat{BOA}$ has a measure at least $2\pi/6$. The value 6 is obtained in the case of a regular hexagon and its center. $\square$

*Proof of Proposition 2.* Suppose that $f$ is monic. We first prove that, for any root $x$ of $f$, it holds

$$ \mathrm{Sep}(x, f)^{\mathrm{mul}(x,f)} > |f^{[\mathrm{mul}(y,f)]}(y)| \cdot 2^{-n} \cdot \max(1, |y|)^{-n} \cdot \mathrm{Mea}(f)^{-1} \quad (16) $$

where $y \ne x$ is an arbitrary root of $f$ that minimizes the distance to $x$. The inequality (16) follows directly from the following computation:

$$ \begin{aligned} |f^{[\mathrm{mul}(y,f)]}(y)| &= \prod_{z \in \mathbb{V}_c(f) \setminus \{y\}} |z - y|^{\mathrm{mul}(z,f)} \\ &= \mathrm{Sep}(x, f)^{\mathrm{mul}(x,f)} \cdot \prod_{z \in \mathbb{V}_c(f) \setminus \{x,y\}} |z - y|^{\mathrm{mul}(z,f)} \\ &\le \mathrm{Sep}(x, f)^{\mathrm{mul}(x,f)} \cdot \mathrm{Mea}(f(X+y)). \end{aligned} $$

Using the multiplicativity of the Mahler measure (see 5) it is easy to prove that

$$ \mathrm{Mea}(f(X + y)) \le 2^n \cdot \mathrm{Mea}(f) \cdot \max(1, |y|)^n. $$

by checking the case of a monic polynomial of degree 1. Using Lemma 1 and its notation, each element $y \in \mathbb{V}_c(f)$ has at most 6 preimages under the mapping $\phi$. We thus conclude that

$$ \begin{aligned} & \prod_{x \in \mathbb{V}_c(f)} \mathrm{Sep}(x, f)^{\mathrm{mul}(x,f)} \\ & > 2^{-n^2} \cdot \mathrm{Mea}(f)^{-n} \cdot \prod_{x \in \mathbb{V}_c(f)} \max(1, |\phi(x)|)^{-n} \cdot \prod_{x \in \mathbb{V}_c(f)} |f^{[\mathrm{mul}(\phi(x),f)]}(\phi(x))| \\ & \ge 2^{-n^2} \cdot \mathrm{Mea}(f)^{-n} \cdot \prod_{x \in \mathbb{V}_c(f)} \max(1, |x|)^{-6n} \cdot \prod_{x \in \mathbb{V}_c(f)} \min(1, |f^{[\mathrm{mul}(\phi(x),f)]}(\phi(x))|) \\ & \ge 2^{-n^2} \cdot \mathrm{Mea}(f)^{-n} \cdot \mathrm{Mea}(f)^{-6n} \cdot \prod_{x \in \mathbb{V}_c(f)} \min(1, |f^{[\mathrm{mul}(x,f)]}(x)|)^6, \end{aligned} $$

which shows that

$$ - \sum_{\substack{x \in \mathbb{V}_c(f) \\ \mathrm{Sep}(x,f) < 1}} \mathrm{mul}(x,f) \cdot \log(\mathrm{Sep}(x,f)) \in \mathcal{O}(n(n+1)\mathrm{Mea}(f) + l\mathrm{GDisc}(f)). $$
It remains to estimate

$$ \sum_{\substack{x \in \mathbb{V}_C(f) \\ \mathrm{Sep}(x,f) \ge 1}} \mathrm{mul}(x,f) \cdot \log(\mathrm{Sep}(x,f)). $$

It holds that

$$ \mathrm{Sep}(x, f) = |x - \phi(x)| \le 2 \cdot \max(1, |x|) \cdot \max(1, |\phi(x)|). \quad (17) $$

Thus, we get

$$ \prod_{\substack{x \in \mathbb{V}_C(f) \\ \mathrm{Sep}(x,f) \ge 1}} \mathrm{Sep}(x,f)^{\mathrm{mul}(x,f)} \le 2^n \cdot \mathrm{Mea}(f)^7 $$

and finally

$$ \sum_{x:\mathrm{Sep}(x,f)>1} \mathrm{mul}(x,f) \cdot \log(\mathrm{Sep}(x,f)) \in \mathcal{O}(n+\mathrm{IMea}(f)). \quad (18) $$

For the non-monic case, the claim follows from the result in the monic case and the fact that if $|\alpha| \ge 1$

$$ - \mathrm{IMea}(f) \le \mathrm{IGDisc}(\alpha f), $$

$$ - \mathrm{IGDisc}(f) \le \mathrm{IGDisc}(\alpha f). $$

□

## 2.2 Quantitative results for univariate polynomials with integer coefficients

For polynomials $f$ with integer coefficients, we introduce the notation of the magnitude of $f$.

**Definition 5** A polynomial $f \in \mathbb{Z}[X]$ is of magnitude bounded by $(n, \tau)$ if its degree is bounded by $n$ and its bitsize is bounded by $\tau$, that is, the absolute value of each of its coefficients is bounded by $2^\tau$.

If $f \in \mathbb{Z}[X]$ is of magnitude bounded by $(n, \tau)$, then $f^{[k]}$ is of magnitude bounded by $(n, \tau + n)$ (using Notation 2), using that $\binom{n}{k} < 2^n$ for all $k = 0, 1, \dots, n$.

It is clear that

$$ \mathrm{Len}(f) \le (n+1) \cdot 2^\tau. \quad (19) $$

Moreover, (6) implies

$$ \mathrm{Mea}(f) \le \sqrt{n+1} \cdot 2^\tau, \quad (20) $$

and thus

$$ \mathrm{IMea}(f) \in \mathcal{O}(\tau + \log(n)). \quad (21) $$
Our next aim is to give bounds on lSep($f$) that depend on the magnitude ($n, \tau$) of $f$. In Proposition 2, we have already derived a bound on lSep($f$) that is related to $n$, lMea($f$) and lGDisc($f$). Given (21) we are left to bound lGDisc($f$) in terms of $n$ and $\tau$. For this, we first derive a general bound on the product of the absolute values that a sequence of integer polynomials $g_1, \dots, g_m$ takes at corresponding roots of $f$. A corresponding bound on lGDisc will then follow by applying our result to the sequence of $f^{[k]}$, $k = \deg(f) - 1, \dots, 0$.

**Proposition 3** Let $f$ be a non-zero polynomial in $\mathbb{Z}[X]$ of magnitude bounded by $(n_1, \tau_1)$ and let $(g_i)_{1 \le i \le m}$ be a sequence of non-zero polynomials in $\mathbb{Z}[X]$ each of magnitude bounded by $(n_2, \tau_2)$.

a) Let $A \subset V_{\mathbb{C}}(f)$ be such that for each $x \in A$, there exists $i(x) \in \{1, \dots, m\}$ with $g_{i(x)}(x) \ne 0$. Then, it holds

$$ \sum_{x \in A} \mathrm{mul}(x, f) \log(|g_{i(x)}(x)|) \in \tilde{O}(n_1 \tau_2 + n_2 \tau_1). \quad (22) $$

b) Suppose moreover that, for every root $x \in V_{\mathbb{C}}(f)$, there exists an $i$ such that $g_i(x) \ne 0$. Denoting by $i(x)$ the smallest value of $i$ such that $g_i(x) \ne 0$, it holds

$$ \sum_{x \in V_{\mathbb{C}}(f)} \mathrm{mul}(x, f) |\log(|g_{i(x)}(x)|)| \in \tilde{O}(n_1 \tau_2 + n_2 \tau_1). \quad (23) $$

*Proof.* a) For any $x \in A$, we have

$$ |g_{i(x)}(x)| \le 2^{\tau_2'} \max(1, |x|)^{n_2}; \quad (24) $$

by applying (2) and (19), with $\tau_2'$ defined by $2^{\tau_2'} = (n_2 + 1)2^{\tau_2}$. Then,

$$ \prod_{x \in A} |g_{i(x)}(x)|^{\mathrm{mul}(x,f)} \le \prod_{x \in A} 2^{\tau_2' \mathrm{mul}(x,f)} \max(1, |x|)^{n_2 \mathrm{mul}(x,f)} \\ \le \prod_{x \in V_{\mathbb{C}}(f)} 2^{\tau_2' \mathrm{mul}(x,f)} \max(1, |x|)^{n_2 \mathrm{mul}(x,f)}, $$

using (24). Finally, we obtain

$$ \prod_{x \in A} |g_{i(x)}(x)|^{\mathrm{mul}(x,f)} \le 2^{\tau_2' \sum \mathrm{mul}(x,f)} \mathrm{Mea}(f)^{n_2} \\ \le 2^{O(n_1 \log(n_2) + n_2 \tau_1 + n_1 \tau_2 + n_2 \log(n_1))}, \quad (25) $$

$$ \text{as } \sum_{x \in A} \mathrm{mul}(x, f) \le n_1, \mathrm{Mea}(f) \le 2^{\tau_1 + \log(n_1+1)}, \text{ and } 2^{\tau_2'} = (n_2+1)2^{\tau_2}. $$

b) We want to prove that

$$ \prod_{x \in V_{\mathbb{C}}(f)} |g_{i(x)}(x)|^{\mathrm{mul}(x,f)} \in 2^{-O(\tau_1 n_2)}. \quad (26) $$

We set

$$ g(X, U) = g_1(X) + U g_2(X) + \dots + U^{m-1} g_m(X) $$
and consider

$$ \mathrm{Res}_X(f,g) = \mathrm{lc}(f)^{n_2} \cdot \prod_{x \in V_C(f)} g(x, U)^{\mathrm{mul}(x,f)}. $$

The polynomial $\mathrm{Res}_X(f,g)$ is then a polynomial in $U$ with integer coefficients. The coefficient of its term of lowest degree, which is a non-zero integer has absolute value equal to

$$ |\mathrm{lc}(f)|^{n_2} \cdot \prod_{x \in V_C(f)} |g_{i(x)}(x)|^{\mathrm{mul}(x,f)}. $$

In particular, this shows that the latter term has absolute value at least 1. It is further clear that

$$ |\mathrm{lc}(f)|^{n_2} \in 2^{O(\tau_1 n_2)}, $$

and thus (26) holds.

We now define

$$ A := \{x | f(x) = 0, |g_{i(x)}(x)| \ge 1\}. $$

Since for any $x \in A$, $|g_{i(x)}(x)| \ge 1$, it is clear by (25) that

$$ 0 \le \sum_{x \in A} \mathrm{mul}(x, f) \cdot \log(|g_{i(x)}(x)|) \le c \in O(n_1\tau_2 + n_2\tau_1 + n_2\log(n_1) + n_1\log(n_2)) \quad (27) $$

It follows by (26) that

$$ \sum_{x \in V_C(f)} -\mathrm{mul}(x, f) \cdot \log(|g_{i(x)}(x)|) \in O(n_2\tau_1). \quad (28) $$

Hence, we obtain

$$ \sum_{x \in V_C(f)} \mathrm{mul}(x, f) |\log(|g_{i(x)}(x)|)| \in O(n_2\tau_1 + n_1\tau_2). \quad (29) $$

□

The following result has already been proven in [19] but we give here a much simpler proof based on Proposition 3.

**Proposition 4** Let $f \in \mathbb{Z}[X]$ be a non-zero polynomial of magnitude bounded by $(n, \tau)$, then $lSep(f) \in \tilde{O}(n\tau + n^2)$.

*Proof.* Using Proposition 3 b) for the sequence $f^{[k]}$, $k = \deg(f) - 1, \dots, 0$, we obtain

$$ lGDisc(f) \in \tilde{O}(n\tau + n^2). $$

Since $lMea(f) \in O(\tau + \log(n))$ by (21), we conclude by Proposition 2. □

Hereafter, we recall some quantitative and complexity results which will be used in the complexity analysis of our algorithms.
**Proposition 5** (see for example [6]) Let $f \in \mathbb{Z}[X]$ be a non-zero polynomial of magnitude bounded by $(n, \tau)$ and $g \in \mathbb{Z}[X]$ a non-zero polynomial of degree $n_1$ dividing $f$. Then, $g$ is of magnitude bounded by $(n_1, n_1 + \tau + \log(n + 1))$.

We need to give details about content and greatest common divisors (gcd) in the ring $\mathbb{Z}[X]$.

**Definition 6** Given a non-zero polynomial $f \in \mathbb{Z}[X]$ its content $\text{cont}(f)$ is defined as the gcd in $\mathbb{Z}$ of the coefficients of $f$. For every $g \in \mathbb{Z}[X]$ dividing $f$, $\text{cont}(g)$ divides $\text{cont}(f)$ in $\mathbb{Z}$.

If $\text{cont}(f) = 1$, $f$ is content-free. Every $g \in \mathbb{Z}[X]$ dividing a content-free polynomial is content-free.

Given two non-zero polynomials $f \in \mathbb{Z}[X]$ and $g \in \mathbb{Z}[X]$ their gcd $\text{gcd}(f, g)$ is defined (up to sign) as the unique polynomial in $\mathbb{Z}[X]$ which is proportional to the gcd of $f$ and $g$ in $\mathbb{Q}[X]$ and is of content $\text{gcd}(\text{cont}(f), \text{cont}(g))$.

The content of the derivative $f'$ of $f$ is a multiple of the content of $f$, so $\text{cont}(\text{gcd}(f, f')) = \text{cont}(f)$ and $f^* = f/\text{gcd}(f, f')$ its square-free part is content-free.

**Proposition 6** [9, 25] Let $f, g \in \mathbb{Z}[X]$ be two non-zero polynomials of respective magnitude bounded by $(n_1, \tau_1)$ and $(n_2, \tau_2)$. Computing their gcd has bit complexity

$$ \tilde{O}(\max(n_1, n_2) \cdot (n_1\tau_2 + n_2\tau_1)). $$

**Proposition 7** [25, Ex. 10.21] Let $f \in \mathbb{Z}[X]$ be a non-zero polynomial of magnitude bounded by $(n, \tau)$. Given a non-zero polynomial $g \in \mathbb{Z}[X]$ that divides $f$, computing the quotient of $f$ divided by $g$ has bit complexity of $\tilde{O}(n\tau + n^2)$.

**Corollary 1** Let $f \in \mathbb{Z}[X]$ be a non-zero polynomial of magnitude bounded by $(n, \tau)$. computing the square-free part $f^*$ of $f$ has bit complexity $\tilde{O}(n^2\tau)$.

**Notation 7** Let $p = r/s$ a rational number with $\text{gcd}(r, s) = 1$. We denote by $\lambda(p)$ its bitsize, defined by the sum of the bitsizes of its numerator $r$ and denominator $s$. For an interval $I = [a, b]$, $a < b$ with rational endpoints, we denote by $|I| = b - a$ its length and by $\lambda(I)$ the maximum of $\lambda(a)$ and $\lambda(b)$.

**Proposition 8** [5, 18] Let $f \in \mathbb{Z}[X]$ be a non-zero polynomial of magnitude bounded by $(n, \tau)$. Let $r$ a rational number of bitsize $\lambda(r)$. Then, the evaluation of $f$ at $r$ can be performed using $\tilde{O}(n(\tau + \lambda(r)))$ bit operations and the bitsize of the output $f(r)$ is $\tilde{O}(\tau + n \cdot \lambda(r))$.

## 2.3 Root isolation

We now focus on the problem of computing the roots of a given univariate polynomial. Here, we consider the two different but related problems of the computation of disjoint isolating regions and the approximation of the roots to a certain precision. Notice that isolating regions allow us to distinguish between
two distinct roots, and thus also to determine the number of distinct roots. However, in general, isolating regions do not allow us to estimate the actual distance between two distinct roots as such regions might be considerably larger than the actual separation of the isolated root.

In order to overcome this issue, we are aiming for the computation of so called well-isolating regions from which we can derive a good estimate for the separation of a root x or, more generally, for the distance from x to any other root y. This good estimate plays a key role in the complexity for refining roots whenever needed.

**Definition 8** Let $f \in \mathbb{C}[X]$ be a polynomial of degree $n$. Then, we define:

(a) A well-isolating interval $\mathcal{I} = (a, b)$ for a real root $x$ of $f$ contains $x$, and it holds that $32 \cdot n \cdot |b - a| < \text{Sep}(x, f)$.

(b) A well-isolating disk $\mathcal{D}_r(m) = \{x \in \mathbb{C} \mid |x - m| \le r\}$ for a complex root $x$ of $f$ contains $x$, and it holds that $64 \cdot n \cdot r < \text{Sep}(x, f)$.

As a consequence a well-isolating interval (resp. disk) contains only one real (resp. complex) root of $f$.

In what follows, we often have to deal with approximations of polynomials and to compute approximations of an exact value that a given polynomial takes at a certain point. The following definitions will turn out to be useful in order to specify these computations.

**Definition 9** For a complex number $a \in \mathbb{C}$ and an integer $L$, we say that a dyadic Gaussian number of the form

$$\tilde{a} = c \cdot 2^{-L-1} + i \cdot d \cdot 2^{-L-1} \in \mathbb{Q} + i \cdot \mathbb{Q},$$

with $c, d \in \mathbb{Z}$, is an (absolute) $L$-bit approximation of $a$ if $|a - \tilde{a}| < 2^{-L}$.

For a polynomial $f = a_0 + \dots + a_n \cdot X^n \in \mathbb{C}[X]$ with arbitrary complex coefficients and an integer $L$, we say that a polynomial $\tilde{f} = \tilde{a}_0 + \dots + \tilde{a}_n \cdot X^n$ is an (absolute) $L$-bit approximation of $f$ if for every $i$, $\tilde{a}_i$ is an (absolute) $L$-bit approximation of $a_i$.

The following result is useful.

**Proposition 9** [18] Let $f \in \mathbb{Z}[X]$ be a non-zero polynomial of magnitude bounded by $(n, \tau)$, $x \in \mathbb{C}$ be an arbitrary complex value, and $L$ be a positive integer.

We can compute a dyadic approximation $\tilde{\beta} = b \cdot 2^{-L-1}$ of $\beta := f(x)$, with $b \in \mathbb{Z}[i]$ and $|\beta - \tilde{\beta}| < 2^{-L}$, using $\tilde{O}(n(L + n \cdot \log(\max(1, |x|)) + \tau))$ bit operations.

The following propositions summarize the results on root isolation and approximation for a complex polynomials we use in the paper.

**Proposition 10** ([21, Thm. 4f<fnref n="6" />]) Let $f \in \mathbb{C}[X]$ be a non-zero polynomial of degree $n$ with $1 \le |\text{lc}(f)| \le 4$. Suppose that the number $m$ of distinct roots of $f$ is given, then it holds:

<footnote n="6">⁶ See also [7, 20, 22, 24] for comparable results.</footnote>
(a) Using a number of bit operations bounded by

$$ \tilde{O}(n \cdot (n^2 + n \mathit{lMea}(f) + \mathit{lGDisc}(f))) \qquad (30) $$

we can compute, for all $x \in V_C(f)$, the multiplicities $\mathit{mul}(x, f)$ as well as well-isolating disks $D_{r(x)}(m(x)) \subset \mathbb{C}$ with dyadic centers $m(x)$ and dyadic radii $r(x)$ such that the bitsizes of all $m(x)$ and $r(x)$ sum up to

$$ \tilde{O}(n + \mathit{lMea}(f) + \mathit{lSep}(f^*_{\mathbb{C}})). $$

As input, we need an oracle giving an absolute $L'$-bit approximation of $f$, where $L'$ is bounded by

$$ \tilde{O}(n \mathit{lMea}(f) + \mathit{lSep}(f) + \mathit{lGDisc}(f)). \qquad (31) $$

(b) Let $V^* \subset V_C(f)$ be a subset of the roots of $f$, $\mu = \max_{x \in V^*} \mathit{mul}(x, f)$, and let $L$ be a given positive integer. Then, we can further refine the isolating disks $D_{r(x)}(m(x))$ for all roots $x$ in $V^*$ to a size less than $2^{-L}$ using

$$ \tilde{O}(n \cdot (L \cdot \mu + n^2 + n \mathit{lMea}(f) + \mathit{lGDisc}(f))) \qquad (32) $$

bit operations.<fnref n="7" /> As input, we need an oracle giving an absolute $L'$-bit approximation of $f$, where $L'$ is bounded by

$$ \tilde{O}(L \cdot \mu + n \mathit{lMea}(f) + \mathit{lSep}(f) + \mathit{lGDisc}(f)). \qquad (33) $$

In the literature, the special case of an integer polynomial $f$ with coefficients of bitsize at most $\tau$ has attracted a lot of interest. The following result, which provides bounds on the isolation of the roots as well on the problem of further refining the isolating disks, is an almost straight forward consequence of Proposition 10 (applied to the polynomial $f \cdot \mathit{lc}(f)^{-1}$).

**Proposition 11** [21, Thm. 5]<fnref n="8" /> Let $f \in \mathbb{Z}[X]$ be a non-zero polynomial of magnitude bounded by $(n, \tau)$. Using $\tilde{O}(n^2\tau + n^3)$ bit operations, one can compute

(a) well-isolating disks $D_{r(x)}(m(x)) \subset \mathbb{C}$ for all complex roots $x$ of $f$ with dyadic centers $m(x)$ and dyadic radii $r(x)$ such that the bitsizes of all $m(x)$ and $r(x)$ sum up to $\tilde{O}(n\tau)$, and

(b) the multiplicities $\mathit{mul}(x, f)$ of each of the roots $x$.

(c) For an arbitrary positive integer $L$, one can further refine all isolating disks to a size less than $2^{-L}$ using $\tilde{O}(n^2\tau + n^3 + nL)$ bit operations.<fnref n="9" />

<footnote n="7">⁷ [21, Thm. 4] only provides a bound for the refinement of all isolating disks (i.e. for $V^* = V_C(f)$), however, from the proof of [21, Thm. 4], the claimed bound directly follows. In addition, in [21, Theorem 4], the additive term $nL \cdot \mu$ appears in the bound on the needed input precision. We remark that this is a typo and that the actual bound is better by a factor $n$. The proof of [21, Theorem 4] clearly shows this fact.</footnote>

<footnote n="8">⁸ See also [7, 20, 22, 23, 24]</footnote>

<footnote n="9">⁹ Notice that, in contrast to the general case, where the coefficients of $f$ are not necessarily integers, the additional factor $\max_{x \in V_C(f)} \mathit{mul}(x, f)$ is missing. This is due to the fact that, within the given complexity, we can first compute the square-free part $f^*$ of $f$ and then work with $f^*$ to refine the isolating disks.</footnote>
Finally we can also identify common roots of a polynomials $f$ with polynomials of a family $g_1, \dots, g_m$.

**Proposition 12** Let $f, g_1, \dots, g_m \in \mathbb{Z}[X]$ be non-zero polynomials of magnitudes bounded by $(d, \tau)$, $(d_1, \tau_1), \dots, (d_m, \tau_m)$, respectively, and let $N, \Lambda$ be positive integers such that $d + d_1 + \dots + d_m < N$ and $\tau + \tau_1 + \dots + \tau_m < \Lambda$. Then, we can isolate all roots of $f$ and all polynomials $g_i$, and identify all common roots of each pair $(f, g_i)$ using no more than $\tilde{O}(N^2\Lambda + N^3)$ bit operations. Within the same complexity, we can also determine the signs $(0, 1 \text{ or } -1)$ of the $g_i$ at the real zeroes of $f$.

*Proof.* We first compute the square-free part $f^*$ using

$$ \tilde{O}(d^2\tau) \in \tilde{O}(N^2\Lambda) $$

bit operations using Corollary 1. The magnitude of $f^*$ is bounded by $(d, O(d+\tau))$. Then, we may compute $h_i := \gcd(f^*, g_i)$ for all $i$ using

$$ \tilde{O}\left(\sum_{i=1}^{m} \max(d, d_i) \cdot (d\tau_i + d\tau_i + d_i\tau)\right) \in \tilde{O}(N(d\Lambda + N\tau + dN)) $$

bit operations due to Proposition 6. In the next step, we compute well-isolating disks for all complex roots of the polynomial $f^*$ as well as for the complex roots of all polynomials $h_i$. We then refine the isolating disks for the roots of all polynomials $h_i$ to a size less than $\min_{x \in V_c(f)} \text{Sep}(x, f)/4$. Since $\text{Sep}(f)$ is bounded by $\tilde{O}(N\Lambda + N^2)$, this can be achieved using $\tilde{O}(N^2\Lambda + N^3)$ bit operations according to Proposition 11.

Notice that, after this refinement, each isolating disk $\mathcal{D}'$ for a root of $h_i$ intersects exactly one isolating disk $\mathcal{D}$ for a root of $f$, and thus $\mathcal{D}$ and $\mathcal{D}'$ isolate one common root. Hence, in order to identify common roots of $f$ and $g_i$, we just have to determine all intersections between the isolating disks for the roots of $h_i$ and those for the roots of $f$. For this, we first compute a lexicographic sorting of all centers of the isolating disks $\mathcal{D}$ for the roots of $f$, which uses $\tilde{O}(d^2\tau)$ bit operations as we need $O(d \log d)$ many comparisons, each of precision $\tilde{O}(d\tau)$. Then, for a given isolating disk $\mathcal{D}'$ for a root of $h_i$, we can determine the unique disk $\mathcal{D}$ that intersects $\mathcal{D}'$ using $\tilde{O}(N\Lambda + N^2)$ bit operations as the needed precision is bounded by $\tilde{O}(N\Lambda + N^2)$ and only $O(\log d)$ many comparisons are needed. Hence, the total complexity for this step is also bounded by $\sum_{i=1}^{m} d_i \cdot \tilde{O}(N\Lambda + N^2) \in \tilde{O}(N^2\Lambda + N^3)$.

For the sign determination part, we simply compute sufficiently good L-bit approximations $\gamma_{i,x}$ of $g_i(x)$ for all $i$ and all real roots $x$ of $f$ with $g_i(x) \neq 0$. That is, we have to compute L-bit approximations $\gamma_{i,x}$ for $L = 1, 2, 4, \dots$ such that $|\gamma_{i,x}| > 2^{-L}$, which then implies that $\text{sign} g_i(x) = \text{sign} \gamma_{i,x}$. Obviously, we succeed in doing so as soon as $L$ is larger than $|\log(|g_i(x)|)|$. Hence, for a specific real root $x$ of $f_i := f^*/\gcd(f^*, g_i)$, the cost for this step is bounded by $\tilde{O}(d_i(\log(|g_i(x)|| + d_i \cdot \log(\max(1, |x|)) + \tau_i))$ bit operations using Proposition 9. The total cost is thus bounded by

$$ \sum_{i=1}^{m} d_i^2 \cdot \sum_{x \in V_{\mathbb{R}}(f)} \log(\max(1, |x|)) + N \cdot \sum_{i=1}^{m} d_i \tau_i + \sum_{i=1}^{m} d_i \cdot \sum_{x \in V_{\mathbb{R}}(f_i)} |\log(|g_i(x)|)| $$
The first term is upper bounded by $N^2 \cdot \text{\textit{lMea}}(f) \in \tilde{O}(N^2\Lambda)$, and the second term is upper bounded by $N \cdot \sum_{i=1}^{m} d_i \cdot \sum_{i=1}^{m} \tau_i \in O(N^2\Lambda)$. For the last term, we use Proposition 3 b) to show that $\sum_{x \in V_{\mathbb{R}}(f_i)} |\log(|g_i(x)|)| \in \tilde{O}(N\Lambda + N^2)$ for all $i$, and thus also $\sum_{i=1}^{m} d_i \sum_{x \in V_{\mathbb{R}}(f_i)} |\log(|g_i(x)|)| \in \tilde{O}(N^2\Lambda + N^3)$. $\square$

### 3 Bivariate results

Similar to our definition of the magnitude of a univariate polynomial, we introduce the following definitions for bivariate polynomials:

**Definition 10** A polynomial $F \in \mathbb{Z}[X, Y]$ is of magnitude bounded by $(n, \tau)$ if its total degree is bounded by $n$ and the bitsize of each of its coefficients is bounded by $\tau$.

#### 3.1 Amortized bounds for bivariate systems

We consider an arbitrary polynomial $R \in \mathbb{Z}[X]$ of magnitude bounded by $(N, \Lambda)$. Given $x \in \mathbb{C}$, we denote by $\mu(x) = \text{mul}(x, R)$ its multiplicity as a root of $R$. We further consider a bivariate polynomial

$$F(X, Y) = f_{n_y}(X) \cdot Y^{n_y} + \dots + f_0(X) \in \mathbb{Z}[X, Y]$$

of magnitude bounded by $(n, \tau)$, such that

$$V_{\mathbb{C}}(R, F) = \{(x, y) \in \mathbb{C} \mid R(x) = F(x, y) = 0\}$$

is finite.

For a root $x$ of $R$, we denote by $n(x)$ the degree of $F(x, Y)$, which might be smaller than $n_y$ but at least 0, since $V_{\mathbb{C}}(R, F)$ is finite. Notice that, for $n(x) \neq n_y$, we have $f_{n(x)}(x) \neq 0$ and $f_{n(x)+1}(x) = \dots = f_{n_y}(x) = 0$. For a root $y$ of $F(x, Y)$, we denote in all Section 3.1, with a slight abuse of notation,

$$\nu(y) = \text{mul}(y, F(x, Y))$$

the multiplicity of $y$ as a root of $F(x, Y)$.

The following proposition provides amortized complexity bounds on the sum of lengths and Mahler measures of the polynomials $F(x, Y)$.

**Proposition 13** Let $R \in \mathbb{Z}[X]$ and $F \in \mathbb{Z}[X, Y]$ be non-zero polynomials of magnitude bounded by $(N, \Lambda)$ and $(n, \tau)$ respectively such that $V_{\mathbb{C}}(R, F)$ is finite. Then, it holds that

$$\sum_{x \in V_{\mathbb{C}}(R)} \mu(x) \cdot \text{\textit{lLen}}(F(x, Y)) \in \tilde{O}(N\tau + n\Lambda + nN) \quad (34)$$

$$\sum_{x \in V_{\mathbb{C}}(R)} \mu(x) \cdot \text{\textit{lMea}}(F(x, Y)) \in \tilde{O}(N\tau + n\Lambda + nN) \quad (35)$$
Proof. For each root $x$ of $R$ in $\mathbb{C}$, we have

$$2^{-n(x)} \cdot \mathrm{Len}(F(x, Y)) \le \mathrm{Mea}(F(x, Y)) \le \|F(x, Y)\|$$

using Definition 4 and according to (6).

Since $n(x) \le n$ and $\sum_{x \in V_C(R)} \mu(x) = N$, it holds that

$$\sum_{x \in V_C(R)} n(x)\mu(x) \le nN$$

and thus

$$2^{-nN} \le 2^{-\sum_{x \in V_C(R)} n(x)\mu(x)}.$$

Let $\ell(x)$ be such that

$$|f_{\ell}(x)| = \max_{j=0, \dots, n_y} |f_j(x)|.$$

We have

$$|f_{n(x)}(x)| \le \mathrm{Len}(F(x, Y)) \le (n_y + 1) \cdot |f_{\ell(x)}(x)|$$

$$\|F(x, Y)\| \le \sqrt{n_y + 1} \cdot |f_{\ell(x)}(x)|,$$

hence denoting by

$$A = \prod_{x \in V_C(R)} |f_{n(x)}(x)|^{\mu(x)}$$

$$B = \prod_{x \in V_C(R)} |f_{\ell(x)}(x)|^{\mu(x)},$$

$$A \le \prod_{x \in V_C(R)} \mathrm{Len}(F(x, Y))^{\mu(x)} \le (n_y + 1)^N \cdot B$$

and

$$2^{-nN} A \le \prod_{x \in V_C(R)} \mathrm{Mea}(F(x, Y))^{\mu(x)} \le \sqrt{n_y + 1}^N \cdot B.$$

The claims (34) and (35) follow by Proposition 3 applied to $R$ and the family $f_j$. □

Our next aim is to prove the following Proposition.

**Proposition 14** Let $R(X) \in \mathbb{Z}[X]$ be a non-zero polynomial of magnitude bounded by $(N, \Lambda)$ and $F(X, Y) \in \mathbb{Z}[X, Y]$ be of magnitude bounded by $(n_1, \tau_1)$, and suppose that

$$V_C(R, F) = \{(x, y) \in \mathbb{C}^2 \mid R(x) = F(x, y) = 0\}$$

is finite. Let $G_1, \dots, G_m$ in $\mathbb{C}[X, Y]$ be polynomials of magnitude bounded by $(n_2, \tau_2)$.
(a) Suppose that $A \subset V_C(R, F)$ and that, for every $(x, y) \in A$, $i(x, y) \in \{1, \dots, m\}$ is such that $G_{i(x,y)}(x, y) \neq 0$. Then, it holds that:

$$ \sum_{(x,y) \in A} \mu(x)\nu(y) \log(|G_{i(x,y)}(x,y)|) \in \tilde{O}((\tau_2 n_1 + \tau_1 n_2)N + (\Lambda + N)n_1 n_2). \quad (36) $$

(b) Suppose that $G_1, \dots, G_m \in \mathbb{Z}[X, Y]$ and that, for every $(x, y) \in V_C(R, F)$, there exists $i$ such that $G_i(x, y) \neq 0$. Denoting by $i(x, y)$ the smallest value of $i$ such that $G_i(x, y) \neq 0$, we have

$$ \sum_{(x,y) \in V_C(R,F)} \mu(x)\nu(y) |\log(|G_{i(x,y)}(x,y)|)| \in \tilde{O}((\tau_2 n_1 + \tau_1 n_2)N + (\Lambda + N)n_1 n_2). \quad (37) $$

where

$$ V_C(R, F)_x := \{y \in \mathbb{C} \mid F(x, y) = 0\}. $$

*Proof.* a) First note that,

$$ |G_{i(x,y)}(x,y)| \le 2^{\tau_2'} \max(1, |x|)^{n_2} \max(1, |y|)^{n_2}, $$

where $\tau_2' := \lceil \log((n_2+1)^2 2^{\tau_2}) \rceil \in O(\tau_2 + \log(n_2))$. Further notice that

$$ \prod_{(x,y) \in A} 2^{\tau_2' \mu(x)} \le \prod_{x \in V_C(R)} 2^{\tau_2' n_1 \mu(x)} \in 2^{O((\tau_2 + \log(n_2))n_1 N)} \quad (38) $$

and

$$ |\ln(R)^{n_1 n_2}| \prod_{(x,y) \in A} \max(1, |x|)^{\mu(x)\nu(y)n_2} \le \mathrm{Mea}(R)^{n_1 n_2} \in 2^{O((\Lambda + \log(N))n_1 n_2)} \quad (39) $$

Hence, since

$$ \prod_{x \in V_C(R)} |\ln(F(x, Y))^{\mu(x)}| \prod_{y | (x, y) \in A} \max(1, |y|)^{\nu(y)\mu(x)} \le \prod_{x \in V_C(R)} \mathrm{Mea}(F(x, Y))^{\mu(x)} \quad (40) $$

it follows that

$$ \prod_{(x,y) \in A} \max(1, |y|)^{\mu(x)\nu(y)n_2} \in 2^{\tilde{O}((\tau_1 N + \Lambda n_1 + n_1 N)n_2)} \quad (41) $$

by Proposition 13 and Proposition 3. We thus conclude that

$$ \prod_{(x,y) \in A} |G_{i(x,y)}(x,y)|^{\mu(x)\nu(y)} \in 2^{\tilde{O}((\tau_2 n_1 + \tau_1 n_2)N + (\Lambda + N)n_1 n_2)} \quad (42) $$

and

$$ \sum_{(x,y) \in A} \mu(x)\nu(y) \log(|G_{i(x,y)}(x,y)|) \in \tilde{O}((\tau_2 n_1 + \tau_1 n_2)N + (\Lambda + N)n_1 n_2). \quad (43) $$
b) In the first step, we aim to prove that

$$ \prod_{(x,y) \in V_c(R,F)} |G_{i(x,y)}(x,y)|^{\mu(x)\nu(y)} \geq \frac{1}{E''} $$

where $E''$ is a natural number of bitsize $O(\Lambda n_1 n_2 + \tau_1 n_2 N)$.

Let as before

$$ F(X, Y) := f_{n_y}(X)Y^{n_y} + \dots + f_0(X), $$

with $n_y = \deg_Y(F) \leq n_1$, and $R^*$ the square-free part of $R$ which is content-free (cf Definition 6).

We define the polynomial sequence $(R_{\ell}^{*}(X))_{\ell \in [1, n_y]} \in \mathbb{Z}[X]$, such that

$$ \deg(F(x, Y)) = \ell \iff R_{\ell}^{*}(x) = 0, \qquad (44) $$

as follows. We first compute a family of polynomials $R_{\ell}^{*}$ whose zeroes characterize $\deg_Y(F(x, Y)) = \ell$.

$$ R_{\le n_y}^{*}(X) := R^{*}(X), \qquad (45) $$

and

$$ R_{\le \ell-1}^{*}(X) := \gcd(R_{\le \ell}^{*}(X), f_{\ell}(X)), \quad R_{\ell-1}^{*}(X) := \frac{R_{\le \ell}^{*}(X)}{R_{\le \ell-1}^{*}(X)}. \qquad (46) $$

for all $\ell \in \{n_y, \dots, 1\}$. Notice that

$$ R^{*} = \prod_{\ell \in \{0, \dots, n_y\}} R_{\ell}^{*}(X) \qquad (47) $$

We further define the following content-free polynomials in $\mathbb{Z}[X]$.

$$ R_{\ell, > 1}^{*}(X) := \gcd(R_{\ell}^{*}, R'), R_{\ell, 1}^{*}(X) := \frac{R_{\ell}^{*}}{R_{\ell, > 1}^{*}(X)} $$

and, for all $i \in \{1, \dots, N\}$,

$$ R_{\ell, > i}^{*}(X) := \gcd(R_{\ell, > i-1}^{*}(X), R^{[i]}(X)), \quad R_{\ell, i}^{*}(X) := \frac{R_{\ell, > i-1}^{*}(X)}{R_{\ell, > i}^{*}(X)}. $$

It is clear using Equation (44) that $\deg(F(x, Y)) = \ell$ and $x$ is a root of multiplicity $\mu$ of $R$ if and only if $R_{\ell, \mu}^{*}(x) = 0$.

Notice that

$$ R^{*} = \prod_{\ell, \mu} R_{\ell, \mu}^{*} \qquad (48) $$

$$ R = \mathrm{cont}(R) \prod_{\ell, \mu} (R_{\ell, \mu}^{*})^{\mu} \qquad (49) $$
Let

$$F_{\ell}(X, Y) := f_{\ell}(X)Y^{\ell} + \dots + f_{0}(X), \qquad (50)$$

and

$$G = G_1 + U G_2 + \dots + U^{m-1} G_m.$$

We further define

$$Z_{\ell, \mu} := V_{\mathbb{C}}(R_{\ell, \mu}^{*}, F) \subset V_{\mathbb{C}}(R, F)$$

and

$$A_{\ell, \mu}(U) := \mathrm{Res}_X(\mathrm{Res}_Y(F_{\ell}, G), R_{\ell, \mu}^{*}) \in \mathbb{Z}[U].$$

Let

$$Q_{\ell}(U, X) := \mathrm{Res}_{Y}(F_{\ell}, G)$$

and notice that

$$Q_{\ell}(U, x) = f_{\ell}(x)^{O(n_2)} \prod_{y|(x,y) \in Z_{\ell, \mu}} G(x, y, U)^{\nu(y)}.$$

Denoting by $\delta_{\ell} \le n_1 n_2$ the degree of $Q_{\ell}(U, X)$ with respect to $X$ and $n_{\ell}$ the degree of $f_{\ell}$ with respect to $X$,

$$A_{\ell, \mu}(U) = \mathrm{lc}(R_{\ell, \mu}^{*})^{\delta_{\ell}} \prod_{x|R_{\ell, \mu}^{*}(x)=0} f_{\ell}(x)^{O(n_2)} \prod_{(x,y) \in Z_{\ell, \mu}} G(x, y, U)^{\nu(y)}$$

The coefficient of the term of smallest degree in $U$ of $A_{\ell, \mu}(U)$ is a non-zero integer and equal to

$$\mathrm{lc}(R_{\ell, \mu}^{*})^{\delta_{\ell} - n_2 n_{\ell}} \mathrm{Res}_{X}(f_{\ell}, R_{\ell, \mu}^{*})^{n_2} \prod_{(x,y) \in Z_{\ell, \mu}} G_{i(x,y)}(x,y)^{\nu(y)}.$$

Since $\delta_{\ell} - n_2 n_{\ell} \in O(n_1 n_2)$, $\mathrm{cont}(R) \prod_{\ell, \mu} \mathrm{lc}(R_{\ell, \mu}^{*})^{\mu} = \mathrm{lc}(R) \in 2^{O(\Lambda)}$, and

$$\prod_{\ell, \mu} \mathrm{Res}_X(f_{\ell}, (R_{\ell, \mu}^{*})^{\mu}) = \mathrm{Res}_X(f_{\ell}, R) \in 2^{O(\tau_1 N + \Lambda n_1)},$$

we conclude that

$$\prod_{(x,y) \in V_{\mathbb{C}}(R,F)} |G_{i(x,y)}(x,y)|^{\mu(x)\nu(y)} \ge \frac{1}{E''} \qquad (51)$$

$$\text{with } E'' := |\mathrm{lc}(R)^{n_1 n_2} \mathrm{Res}_X(f_{\ell}, R)^{n_2}| \in 2^{O(\Lambda n_1 n_2 + \tau_1 n_2 N)}.$$

Finally, we have

$$\sum_{(x,y) \in V_{\mathbb{C}}(R,F)} -\mu(x)\nu(y) \log(|G_{i(x,y)}(x,y)|) \in O(\Lambda n_1 n_2 + \tau_1 n_2 N). \qquad (52)$$
Defining $A := \{(x, y) \in V_C(R, F) \mid |G_i(x, y)| \ge 1\}$, and using (42), (52) and (43), we obtain finally

$$ \sum_{x \in V_C(R, F)} \mu(x)\nu(y)\log(|G_{i(x,y)}(x,x)|) \in \tilde{O}((\tau_2 n_1 + \tau_1 n_2)N + (\Lambda + N)n_1n_2) \qquad (53) \\ \square $$

The following proposition provides amortized complexity bounds on the sum of the Mahler measures of the polynomials $F(x_i, Y)$, the separators of the roots $x_{i,j}$ as well as the absolute values of the first non-vanishing derivatives of $F(x_i, Y)$ at the roots $x_{i,j}$:

We denote

$$ F^{[k]} = \frac{\partial_Y^k F}{k!}. \qquad (54) $$

**Proposition 15** Let $R(X) \in \mathbb{Z}[X]$ be a non-zero polynomial of magnitude bounded by $(N, \Lambda)$ and $F(X, Y) \in \mathbb{Z}[X, Y]$ be of magnitude bounded by $(n, \tau)$, and suppose that

$$ V_C(R, F) = \{(x, y) \in \mathbb{C}^2 \mid R(x) = F(x, y) = 0\} $$

is finite. Then, it holds that

$$ (a) \sum_{x \in V_C(R)} \mu(x) \cdot \text{lGDisc}(F(x, Y)) \in \tilde{O}(n(N\tau + n\Lambda + Nn)). $$

$$ (b) \sum_{x \in V_C(R)} \mu(x) \cdot \text{Sep}(F(x, Y)) \in \tilde{O}(n(N\tau + n\Lambda + Nn)), $$

*Proof.* (a) is an immediate consequence of Proposition 14 applied to the family $F^{[k]}$. (b) follows directly from (a), Proposition 2 and Proposition 13. $\square$

## 3.2 Fixing the degree and the number of distinct roots in the fibers

We first give results on the multiplicities of the roots of $F(x, Y)$ at the X-critical points of $F$.

Consider a bivariate polynomial

$$ F(X, Y) = f_{n_y}(X) \cdot Y^{n_y} + \dots + f_0(X) \in \mathbb{C}[X, Y]. \qquad (55) $$

Notice that

$$ V_C(F) = \{(x, y) \in \mathbb{C}^2 \mid F(x, y) = 0\} $$

contains no vertical line if and only if the polynomials $f_i(X)$, $i = 0, \dots, n_y$, do not share a common non-trivial factor. In this case, let

$$ \text{Crit}_X(V_C(F)) := \{(x, y) \in \mathbb{C}^2 \mid F(x, y) = \partial_Y F(x, y) = 0\} $$

be the set of X-critical points of $F$.
**Proposition 16** Let $F \in \mathbb{C}[X, Y]$ be such that $V_{\mathbb{C}}(F)$ contains no vertical line. Given $x \in \mathbb{C}$,

$$ \sum_{x|(x,y) \in \text{Crit}_X(V_{\mathbb{C}}(F))} (\text{mul}(y, F_{n(x)}(x, Y)) - 1) \le \text{mul}(x, \text{Disc}_Y(F_{n(x)})). \quad (56) $$

The proof of Proposition 16 is based on the following lemma.

**Lemma 2** Let $F$ and $G$ be two non-zero bivariate polynomials. Given $x \in \mathbb{C}$ such that $F(x, Y)$ and $G(x, Y)$ are non identically zero,

$$ \deg(\text{gcd}(F(x, Y), G(x, Y))) \le \text{mul}(x, \text{Res}_Y(F, G)). \quad (57) $$

*Proof.* The claim follows clearly from the two following statements.

a) Let $f, g$ be two univariate polynomials of respective degrees $p, q$. Let $\phi$ be the mapping from $K_{<q}[X] \times K_{<p}[X]$ to $K_{<p+q}[X]$ sending $(U, V)$ to $Uf + Vg$. Then $\text{Im}(\phi)$ is the set of multiples of the greatest common divisor $h = \text{gcd}(f, g)$ of $f$ and $g$, and the rank of $\phi$ is $p+q-\text{deg}(h)$. It is clear that $(m \cdot g/h, -m \cdot f/h)$ is in the kernel of $\phi$ for every polynomial $m$ of degree $< \text{deg}(h)$. In the other direction, every $(U, V)$ in the kernel of $\phi$ is such that there exists $m$ of degree $< \text{deg}(h)$ with $U = m \cdot g/h$ and $V = -m \cdot f/h$. This implies that the dimension of $\text{Ker}(\phi)$ is equal to $\text{deg}(h)$ and the dimension of $\text{Im}(\phi)$ is thus equal to $p+q-\text{deg}(h)$. But every element of $\text{Im}(\phi)$ is a multiple of $h$, and the vector space of multiples of $h$ of degree $< p+q$ is also of dimension $p+q-\text{deg}(h)$. It follows that $\text{Im}(\phi)$ coincides with the set of multiple of $h$, and the rank of $\phi$ is $p+q-\text{deg}(h)$.

b) Let $M(X)$ be an $n \times n$ matrix with coefficients in $K[X]$. If the rank of $M(x_0)$ is equal to $n-k$, then $x_0$ is a root of $\det(M(X))$ of multiplicity at least $k$. The proof is by induction on $k$.

If $k=0$ the statement is true.

If $k > 0$, then $M(x_0)$ is not invertible, and $\det(M(x_0)) = 0$. Denote by $m_{i,j}(X)$ the $(i, j)$-th entry of $M(X)$, and by $M_{i,j}(X)$ the $(n-1) \times (n-1)$-matrix obtained by removing the $i$-th row and $j$-th column from $M(X)$. The rank of $M_{i,j}(x_0)$ is $r(x_0) \le n-k$, hence by induction hypothesis $x_0$ is a root of $\det(M_{i,j}(X))$ of multiplicity at least equal to $(n-1)-r(x_0) \ge k-1$. According to Jacobi's formula, we have

$$ \frac{d}{dX} \det(M(X)) = \sum_{i,j} (-1)^{i+j} m'_{i,j}(X) \det(M_{i,j}(X)), $$

and thus the claim follows by induction since $x_0$ is a root of $\det(M(X))$ and a root of multiplicity at least $k-1$ of its derivative. $\square$

*Proof of Proposition 16.* Use Lemma 2 with $F = F_{n(x)}$, $G = \partial_Y F_{n(x)}(X, Y)$ noting that

$$ \sum_{y|(x,y) \in \text{Crit}_X(V_{\mathbb{C}}(F))} (\text{mul}(y, F_{n(x)}(x, Y))-1) = \text{deg}(\text{gcd}(F_{n(x)}(x, Y), \partial_Y F_{n(x)}(x, Y))). \quad (58) $$

<figure><img src="image_3.png" /></figure>
**Proposition 17** Let $F \in \mathbb{Z}[X, Y]$ be a non-zero square-free polynomial of magnitude bounded by $(n, \tau)$ such that $V_{\mathbb{C}}(F)$ has no vertical line. There exists a polynomial $R_Y \in \mathbb{Z}[Y]$ of magnitude bounded by $(O(n^2), O(n\tau + n^2))$ such that given $y \in \mathbb{C}$

$$ \sum_{x|(x,y) \in \text{Crit}_X(V_{\mathbb{C}}(F))} (\text{mul}(y, F_{n(x)}(x, Y)) - 1) \leq \text{mul}(y, R_Y). \quad (59) $$

In particular, the zeroes of $R_Y$ contain the projection of $\text{Crit}_X(V_{\mathbb{C}}(F))$ on the Y-axis.

*Proof.* a) We suppose first that there is only one $x$ such that $(x, y) \in \text{Crit}(V_{\mathbb{C}}(F))$, $\text{mul}(y, F_{n(x)}(x, Y)) > 1$ and denote $\mu = \text{mul}(y, F_{n(x)}(x, Y))$. Defining

$$ R_Y(Y) := \text{Res}_X(F, \partial_Y F)(Y), \quad (60) $$

there exist $U(X, Y)$, $V(X, Y)$ such that

$$ R_Y(Y) = U(X, Y)F(X, Y) + V(X, Y)\partial_Y F(X, Y). \quad (61) $$

Derivating (60) $1, \dots, \mu - 2$ times with respect to $Y$ and using that

$$ F(x, y) = \partial_Y F(x, y) = \dots = \partial_Y^{(\mu-1)} F(x, y) = 0 $$

we obtain

$$ R_Y(y) = \partial_Y R_Y(y) = \dots = \partial_Y^{(\mu-2)} R_Y(y) = 0. \quad (62) $$

b) We reduce the general case to the preceding situation by the change of variable $Y \leftarrow Y + \varepsilon X$ where $\varepsilon$ is a new variable. We use for the proof the field $\mathbb{R}\langle\varepsilon\rangle$ of algebraic Puiseux series [6], which is a real closed field containing $\mathbb{R}(\varepsilon)$, totally ordered with the order $0_+$ making $\varepsilon$ positive and smaller than any positive element of $\mathbb{R}$. We denote $\mathbb{C}\langle\varepsilon\rangle^2 = \mathbb{R}\langle\varepsilon\rangle^2[i]$.

Notice that each X-critical point $(x, y)$ of $F$ in $\mathbb{C}^2$ yields a X-critical point $(x, y - \varepsilon x)$ of $\tilde{F}(X, Y) := F(X, Y + \varepsilon X)$ in $\mathbb{C}\langle\varepsilon\rangle^2$, and that the multiplicity of $y - \varepsilon x$ as a root of $\tilde{F}(x, Y)$ coincides with the multiplicity $\mu(x, y)$ of $y$ as a root of $F(x, Y)$ as $\partial_Y^{(i)} \tilde{F}(x, y) = \partial_Y^{(i)} F(x, y - \varepsilon x)$. Moreover there are no two distinct critical points of $\tilde{F}(x, y)$ sharing the same y-coordinate. Hence, it holds by a) that $y - \varepsilon x$ is a root of $\text{Res}_X(\tilde{F}, \partial_Y \tilde{F})(Y)$ of multiplicity at least $\mu(x, y)$. Then

$$ \text{Res}_X(\tilde{F}, \partial_Y \tilde{F})(Y) = A(\varepsilon) \tilde{R}(Y, \varepsilon) $$

with $A(\varepsilon) \in \mathbb{C}(\varepsilon)$, $\tilde{R}(Y, \varepsilon)$ monic in $Y$,

$$ \tilde{R}(Y, \varepsilon) = \prod_{(x,y) \in \text{Crit}(V_{\mathbb{C}}(F))} (Y - y + \varepsilon x)^{\mu(x,y)} B(Y, \varepsilon), $$

with

$$ \text{mul}(y - \varepsilon x, \tilde{F}_{n(x)}(x, Y)) - 1 \leq \mu(x, y), \quad (63) $$
and $B(Y, \varepsilon) \in \mathbb{C}[X, \varepsilon]$ such that $B(Y, 0) \in \mathbb{C}[X]$ is a non-zero polynomial.
Hence, denoting by

$$ \nu(y) = \sum_{x|(x,y) \in \text{Crit}(V_{\mathbb{C}}(F))} \mu(x, y), $$

$$ R_Y := \tilde{R}(Y, 0) = \prod_{y \in \pi_Y(\text{Crit}(V_{\mathbb{C}}(F)))} (Y - y)^{\nu(y)} B(Y, 0), $$

we have

$$ \sum_{x|(x,y) \in \text{Crit}(V_{\mathbb{C}}(F))} (\text{mul}(y, F_{n(x)}(x, Y)) - 1) \le \nu(y) \le \text{mul}(y, R_Y). \quad (64) $$

Finally, notice that $R_Y$ is of magnitude bounded by $(O(n^2), O(n\tau + n^2))$. $\square$

**Remark 2** When $\deg_X(F) \ge \deg_Y(F)$, it turns out that

$$ R_Y(Y) = \text{Res}_X(F, \partial_Y F)(Y) $$

because the Sylvester-matrix of $F, \partial_Y F$ and $\tilde{F}, \partial_Y \tilde{F}$ have the same dimension, since $\deg_X(F) = \deg_X(\tilde{F})$. However, when $\deg_X(F) < \deg_Y(F)$, it can happen that $R_Y(Y) \ne \text{Res}_X(F, \partial_Y F)(Y)$.

This is the case for example if

$$ F(X, Y) = (X - Y^2 + 1)(X - Y^2 - 1)(XY^2 - 1) $$

since we have

$$ R_Y(Y) = 2048(Y^4 + Y^2 - 1)^2(Y^4 - Y^2 - 1)^2Y^2, $$

$$ \text{Res}_X(F, \partial_Y F)(Y) = -32(Y^4 + Y^2 - 1)^2(Y^4 - Y^2 - 1)^2Y^3. $$

We now give details on how to determine the degree of $F(x, Y)$ and its number of distinct complex roots for a root $x$ of $R$. Our aim is to prove the following proposition:

**Proposition 18** Let $R(X) \in \mathbb{Z}[X]$ a non-zero polynomial of magnitude bounded by $(N, \Lambda)$ and $F(X, Y) \in \mathbb{Z}[X, Y]$ be of magnitude bounded by $(n, \tau)$, and suppose that

$$ V_{\mathbb{C}}(R, F) = \{(x, y) \in \mathbb{C}^2 \mid R(x) = F(x, y) = 0\} $$

is finite. Computing

$$ n(x) := \deg(F(x, Y)), k(x) := \deg(\text{gcd}(F(x, Y), \partial_Y(F(x, Y)))) $$

for every root $x \in \mathbb{C}$ of $R$ has bit complexity

$$ \tilde{O}(n \max(N, n^2)(N\tau + n\Lambda + Nn) + n^5\tau + n^6). $$
Note that $n(x) - k(x)$ is the number of distinct complex roots of $F(x, Y)$.

We start by estimating the cost of computing the polynomials $R_{\ell}^{*}$ defined in Equation (45) and Equation (46).

**Lemma 3** The computation of all the polynomials

$$ (R_{\ell}^{*}(X))_{\ell \in [1, n_y]} $$

uses $\tilde{O}(\max(n, N)(N\tau + n\Lambda + Nn) + n^3\tau + n^4)$ bit operations.

*Proof.* Since $R^*$ is of degree at most $N$ and bitsize bounded by $\Lambda + N$, and $f_{n_y}(X)$ is of degree at most $n$ and bitsize $O(\tau)$, the computation of their gcd needs $\tilde{O}(\max(n, N)(N\tau + n\Lambda + Nn))$ bit operations according to Proposition 6. Since, for all $\ell \in [0, n_y - 1]$, $\deg(R_{\le \ell}^*) \le n$ and the bitsize of the coefficients of the $R_{\le \ell}^*$ is at most $n + \tau$, the complexity of computing all $(R_{\le \ell}^*)_{\ell \in [0, n_y - 1]}$ is in $O(n^3\tau + n^4)$.

It remains to compute the $R_{\ell}^{*}$ themselves by performing the exact division of $R_{\le \ell}^{*}$ by $R_{\le \ell-1}^{*}$. This takes $O(N\Lambda + N^2)$ binary operations for $\ell = n_y$ and $O(n\tau + n^2)$ binary operations for each $\ell < n_y$. $\square$

The proof of Proposition 18 uses a family of polynomials $\Delta_{\ell,k}^{*}$ defined as follows. We further denote $\text{sDisc}_{\ell,k}(X)$ the $k$-th subdiscriminant of $F_{\ell}$ considered as a polynomial in $Y$. We also define the content-free elements of $\mathbb{Z}[X]$ by:

$$ \Delta_{\ell, \ge 0}^{*}(X) := R_{\ell}^{*}, $$

and for all $k \in \{0, \dots, \ell - 1\}$,

$$ \Delta_{\ell, \ge k+1}^{*}(X) := \gcd(\Delta_{\ell, \ge k}^{*}(X), \text{sDisc}_{\ell,k}(X)), \quad \Delta_{\ell,k}^{*}(X) := \frac{\Delta_{\ell, \ge k}^{*}(X)}{\Delta_{\ell, \ge k+1}^{*}(X)}. \qquad (65) $$

Given $\ell \in [1, n_y]$ and $x \in \mathbb{C}$ such that $\deg_Y(F(x, Y)) = \ell$ (i.e. $R_{\ell}^{*}(x) = 0$), it is clear that, using Notation 50,

$$ \deg_Y(\gcd(F_{\ell}(x, Y), \partial_Y F_{\ell}(x, Y))) \ge k \iff \Delta_{\ell, \ge k}^{*}(x) = 0. \\ \deg_Y(\gcd(F_{\ell}(x, Y), \partial_Y F_{\ell}(x, Y))) = k \iff \Delta_{\ell,k}^{*}(x) = 0. \qquad (66) $$

**Lemma 4** The computation of all the polynomials

$$ (\text{sDisc}_{\ell,k}(X))_{\ell \in [1, n_y], k \in [0, \ell-1]} $$

uses $\tilde{O}(n^5\tau)$ bit operations.

*Proof.* The claim follows clearly from [6, Prop. 8.46], [25, §11.2] since there are $n_y \le n$ lists of sudiscriminants (i.e. subresultant coefficients) to compute. $\square$

**Lemma 5** The computation of all the polynomials $(\Delta_{\ell,k}^{*}(X))_{\ell \in [1, n_y], k \in [0, \ell-1]}$ uses a number of bit operations bounded by

$$ \tilde{O}(n \max(N, n^2)(N\tau + n\Lambda + Nn) + n^5\tau + n^6). $$
Proof. We compute first all the polynomials

$$(\mathrm{sDisc}_{\ell,k}(X))_{\ell \in [1,n_y], k \in [0,\ell-1]}$$

using Lemma 4.

Let $\delta_{\ell,k}$ be the degree of $\Delta_{\ell, \ge k}^*$, and let $\tau_{\ell,k}$ be the maximal bitsize of the coefficients of $\Delta_{\ell, \ge k}^*$.

The roots of $\Delta_{n_y, 0}^*$ are exactly the roots $x$ of $R$ with

$$\deg_Y(F(x, Y)) = n_y \text{ and } \deg_Y(\gcd(F(x, Y), \partial_Y F(x, Y))) = 0.$$

The computation of $\Delta_{n_y, 0}^*$ needs $\tilde{O}(\max(N, n^2)(Nn\tau + n^2\Lambda + Nn^2))$ bit operations according to Proposition 6 and Proposition 7.

From Proposition 16, we conclude that each root of $\Delta_{n_y, \ge k}^*$ for $k > 0$ is also a root of $\mathrm{Disc}_Y(F)$ of multiplicity at least $k$. Since $\Delta_{n_y, \ge k}^*$ divides $R^*$, it is square-free and $(\Delta_{n_y, \ge k}^*)^k$ divides $\mathrm{Disc}_Y(F)$, and thus

$$\delta_{n_y, k} \le \frac{n(2n-1)}{k}, \quad \text{and} \quad \sum_{k=1}^{n_y} \delta_{n_y, k} \in \tilde{O}(n^2).$$

Moreover, (14) yields that $\tau_{n_y, k} \le \mathrm{lMea}(\Delta_{n_y, \ge k}^*) + \delta_{n_y, k}$. Since $\Delta_{n_y, \ge k}^*$ divides $\mathrm{Disc}_Y(F)$ and since the Mahler measure is multiplicative (see 5), we have

$$\sum_{k=1}^{n_y} \mathrm{lMea}(\Delta_{n_y, \ge k}^*) \le \mathrm{lMea}(\mathrm{Disc}_Y(F)) \in \tilde{O}(n\tau),$$

and thus

$$\sum_{k=1}^{n_y} \tau_{n_y, k} \in \tilde{O}(n\tau + n^2).$$

On the other hand, for $\ell \in [1, n_y - 1]$, $\Delta_{\ell, \ge k}^*$ is a divisor of $R_{\ell}^*$, so that

$$\sum_{k=0}^{\ell} \delta_{\ell, k} \le (\ell + 1) \cdot \deg(R_{\ell}^*), \quad \sum_{\ell=1}^{n_y-1} \deg(R_{\ell}^*) \le n_y \le n,$$

and

$$\sum_{\ell=1}^{n_y-1} \sum_{k=0}^{\ell} \delta_{\ell, k} \in \tilde{O}(n^2).$$

As above, we use (14) to show that $\tau_{\ell, k} \le \mathrm{lMea}(\Delta_{\ell, \ge k}^*) + \delta_{\ell, k}$. Since $\Delta_{\ell, \ge k}^*$ is a divisor of $R_{\ell}^*$, which is a divisor of $f_{\ell}$, and

$$\sum_{k=0}^{\ell} \mathrm{lMea}(\Delta_{\ell, \ge k}^*) \le \mathrm{lMea}(f_{\ell}) \in \tilde{O}(\tau),$$

we conclude that

$$\sum_{\ell=1}^{n_y-1} \sum_{k=0}^{\ell} \tau_{\ell, k} \in \tilde{O}(n^2 + n\tau).$$
Finally

$$ \sum_{k=1}^{n_y} \delta_{n_y, k} + \sum_{\ell=1}^{n_y-1} \sum_{k=0}^{\ell} \delta_{\ell, k} \in \tilde{O}(n^2) \qquad (67) $$

$$ \sum_{k=1}^{n_y-1} \tau_{n_y, k} + \sum_{\ell=1}^{n_y-1} \sum_{k=0}^{\ell} \tau_{\ell, k} \in \tilde{O}(n\tau + n^2). \qquad (68) $$

The computation of $\Delta_{\ell, \ge k+1}^*(X) = \gcd(\Delta_{\ell, \ge k}^*(X), \text{sDisc}_{\ell, k}(X))$ for $(\ell, k) \ne (n_y, 0)$ uses

$$ \tilde{O}(\max(\delta_{\ell,k}, n^2)(n^2\tau_{\ell,k} + \delta_{\ell,k}n\tau)) \in \tilde{O}(n^2(n^2\tau_{\ell,k} + \delta_{\ell,k}n\tau)) $$

bit operations according to Proposition 6. Finally, the computation of all the $\Delta_{\ell, \ge k}^*$ needs

$$ \tilde{O}(\max(N, n^2)(Nn\tau + n^2\Lambda + Nn^2) + n^5\tau + n^6) $$

bit operations using (67) and (68).

It remains to compute the $\Delta_{\ell, k}^*$ themselves by performing the exact division of $\Delta_{\ell, \ge k}^*$ by $\Delta_{\ell, \ge k+1}^*$. This takes $O(N\Lambda + N^2)$ binary operations for $(\ell, k) = (n_y, 0)$, $O(n^2\tau + n^3)$ binary operations for each $(n_y, k)$, with $k \ne 0$, and $O(n\tau + n^2)$ binary operations for each $(\ell, k)$, with $\ell < n_y$. $\square$

*Proof of Proposition 18.* In order to determine $n(x)$ for every $x \in V_C(f)$, we use Equation (44), Lemma 3 and Proposition 12.

Similarly in order to determine $k(x)$ for every $x \in V_C(f)$, we use Equation (66), Lemma 5 and Proposition 12. $\square$

### 3.3 Bivariate root isolation

We now bound the complexity of computing the roots of all polynomials $F(x, Y)$, where $x$ runs over all roots of $R$, using Proposition 10.

**Proposition 19** Let $R \in \mathbb{Z}[X]$ be a non-zero polynomial of magnitude bounded by $(N, \Lambda)$, let $F \in \mathbb{Z}[X, Y]$ be of magnitude bounded by $(n, \tau)$, and suppose that

$$ V_C(R, F) = \{(x, y) \in \mathbb{C}^2 \mid R(x) = F(x, y) = 0\} $$

is finite. Then, it holds:

(a) Using

$$ \tilde{O}(N^2\Lambda + N^3 + n \cdot \max(n^2, N) \cdot (N\tau + n\Lambda + Nn) + n^5\tau + n^6) $$

bit operations, we can compute
(a.1) well-isolating disks $\mathcal{D}_{x,y} \subset \mathbb{C}$ for all complex roots $y$ of all polynomials $F(x, Y)$, where the sum of the bitsizes of the radii and centers of all disks $\mathcal{D}_{x,y}$ is bounded by $\tilde{O}(n(N\tau + n\Lambda + Nn))$,

(a.2) the corresponding multiplicities $\mu(x, y)$ for each of the complex roots $y$ of all polynomials $F(x, Y)$, and

(a.3) dyadic approximation $\tilde{\sigma}_{x,y}$ of the separations $\text{Sep}(y, F(x, Y))$ such that

$$ \frac{1}{2} \cdot \text{Sep}(y, F(x, Y)) < \tilde{\sigma}_{x,y} < 2 \cdot \text{Sep}(y, F(x, Y)) $$

for all roots $x$ (resp. $y$) of $R$ (resp. $F(x, Y)$).

(b) Let $V \subset \{(x, y) \in \mathbb{C}^2 : R(x) = 0 \text{ and } F(x, y) = 0\}$, and $L$ be a positive integer. Then, we can further refine all isolating disks $\mathcal{D}_{x,y}$, with $(x, y) \in V$, to a size less than $2^{-L}$, in a number of bit operations bounded by

$$ \tilde{O}(N^2\Lambda + N^3 + n \cdot \max(n^2, N) \cdot (N\tau + n\Lambda + Nn) + L \cdot (N \cdot \mu + n^2 \cdot \sum_{x \in \pi_X(V)} \mu_x)) $$

where $\mu_x := \max_{(x,y) \in V} \mu(x, y)$, and $\mu = \max_{x \in \pi_X(V)} \mu_x$.

*Proof.* First compute

$$ n(x) := \deg F(x, Y), k(x) := \deg \gcd(F(x, Y), \partial_Y F(x, Y)) $$

for all roots $x$ of $R$. According to Proposition 18, this computation needs

$$ \tilde{O}(n \max(N, n^2)(N\tau + n\Lambda + Nn) + n^5\tau + n^6) $$

bit operations. Further notice that $F(x, Y)$ has $m(x) = n(x) - k(x)$ distinct complex roots.

Let $x$ be a fixed complex root of $R$, $\tau_x \in \mathbb{Z}$ such that $2^{-\tau_x} < \text{lc}(F(x, Y)) \le 2^{-\tau_x+2}$, and $F_x := 2^{\tau_x} \cdot F(x, Y)$. Notice that $F_x$ has the same roots as $F(x, Y)$, and the leading coefficient of $F_x$ has absolute value in between 1 and 4. Then according to Proposition 10, we can compute well-isolating disks $\mathcal{D}_{x,y}$ for the roots of $F_x$ (and thus also for the roots of $F(x, Y)$) as well as the multiplicities $\mu(x, y)$ in a number of bit operations that is bounded by

$$ \tilde{O}(n(n^2 + n \cdot \text{lMea}(F_x) + \text{lGDisc}(F_x))). \qquad (69) $$

using Proposition 2; For this, we need an approximation of $F_x$ to an absolute precision that is bounded by

$$ \rho_x \in \tilde{O}(n \text{lMea}(F_x) + \text{lGDisc}(F_x)). \qquad (70) $$

Using Proposition 13, Proposition 15 now yields the bound

$$ \sum_{x \in V_{\mathbb{C}}(R)} \rho_x \in \tilde{O}(n \cdot (N\tau + n\Lambda + Nn)) $$

for the sum of the bound (70) for the needed input precision over all $x \in V_{\mathbb{C}}(R)$.
It remains to show that we can compute sufficiently good approximations of the polynomials $F_x$ in a number of bit operations that is bounded by $\tilde{O}(n^2 \cdot (N\tau + n\Lambda + Nn))$. In order to compute a $\rho_x$-bit approximation of $F_x$, we first compute a $\tau_x$ with $2^{-\tau_x-2} < \ln(F(x, Y)) \le 2^{-\tau_x}$ as well as a $(\rho_x + \tau_x)$-bit approximation of $F(x, Y)$ and then shift the coefficients of the latter approximation of $F(x, Y)$ by $\tau_x$ bits. We first estimate the cost for the computation of the $\tau_x$'s. According to Proposition 9, we can compute an approximation $\tilde{c}_x$ of $c_x := |\ln(F(x, Y))|$ with $|c_x - \tilde{c}_x| < 2^{-L}$ using $\tilde{O}(n(L+n\log(\max(1, |x|)))+\tau)$ bit operations, and as input we need an $\tilde{O}(L+n\log \max(1, |x|)+\tau)$-bit approximation of $x$. Hence, when choosing $L = 2, 4, 8, \dots$, we succeed in computing $\tau_x$ for an $L_x$ of size

$$L_x \in O(|\log(|\ln(F(x, Y))|)| + \tau + n + n \log(\max(1, |x|))),$$

and the cost for the evaluation is bounded by $\tilde{O}(nL_x)$ bit operations. When summing up the latter bound over all $x$ and using Proposition 3 (b) (with $g_i = f_{n_{y-i}}$, the sequence of coefficients of $F \in \mathbb{Z}[X][Y]$), we obtain

$$\sum_{x \in V_{\mathbb{C}}(R)} \tilde{O}(nL_x) = n \cdot \tilde{O}\left(\sum_{x \in V_{\mathbb{C}}(R)} \left(|\log(|\ln(F(x, Y))|)| + \tau + n + n \log(\max(1, |x|))\right)\right) \\ \in \tilde{O}(n^2(N\tau + n\Lambda + Nn))$$

Notice that the above computation further implies that $\sum_{x \in V_{\mathbb{C}(R)}} \tau_x \in \tilde{O}(n(N\tau + n\Lambda + Nn))$.

For estimating the cost of computing sufficiently good approximations of $F(x, Y)$, we can again use Proposition 9. We conclude that the cost for computing a $(\rho_x + \tau_x)$-bit approximation of $F(x, Y)$ is bounded by $\tilde{O}(n^2(\tau + n + n \log(\max(1, |x|)) + \rho_x + \tau_x))$ bit operations and that we need a $\tilde{O}(\tau + n + n \log(\max(1, |x|)) + \rho_x + \tau_x)$-bit approximation of $x$. Summing up the cost over all $x$ then yields

$$\tilde{O}(n^2 N(\tau + n) + n^3 \sum_{x \in V_{\mathbb{C}}(R)} \log(\max(1, |x|)) + n^2 \sum_{x \in V_{\mathbb{C}}(R)} (\rho_x + \tau_x))$$

which is in

$$\tilde{O}(n^3 \cdot (N\tau + n\Lambda + Nn)).$$

Finally, we have to bound the cost for computing sufficiently good approximations of the roots $x$ of $R$. Notice that each term $\tau + n + n \log(\max(1, |x|)) + \rho_x + \tau_x$ is bounded by $\tilde{O}(n \cdot (N\tau + n\Lambda + Nn))$ for each root $x$ of $R$; in fact, the latter bound even applies to the sum of all these terms. Hence, it suffices to compute approximations of all roots of $R$ to an absolute precision of size $\tilde{O}(n \cdot (N\tau + n\Lambda + Nn))$. According to Proposition 11, the cost for the computation of well-isolating disks of corresponding size is bounded by $\tilde{O}(N^2\Lambda + N^3 + Nn(N\tau + n\Lambda + Nn))$. The bound on the sum of the bitsizes of the radii and the centers of the disks $D_{x,y}$ follows directly from Proposition 13
and Proposition 15. This concludes the proof of Parts a) and b). For Part (c), notice that

$$ \frac{\min_{y' \neq y: F(x, y') = 0} |m_{x,y} - m_{x,y'}|}{\mathrm{Sep}(y, F(x, Y))} \in (1 - 1/32, 1 + 1/32), $$

where $m_{x,y}$ denotes the center of $\mathcal{D}_{x,y}$. Hence, approximations $\tilde{\sigma}_{x,y}$ with the required properties can directly be obtained from the distances between the centers $m_{x,y}$. Since the sum of the bitsizes of all centers $m_{x,y}$ is bounded by $\tilde{O}(\sum_{x \in V_C(R)} \mathrm{lMea}(F_x) + \mathrm{lSep}(F_x^*)) \in \tilde{O}(n(N\tau + n\mathrm{lMea} + Nn))$, the claim follows.

It remains to prove the last claim on the cost for refining the disks $\mathcal{D}_{x,y}$, with $(x, y) \in V$, to a size less than $2^{-L}$. For this, we use Proposition 11 (c), which shows that, for a fixed $x$, we can refine all disks $\mathcal{D}_{x,y}$ using

$$ \tilde{O}(n(L \cdot \mu_x + n^2 \cdot \mathrm{lMea}(F_x) + n \mathrm{lGDisc}(F_x) + n^3)) $$

bit operations. Now, summing the latter bound over all $x$ yields

$$ \tilde{O}(n^2(N\tau + n\Lambda + Nn) + nL \cdot \sum_{x \in V_C(R)} \mu_x). $$

For the input precision $\rho_x$ to which we need to approximate the polynomial $F_x$, we obtain the bound

$$ \rho_x \in \tilde{O}(L \cdot \mu + n \cdot \mathrm{lMea}(F_x) + \mathrm{lGDisc}(F_x) + n^2). $$

Again, using the same argument as above, it follows that sufficiently good approximations of the polynomials $F_x$ can be computed using

$$ \tilde{O}(n^3 \cdot (N\tau + n\Lambda + Nn) + L(N\mu + n^2 \cdot \sum_{x \in V_C(R)} \mu_x)) $$

bit operations.

<figure><img src="image_4.png" /></figure>

Theorem 2 follows from Proposition 19.

**Proposition 20** Let $R \in \mathbb{Z}[X]$ a non-zero polynomial of magnitude bounded by $(N, \Lambda)$, $F, G \in \mathbb{Z}[X, Y]$ be of magnitude bounded by $(n, \tau)$, and $H := F \cdot G$. Suppose moreover that

$$ V_C(R, H) = \{(x, y) \in \mathbb{C}^2 \mid R(x) = H(x, y) = 0\} $$

is finite. Using a number of bit operations bounded by

$$ \tilde{O}(N^2\Lambda + N^3 + n^5\tau + n^6 + n \cdot \max(n^2, N) \cdot (N\tau + n\Lambda + Nn)) $$

we can carry out the following computations for all complex roots $x$ of $R$:

(a) computing well-isolating disks $\mathcal{D}_{x,y}$ for all complex roots $y$ of the polynomial $H(x, Y)$ together with the corresponding multiplicities $\nu(x, y) = \mathrm{mul}(y, H(x, Y))$.
(b) determining for each root y of $H(x, Y)$ whether y is a root of $F(x, Y)$, $G(x, Y)$, or both. If x as well as y are real, we can further determine the sign of $F(x, y)$ and $G(x, y)$.

*Proof.* Part (a) already follows from Lemma 5 and Proposition 19 as $H$ has magnitude bounded by $(O(n), O(\log(n) + \tau))$. We may further assume that, for all complex roots $x$ of $R$, we have already computed

- well-isolating disks $\mathcal{D}_{x,y'}^F$ and $\mathcal{D}_{x,y''}^G$ for all complex roots $y'$ and $y''$ of the polynomials $F(x, Y)$ and $G(x, Y)$, respectively,

- the corresponding multiplicities $\mathrm{mul}(y', F(x, Y))$ and $\mathrm{mul}(y'', G(x, Y))$,

- the degrees of the polynomials $F(x, Y)$ and $G(x, Y)$, and

- the signs of the leading coefficients of the polynomials $F(x, Y)$ and $G(x, Y)$ in case that $x$ is a real root of $R$.

For (b), we now refine each disk $\mathcal{D}_{x,y'}^F$ such that it intersects with exactly one of the disks $\mathcal{D}_{x,y}$. If this is the case, then it holds that $y = y'$. In addition, $y$ is also a root of $G(x, Y)$ if and only if $\nu(x, y) > \mathrm{mul}(y', F(x, Y))$ as $\mathrm{mul}(y, F(x, Y)) + \mathrm{mul}(y, G(x, Y)) = \nu(x, y)$. Hence, for each root $y$ of $H(x, Y)$, we also know its multiplicity as a root of $F(x, Y)$ and $G(x, Y)$. When restricting to the real roots of $R$, this implies that we can directly deduce the sign of $F(x, y)$ (resp. $G(x, y)$) at each real root $y$ of $H(x, Y)$ that is not a root of $F(x, Y)$ (resp. $G(x, Y)$). Namely, from the sign of the leading coefficient of $F(x, Y)$ (resp. $G(x, Y)$) and its degree, we know its sign at $\pm\infty$, and the polynomial changes signs exactly at those roots of $H$ that are roots of $F(x, Y)$ (resp. $G(x, Y)$) of odd multiplicity.

It remains to bound the cost for the refinement of the disks $\mathcal{D}_{x,y'}^F$. We proceed in rounds enumerated by $\ell = 1, 2, 3, \dots$: Initially, we set $Z^1 := V_{\mathbb{C}}(R, F)$. In the $\ell$-th round, we refine each of the isolating disks $\mathcal{D}_{x,y'}^F$ for all $(x, y') \in Z^\ell$ to a size less than $2^{-2\ell}$ and check whether it intersects exactly one of the isolating disks $\mathcal{D}_{x,y}$ for the roots of $H(x, Y)$. If this is the case, we know that $y = y'$.

After having treated all points in $Z^\ell$, we set $Z^{\ell+1}$ to be the set of all $(x, y')$ in $Z^\ell$ for which the isolating disk $\mathcal{D}_{x,y'}^F$ intersects more than one of isolating disks for $H(x, Y)$. That is, $Z^\ell$ is the set of all $(x, y') \in Z^1$ for which we have not determined a corresponding root $y$ of $H(x, Y)$ with $y = y'$ after the $\ell$-th round. We then proceed with the $(\ell+1)$-st round. We stop as soon as $Z^\ell$ becomes empty, in which case, each root of each $F(x, Y) = 0$ is matched to a corresponding root of $H(x, Y)$. Notice that, for each $(x, y')$, we must succeed in round $\ell_{x,y'}$, for some $\ell_{x,y'}$ with

$$2^{\ell_{x,y'}} \le O(|\log(\mathrm{Sep}(y', H(x, Y)))|).$$

From the amortized bounds on the separation of the roots (Proposition 15), we have that $|\log(\mathrm{Sep}(y', H(x, Y)))| \in \tilde{O}(n(N\tau+n\Lambda+Nn))$, thus we are done after $\ell_{\max}$ rounds for

$$\ell_{\max} = \max_{x,y'} \ell_{x,y''} + 1 \in O(\log(n(N\tau + n\Lambda + Nn))). \quad (71)$$
According to Proposition 19, the cost for refining the disks $\mathcal{D}_{x,y'}^F$ for all $(x, y') \in Z^\ell$ to a size less than $2^{-2^\ell}$ is bounded by

$$ \sum_{\ell=1}^{\ell_{\max}} \tilde{O}(N^2 \Lambda + N^3 + n \max(n^2, N)(N\tau + n\Lambda + Nn) + 2^\ell (N\mu^{[\ell]} + n^2 \sum_{x \in \mathbb{C}: R(x)=0} \mu_x^{[\ell]})) $$

bit operations, where

$$ \mu_x^{[\ell]} := \begin{cases} \max_{(x,y') \in Z^\ell} \mathrm{mul}(y', F(x, Y)) & \text{if there exists } (x, y') \in Z^\ell \\ 0 & \text{otherwise.} \end{cases} $$

and $\mu_x^{[\ell]} := \max_{x:R(x)=0} \mu_x^{[\ell]}$. Since $\ell_{\max}$ is bounded by $O(\log(n(N\tau + n\Lambda + Nn)))$, we are left to bound the sum

$$ \sum_{\ell=1}^{\ell_{\max}} 2^{\ell} \cdot (N \cdot \mu_x^{[\ell]} + n^2 \cdot \sum_{x \in \mathbb{C}: R(x)=0} \mu_x^{[\ell]}). \quad (72) $$

If, for a fixed root $x$ of $R$, there exists a $(x, y') \in Z^\ell$, then let $(x, y'_{\ell,x}) \in Z^\ell$ be a point in $Z^\ell$ with $\mathrm{mul}(y'_\ell, F(x_\ell, Y)) = \mu^{[\ell]}$. In other words, $y'_{\ell,x}$ maximizes the multiplicity within the fiber for all roots $y'$ of $F(x, Y)$ with $(x, y') \in Z^\ell$. In addition, let $(x_\ell, y'_\ell)$ be a point in $Z^\ell$ that maximizes the multiplicity over all fibers. Thus, the sum in (72) can be rewritten as

$$ N \cdot \sum_{\ell=1}^{\ell_{\max}} \mathrm{mul}(y'_\ell, F(x_\ell, Y)) \cdot 2^\ell + n^2 \cdot \sum_{\ell=1}^{\ell_{\max}} \sum_{x \in \mathbb{C}: R(x)=0} \mathrm{mul}(y'_{\ell,x}, F(x, Y)) \cdot 2^\ell. $$

Notice that a pair $(x, y') \in Z_{x,y}^{\ell}$ can appear at most $\ell_{\max}$ many times in each of the above sums. In addition, it holds that $(x, y') \notin Z^\ell$ if $\ell > \ell_{x,y'}$ for some $2^{\ell_{x,y'}} \in O(|\log(\mathrm{Sep}(y', H(x, Y)))|)$. Hence, the above sum is upper bounded by

$$ O(\ell_{\max} \cdot (n^2 + N) \cdot \sum_{(x,y') \in Z^1} \mathrm{mul}(y', F(x, Y)) \cdot |\log(\mathrm{Sep}(y', H(x, Y)))|) \quad (73) $$

Since $\mathrm{mul}(y', F(x, Y)) \le \mathrm{mul}(y', H(x, Y))$ and $\ell_{\max} \in O(\log(n(N\tau + n\Lambda + Nn)))$, we thus conclude from Proposition 15 that (73) is upper bounded by

$$ \tilde{O}(n \cdot (n^2 + N) \cdot (N\tau + n\Lambda + Nn)). $$

Finally, the cost of checking whether an isolating disk $\mathcal{D}_{x,y'}^F$ intersects exactly one of the isolating disks $\mathcal{D}_{x,y}$ for the roots of $H(x, Y)$ is bounded by $O(n \cdot (\mathrm{lSep}(H(x, Y)^*) + \mathrm{lMea}(H(x, Y)))$ as there are $n$ comparisons between disks with radii and centers of bitsize $O(\mathrm{lSep}(H(x, Y)^*) + \mathrm{lMea}(H(x, Y)))$. The total cost for all comparisons is thus bounded by

$$ O(\kappa \cdot n^2 \cdot \sum_{x:R(x)=0} [\mathrm{Sep}(H(x, Y)^*) + \mathrm{Mea}(H(x, Y))]) = \tilde{O}(n^3(N\tau + n\Gamma + Nn)), $$
where the latter inequality follows from Proposition 13 and Proposition 15. Hence, our claim follows. □

We remark that the above considerations immediately yield a new algorithm for solving a bivariate polynomial system that achieves the current record complexity bound for this problem.

**Corollary 2** Let $F, G \in \mathbb{Z}[X, Y]$ be coprime polynomials of magnitude bounded by $(n, \tau)$. Then, we can compute isolating regions for all complex solutions of the system $F = G = 0$ using $\tilde{O}(n^5\tau + n^6)$ bit operations.

*Proof.* Let $R = \text{Res}_X(F, G)$ be the resultant polynomial of $F$ and $G$, which can be computed using $\tilde{O}(n^4\tau + n^5)$ bit operations. Any common solution $(x_0, y_0) \in \mathbb{C}$ of $F = G = 0$ yields a root $x_0$ of $R$, and then $y_0$ is a common root of $F(x_0, Y)$ and $G(x_0, Y)$. Vice versa, any common root $y_0$ of $F(x_0, Y)$ and $G(x_0, Y)$ yields a solution of $F = G = 0$. According to Proposition 20, we can compute all common roots of $F(x, Y)$ and $G(x, Y)$ for all complex roots $x$ of $R$ using $\tilde{O}(n^5\tau + n^6)$ bit operations. Hence, the claim follows. □

*Remark 3* In the proof of Proposition 20, we needed to recursively refine the isolating disks for the roots of $F(x, Y)$ until a certain test applies. That is, we needed to check whether a disk intersects exactly one of the isolating disks of $H(x, Y)$. While this test itself is rather simple (and cheap), its success is directly related to a hidden parameter, which is in this case the separation of some specific (but unknown) root of the polynomial $H(x, Y)$.

In the worst case, the cost for refining isolating disks for the polynomial $F(x, Y)$ until the test applies is rather large (i.e. it is comparable to our bound for the overall computation), and thus it would be very costly to refine all isolating disks to such a small size. Fortunately, this is not necessary as, for most roots of $F(x, Y)$, the success of the test is related to a root of $H(x, Y)$ with larger separation. In order to exploit this fact, we need to design adaptive algorithms in each of these cases and to use our amortized bounds on the separation of the roots (Proposition 4 and Proposition 15).

Three instances of such a situation appear in this paper, the first in Proposition 20 and the two others in the proof of Theorem 4 parts c.1 and c.2.

# 4 Computation of the topology

## 4.1 Preliminary definitions and results

Let $P \in \mathbb{Z}[X, Y]$ be a square-free polynomial of magnitude bounded by $(d, \tau)$. In addition, let

$$V_{\mathbb{R}}(P) = \{(x, y) \in \mathbb{R}^2 \mid P(x, y) = 0\}$$

be the real algebraic curve defined by $P$, and

$$V_{\mathbb{C}}(P) = \{(x, y) \in \mathbb{C}^2 \mid P(x, y) = 0\}$$
be the corresponding complex algebraic curve.

We first decompose

$$P(X, Y) = p(X) \cdot Q(X, Y) \qquad (74)$$

with $p(X) \in \mathbb{Z}[X]$ and $Q(X, Y) \in \mathbb{Z}[X, Y]$ such that $Q(x, Y)$ never identically vanishes for any $x \in \mathbb{C}$. In more geometric terms, we separate the vertical lines contained in $V_{\mathbb{C}}(P)$ from the remaining part $V_{\mathbb{C}}(Q)$ of the curve, which does not contain any vertical lines.

**Proposition 21** We can compute $p(X)$ and $Q(X, Y)$ using $\tilde{O}(d^4 + d^3\tau)$ bit operations. The polynomial $p(X)$ and $Q(X, Y)$ have magnitude bounded by $(d, \tau + d + \log(d + 1))$.

*Proof.* Let $P(X, Y) := p_{\deg_Y(P)}(X)Y^{\deg_Y(P)} + \dots + p_0(X)$, with $\deg_Y(P) \le d$. Let $p(X)$ the gcd of all the coefficients $p_i(X)$. We first compute $p(X)$ then write $P(X, Y) = p(X)Q(X, Y)$. The claimed bounds on the cost for computing $p(X)$ and $Q(X, Y)$ as well as on the magnitude of these polynomials follow immediately from Propositions 5 and 6. $\square$

From now on, we study the zero set of $Q(X, Y)$, which contains no vertical lines. We suppose moreover that $\deg_X(Q(X, Y)) > 0$ because otherwise $V_{\mathbb{R}}(Q)$ is a finite number of horizontal lines and its topology, very easy to describe, is treated as a special case in the first part of sub-section 4.6. We also describe in sub-section 4.6 how to add back vertical lines contained in $V_{\mathbb{R}}(P)$ to obtain the topology of $V_{\mathbb{R}}(P)$ from the topology of $V_{\mathbb{R}}(Q)$.

A point $(\alpha, \beta) \in V_{\mathbb{R}}(Q)$ is called:

- an $X$-critical point if $\partial_Y Q(\alpha, \beta) = 0$,

- a $Y$-critical point if $\partial_X Q(\alpha, \beta) = 0$,

- a singular point if $\partial_X Q(\alpha, \beta) = \partial_Y Q(\alpha, \beta) = 0$,

- a regular point if $\partial_Y Q(\alpha, \beta) \neq 0$ and $\partial_X Q(\alpha, \beta) \neq 0$.

Notice that a singular point of $V_{\mathbb{R}}(Q)$ is also an $X$-critical and a $Y$-critical point.

We define

$$D_X(X) := \mathrm{Res}_Y(Q, \partial Y Q) = q_{d'}(X) \mathrm{Disc}_Y(Q)(X), \qquad (75)$$

where $q_{d'}(X)$ is the leading coefficient of $Q$ with respect to $Y$.

In geometric terms, the zeroes of $D_X$ are the projections on the $X$-axis of the $X$-critical points or the values $\alpha$ such that $\deg(Q(\alpha, Y)) < \deg_Y(Q) = d'$.

The special case where $D_X(X)$ has no real root is considered separately in the first part of sub-section 4.6.

Let

$$\alpha_1 < \dots < \alpha_N \qquad (76)$$

be the real roots of $D_X(X)$.
For every $i = 1, \dots, N$, we denote by $m_i$ the number of roots of $Q(\alpha_i, Y)$ and by $\beta_{i,1}, \dots, \beta_{i,m_i}$, with

$$ \beta_{i,1} < \dots < \beta_{i,m_i}, \qquad (77) $$

the real roots of $Q(\alpha_i, Y)$.

We denote by $m'_0$ (resp. $m'_i, i = 1, \dots, N$) the number of roots of $Q(x, Y)$ when $x \in (-\infty, \alpha_1)$ (resp. $x \in (\alpha_i, \alpha_{i+1})$, $x \in (x_N, +\infty)$). It is clear that the numbers $m'_i, i = 1, \dots, N-1$ coincide with the number of roots of $Q(\alpha'_i, Y)$ where $\alpha'_i$ is the smallest root of $D'_X$ bigger than $\alpha_i$.

In order to evaluate $m'_0$ and $m'_N$, we use the following classical Cauchy bound. Let $f(X) = a_nX^n + \dots + a_qX^q$, be a univariate polynomial of degree $n$ with coefficients in $\mathbb{C}$, such that $a_q \neq 0$, $a_{q-1} = \dots, a_0 = 0$. Denoting

$$ \mathrm{Cau}(f) := \sum_{q \le i \le n} \left| \frac{a_i}{a_n} \right|, \qquad (78) $$

the absolute value of any root of $f$ in $\mathbb{C}$ is smaller than $\mathrm{Cau}(f)$ (cf. for example [6, Lemma 10.2]). The numbers $m'_0$ and $m'_N$ coincide with the number of roots of $Q(\mathrm{Cau}(D_X), Y)$ and $Q(-\mathrm{Cau}(D_X), Y)$.

For each fixed $i$, we define the set of indices of X-critical points above $i$ as

$$ \mathrm{CRITIND}_i := \{j \in \{1, \dots, m_i\} : (\alpha_i, \beta_{i,j}) \in \mathrm{Crit}_X(V_{\mathbb{R}}(Q))\}. $$

with $\mathrm{Crit}_X(V_{\mathbb{R}}(Q)) := \{(x, y) \in \mathbb{R}^2 \mid Q(x, y) = \partial_Y Q(x, y) = 0\}$ and the set of indices of singular points above $i$ as

$$ \mathrm{SINGIND}_i := \{j \in \{1, \dots, m_i\} : (\alpha_i, \beta_{i,j}) \in \mathrm{Sing}(V_{\mathbb{R}}(Q))\}. $$

$$ \text{with } \mathrm{Sing}(V_{\mathbb{R}}(Q)) := \{(x, y) \in \mathbb{R}^2 \mid Q(x, y) = \partial_Y Q(x, y) = \partial_X Q(x, y) = 0\}. $$

Our aim is to determine the number $\mathrm{LEFT}_{i,j}$ of the curve segments ending at $(\alpha_i, \beta_{i,j})$ to the left of $\alpha_i$ as well as the number $\mathrm{RIGHT}_{i,j}$ of the curve segments ending at $(\alpha_i, \beta_{i,j})$ to the right of $\alpha_i$.

These numbers are easy to determine if $j \notin \mathrm{SINGIND}_i$. If $(\alpha_i, \beta_{i,j})$ is regular, $\mathrm{LEFT}_{i,j} = \mathrm{RIGHT}_{i,j} = 1$. If $(\alpha_i, \beta_{i,j})$ is X-critical but not singular, denoting by $\mu_{i,j}$ the multiplicity of $\beta_{i,j}$ as a root of $Q(\alpha_i, Y)$

- if $\mu_{i,j}$ is odd,

$$ \mathrm{LEFT}_{i,j} = \mathrm{RIGHT}_{i,j} = 1 \qquad (79) $$

- if $\mu_{i,j}$ is even and $\partial_Y Q[\mu_{i,j}](\alpha_i, \beta_{i,j}) > 0$,

$$ \mathrm{LEFT}_{i,j} = 0, \mathrm{RIGHT}_{i,j} = 2 \qquad (80) $$

- if $\mu_{i,j}$ is even and $\partial_Y Q[\mu_{i,j}](\alpha_i, \beta_{i,j}) < 0$,

$$ \mathrm{LEFT}_{i,j} = 2, \mathrm{RIGHT}_{i,j} = 0 \qquad (81) $$
<figure><img src="image_5.png" /><figcaption>Fig. 2: Simple asymptotes, X-critical points and singular points</figcaption></figure>

We now explain how to deal with the vertical asymptotes in the simple case. We denote by $d' = \deg_Y(Q) \le d$ and by $q_0(X), \dots, q_{d'}(X)$ the coefficients of $Q$ considered as a polynomials in $Y$. The vertical asymptotes occur at values of $\alpha$ where $\deg(Q(\alpha, Y)) < \deg_Y(Q)$, i.e. at zeroes of $q_{d'}$. Our aim is to count the number of asymptotes $\text{LEFT}_{i,0}$ and $\text{RIGHT}_{i,0}$ tending to $-\infty$ just before $\alpha_i$ and just after $\alpha_i$ (resp. $\text{LEFT}_{i,m_i+1}$ and $\text{RIGHT}_{i,m_i+1}$ tending to $+\infty$ just before $\alpha_i$ and just after $\alpha_i$). If $\deg(Q(\alpha, Y)) = d'$ there are no asymptotes and

$$ \text{LEFT}_{i,0} = \text{RIGHT}_{i,0} = \text{LEFT}_{i,m_i+1} = \text{RIGHT}_{i,m_i+1} = 0. $$

The asymptote is simple when $\deg(Q(\alpha, Y)) = d' - 1$, i.e. when $q_{d'}(\alpha) = 0$, $q_{d'-1}(\alpha) \neq 0$, and we have

$$ - \text{ if } q_{d'-1}(\alpha) < 0, $$

$$ \text{LEFT}_{i,0} = 1, \text{RIGHT}_{i,0} = 0, \text{LEFT}_{i,m_i+1} = 0, \text{RIGHT}_{i,m_i+1} = 1; \quad (82) $$

$$ - \text{ if } q_{d'-1}(\alpha) > 0 $$

$$ \text{LEFT}_{i,0} = 0, \text{RIGHT}_{i,0} = 1, \text{LEFT}_{i,m_i+1} = 1, \text{RIGHT}_{i,m_i+1} = 0. \quad (83) $$

Using the notation above, we can prove the following Theorem.

**Theorem 3 (Cylindrical Algebraic Decomposition) Using $\tilde{O}(d^5\tau + d^6)$ bit operations, we can compute:**

- the number $N$,

- for each $i = 1, \dots, N$, the numbers $m_i$,

- for each $i = 0, \dots, N$, the numbers $m'_i$,
- for each $i = 1, \dots, N$, the set $\text{CRITIND}_i$,

- for each $i = 1, \dots, N$, the set $\text{SINGIND}_i$,

- for each $j \in \text{CRITIND}_i \setminus \text{SINGIND}_i$, the multiplicity $\mu_{i,j}$ of $\beta_{i,j}$ as a root of $Q(\alpha_i, Y)$ and the sign $\text{sign}(\partial_Y^{\mu_{i,j}} Q(\alpha_i, \beta_{i,j}))$,

- for each $i = 1, \dots, N$, the degree $\text{deg}(Q(\alpha_i, Y))$,

- for each $i = 1, \dots, N$ such that $\text{deg}(Q(\alpha_i, Y)) = d' - 1$, $\text{sign}(q_{d'-1}(\alpha_i))$.

**Proof.** First note, using Lemma 6, that $D_X$ is a polynomial of magnitude bounded by $(N, \Lambda) \in (O(d^2), \tilde{O}(d\tau+d^2))$. Hence, by Proposition 11 and Proposition 12, we can compute well-isolating intervals for the real roots of $D_X$ in a number of bit operations bounded by $\tilde{O}(d^5\tau+d^6)$. According to Proposition 18 (with $R := D_X$ and $F := Q(X, Y)$), we may further compute $\text{deg}(Q(\alpha_i, Y))$ and the number of distinct roots of $Q(\alpha_i, Y)$ for all $i$ from 1 to $N$ using $\tilde{O}(d^5\tau + d^6)$ bit operations. From Proposition 19, we conclude that using also $\tilde{O}(d^5\tau + d^6)$ bit operations we can further compute well-isolating intervals for all real roots of the polynomials $Q(\alpha_i, Y)$ as well as the corresponding multiplicities $\mu_{i,j}$ of $\beta_{i,j}$ for all $i$ from 1 to $N$. Each root $\beta_{i,j}$ of multiplicity larger than one then corresponds to an $X$-critical point $(\alpha_i, \beta_{i,j})$, which defines $\text{CRITIND}_i$ for $i = 1, \dots, N$. In order to define $\text{SINGIND}_i$ for $i = 1, \dots, N$ we compute the sign of $\partial_X Q(\alpha_i, \beta_{i,j})$ for all $j \in \text{CRITIND}_i$ using Proposition 20. We compute for each $j \in \text{CRITIND}_i \setminus \text{SINGIND}_i$ the sign $\text{sign}(\partial_Y^{\mu_{i,j}} Q(\alpha_i, \beta_{i,j}))$ using again Proposition 20. We finally compute for each $i = 1, \dots, N$ such that $\text{deg}(Q(\alpha_i, Y)) = d' - 1$, $\text{sign}(q_{d'-1}(\alpha_i))$ using Proposition 12. $\square$

As a consequence if it is the case that

- for each $i = 1, \dots, N$, the set $\text{SINGIND}_i$ has 0 or 1 element

- for each $i = 1, \dots, N$, $\text{deg}(Q(\alpha_i, Y)) = d'$ or $\text{deg}(Q(\alpha_i, Y)) = d' - 1$

we have all the information needed to compute $\text{LEFT}_{i,j}$ and $\text{RIGHT}_{i,j}$ for $j \notin \text{SINGIND}_i$ as well as $\text{LEFT}_{i,0}$ and $\text{RIGHT}_{i,m_i+1}$ using Equations (79), (80), (81), (82), (83). Finally, for each $i = 1, \dots, N$, $j \in \text{SINGIND}_i$

- $\text{LEFT}_{i,j} = m'_{i-1} - \sum_{k=0, \dots, m_i+1, k \neq j} \text{LEFT}_{i,k}$,

- $\text{RIGHT}_{i,j} = m'_{i} - \sum_{k=0, \dots, m_i+1, k \neq j} \text{RIGHT}_{i,k}$.

The more complicated remaining cases when there are several singular points above one $\alpha_i$ or several vertical asymptotes at $\alpha_i$ are discussed in the following sections.

## 4.2 Adjacency boxes and number of left and right curve segments at a singular point

We now deal with the determination of the number $\text{LEFT}$ of the curve segments ending at $(\alpha, \beta)$ to the left of $\alpha$ as well as the number $\text{RIGHT}$ of the curve segments ending at $(\alpha, \beta)$ to the right of $\alpha$ at a singular point $(\alpha, \beta)$ of $V_{\mathbb{R}}(Q)$.

**Definition 11** A rectangle $\text{Box}(\alpha, \beta) := [\alpha^{-}, \alpha^{+}] \times [\gamma^{-}, \gamma^{+}]$ is an adjacency box associated to a singular point $(\alpha, \beta)$ of $V_{\mathbb{R}}(Q)$ if the following holds
- $\alpha^{-} < \alpha < \alpha^{+}, \gamma^{-} < \beta < \gamma^{+}$,

- there is no X-critical point of $V_{\mathbb{R}}(Q)$ inside $([\alpha^{-}, \alpha) \cup (\alpha, \alpha^{+}]) \times \mathbb{R}$,

- except points of the horizontal line $Y = \beta$ when it is included $V_{\mathbb{R}}(Q)$, there is no Y-critical point of $V_{\mathbb{R}}(Q)$ inside $([\alpha^{-}, \alpha) \cup (\alpha, \alpha^{+}]) \times \mathbb{R}$,

- there is no Y-critical point or X-critical point of $V_{\mathbb{R}}(Q)$ inside $\mathbb{R} \times ([\gamma^{-}, \beta) \cup (\beta, \gamma^{+})]$.

It follows clearly from the definition that $(\alpha, \beta)$ is the only singular point of $\text{Box}(\alpha, \beta)$.

The aim of this subsection is to explain how counting the intersection points of $V_{\mathbb{R}}(Q)$ with some specific parts of the boundary of $\text{Box}(\alpha, \beta)$, and taking into account some sign conditions on the slope of the curve, makes it possible to compute the number LEFT and RIGHT.

We denote by

- LBox$(\alpha, \beta) := [\alpha^{-}, \alpha] \times [\gamma^{-}, \gamma^{+}] \setminus \{(\alpha, \beta)\}$ the left-half of $\text{Box}(\alpha, \beta)$

- RBox$(\alpha, \beta) := [\alpha, \alpha^{+}] \times [\gamma^{-}, \gamma^{+}] \setminus \{(\alpha, \beta)\}$ the right-half of $\text{Box}(\alpha, \beta)$.

We denote by $\text{Slope}(X, Y)$ the rational fraction

$$ \text{Slope}(X, Y) = - \frac{\partial_X Q(X, Y)}{\partial_Y Q(X, Y)}. $$

The slope of the tangent to a level line of $Q$ at a regular point $(x, y)$ is given by

$$ \text{Slope}(x, y) = - \frac{\partial_X Q(x, y)}{\partial_Y Q(x, y)}. $$

Note that at any point $(x, y)$ of $\text{Box}(\alpha, \beta) \setminus \{(\alpha, \beta)\}$ intersected with $V_{\mathbb{R}}(Q)$, $\text{Slope}(x, y)$ is well defined and not 0, except if $y = \beta$ and $Y = \beta$ is a horizontal line contained in $V_{\mathbb{R}}(Q)$.

A boundary point $(x, y)$ of LBox$(\alpha, \beta)$ (resp. RBox$(\alpha, \beta)$) in $V_{\mathbb{R}}(Q)$ is exactly of one of the following types

- type 0: there is no curve segment of $V_{\mathbb{R}}(Q)$ containing $(x, y)$ inside LBox$(\alpha, \beta)$ (resp. RBox$(\alpha, \beta)$); this is the case only at some corners, i.e. if $(x, y) = (\alpha_{-}, \gamma_{+})$ with $\text{Slope}(\alpha_{-}, \gamma_{+}) > 0$ or $(x, y) = (\alpha_{-}, \gamma_{-})$ with $\text{Slope}(\alpha_{-}, \gamma_{-}) < 0$ (resp. $(x, y) = (\alpha_{+}, \gamma_{+})$ with $\text{Slope}(\alpha_{+}, \gamma_{+}) < 0$ or $(x, y) = (\alpha_{+}, \gamma_{-})$) with $\text{Slope}(\alpha_{+}, \gamma_{-}) > 0$).

- type 1: there is a curve segment of $V_{\mathbb{R}}(Q)$ containing $(x, y)$ which ends at another boundary point denoted by $\text{Match}(x, y)$ of LBox$(\alpha, \beta) \cap V_{\mathbb{R}}(Q)$ (resp. RBox$(\alpha, \beta) \cap V_{\mathbb{R}}(Q)$);

- type 2: there is a curve segment of $V_{\mathbb{R}}(Q)$ containing $(x, y)$ which ends at $\text{Match}(x, y) = (\alpha, \beta)$.

**Remark 4** The following properties are clear from Definition 11. The matching point $\text{Match}(x, y)$ has the same slope sign as $(x, y)$ for type 1. If $(x, y) \neq (x', y')$, $\text{Match}(x, y) \neq \text{Match}(x', y')$ except if $\text{Match}(x, y) = \text{Match}(x', y') = (\alpha, \beta)$. A curve segment associated to a point of type 1 does not meet any other curve segment, and a curve segment of type 2 meets only other curve segments of type 2, at $(\alpha, \beta)$.
We denote by

- LBox$^+(\alpha, \beta) := [\alpha^-, \alpha] \times (\beta, \gamma^+]$ the upper left-half of Box$(\alpha, \beta)$

- RBox$^+(\alpha, \beta) := [\alpha, \alpha^+] \times (\beta, \gamma^+]$ the upper right-half of Box$(\alpha, \beta)$,

- LBox$^-(\alpha, \beta) := [\alpha^-, \alpha] \times [\gamma^-, \beta)$ the lower left-half of Box$(\alpha, \beta)$

- RBox$^-(\alpha, \beta) := [\alpha, \alpha^+] \times [\gamma^-, \beta)$ the lower right-half of Box$(\alpha, \beta)$.

We introduce some definitions to describe the intersection of $V_R(Q)$ with the boundaries of LBox$(\alpha, \beta)$, RBox$(\alpha, \beta)$, LBox$^+(\alpha, \beta)$, RBox$^+(\alpha, \beta)$, LBox$^-(\alpha, \beta)$ and LBox$^-(\alpha, \beta)$.

**Notation 12** Denote by

- $V_{\alpha^-} = V_R(Q) \cap (\{\alpha^-\} \times (\gamma^-, \gamma^+))$ and $V_{\alpha^+} = V_R(Q) \cap (\{\alpha^+\} \times (\gamma^-, \gamma^+))$, ordered by increasing value of $y$,

- $V_{\alpha^-}^{=\beta} = V_R(Q) \cap (\{\alpha^-, \beta\})$, $V_{\alpha^-}^{<\beta} = V_R(Q) \cap (\{\alpha^-\} \times (\gamma^-, \beta))$, $V_{\alpha^-}^{>\beta} = V_R(Q) \cap (\{\alpha^-\} \times (\beta, \gamma^+))$, ordered by increasing value of $y$,

- $V_{\alpha^+}^{=\beta} = V_R(Q) \cap (\{\alpha^+, \beta\})$, $V_{\alpha^+}^{<\beta} = V_R(Q) \cap (\{\alpha^+\} \times (\gamma^-, \beta))$, $V_{\alpha^+}^{>\beta} = V_R(Q) \cap (\{\alpha^+\} \times (\beta, \gamma^+))$, ordered by increasing value of $y$,

- $V_{\alpha}^{<\beta} = V_R(Q) \cap (\{\alpha\} \times (\gamma^-, \beta))$, $V_{\alpha}^{>\beta} = V_R(Q) \cap (\{\alpha\} \times (\gamma^-, \beta))$, ordered by increasing value of $y$,

and

- $H_{\gamma^-}^{=\alpha^-} = V_R(Q) \cap (\{\alpha^-, \gamma^-\})$, $H_{\gamma^-}^{<\alpha} = V_R(Q) \cap ((\alpha^-, \alpha) \times \{\gamma^-\})$, $H_{\gamma^-}^{=\alpha} = V_R(Q) \cap (\{\alpha, \gamma^-\})$, $H_{\gamma^-}^{>\alpha} = V_R(Q) \cap ((\alpha, \alpha^+) \times \{\gamma^-\})$, $H_{\gamma^-}^{=\alpha^+} = V_R(Q) \cap \{(\alpha^+, \gamma^-)\}$,

- $H_{\gamma^+}^{=\alpha^-} = V_R(Q) \cap (\{\alpha^-, \gamma^+\})$, $H_{\gamma^+}^{<\alpha} = V_R(Q) \cap ((\alpha^-, \alpha) \times \{\gamma^+\})$, $H_{\gamma^+}^{=\alpha} = V_R(Q) \cap (\{\alpha, \gamma^+\})$, $H_{\gamma^+}^{>\alpha} = V_R(Q) \cap ((\alpha, \alpha^+) \times \{\gamma^+\})$, $H_{\gamma^+}^{=\alpha^+} = V_R(Q) \cap \{(\alpha^+, \gamma^+)\}$.

In summary:

- the boundary points of LBox$^+(\alpha, \beta)$ in $V_R(Q)$ are $V_{\alpha^-}^{>\beta} \cup H_{\gamma^+}^{=\alpha^-} \cup H_{\gamma^+}^{<\alpha} \cup H_{\gamma^+}^{=\alpha} \cup V_{\alpha}^{>\beta}$,

- the boundary points of RBox$^+(\alpha, \beta)$ in $V_R(Q)$ are $V_{\alpha^+}^{>\beta} \cup H_{\gamma^+}^{=\alpha^+} \cup H_{\gamma^+}^{>\alpha} \cup H_{\gamma^+}^{=\alpha} \cup V_{\alpha}^{>\beta}$,

- the boundary points of LBox$^-(\alpha, \beta)$ in $V_R(Q)$ are $V_{\alpha^-}^{<\beta} \cup H_{\gamma^-}^{=\alpha^-} \cup H_{\gamma^-}^{<\alpha} + H_{\gamma^-}^{=\alpha} \cup V_{\alpha}^{<\beta}$,

- the boundary points of RBox$^-(\alpha, \beta)$ in $V_R(Q)$ are $V_{\alpha^+}^{<\beta} \cup H_{\gamma^+}^{=\alpha^+} \cup H_{\gamma^+}^{>\alpha} \cup H_{\gamma^-}^{=\alpha} \cup V_{\alpha}^{<\beta}$.

**Example 13** In the case of Figure 3, if the signs of the slopes are all positive on the boundary points, the matching process is intuitive and illustrated by Figure 4.
<figure><img src="image_6.png" /><figcaption>Fig. 3: Illustration of the notations</figcaption></figure>

<figure><img src="image_7.png" /><figcaption>Fig. 4: Example of matching</figcaption></figure>
The aim of the next pages is to transform the intuition used in the example
into explicit definitions and an algorithm covering all cases.

**Proposition 22** It holds

a) All the boundary points of LBox<sup>+</sup>(α, β) in V<sub>ℝ</sub>(Q) have the same slope sign.

b) All the boundary points of RBox<sup>+</sup>(α, β) in V<sub>ℝ</sub>(Q) have the same slope sign.

c) All the boundary points of LBox<sup>-</sup>(α, β) in V<sub>ℝ</sub>(Q) have the same slope sign.

d) All the boundary points of RBox<sup>-</sup>(α, β) in V<sub>ℝ</sub>(Q) have the same slope sign.

*Proof.* We prove only a), the proofs for b), c) and d) being similar.

Suppose that $H_{\gamma_+}^{=\alpha^{-}} + H_{\gamma_+}^{<\alpha} + H_{\gamma_+}^{=\alpha}$ has at least two elements, and that $(x_1, \gamma^+)$ and $(x_2, \gamma^+)$ $x_1 < x_2$ are two points of $H_{\gamma_+}^{=\alpha^{-}} + H_{\gamma_+}^{<\alpha} + H_{\gamma_+}^{=\alpha}$ with different slope signs and denote by $C_1$ and $C_2$ the connected components of $V_{\mathbb{R}}(Q)$ inside $[\alpha^{-}, \alpha) \times \mathbb{R}$ such that $(x_1, \gamma^+) \in \bar{C}_1$ and $(x_2, \gamma^+) \in \bar{C}_2$. Since Box$(\alpha, \beta)$ is an adjacency box (cf Definition 11), $C_1$ and $C_2$ are the graphs of two monotonous semi-algebraic continuous functions $\varphi_1$ and $\varphi_2$ defined on $[\alpha^{-}, \alpha)$. At $\alpha$, $\varphi_1$ and $\varphi_2$ have limits of opposite signs, so that the sign of the limit of $\varphi_1 - \varphi_2$ is well defined at $\alpha$. The signs of $\varphi_1(x_1) - \varphi_2(x_1)$ at $x_1$ and the sign of the limit of $\varphi_1 - \varphi_2$ at $x_2$ are opposite, so $\varphi_1(x) = \varphi_2(x)$ for a value $x \in (x_1, \alpha)$, which is impossible because such a point would be a singular point of $V_{\mathbb{R}}(Q)$ inside $[\alpha^{-}, \alpha) \times \mathbb{R}$.

Suppose that $V_{\alpha}^{>\beta}$ (resp. $V_{\alpha^{-}}^{>\beta}$) has at least two elements, and that $(\alpha, y_1)$ and $(\alpha, y_2)$ (resp. $(\alpha^{-}, y_1)$ and $(\alpha^{-}, y_2)$), $y_1 < y_2$, are two points of $V_{\alpha}^{>\beta}$ (resp. $V_{\alpha}^{<\beta}$) with different slope signs and denote by $C'_1$ and $C'_2$ the connected components of $V_{\mathbb{R}}(Q)$ inside $\mathbb{R} \times (\beta, \gamma^+]$ containing them. Since Box$(\alpha, \beta)$ is an adjacency box (cf Definition 11), $C'_1$ and $C'_2$ are the graphs of two monotonous semi-algebraic continuous functions $\psi_1$ and $\psi_2$ defined on $(\beta, \gamma^+]$. The signs of $\psi_1 - \psi_2$ at $y_1$ and $y_2$ are opposite, so $\psi_1(y) = \psi_2(y)$ for a value $y \in (y_1, y_2)$, which is impossible because such a point would be a singular point of $V_{\mathbb{R}}(Q)$ inside $\mathbb{R} \times (\beta, \gamma^+]$.

Suppose that $H_{\gamma_+}^{=\alpha^{-}} + H_{\gamma_+}^{<\alpha} + H_{\gamma_+}^{=\alpha} \neq \emptyset$ and $V_{\alpha}^{>\beta} \neq \emptyset$, and let $(\alpha, y)$ be the element of $\bar{V}_{\alpha}^{>\beta}$ with highest value of $y$.

(i) Suppose that the slope sign of $(\alpha, y)$ is negative and the slope sign of the elements of $H_{\gamma_+}^{=\alpha^{-}} + H_{\gamma_+}^{<\alpha} + H_{\gamma_+}^{=\alpha}$ is positive. Let $(x, \gamma^+)$ be the element of $H_{\gamma_+}^{<\alpha} + H_{\gamma_+}^{=\alpha}$ with highest value of $x$. Denote by $C'_1$ and $C'_2$ the connected components of $V_{\mathbb{R}}(Q)$ inside $\mathbb{R} \times (\beta, \gamma^+]$ such that $(\alpha, y) \in \bar{C}_1$ and $(x, \gamma^+) \in \bar{C}_2$. Since Box$(\alpha, \beta)$ is an adjacency box (cf Definition 11), $C'_1$ (resp. $C'_2$) is the graph of an increasing (resp. decreasing) semi-algebraic continuous functions $\psi_1$ (resp. $\psi_2$) defined on $(\beta, \gamma^+]$. The matching point of $(\alpha, y)$ is not $(x, \gamma^+)$ because these two points have opposite slope signs so that the limit of $\varphi_1$ at $\gamma^+$ is strictly less than $x$. The signs of the limit $\psi_1 - \psi_2$ at $\beta$ (resp. $\gamma^+$) is positive (resp. negative) and at $y_2$ is negative (resp. positive), so $\psi_1(y) = \psi_2(y)$ for a value $y \in (\beta, \gamma^+]$, which is impossible because such a point would be a singular point of $V_{\mathbb{R}}(Q)$ inside $\mathbb{R} \times (\beta, \gamma^+)$.
(ii) Suppose now that the slope sign of $(\alpha, y)$ is positive and the slope sign of the elements of $H_{\gamma_+}^{=\alpha^{-}} + H_{\gamma_+}^{<\alpha} + H_{\gamma_+}^{=\alpha}$ is negative.

If $Q(\alpha, \gamma^+) = 0$, this is impossible by (i), using the symmetry with respect to the line $X = \alpha$.

Otherwise there is an element $(x, \gamma^+)$ in $H_{\gamma_+}^{=\alpha^{-}} + H_{\gamma_+}^{<\alpha}$. Denote by $C_1$ (resp. $C_2$) the connected components of $V_{\mathbb{R}}(Q)$ inside $[\alpha^{-}, \alpha) \times \mathbb{R}$ such that $(x, \gamma^+) \in \tilde{C}_1$ (resp. $(\alpha, y) \in \tilde{C}_2$). Since Box$(\alpha, \beta)$ is an adjacency box (cf Definition 11), $C_1$ (resp. $C_2$) is the graph of an increasing (resp. decreasing) semi-algebraic continuous functions $\varphi_1$ (resp. $\varphi_2$) defined on $[\alpha^{-}, \alpha)$. The matching point of $(x, \gamma^+)$ is not $(\alpha, y)$ because these two points have opposite slope signs so that the limit of $\varphi_2$ at $\alpha$ is strictly less than $y$. So the limit of $\varphi_1 - \varphi_2$ at $\alpha^{-}$ (resp. $\alpha$) is negative (resp. positive). It follows that $\varphi_1(x) = \varphi_2(x)$ for a value $x \in (\alpha^{-}, \alpha)$, which is impossible because such a point would be a singular point of $V_{\mathbb{R}}(Q)$ inside $[\alpha^{-}, \alpha) \times \mathbb{R}$.

Suppose finally that $H_{\gamma_+}^{=\alpha^{-}} + H_{\gamma_+}^{<\alpha} + H_{\gamma_+}^{=\alpha} \neq \emptyset$ and $V_{\alpha^{-}}^{>\beta} \neq \emptyset$, and let $(\alpha, y)$ be $V_{\alpha^{-}}^{>\beta} \neq \emptyset$ with highest value of $y$.

(i) Suppose that the slope sign of $(\alpha, y)$ is negative and the slope sign of the elements of $H_{\gamma_+}^{=\alpha^{-}} + H_{\gamma_+}^{<\alpha} + H_{\gamma_+}^{=\alpha}$ is positive. Let $(x, \gamma^+)$ be the element of $H_{\gamma_+}^{<\alpha} + H_{\gamma_+}^{=\alpha}$ with smallest value of $x$. Denote by $C'_1$ and $C'_2$ the connected components of $V_{\mathbb{R}}(Q)$ inside $\mathbb{R} \times (\beta, \gamma^+]$ such that $(\alpha, y) \in \tilde{C}_1$ and $(x, \gamma^+) \in \tilde{C}_2$. Since Box$(\alpha, \beta)$ is an adjacency box (cf Definition 11), $C'_1$ (resp. $C'_2$ is the graph of an increasing (resp. decreasing) semi-algebraic continuous functions $\psi_1$ (resp. $\psi_2$) defined on $(\beta, \gamma^+]$. The matching point of $(\alpha, y)$ is not $(x, \gamma^+)$ because these two points have opposite slope signs so that the limit of $\varphi_1$ at $\gamma^+$ is strictly less than $x$. The signs of the limit $\psi_1 - \psi_2$ at $\beta$ (resp. $\gamma^+$) is positive (resp. negative) and at $y_2$ is negative (resp. positive), so $\psi_1(y) = \psi_2(y)$ for a value $y \in (\beta, \gamma^+)$, which is impossible because such a point would be a singular point of $V_{\mathbb{R}}(Q)$ inside $\mathbb{R} \times (\beta, \gamma^+)$. □

(ii) Suppose now that the slope sign of $(\alpha, y)$ is positive and the slope sign of the elements of $H_{\gamma_+}^{=\alpha^{-}} + H_{\gamma_+}^{<\alpha} + H_{\gamma_+}^{=\alpha}$ is negative.

If $Q(\alpha^{-}, \gamma^+) = 0$, this is impossible by (i), using the symmetry with respect to the line $X = \alpha$.

Otherwise there is an element $(x, \gamma^+)$ in $H_{\gamma_+}^{=\alpha^{-}} + H_{\gamma_+}^{<\alpha}$. Denote by $C_1$ (resp. $C_2$) the connected components of $V_{\mathbb{R}}(Q)$ inside $[\alpha^{-}, \alpha) \times \mathbb{R}$ such that $(x, \gamma^+) \in \tilde{C}_1$ (resp. $(\alpha, y) \in \tilde{C}_2$). Since Box$(\alpha, \beta)$ is an adjacency box (cf Definition 11), $C_1$ (resp. $C_2$) is the graph of an increasing (resp. decreasing) semi-algebraic continuous functions $\varphi_1$ (resp. $\varphi_2$) defined on $[\alpha^{-}, \alpha)$. The matching point of $(x, \gamma^+)$ is not $(\alpha, y)$ because these two points have opposite slope signs so that the limit of $\varphi_2$ at $\alpha$ is strictly less than $y$. So the limit of $\varphi_1 - \varphi_2$ at $\alpha^{-}$ (resp. $\alpha$) is negative (resp. positive). It follows that $\varphi_1(x) = \varphi_2(x)$ for a value $x \in (\alpha^{-}, \alpha)$, which is impossible because such a point would be a singular point of $V_{\mathbb{R}}(Q)$ inside $[\alpha^{-}, \alpha) \times \mathbb{R}$. □
**Notation 14** We denote by $\sigma^+$ (resp. $\sigma^-$) the slope signs of the boundary points of LBox$^+(\alpha, \beta)$ (resp. LBox$^-(\alpha, \beta)$) in $V_{\mathbb{R}}(Q)$ and by $\tau^+$ (resp. $\tau^-$) of the boundary points of RBox$^+(\alpha, \beta)$ (resp. RBox$^-(\alpha, \beta)$) in $V_{\mathbb{R}}(Q)$

By convention when there are no boundary points of LBox$^+(\alpha, \beta)$ (resp. RBox$^-(\alpha, \beta))$ in $V_{\mathbb{R}}(Q)$ we define $\sigma^+$ (resp. $\tau^-$) to be $> 0$ and when there are no boundary points of LBox$^-(\alpha, \beta)$, (resp. RBox$^+(\alpha, \beta))$ in $V_{\mathbb{R}}(Q)$ we define $\sigma^-$, (resp. $\tau^+$) to be $< 0$.

**Algorithm 1 (Number of curve segments arriving at a singular point)**

1. Number of curve segments arriving to the left

**Input:** $\#V_{\alpha^{-}}$, $\#V_{\alpha^{-}}^{=\beta}$, $\#V_{\alpha^{-}}^{>\beta}$, $\#V_{\alpha^{-}}^{<\beta}$, $\#H_{\gamma^{-}}^{=\alpha^{-}}$, $\#H_{\gamma^{-}}^{<\alpha}$, $\#H_{\gamma^{-}}^{=\alpha}$, $\#H_{\gamma^{-}}^{=\alpha^{-}}$, $\#H_{\gamma^{+}}^{<\alpha}$, $\#H_{\gamma^{+}}^{=\alpha}$, $\#H_{\gamma^{+}}^{=\alpha^{-}}$, $\#H_{\gamma^{+}}^{>\alpha}$, $\#V_{\alpha^{-}}^{>\beta}$, $\#V_{\alpha^{-}}^{<\beta}$, $\sigma^{-}$ and $\sigma^{+}$

**Output:** the number LEFT of the curve segments ending at $(\alpha, \beta)$ to the left of $\alpha$

$$ \text{If } \sigma^{+} > 0 \text{ and } \sigma^{-} < 0, \text{ compute} $$

$$ \text{LEFT} = \#V_{\alpha^{-}}^{=\beta}. \qquad (84) $$

$$ \text{If } \sigma^{+} < 0 \text{ and } \sigma^{-} > 0, \text{ compute} $$

$$ \text{LEFT} = \#V_{\alpha^{-}} + \#H_{\gamma^{+}}^{=\alpha} + \#H_{\gamma^{+}}^{<\alpha} + \#H_{\gamma^{-}}^{=\alpha^{-}} + \#H_{\gamma^{-}}^{<\alpha} - (\#V_{\alpha}^{>\beta} + \#V_{\alpha}^{<\beta}). \qquad (85) $$

$$ \text{If } \sigma^{+} > 0 \text{ and } \sigma^{-} > 0 \text{ and } Q(\alpha^{-}, \beta) = 0, \text{ compute} $$

$$ \text{LEFT} = 1 + \#V_{\alpha^{-}}^{<\beta} - (\#H_{\gamma^{-}}^{<\alpha} + \#H_{\gamma^{-}}^{=\alpha} + \#V_{\alpha}^{<\beta}). \qquad (86) $$

$$ \text{If } \sigma^{+} > 0 \text{ and } \sigma^{-} > 0 \text{ and } Q(\alpha^{-}, \beta) \neq 0, \text{ compute} $$

$$ \text{LEFT} = \#V_{\alpha^{-}} + \#H_{\gamma^{-}}^{=\alpha^{-}} + \#H_{\gamma^{-}}^{<\alpha} - (\#H_{\gamma^{+}}^{<\alpha} + \#H_{\gamma^{+}}^{=\alpha} + \#V_{\alpha}^{>\beta} + \#V_{\alpha}^{<\beta}). \qquad (87) $$

$$ \text{If } \sigma^{+} < 0 \text{ and } \sigma^{-} < 0 \text{ and } Q(\alpha^{-}, \beta) = 0, \text{ compute} $$

$$ \text{LEFT} = 1 + \#V_{\alpha^{-}}^{>\beta} - (\#H_{\gamma^{+}}^{<\alpha} + \#H_{\gamma^{+}}^{=\alpha} + \#V_{\alpha}^{>\beta}). \qquad (88) $$

$$ \text{If } \sigma^{+} < 0 \text{ and } \sigma^{-} < 0 \text{ and } Q(\alpha^{-}, \beta) \neq 0, \text{ compute} $$

$$ \text{LEFT} = \#V_{\alpha^{-}} + \#H_{\gamma^{+}}^{=\alpha^{-}} + \#H_{\gamma^{+}}^{<\alpha} - (\#H_{\gamma^{-}}^{<\alpha} + \#H_{\gamma^{-}}^{=\alpha} + \#V_{\alpha}^{>\beta} + \#V_{\alpha}^{<\beta}). \qquad (89) $$

2. Number of curve segments arriving to the right

**Input:** $\#V_{\alpha^{+}}$, $\#V_{\alpha^{+}}^{=\beta}$, $\#V_{\alpha^{+}}^{>\beta}$, $\#V_{\alpha^{+}}^{<\beta}$, $\#H_{\gamma^{-}}^{=\alpha^{+}}$, $\#H_{\gamma^{-}}^{>\alpha}$, $\#H_{\gamma^{-}}^{=\alpha}$, $\#H_{\gamma^{-}}^{=\alpha^{+}}$, $\#H_{\gamma^{+}}^{>\alpha}$, $\#H_{\gamma^{+}}^{=\alpha}$, $\#H_{\gamma^{+}}^{=\alpha^{-}}$, $\#V_{\alpha^{-}}^{>\beta}$, $\#V_{\alpha^{-}}^{<\beta}$, $\tau^{-}$ and $\tau^{+}$

**Output:** the number RIGHT of the curve segments ending at $(\alpha, \beta)$ to the right of $\alpha$.

$$ \text{If } \tau^{+} < 0 \text{ and } \tau^{-} > 0, \text{ compute} $$

$$ \text{RIGHT} = \#V_{\alpha^{+}}^{=\beta}. \qquad (90) $$
$$ \text{If } \tau^+ > 0 \text{ and } \tau^- < 0, \text{ compute} $$

$$ \text{RIGHT} = \#V_{\alpha^+} + \#H_{\gamma^+}^{=\alpha} + \#H_{\gamma^+}^{>\alpha} + \#H_{\gamma^-}^{=\alpha} + \#H_{\gamma^-}^{>\alpha} - (\#V_{\alpha}^{>\beta} + \#V_{\alpha}^{<\beta}) \quad (91) $$

$$ \text{If } \tau^+ < 0 \text{ and } \tau^- < 0 \text{ and } Q(\alpha^+, \beta) = 0, \text{ compute} $$

$$ \text{RIGHT} = 1 + \#V_{\alpha^+}^{<\beta} - (\#H_{\gamma^-}^{>\alpha} + \#H_{\gamma^-}^{=\alpha} + \#V_{\alpha}^{<\beta}) \quad (92) $$

$$ \text{If } \tau^+ < 0 \text{ and } \tau^- < 0 \text{ and } Q(\alpha^+, \beta) \neq 0, \text{ compute} $$

$$ \text{RIGHT} = \#V_{\alpha^+} + \#H_{\gamma^-}^{=\alpha} + \#H_{\gamma^-}^{>\alpha} - (\#H_{\gamma^+}^{>\alpha} + \#H_{\gamma^+}^{=\alpha} + \#V_{\alpha}^{>\beta} + \#V_{\alpha}^{<\beta}) \quad (93) $$

$$ \text{If } \tau^+ > 0 \text{ and } \tau^- > 0 \text{ and } Q(\alpha^+, \beta) = 0, \text{ compute} $$

$$ \text{RIGHT} = 1 + \#V_{\alpha^+}^{>\beta} - (\#H_{\gamma^+}^{>\alpha} + \#H_{\gamma^+}^{=\alpha} + \#V_{\alpha}^{>\beta}) \quad (94) $$

$$ \text{If } \tau^+ > 0 \text{ and } \tau^- > 0 \text{ and } Q(\alpha^+, \beta) \neq 0, \text{ compute} $$

$$ \text{RIGHT} = \#V_{\alpha^+} + \#H_{\gamma^+}^{=\alpha} + \#H_{\gamma^+}^{>\alpha} - (\#H_{\gamma^-}^{>\alpha} + \#H_{\gamma^-}^{=\alpha} + \#V_{\alpha}^{>\beta} + \#V_{\alpha}^{<\beta}) \quad (95) $$

*Proof of correctness of Algorithm 1.* We denote by $\text{LEFT}^+$ the number of curve segments arriving at $(\alpha, \beta)$ inside $\text{LBox}^+(\alpha, \beta)$.

If $\sigma^+ > 0$ and $(\sigma^- > 0$ or $Q(\alpha^-, \beta) = 0)$, there is no matching point of a boundary point of $\text{LBox}^+(\alpha, \beta)$ contained in $\text{LBox}^-(\alpha, \beta)$ and no curve segment starting from $V_{\alpha^-}^{>\beta}$ is of type 2, so that

$$ \text{LEFT}^+ = 0. $$

This is clear by Remark 4 and by the fact that there are no singular point in $\text{LBox}(\alpha, \beta)$.

If $\sigma^+ < 0$ and $\sigma^- < 0$ and $Q(\alpha^-, \beta) = 0$, there is no matching point of a boundary point of $\text{LBox}^+(\alpha, \beta)$ contained in $\text{LBox}^-(\alpha, \beta)$ and

$$ \text{LEFT}^+ = \#V_{\alpha^-}^{>\beta} - (\#H_{\gamma^+}^{<\alpha} + \#H_{\gamma^+}^{=\alpha} + \#V_{\alpha}^{>\beta}). $$

This is clear by the fact that there are no singular point in $\text{LBox}(\alpha, \beta)$.

If $\sigma^+ < 0$ and $\sigma^- < 0$ with $Q(\alpha^-, \beta) \neq 0$, there maybe matching points of a boundary points of $\text{LBox}^+(\alpha, \beta)$ contained in $\text{LBox}^-(\alpha, \beta)$ and

$$ \text{LEFT} = \#V_{\alpha^-} + \#H_{\gamma^+}^{=\alpha} + \#H_{\gamma^+}^{<\alpha} - (\#H_{\gamma^-}^{<\alpha} + \#H_{\gamma^-}^{=\alpha}) - (\#V_{\alpha}^{>\beta} + \#V_{\alpha}^{<\beta}). $$

This is clear by Remark 4 and by the fact that there are no singular point in $\text{LBox}(\alpha, \beta)$.

It is easy to prove the statement, using symmetries. $\square$
<figure><img src="image_8.png" /><figcaption>Fig. 5: Another example of matching</figcaption></figure>

**Example 15** In the case of Figure 3, for the left side we have $Q(\alpha^{-}, \beta) \neq 0$, $\#V_{\alpha^{-}} = 7$, $\#H_{\gamma^{+}}^{=\alpha^{-}} = 0$, $\#H_{\gamma^{+}}^{<\alpha} = 2$, $\#H_{\gamma^{+}}^{=\alpha} = 0$, $\#H_{\gamma^{-}}^{=\alpha^{-}} = 0$, $\#H_{\gamma^{-}}^{<\alpha} = 1$, $\#H_{\gamma^{-}}^{=\alpha} = 0$, $\#V_{\alpha}^{>\beta} = 2$, $\#V_{\alpha}^{<\beta} = 2$. For the right side we have $Q(\alpha^{+}, \beta) \neq 0$, $\#V_{\alpha^{+}} = 5$, $\#H_{\gamma^{+}}^{=\alpha^{+}} = 0$, $\#H_{\gamma^{+}}^{>\alpha} = 1$, $\#H_{\gamma^{+}}^{=\alpha} = 0$, $\#H_{\gamma^{-}}^{=\alpha^{+}} = 0$, $\#H_{\gamma^{-}}^{>\alpha} = 0$, $\#H_{\gamma^{-}}^{=\alpha} = 0$, $\#V_{\alpha}^{>\beta} = 2$, $\#V_{\alpha}^{<\beta} = 0$.

Hence, if $\sigma^{+} > 0$, $\sigma^{-} > 0$, from formula (87) LEFT = 2. If $\tau^{+} > 0$, $\tau^{-} > 0$. we have from formula (95) RIGHT = 2. This is illustrated by Figure 4.

Always in the case of Figure 3, if we have $\sigma^{+} > 0$, $\sigma^{-} < 0$, $\tau^{+} > 0$, $\tau^{-} < 0$ it follows from formula (84) LEFT = 0 and from formula (91) RIGHT = 2. This is illustrated by Figure 5.

## 4.3 Computing adjacency boxes at singular points

Our aim is now to compute adjacency boxes at singular points.

We need to introduce the following definitions.

In order to distinguish the Y-critical points which belong to a horizontal line contained in the curve and the other Y-critical points, we write

$$Q(X, Y) = c(Y) \cdot \tilde{Q}(X, Y) \qquad (96)$$

with $c(Y) \in \mathbb{Z}[Y]$ and $\tilde{Q}(X, Y) \in \mathbb{Z}[X, Y]$ such that $\tilde{Q}(X, y)$ never identically vanishes for any $y \in \mathbb{C}$. In more geometric terms, we separate the horizontal lines contained in $V_{\mathbb{C}}(Q)$ from the remaining part $V_{\mathbb{C}}(\tilde{Q})$ of the curve, which does not contain any horizontal lines.
This is done as follows. Let $Q(X, Y) := c_{\deg_X(Q)}(Y)X^{\deg_X(Q)} + \dots + c_0(X)$, with $\deg_X(Q) \le d$. Let $c(X)$ the gcd of all the coefficients $c_i(X)$. We compute $c(Y)$ and $\tilde{Q}(X, Y)$ using $\tilde{O}(d^4 + d^3\tau)$ bit operations by Propositions 5 and 6. The polynomials $c(Y)$ and $\tilde{Q}(X, Y)$ have magnitude bounded by $(d, \tau + d + \log(d+1))$.

We introduce the following definitions

$$D_Y(Y) := \mathrm{Disc}_X(Q)(Y), \qquad (97)$$

$$S_X(X) := D_X(X) \cdot \mathrm{Res}_Y(\tilde{Q}, \partial_X \tilde{Q})(X), \qquad (98)$$

$$S_Y(Y) := D_Y(Y) \cdot \mathrm{Res}_X(Q, \partial_Y Q)(Y), \qquad (99)$$

$$T_X(X) := S_X(X) \cdot (S_X^*)'(X), \qquad (100)$$

$$T_Y(Y) := S_Y(Y) \cdot (S_Y^*)'(Y). \qquad (101)$$

where $(S_X^*)'$ and $(S_Y^*)'$ are the derivatives of the square-free parts of $S_X$ and $S_Y$, respectively.

In geometric terms

- the zeroes of $D_Y$ are the projections on the $Y$ axis of the $Y$-critical points or the values $\gamma$ such that $\deg(Q(X, \gamma)) < \deg_X(Q) - 1$,

- the zeroes of $S_X$ are the zeroes of $D_X$ and the projections on the $X$-axis of the $Y$-critical points which do not belong to an horizontal line entirely contained in $V_{\mathbb{R}}(Q)$,

- the zeroes of $S_Y$ are the zeroes of $D_Y$ and the projections on the $Y$-axis of the $X$-critical points,

- the zeroes of $T_X(X)$ are the zeroes of $S_X$ and the zeroes of the derivative of its square-free part,

- the zeroes of $T_Y(Y)$ are the zeroes of $S_Y$ and the zeroes of the derivative of its square-free part.

Note that between $\alpha_i$ and $\alpha_{i+1}$ there is always one root of $(S_X^*)'(X)$ and that between two roots of $D_Y$ there is always one root of $(S_Y^*)'(Y)$.

**Lemma 6** All the polynomials $D_X, D_Y, S_X, S_Y, T_X, T_Y$ are of magnitude bounded by $(O(d^2), O(d\tau + d^2))$ and can be all computed with a bit complexity $\tilde{O}(d^4\tau + d^5)$.

*Proof.* Use Proposition 6 and [6, Prop. 8.46], [25, §11.2] □

<figure><img src="image_9.png" /></figure>

We denote by $\xi_1, \dots, \xi_{N'}$, with

$$\xi_1 < \dots < \xi_{N'}, \qquad (102)$$

the real roots of $(S_X^*)'(X)$, and $\xi_0 = -\mathrm{Cau}(T_X)$, $\xi_{N'+1} = \mathrm{Cau}(T_X)$ using Notation 78, such that $\xi_0$ (resp. $\xi_{N'+1}$) is smaller (resp. bigger) than all real roots of $S_X$ and $(S_X^*)'$. Remark that $\xi_0$ and $\xi_{N'+1}$ are rational numbers of bitsize $\tilde{O}(d\tau + d^2)$.

For every $i = 1, \dots, N$, we denote $\alpha_i^-$ and $\alpha_i^+$ the two successive elements of

$$\{\xi_0, \xi_1, \dots, \xi_{N'}, \xi_{N'+1}\}$$
defined by $\alpha_i \in (\alpha_i^-, \alpha_i^+)$. Note that $\alpha_i$ is the only root of $S_X$ (hence of $D_X$) in $(\alpha_i^-, \alpha_i^+)$.

In the Y-direction, we denote by $\gamma_1, \dots, \gamma_M$, with

$$ \gamma_1 < \dots < \gamma_M, $$

the real roots of $S_Y(Y)$. We also denote by

$$ \eta_1 < \dots < \eta_{M'}, \qquad (103) $$

the real roots of $(S_Y^*)'(Y)$, and $\eta_0 = -\text{Cau}(T_Y)$, $\eta_{M'+1} = \text{Cau}(T_Y)$) using Notation 78, such that $\eta_0$ (resp. $\eta_{M'+1}$) is smaller (resp. bigger) than all real roots of $S_Y$ and $(S_Y^*)'$. Remark that $\eta_0$ and $\eta_{M'+1}$ are rational numbers of bitsize $O(d\tau + d^2)$. For every $k = 1, \dots, M$, we denote by $\gamma_k^-$ and $\gamma_k^+$ the two successive elements of

$$ \{\eta_0, \eta_1, \dots, \eta_{M'}, \eta_{M'+1}\} $$

defined by $\gamma_i \in (\gamma_i^-, \gamma_i^+)$. Note that $\gamma_i$ is the only root of $S_Y$ (hence of $D_Y$) in $(\gamma_i^-, \gamma_i^+)$.

For every singular point $(\alpha_i, \beta_{i,j})$, notice that $\beta_{i,j}$ is a root of $S_Y$. We define $k(i,j)$ as the index such that $\gamma_{k(i,j)} = \beta_{i,j}$.

For each $i = 1, \dots, N$, we denote by

$$ \eta_{i,1}^- < \dots < \eta_{i,m_i^-}^- \quad (\text{resp.} \eta_{i,1}^+ < \dots < \eta_{i,m_i^+}^+) \qquad (104) $$

the real roots of $Q(\alpha_i^-, Y)$ (resp. $Q(\alpha_i^+, Y)$).

For each $k = 1, \dots, M$, we denote by

$$ \xi_{k,1}^- < \dots < \xi_{k,n_k^-}^- \quad (\text{resp.} \xi_{k,1}^+ < \dots < \xi_{k,n_k^+}^+) \qquad (105) $$

the real roots of $Q(X, \gamma_k^-)$ (resp. $Q(X, \gamma_k^+)$).

We suppose the computations of Theorem 3 have already been performed and prove the following result. Its Corollary 3 provides adjacency boxes at critical points.

**Theorem 4** Using $\tilde{O}(d^5\tau + d^6)$ bit operations, we can carry out the following computations:

(a.1) Dyadic intervals $H_i, V_{i,j}$ for $1 \le i \le N, 1 \le j \le m_i$ such that $H_i$ is well-isolating for $\alpha_i$ as a root of $T_X$, and $V_{i,j}$ is well-isolating for $\beta_{i,j}$ as a root of $Q(\alpha_i, Y)$.

(a.2) Dyadic intervals $H_i^-, V_{i,j}^-$, (resp. $H_i^+, V_{i,j}^+$) for $1 \le i \le N, 1 \le j \le m_i^-$ (resp. $j \le m_i^+$) such that $H_i^-$ (resp. $H_i^+$) is well-isolating for $\alpha_i^-$ (resp. $\alpha_i^+$) as a root of $T_X$, and $V_{i,j}^-$ (resp. $V_{i,j}^+$) is well-isolating for $\eta_{i,j}^-$ (resp. $\eta_{i,j}^+$) as a root of $Q(\alpha_i^-, Y)$ (resp. $Q(\alpha_i^+, Y)$). Moreover the signs of $\partial_X Q(\alpha_i^-, \eta_{i,j}^-)$ and $\partial_Y Q(\alpha_i^-, \eta_{i,j}^-)$ (resp. $\partial_X Q(\alpha_i^+, \eta_{i,j}^+)$ and $\partial_Y Q(\alpha_i^+, \eta_{i,j}^+)$ are also part of the output.
(b) Dyadic intervals $V_k^-, H_{k,\ell}^-$ (resp. $V_k^+, H_{k,\ell}^+$) for $1 \le k \le M, 1 \le \ell \le n_k^-$ (resp. $\ell \le n_k^+$) such that $V_k^-$ (resp. $H_k^+$) is well-isolating for $\gamma_k^-$ (resp. $\gamma_k^+$) as a root of $T_Y$ and $H_{k,\ell}^-$ (resp. $H_{k,\ell}^+$) is well-isolating for $\xi_{k,\ell}^-$ (resp. $\xi_{k,\ell}^+$) as a root of $Q(X, \gamma_k^-)$ (resp. $Q(X, \gamma_k^+)$). Moreover the signs of $\partial_X Q(\xi_{k,\ell}^-, \gamma_k^-)$ and $\partial_Y Q(\xi_{k,\ell}^-, \gamma_k^-)$ (resp. $\partial_X Q(\xi_{k,\ell}^+, \gamma_k^+)$ and $\partial_Y Q(\partial_X Q(\xi_{k,\ell}^+, \gamma_k^+))$ are also part of the output.

(c.1) Dyadic intervals $V_k$, for $k = 1, \dots, M$, that are well-isolating for $\gamma_k$ as roots of $T_Y$ and for each $i = 1, \dots, N, j \in \text{SINGIND}_i$, the index $k(i, j)$ such that $\beta_{i,j} = \gamma_{k(i,j)}$

(c.2) For each $i = 1, \dots, N, j \in \text{SINGIND}_i$, the intervals $H_{k(i,j),\ell}^-$ for $\ell = 1, \dots, n_k^-$ (resp. $H_{k(i,j),\ell}^+$ for $\ell = 1, \dots, n_k^+$) contain at most one of the three points $\alpha_i^-, \alpha_i, \alpha_i^+$.

(c.3) For each $i = 1, \dots, N, j \in \text{SINGIND}_i$, the intervals $V_{i,j}^-$ for $j' = 1, \dots, m_i^-$ (resp. $V_{i,j}^+$ for $j' = 1, \dots, m_i^+$) contain at most one of the two points $\gamma_{k(i,j)}^-$ and $\gamma_{k(i,j)}^+$.

Moreover, it holds that

$$ \sum_{i=1}^{N} \lambda(H_i)(\text{resp. } \sum_{i=1}^{N} \lambda(H_i^-), \sum_{i=1}^{N} \lambda(H_i^+)) \in \tilde{O}(d^3\tau + d^4), \quad (106) $$

$$ \sum_{i=1}^{N} \sum_{j=1}^{m_i} \lambda(V_{i,j}) (\text{resp. } \sum_{i=1}^{N} \sum_{j=1}^{m_i^-} \lambda(V_{i,j}^-), \sum_{i=1}^{N} \sum_{j=1}^{m_i^+} \lambda(V_{i,j}^+)) \in \tilde{O}(d^3\tau + d^4). \quad (107) $$

$$ \sum_{k=1}^{M} \lambda(V_k)(\text{resp. } \sum_{k=1}^{M} \lambda(V_k^-), \sum_{k=1}^{M} \lambda(V_k^+)) \in \tilde{O}(d^3\tau + d^4). \quad (108) $$

$$ \sum_{k=1}^{M} \sum_{\ell=1}^{n_k^-} \lambda(H_{k,\ell}^-) (\text{resp. } \sum_{k=1}^{M} \sum_{\ell=1}^{n_k^+} \lambda(H_{k,\ell}^+)) \in \tilde{O}(d^3\tau + d^4). \quad (109) $$

**Remark 5** Note that Theorem 4 (c.2) does not decide whether $\xi_{k(i,j),\ell}^+ < \alpha_i$, $\xi_{k(i,j),\ell}^+ = \alpha_i$ or $\xi_{k(i,j),\ell}^+ > \alpha_i$ in the case where $H_{k(i,j),\ell}^+$ intersects $H_i$. Indeed, we do not compute the sign of $Q(\alpha_i, \gamma_{k(i,j)}^+)$. It would be of course possible to obtain this information using exact computations, but not within the complexity bounds we are aiming for in this paper: to the best of our knowledge, the computation for this decision would exceed $\tilde{O}(d^5\tau + d^6)$ bit operations, because the distance between $\alpha_i$ and $\xi_{k(i,j),\ell}^+$ can be very small and it would be very costly to refine $H_{k(i,j),\ell}^+$ and $H_i$ enough for this decision.

The same remark holds for similar statements covering the other cases considered in (c.2) and (c.3).
Proof. For (a.1) first note, using Lemma 6, that $T_X$ is a polynomial of magnitude bounded by $(N, \Lambda) \in (O(d^2), \tilde{O}(d\tau + d^2))$. Hence, Proposition 11 and Proposition 12, we can compute well-isolating intervals for the real roots of $T_X$ and identify the real roots of $D_X$ in a number of bit operations bounded by $\tilde{O}(d^5\tau + d^6)$. According to Proposition 18 (with $R := D_X$ and $F := Q(X, Y)$), we may further compute $\deg(\gcd(Q(\alpha_i, Y), \partial_Y Q(\alpha_i, Y)))$ for all $i$ from 1 to $N$ using $\tilde{O}(d^5\tau + d^6)$ bit operations. Now, from Proposition 19, we conclude that using also $\tilde{O}(d^5\tau + d^6)$ bit operations we can further compute well-isolating intervals for all real roots of the polynomials $Q(\alpha_i, Y)$.

For (a.2), using Proposition 11 and Proposition 12, we can compute well-isolating intervals for the real roots of $T_X$ and identify the real roots of $(D_X^*)'$ in a number of bit operations bounded by $\tilde{O}(d^5\tau + d^6)$. According to Proposition 18 (with $R := (T_X^*)'$ and $F := Q(X, Y)$), we may further compute $\deg Q(\xi_i, Y)$. Now, from Proposition 19, we conclude that within a number of bit operations bounded by $\tilde{O}(d^5\tau + d^6)$ we can further compute well-isolating intervals for all real roots of the polynomials

$$Q(\xi_i, Y) \cdot \partial_X Q(\xi_i, Y) \cdot \partial_Y Q(\xi_i, Y),$$

and identify the roots of $Q(\xi_i, Y)$ for each $i = 1, \dots, N'$ by Proposition 20. It remains to compute isolating intervals for all the roots of the polynomials

$$Q(\xi_0, Y) \cdot \partial_X Q(\xi_0, Y) \cdot \partial_Y Q(\xi_0, Y),$$

and

$$Q(\xi'_N, Y) \cdot \partial_X Q(\xi'_N, Y) \cdot \partial_Y Q(\xi'_N, Y).$$

It is then easy to identify $\alpha_i^-$ and $\alpha_i^+$ as well as $H_i^-, V_{i,j'}^-, V_i^+, V_{i,j'}^+$ as part of the results of the preceding computations. The bound on the sum of the bitsizes of the intervals $H_i^-, V_{i,j'}^-, H_i^+, V_{i,j'}^+$ follows from Part (a.1) of Proposition 19 and Proposition 20.

Part (b) is entirely similar to Part (a.2), exchanging the role of $X$ and $Y$.

In Part (c.1), the computation of $T_Y$ takes $\tilde{O}(d^4\tau+d^5)$ according to Lemma 6, and the computation of the $V_k$, $k = 1, \dots, M$ uses a number of bit operations bounded by $\tilde{O}(d^5\tau + d^6)$ from Proposition 11 and Proposition 12 since $T_Y$ is of magnitude bounded by $(O(d^2), O(d\tau + d^2))$.

We define $I_i^1 := \text{SINGIND}_i$. In order to compute the numbers $k(i, j)$ for each $\beta_{i,j}, j \in \text{SINGIND}_i$, we proceed in rounds enumerated by $\ell = 1, 2, 3, \dots$. In the $\ell$-th round, we refine the isolating intervals for all $i$ and all roots $\beta_{i,j}$ with $j \in I_i^\ell$ to a size less than $2^{-2\ell}$. If the corresponding isolating interval $V_{i,j}$ intersects with at most one isolating interval $V_k$ for the roots of $T_Y$, we know that $k = k(i, j)$. After having treated all elements in $I_i^\ell$, we set $I_i^{\ell+1}$ to be the set of all critical indices in $I_i^\ell$ for which the isolating interval $V_{i,j}$ for $\beta_{i,j}$ intersects more than one of the intervals $V_k$. That is, $I_i^\ell$ is the set of all critical indices for which $k(i, j)$ is not known after the $\ell$-th round. We then proceed with the $(\ell+1)$-st round. We stop as soon as $I_i^\ell$ becomes empty for every $i = 1, \dots, N$, in which case, $k(i, j)$ is determined for all $X$-critical points.
We use the polynomial $R_Y$ defined in Proposition 17, with $F = Q$, remembering that the roots of $R_Y$ contain the projections of the $Y$-critical points of $Q$. Notice that, for each critical point $(\alpha_i, \beta_{i,j})$, we succeed in round $\ell_{i,j}$, where $2^{\ell_{i,j}}$ is bounded by $O(|\log(\mathrm{Sep}(\beta_{i,j}, T_Y R_Y))|)$. That is, $j \notin I_i^\ell$ for any $\ell > \ell_{i,j}$.

In addition, the cost of the test for checking whether the interval $V_{i,j}$ intersects with exactly one isolating interval $V_k$ is bounded by $\tilde{O}(d^3\tau + d^4)$ bit operations in each round. Indeed, we need to consider only $O(\log(d))$ comparisons between corresponding endpoints of the occurring intervals and each comparison is carried out with a precision bounded by $\tilde{O}(d^3\tau + d^4)$, using that, from the amortized bounds on the separation of the roots (Proposition 4)

$$O(|\log(\mathrm{Sep}(\beta_{i,j}, T_Y R_Y))|) \in O(d^3\tau + d^4).$$

Since there are $O(d^2)$ many critical points, the total cost for the comparisons is thus bounded by $\tilde{O}(d^5\tau + d^6)$.

It remains to estimate the cost for refining the intervals $V_{i,j}$ to a width less than $2^{-2^{\ell_{i,j}}}$ for all $i, j$. Using again $O(|\log(\mathrm{Sep}(\beta_{i,j}, T_Y R_Y))|) \in O(d^3\tau + d^4)$, we are done after $\kappa$ rounds for

$$\kappa = \max_{i,j} \ell_{i,j} + 1 \in O(\log(d^4 + d^3\tau)). \qquad (110)$$

According to Proposition 19, this cost is bounded by

$$\sum_{\ell=1}^{\kappa} \tilde{O}(d^5\tau + d^6 + 2^{\ell}d^2 \cdot \sum_{i=1}^{N} \mu_i^{[\ell]}) \in \tilde{O}(d^5\tau + d^6) + \tilde{O}(d^2 \cdot \sum_{\ell} 2^{\ell} \cdot \sum_{i=1}^{N} \mu_i^{[\ell]}),$$

where, denoting $\mu_{i,j} = \mathrm{mul}(\beta_{i,j}, Q(\alpha_i, Y))$

$$\mu_i^{[\ell]} := \begin{cases} \max_{j \in I_i^\ell} \mu_{i,j} & \text{if } I_x^\ell \neq \emptyset \\ 0 & \text{otherwise.} \end{cases}$$

Hence, it suffices to show that

$$\sum_{\ell=1}^{\kappa} 2^{\ell} \cdot \sum_{i=1}^{N} \mu_i^{[\ell]} \in \tilde{O}(d^3\tau + d^4).$$

If $I_i^\ell \neq \emptyset$, let $j_i^{[\ell]} \in I_i^\ell$ be such that $\mu_{i,j_i^{[\ell]}} = \mu_i^{[\ell]}$. In other words, $j_i^{[\ell]}$ is the critical index $I_i^\ell$ over $\alpha_i$ which maximizes the multiplicity within the fiber. We may thus write

$$\sum_{\ell=1}^{\kappa} 2^{\ell} \cdot \sum_{i=1}^{N} \mu_i^{[\ell]} = \sum_{\ell=1}^{\kappa} 2^{\ell} \sum_{i, I_i^\ell \neq \emptyset} \mu_{i,j_i^{[\ell]}}$$
Obviously, each critical index $(i, j)$ appears in the latter sum a number of times that is bounded by $\kappa \in O(\log(d^3\tau + d^4))$. In addition, since $(\alpha_i, \beta_{i,j}) \notin I_\kappa$ and $2^{\ell_{i,j}} \in O(|\log(\text{Sep}(\beta_{i,j}, T_Y R_Y))|)$, it follows that,

$$ \sum_{\ell=1}^{\kappa} 2^{\ell} \sum_{i=1}^{N} \sum_{j \in I_i^{\ell}} \mu_{i,j} \in \tilde{O}\left(\sum_{i=1}^{N} \sum_{j \in \text{SINGIND}_i} \mu_{i,j} \cdot \left|\log(\text{Sep}(\beta_{i,j}, T_Y R_Y))\right|\right). $$

Since

$$ \sum_{\ell=1}^{\kappa} 2^{\ell} \sum_{i, I_i^{\ell} \neq \emptyset} \mu_i^{[\ell]} \leq \sum_{\ell=1}^{\kappa} 2^{\ell} \sum_{i=1}^{N} \sum_{j \in I_i^{\ell}} \mu_{i,j}, $$

we have

$$ \sum_{\ell=1}^{\kappa} 2^{\ell} \sum_{i, I_i^{\ell} \neq \emptyset} \mu_i^{[\ell]} \in \tilde{O}\left(\sum_{i=1}^{N} \sum_{j \in \text{SINGIND}_i} \mu_{i,j} \cdot \left|\log(\text{Sep}(\beta_{i,j}, T_Y R_Y))\right|\right). $$

According to Proposition 17, it holds that, for any fixed value $\beta_{i,j}$,

$$ \sum_{(\alpha_i, \beta_{i,j}): \beta_{i,j} = \gamma} (\mu_{i,j} - 1) \leq \text{mul}(\gamma, R_Y). $$

Hence, since $\mu_{i,j} \leq 2 \cdot (\mu_{i,j} - 1)$ we conclude that

$$ \sum_{(i,j): \beta_{i,j} = \gamma} \mu_{i,j} \leq 2 \cdot \text{mul}(\gamma, T_Y R_Y). $$

This shows that

$$ \sum_{\ell=1}^{\kappa} 2^{\ell} \sum_{i=1}^{N} \mu_i^{[\ell]} \in \tilde{O}(\text{Sep}(T_Y R_Y)) \in \tilde{O}(d^3\tau + d^4). $$

using Proposition 4.

Part (c.2,c.3) can be proved as follows. We treat in details the case of intervals $V_{i,j}^{-}$ which is the first half of c3).

For each fixed $k$, we define the set of indices of singular places at level $k$ as

$$ \text{SINGPL}_k := \{i \in \{1, \dots, N\} : (\alpha_i, \gamma_k) \in \text{Sing}(V_{\mathbb{R}}(Q))\}. $$

with, as before, with $\text{Sing}(V_{\mathbb{R}}(Q)) := \{(x, y) \in \mathbb{R}^2 | Q(x, y) = \partial_Y Q(x, y) = 0\}$. Let $V_{i,j'}^{-}$ be the intervals as computed according to Part (a.2). In what follows, we restrict to the set $I^1$ of all so-called bad pairs $(i, j')$ of indices such that the interval $V_{i,j'}^{-}$ intersects two intervals $V_{k(i,j)}^{-}$ and $V_{k(i,j)}^{+}$, and define $I_i^1$ as the set of corresponding indices above $i$. We fix a mapping $\phi$ that maps each such bad pair $(i, j')$ to an arbitrary index $k(i, j)$ (there might exist more than one such index) such that $V_{i,j'}^{-}$ intersects the intervals $V_{k(i,j)}^{-}$ and $V_{k(i,j)}^{+}$ and moreover $\gamma_{k(i,j)}^{+} - \gamma_{k(i,j)}^{-}$ is minimal with this property. Then, the size of the preimage of each $k(i, j)$ is upper bounded by $\text{SINGPL}_{k(i,j)}$.
Namely, for a fixed $i$, there can be at most one interval $V_{i,j'}$ intersecting the two intervals $V_{k(i,j)}$ and $V_{k(i,j)}^+$. We thus conclude, using Proposition 17 and its notation, with $F = Q$, that

$$|\Phi^{-1}(k(i, j))| \le \#\mathrm{SINGP}_{k(i,j)} \le \mathrm{mul}(\gamma_{k(i,j)}, R_Y) \le \mathrm{mul}(\gamma_{k(i,j)}, R_Y T_Y),$$

which further implies that $I^1$ contains at most $O(d^2)$ many elements. Further notice that a pair $(i, j)$ cannot be bad if the width of the corresponding interval $V_{i,j'}$ is smaller than $\frac{1}{2} \cdot \mathrm{Sep}(\gamma, T_Y)$ as the distance between the intervals $V_k^-$ and $V_k^+$ is at least $\frac{1}{2} \cdot \mathrm{min}(|\gamma_{k(i,j)}\gamma_{k(i,j)}|) \le \frac{1}{2} \cdot \mathrm{Sep}(\gamma_{k(i,j)}, T_Y)$. Hence, in order to guarantee that the $V_{i,j'}$ does not intersects two intervals $V_{k(i,j)}$ and $V_{k(i,j)}^+$, it is enough to refine the intervals $V_{i,j'}$ with $(i, j') \in I_1$ to a width smaller than $\frac{1}{2} \cdot \mathrm{Sep}(\gamma_{k(i,j)}, T_Y)$.

For this, we proceed in rounds enumerated by $\ell = 1, 2, 3, \dots$, where, in the $\ell$-th round, we refine all intervals $V_{i,j'}$ with $(i, j') \in I_i^\ell$ to a width less than $2^{-2^\ell}$. Then, we remove all pairs $j'$ from $I_i^\ell$ that are not bad anymore to obtain $I_i^{\ell+1}$. In other words, $I_i^{\ell+1}$ is the set of all pairs for which $V_{i,j}$ intersects two intervals $V_{k(i,j)}$ and $V_{k(i,j)}^+$ after the $\ell$-th round. We then proceed with the $(\ell+1)$-st round. We stop as soon as all $I_i^\ell$ becomes empty, in which case, none of the intervals $V_{i,j'}$ violates the condition.

Notice that an interval $V_{i,j'}$ is removed after $\ell_{i,j'}$ rounds, where $2^{\ell_{i,j'}}$ is bounded by $O(|\log(\mathrm{Sep}(\gamma_{\phi((i,j'))}, T_Y))|)$. That is, $j \notin I_i^\ell$ for any $\ell > \ell_{i,j'}$. This further implies that each root contained in $\phi(V_\ell)$ has separation smaller than $2^{1+2^{-\ell}}$. Further notice that, from the amortized bounds on the separation of the roots (Proposition 4)

$$O(|\log(\mathrm{Sep}(\gamma_{\phi((i,j'))}, T_Y))|) \in O(d^3\tau + d^4),$$

so that the test checking whether $j' \in I_i^\ell$ is bounded by $\tilde{O}(d^3\tau + d^4)$ bit operations in each round as we need to consider only $O(\log(d))$ comparisons between corresponding endpoints of the occurring intervals and each comparison is carried out with a precision bounded by $\tilde{O}(d^3\tau + d^4)$. Since there are $O(d^2)$ many element in each $I$, the total cost for the comparisons is thus bounded by $\tilde{O}(d^5\tau + d^6)$.

It remains to estimate the cost for refining the intervals $V_{i,j'}$ to a width less than $2^{-2^{\ell_{i,j'}}}$ for all $(i, j) \in I$. Using again $O(|\log(\mathrm{Sep}(\gamma_{\phi((i,j'))}, T_Y))|) \in O(d^3\tau + d^4)$,

$$\kappa = \max_{i,j'} \ell_{i,j'} + 1 \in O(\log(d^3\tau + d^4)).$$

According to Proposition 19, this cost is bounded by

$$\sum_{\ell=1}^{\kappa} \tilde{O}(d^5\tau + d^6 + 2^\ell d^2 \cdot \lambda_\ell) \in \tilde{O}(d^5\tau + d^6) + \tilde{O}(d^2 \cdot \sum_{\ell} 2^\ell \cdot |\{i \mid I_i^\ell \neq \emptyset\}|),$$
Hence, it suffices to show that

$$ \sum_{\ell=1}^{\kappa} 2^{\ell} \cdot |\{i \mid I_i^{\ell} \neq \emptyset\}| \in \tilde{O}(d^4 + d^3 \tau), $$

or alternatively that

$$ \sum_{\ell=1}^{\kappa} \sum_{k(i,j):\log(\mathrm{Sep}(\gamma_{k(i,j)}, R_Y T_Y))<2^{1-2^\ell}} \mathrm{mul}(\gamma_{k(i,j)}, R_Y T_Y) \cdot |\log(\mathrm{Sep}(\gamma_{k(i,j)}, R_Y T_Y))| \in \tilde{O}(d^3\tau + d^4). \quad (111) $$

as each root $\gamma_{k(i,j)}$ has at most $\mathrm{mul}(\gamma_{k(i,j)}, R_Y T_Y)$ preimages under the mapping $\phi$ and $\phi(I_i^\ell)$ contains only roots $\gamma_{k(i,j)}$ of separation smaller than $2 \cdot 2^{1-2^\ell}$.

Since $\kappa \in O(\log(d^3\tau+d^4))$ and since $\sum_{k=1}^M \mathrm{mul}(\gamma_{k(i,j)}, R_Y T_Y) \cdot |\log(\mathrm{Sep}(\gamma_k, R_Y T_Y))| \in \tilde{O}(d^3\tau + d^4)$, we conclude that the inequality in (111) holds.

The case of intervals $V_{i,j'}^+$ which is the second half of (c.1) is entirely similar. We also omit the proof of (c.2) which is quite similar, exchanging the role of $X$ and $Y$ and treating first the case $\alpha_i^-, \alpha_i$ and second the case $\alpha_i, \alpha_i^+$. $\square$

Using the notation of Theorem 4, we have

**Corollary 3** For every $i$ and $j \in \mathrm{SINGIND}_i$,

$$ \mathrm{Box}(\alpha_i, \beta_{i,j}) = [\alpha_i^-, \alpha_i^+] \times [\gamma_{k(i,j)}^-, \gamma_{k(i,j)}^+] $$

is an adjacency bor for $(\alpha_i, \beta_{i,j})$.

Moreover if

- $H_i^-$ does not intersect any $H_{k(i,j),\ell}^-$ or $V_{k(i,j)}^-$ does not intersect any $V_{i,\ell}^-$

- $H_i$ does not intersect any $H_{k(i,j),\ell}^-$ or $V_{k(i,j)}^-$ does not intersect any $V_{i,\ell}^-$

- $H_i^+$ does not intersect any $H_{k(i,j),\ell}^-$ or $V_{k(i,j)}^+$ does not intersect any $V_{i,\ell}^-$

- $H_i^-$ does not intersect any $H_{k(i,j),\ell}^+$ or $V_{k(i,j)}^+$ does not intersect any $V_{i,\ell}^-$

- $H_i$ does not intersect any $H_{k(i,j),\ell}^+$ or $V_{k(i,j)}^+$ does not intersect any $V_{i,\ell}^-$

- $H_i^+$ does not intersect any $H_{k(i,j),\ell}^+$ or $V_{k(i,j)}^+$ does not intersect any $V_{i,\ell}^+$

the numbers $\mathrm{LEFT}_{i,j}$ and $\mathrm{RIGHT}_{i,j}$ are known.

*Proof.* The fact that $\mathrm{Box}(\alpha_i, \beta_{i,j})$ satisfies the conditions of Definition 11 follows clearly from Theorem 4 (a) and (b) given the definition of $T_X$ and $T_Y$.

It is clear that if $H_i^-$ does not intersect any $H_{k(i,j),\ell}^-$, $H_i^-$ does not intersect any $H_{k(i,j),\ell}$ and $H_i^+$ does not intersect any $H_{k(i,j),\ell}$, then $\#H_{\gamma_{k(i,j)}^-}^{=\alpha_i^-} = \#H_{\gamma_{k(i,j)}^-}^{=\alpha_i^+} = \#H_{\gamma_{k(i,j)}^-}^{<\alpha_i}$ and $\#H_{\gamma_{k(i,j)}^-}^{>\alpha_i}$ are determined from the output of Theorem 4. Moreover even if $V_{k(i,j)}^-$ intersect an interval $V_{i,\ell}^-$ we can compare $\eta_{i,\ell}^-$ and $\gamma_{k(i,h)}^-$, because we know the sign of $Q(\alpha_i^-, \gamma_{k(i,h)}^-)$.
Taking into account all the other items, it is easy to see that there is
enough information to determine from the output of Theorem 4 all the numbers
necessary to compute $LEFT_{i,j}$ and $RIGHT_{i,j}$ according to Algorithm 1. $\square$

4.4 Computing the number of curve segments arriving to the left and to the right of a singular point

Our aim is to compute for all adjacency boxes $\text{Box}(\alpha_i, \beta_{i,j})$ associated to singular points $(\alpha_i, \beta_{i,j})$, the numbers $\text{LEFT}_{i,j}$ and $\text{RIGHT}_{i,j}$ of curve segments arriving at $(\alpha_i, \beta_{i,j})$ to the left and to the right using the formulas in Algorithm 1.

Since we concentrate on a fixed singular point, we can forget about the in-
dices in the subsection; Consider a singular point $(\alpha, \beta) = (\alpha_i, \beta_{i,j})$, and its ad-
jacency box $\text{Box}(\alpha, \beta)$ with $\alpha^- = \alpha_i^-$, $\alpha^+ = \alpha_i^+$ and $\gamma^- = \gamma_{k(i,j)}^-$, $\gamma^+ = \gamma_{k(i,j)}^+$,
where $\alpha^-, \alpha, \alpha^+$ and $\gamma^-, \gamma$ are given by dyadic intervals $(a^-, a'^-)$, $(a, a')$, $(a^+, a'^+)$
and $(c^-, c'^-)$, $(c^+, c'^+)$. Denote $\text{LEFT} = \text{LEFT}_{i,j}$ and $\text{RIGHT} = \text{RIGHT}_{i,j}$.

The information computed in Theorem 4 is not always sufficient to deter-
mine the quantities involved in formulas (84, 85, 86, 87, 88, 89) and (90, 91,
92, 93, 94, 95) of Algorithm 1. For example, if at the corner ($\alpha^-$, $\gamma^+$), the
interval $(x, x')$ isolating a root $\xi$ of $Q(X, \gamma^+)$ contains $\alpha^-$ and the interval
$(y, y')$ isolating a root $\eta$ of $Q(\alpha^-, Y)$ contains $\gamma^+$, we do not know the sign
$Q(\alpha^-, \gamma^+)$ so we do not know whether $\xi < \alpha^-$, $\xi = \alpha^-$ or $\xi > \alpha^-$ (resp.
$\eta < \gamma^+$, $\eta = \gamma^+$ or $\eta > \gamma^+$) (see Remark 5) and we cannot determine $\#V_{\alpha^-}$,
$\#H_{\gamma^+}^{=\alpha^-}$, $\#H_{\gamma^+}^{<\alpha}$.

So we introduce the following definition to deal with such situations.

**Definition 16** The corner $(\alpha^{-}, \gamma^{+})$ is **ambiguous** if there are intervals $(x, x')$ and $(y, y')$ output by Theorem 4 such that $(x, x')$, isolating a root $\xi$ of $Q(X, \gamma^{+})$, intersects $(a^{-}, a'^{-})$ and $(y, y')$, isolating a root $\eta$ of $Q(\alpha^{-}, Y)$, intersects $(c^{+}, c'^{+})$. We omit similar definitions for the three corners $(\alpha^{-}, \gamma^{-})$, $(\alpha^{+}, \gamma^{-})$, $(\alpha^{+}, \gamma^{+})$.

Similarly the midpoint $(\alpha, \gamma^+)$ is **ambiguous** if there are intervals $(x, x')$ and $(y, y')$ output by Theorem 4 such that $(x, x')$, isolating a root $\xi$, of $Q(X, \gamma^+)$ contains $\alpha$ and $(y, y')$, isolating a root $\eta$ of $Q(\alpha, Y)$, contains $\gamma^+$. We omit a similar definition for the other midpoint $(\alpha, \gamma^-)$.

At the ambiguous corner $(\alpha^{-}, \gamma^{+})$, it is not possible to know the cardinals
of $H_{\gamma^{+}}^{<\alpha} \cap [x, x']$, $H_{\gamma^{+}}^{=\alpha} \cap [x, x']$ and $V_{\alpha^{-}} \cap [y, y']$ since we do not know whether
$\xi \in H_{\gamma^{+}}^{<\alpha}$ (resp. $\eta \in V_{\alpha^{-}}$).

However we note that

- If $\sigma^+ > 0$ (with $\partial_X Q(\alpha^-, \gamma^+) > 0$ and $\partial_Y Q(\alpha^-, \gamma^+) < 0$) then $Q(x, \gamma^+) < 0$ and $Q(x', \gamma^+) > 0$ while $Q(\alpha^-, y) > 0$ and $Q(\alpha^-, y') < 0$.

- If $Q(\alpha^{-}, \gamma^{+}) > 0$, then $\xi < \alpha^{-}$ and $\eta > \gamma^{+}$. So that $\#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = \#V_{\alpha^{-}} \cap [y, y'] = 0$

- If $Q(\alpha^{-}, \gamma^{+}) < 0$, then $\xi > \alpha^{-}$ and $\eta < \gamma^{+}$. So that $\#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = \#V_{\alpha^{-}} \cap [y, y'] = 1,$
- If $Q(\alpha^{-}, \gamma^{+}) = 0$, then $\xi = \alpha^{-}$ and $\eta = \gamma^{+}$. So that $\#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = \#V_{\alpha^{-}} \cap [y, y'] = 0$

<figure><img src="image_10.png" /><figcaption>Fig. 6: The three possibilities for an ambiguous corner with $\sigma^{+} > 0$</figcaption></figure>

In all cases, when $\sigma^{+} > 0$ (with $\partial_{X}Q(\alpha^{-}, \gamma^{+}) > 0$ and $\partial_{Y}Q(\alpha^{-}, \gamma^{+}) < 0$)

$$ \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] - \#V_{\alpha^{-}} \cap [y, y'] = 0. $$

- If $\sigma^{+} < 0$ (with $\partial_{X}Q(\alpha^{-}, \gamma^{+}) > 0$ and $\partial_{Y}Q(\alpha^{-}, \gamma^{+}) > 0$), then $Q(x, \gamma^{+}) < 0$ and $Q(x', \gamma^{+}) > 0$ while $Q(\alpha^{-}, y) < 0$ and $Q(\alpha^{-}, y') > 0$.

- If $Q(\alpha^{-}, \gamma^{+}) > 0$, then $\xi < \gamma^{-}$ and $\eta < \alpha^{+}$. So that $\#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = \#H_{\gamma^{+}}^{=\alpha^{-}} \cap [x, x'] = 0, \#V_{\alpha^{-}} \cap [y, y'] = 1$

- If $Q(\alpha^{-}, \gamma^{+}) < 0$, then $\xi > \gamma^{-}$ and $\eta > \alpha^{+}$. So that $\#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = 1, \#V_{\alpha^{-}} \cap [y, y'] = \#H_{\gamma^{+}}^{=\alpha^{-}} \cap [x, x'] = 0$

- If $Q(\alpha^{-}, \gamma^{+}) = 0$ then $\xi = \alpha^{-}$ and $\eta = \gamma^{+}$. So that $\#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = \#V_{\alpha^{-}} \cap [y, y'] = 0, \#H_{\gamma^{+}}^{=\alpha^{-}} \cap [x, x'] = 1$

<figure><img src="image_11.png" /><figcaption>Fig. 7: The three possibilities for an ambiguous corner with $\sigma^{+} < 0$</figcaption></figure>

In all cases, when $\sigma^{+} < 0$ (with $\partial_{X}Q(\alpha^{-}, \gamma^{+}) > 0$ and $\partial_{Y}Q(\alpha^{-}, \gamma^{+}) > 0$)

$$ \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] + \#V_{\alpha^{-}} \cap [y, y'] + \#V_{\alpha^{-}} \cap [y, y'] = 1. $$

- Details for the remaining cases $\sigma^{+} > 0$ with $\partial_{X}Q(\alpha^{-}, \gamma^{+}) < 0$ and $\partial_{Y}Q(\alpha^{-}, \gamma^{+}) > 0$ (resp. $\sigma^{+} < 0$ with $\partial_{X}Q(\alpha^{-}, \gamma^{+}) < 0$ and $\partial_{Y}Q(\alpha^{-}, \gamma^{+}) < 0$) are entirely similar, and omitted.
Summarizing the situation in all the cases, the conclusion is as follows

- If $\sigma^+ > 0$ then

$$ \#V_{\alpha^{-}} \cap [y, y'] - \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = 0 $$

- If $\sigma^+ < 0$ then

$$ \#V_{\alpha^{-}} \cap [y, y'] + \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] + \#H_{\gamma^{+}}^{=\alpha} \cap [x, x'] = 1 $$

so that the sign of $Q(\alpha^{-}, \gamma^{+})$ has no influence on LEFT given the formulas of Algorithm 1.

We now analyze the situation at an ambiguous midpoint $(\alpha, \gamma^{+})$.

- If $\sigma^+ > 0$ with $\partial_X Q(\alpha, \gamma^+) > 0$ and $\partial_Y Q(\alpha, \gamma^+) < 0$, then $Q(x, \gamma^+) < 0$ and $Q(x', \gamma^+) > 0$ while $Q(\alpha, y) > 0$ and $Q(\alpha, y') < 0$.

- If $Q(\alpha, \gamma^+) > 0$, then $\xi < \alpha$ and $\eta > \gamma^+$. So that

$$ \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = 1, \#H_{\gamma^{+}}^{=\alpha} \cap [x, x'] = \#V_{\alpha}^{>\beta} \cap [y, y'] = 0 $$

- If $Q(\alpha, \gamma^+) < 0$, then $\xi > \alpha$ and $\eta < \gamma^+$. So that

$$ \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = \#H_{\gamma^{+}}^{=\alpha} \cap [x, x'] = 0, \#V_{\alpha}^{>\beta} \cap [y, y'] = 1 $$

- If $Q(\alpha, \gamma^+) = 0$, then $\xi = \alpha$ and $\eta = \gamma^+$. So that

$$ \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = 0, \#H_{\gamma^{+}}^{=\alpha} \cap [x, x'] = 1, \#V_{\alpha}^{>\beta} \cap [y, y'] = 0 $$

In all cases, if $\sigma^+ > 0$ (with $\partial_X Q(\alpha^{-}, \gamma^+) > 0$ and $\partial_Y Q(\alpha^{-}, \gamma^+) < 0$) then

$$ -\#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] - \#H_{\gamma^{+}}^{=\alpha} \cap [x, x'] - \#V_{\alpha}^{>\beta} \cap [y, y'] = -1. $$

- If $\sigma^+ < 0$ with $\partial_X Q(\alpha, \gamma^+) > 0$ and $\partial_Y Q(\alpha, \gamma^+) > 0$, then $Q(x, \gamma^+) < 0$ and $Q(x', \gamma^+) > 0$ while $Q(\alpha, y) < 0$ and $Q(\alpha, y') > 0$.

- If $Q(\alpha, \gamma^+) > 0$, then the root $\xi$ is to the left of $\alpha$ and the root $\eta$ is under $\gamma^+$. So that

$$ \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = 1, \#V_{\alpha}^{>\beta} \cap [y, y'] = 1 $$

- If $Q(\alpha, \gamma^+) < 0$, then the root $\xi$ is to the right of $\alpha$ and the root $\eta$ is above $\gamma^+$. So that

$$ \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = 0, \#V_{\alpha}^{>\beta} \cap [y, y'] = 0 $$

- If $Q(\alpha, \gamma^+) = 0$ then $\xi = \alpha$ and $\eta = \gamma^+$. So that

$$ \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] = \#V_{\alpha}^{>\beta} \cap [y, y'] = 0 $$

In all cases, when $\sigma^+ < 0$ (with $\partial_X Q(\alpha^{-}, \gamma^+) > 0$ and $\partial_Y Q(\alpha^{-}, \gamma^+) > 0$),

$$ \#H_{\gamma^{+}}^{<\alpha} \cap [x, x'] - \#V_{\alpha}^{>\beta} \cap [y, y'] = 0. $$
- Details for the remaining cases $\sigma^+ > 0$ with $\partial_X Q(\alpha, \gamma^+) < 0$ and $\partial_Y Q(\alpha, \gamma^+) > 0$ (resp. $\sigma^+ < 0$ with $\partial_X Q(\alpha, \gamma^+) < 0$ and $\partial_Y Q(\alpha, \gamma^+) < 0$) are omitted.

Summarizing the situation in all the cases, the conclusion is as follows

- If $\sigma^+ > 0$ then

$$ -\#H_{\gamma^+}^{<\alpha} \cap [x, x'] - \#H_{\gamma^+}^{=\alpha} \cap [x, x'] - \#V_{\alpha}^{>\beta} \cap [y, y'] = -1 $$

- If $\sigma^+ < 0$ then

$$ \#H_{\gamma^+}^{<\alpha} \cap [x, x'] - \#V_{\alpha}^{>\beta} \cap [y, y'] = 0 $$

so that the sign of $Q(\alpha, \gamma^+)$ has no influence on LEFT given the formulas of Algorithm 1).

The analysis for the other ambiguous corners and midpoints is similar.

So we can conclude

**Proposition 23** *The sign of $Q$ at an ambiguous corner or midpoint has no influence on LEFT and RIGHT.*

So we can decide arbitrarily that $Q$ is zero at all ambiguous corners and midpoints. In order to obtain the quantities

$$ \#V_{\alpha^{-}}, \#H_{\gamma^{-}}^{=\alpha^{-}}, \#H_{\gamma^{-}}^{<\alpha}, \#H_{\gamma^{-}}^{=\alpha}, \#H_{\gamma^{+}}^{=\alpha^{-}}, \#H_{\gamma^{+}}^{<\alpha}, \#H_{\gamma^{+}}^{=\alpha}, \#V_{\alpha}^{>\beta}, \#V_{\alpha}^{<\beta} $$

we now use the output of Theorem 4 and the extra information that $Q$ is zero at all ambiguous corners and midpoints. Finally, we use these quantities to compute correctly LEFT according to the formulas of Algorithm 1. The situation is similar for RIGHT.

All in all, we proved, using Theorem 4 and Corollary 3:

**Proposition 24** *Using $\tilde{O}(d^5\tau + d^6)$ bit-operations, we can compute $\text{LEFT}_{i,j}$ and $\text{RIGHT}_{i,j}$ for every $i, j, i = 1, \dots, N, j \in \text{CRITIND}_i$.*

## 4.5 Vertical asymptotes

We now explain how to deal with the vertical asymptotes.

The vertical asymptotes occur at values of $\alpha_i$ where $q(\alpha_i) = 0$, i.e. $\deg(Q(\alpha_i, Y)) < \deg_Y(Q)$.

Our aim is to compute numbers $\text{LEFT}_{i,0}$ and $\text{RIGHT}_{i,0}$ (resp $\text{LEFT}_{1,m_i+1}$ and $\text{RIGHT}_{1,m_i+1}$) counting the number of asymptotes tending to $-\infty$ just before $\alpha_i$ and just after $\alpha_i$ (resp. tending to $+\infty$ just before $\alpha_i$ and just after $\alpha_i$).

There are two cases to consider.

As we have seen already in Section 4.1, when $\deg(Q(\alpha_i, Y)) = \deg_Y(Q) - 1$,
- if the degree of the coefficient of degree $\deg_Y(Q) - 1$ evaluated at $\alpha_i$ is positive, there is only one asymptote going to $-\infty$ just before $\alpha_i$ and to $+\infty$ just after $\alpha_i$ and we define

$$ \mathrm{LEFT}_{i,0} = 1, \mathrm{RIGHT}_{i,0} = 0, \mathrm{LEFT}_{1,m_i+1} = 0, = \mathrm{RIGHT}_{1,m_i+1} = 1. $$

- if the degree of the coefficient of degree $\deg_Y(Q) - 1$ evaluated at $\alpha_i$ is negative there is only one asymptote going to $+\infty$ before $\alpha_i$ and $-\infty$ after $\alpha_i$ and we define

$$ \mathrm{LEFT}_{i,0} = 0, \mathrm{RIGHT}_{i,0} = 1, \mathrm{LEFT}_{1,m_i+1} = 1, = \mathrm{RIGHT}_{1,m_i+1} = 0. $$

When $\deg(Q(\alpha_i, Y)) < \deg_Y(Q) - 1$, $\alpha_i$ is also a root of $D_X$. The indices $i = 1, \dots, N$ such that $\deg(Q(\alpha_i, Y)) < \deg_Y(Q) - 1$ are part of the output of Theorem 4.

For vertical asymptotes at $-\infty$, we isolate the roots of $Q(X, \gamma_1^-) = 0$ and decide the sign slope at the roots of $Q(X, \gamma_1^-) = 0$. This can be done in $\tilde{O}(d^4\tau + d^5)$ bit-operations since $Q(X, \gamma_1^-)$ is a polynomial of degree at most $d$ and bit size $O(d^2\tau + d^3)$. We also compare the roots of $Q(X, \gamma_1^-)$ with the roots of $D_X$. Note first that $Q(X, \gamma_1^-)$ and $D_X$ have no roots in common. Since the separators of $Q(X, \gamma_1^-)$ and $D_X$ are both bounded by $2^{\tilde{O}(d^3\tau+d^4)}$ this can be done by Proposition 11 with complexity $\tilde{O}(d^5\tau + d^6)$.

On each open interval $(\alpha_i, \alpha_{i+1})$, $i = 1, \dots, N$ delimited by roots of $D_X$, let $\mathrm{RIGHT}_{i,0}$ the number of roots of $Q(X, \gamma_1^-) = 0$ such that the slope sign is $> 0$ and $\mathrm{LEFT}_{i+1,0}$ the number of roots of $\tilde{Q}(X, \gamma_1^-) = 0$ such that the slope sign is $< 0$. We also denote by let $\mathrm{RIGHT}_{N,0}$ the number of roots of $Q(X, \gamma_1^-) = 0$ such that the slope sign is $> 0$ on $(\alpha_N, +\infty)$ and $\mathrm{LEFT}_{1,0}$ the number of roots of $Q(X, \gamma_M^+) = 0$ such that the slope sign is $< 0$ on $(-\infty, \alpha_1)$.

Note that all the roots $Q(X, \gamma_1^-) = 0$ on $(\alpha_i, \alpha_{i+1})$ with positive slope sign are bigger than all the roots $Q(X, \gamma_1^-) = 0$ on $H_i$ with negative slope sign. Note also that if $\alpha_i$ is such that $\deg(Q(\alpha_i, Y)) = \deg_Y(Q)$, $\mathrm{LEFT}_{i,0} = \mathrm{RIGHT}_{i,0} = 0$.

The situation at $+\infty$ is entirely similar and we define $\mathrm{RIGHT}_{i,m_i+1}$ the number of roots of $Q(X, \gamma_M^+) = 0$ on $(\alpha_i, \alpha_{i+1})$ such that the slope sign is $> 0$ and $\mathrm{LEFT}_{i+1,m_i+1}$ the number of roots of $Q(X, \gamma_M^+) = 0$ on $(\alpha_i, \alpha_{i+1})$ such that the slope sign is $< 0$. We also denote by let $\mathrm{RIGHT}_{N,m_N+1}$ the number of roots of $Q(X, \gamma_M^+) = 0$ such that the slope sign is $< 0$ on $(\alpha_N, +\infty)$ and $\mathrm{LEFT}_{1,m_1+1}$ the number of roots of $Q(X, \gamma_M^+) = 0$ such that the slope sign is $> 0$ on $(-\infty, \alpha_1)$.

Finally we have

**Proposition 25** The number of asymptotic branches tending to $-\infty$ (resp $+\infty$) to the left of $\alpha_i$ is $\mathrm{LEFT}_{i,0}$ (resp. $\mathrm{LEFT}_{i,m_i+1}$) and the number of asymptotic branches tending to $-\infty$ (resp $+\infty$) to the right of $\alpha_i$ is $\mathrm{RIGHT}_{i,0}$ (resp. $\mathrm{RIGHT}_{i,m_i+1}$). Moreover the complexity of computing these numbers is $\tilde{O}(d^5\tau + d^6)$.
## 4.6 Final topology

For $(\alpha_i, \beta_{i,j})$ X-critical, i.e. $j \in \text{CRITIND}_i$, we denote as before by $\text{LEFT}_{i,j}$ (resp. $\text{RIGHT}_{i,j}$) the number of curve segments arriving at $(\alpha_i, \beta_{i,j})$ inside Box$(\alpha, \beta)$. Note that this information has been computed in Proposition 24 using $\tilde{O}(d^5\tau + d^6)$ bit operations. For $j \notin \text{CRITIND}_i$, we take $\text{LEFT}_{i,j} = \text{RIGHT}_{i,j} = 1$. If $j \in \text{CRITIND}_i \setminus \text{SINGIND}_i$, denoting by $\mu_{i,j}$ the multiplicity of $\beta_{i,j}$ as a root of $Q(\alpha_i, Y)$

- if $\mu_{i,j}$ is even and $\partial_Y Q^{(\mu_{i,j})}(\alpha_i, \beta_{i,j}) > 0$, $\text{LEFT}_{i,j} = 0$, $\text{RIGHT}_{i,j} = 2$

- if $\mu_{i,j}$ is even and $\partial_Y Q^{(\mu_{i,j})}(\alpha_i, \beta_{i,j}) < 0$, $\text{LEFT}_{i,j} = 2$, $\text{RIGHT}_{i,j} = 0$

- if $\mu_{i,j}$ is odd, $\text{LEFT}_{i,j} = \text{RIGHT}_{i,j} = 1$.

as discussed in Section 4.1.

We denote as before by $\text{LEFT}_{i,0}$ (resp. $\text{RIGHT}_{i,0}$) the number of vertical asymptotes tending to $-\infty$ at the left (resp. the right) of $\alpha_i$ and by $\text{LEFT}_{i,m_i+1}$ (resp. $\text{RIGHT}_{i,m_i+1}$) the number of vertical asymptotes tending to $+\infty$ at the left (resp. the right) of $\alpha_i$. Note that this information has been already determined in Proposition 25.

The topology of $V_{\mathbb{R}}(Q)$ is encoded by the finite list

$$ \tilde{\mathcal{L}}(Q) = [m'_0, L_1, \dots, L_N, m'_N] $$

where

- $L_i = [m_i, [[\text{LEFT}_{i,j}, \text{RIGHT}_{i,j}], 0 \le j \le m_i + 1]]]$ for $i = 1, \dots, N$,

In the special case where $\text{deg}_X(Q(X, Y)) = 0$ and $V_{\mathbb{R}}(Q)$ is a finite number of horizontal lines, we compute the number $m$ of real roots of $Q(X, Y)$ which is a polynomial in $Y$. Similarly in the special case where $D_X(X)$ has no real root, we compute the number $m$ of real roots of $Q(0, Y)$.

In both special cases, the topology of $V_{\mathbb{R}}(Q)$ is encoded by $\tilde{\mathcal{L}}(Q) = [m]$.

**Example 17** Now we illustrate the previous result by taking an example, where

$$ P(X, Y) = (4X + 1)(8X - 1)(16X - 1)(XY - 1)(4Y^2 - 4X - 1)(4Y^2 + 4X - 1), $$

and

$$ Q(X, Y) = (XY - 1)(4Y^2 - 4X - 1)(4Y^2 + 4X - 1). $$

We have

$$ D_X = -2^{28} X^4 (4X - 1)(1 + 4X)(4 - X^2 + 4X^3)^2 (-4 + X^2 + 4X^3)^2. $$

Since $4 - X^2 + 4X^3$ (resp. $-4 + X^2 + 4X^3$) has one real root on $[-1, -1/2]$ (resp. on $[1/2, 1]$), we have $N = 5$. We obtain

$$ \tilde{\mathcal{L}}(Q) = [3, L_1, 3, L_2, 5, L_3, 5, L_4, 3, L_5, 3] $$

where
$$- L_1 = [2, [[0, 0], [2, 2], [1, 1], [0, 0]]]$$

$$- L_2 = [4, [[0, 0], [1, 1], [1, 1], [0, 2], [1, 1], [0, 0]]]$$

$$- L_3 = [2, [[1, 0], [2, 2], [2, 2], [0, 1]]]$$

$$- L_4 = [4, [[0, 0], [1, 1], [2, 0], [1, 1], [1, 1], [0, 0]]]$$

$$- L_5 = [2, [[0, 0], [1, 1], [2, 2], [0, 0]]]$$

For example the list $L_3$ means that above $\alpha_3 = 0$ there is one asymptote going to $-\infty$ at the left of $\alpha_3$, then two singular points with two branches to the left and two branches to the right and one asymptote going to $+\infty$ at the right of $\alpha_3$.

<figure><img src="image_12.png" /><figcaption>Fig. 8: Simple planar graph isotopic to the curve in Example 17 without its vertical lines</figcaption></figure>

A simple planar graph Gr(Q) can be obtained as follows,

- define $d' = \max(\max_{i=0,...,N} m'_i, \max_{i=1,...,N} m_i)$,

- for each $i = 0, ..., N$ include the points

$$I_{i,j} = \left( 2i + 1, \frac{j(d' + 1)}{m'_{i} + 1} \right)$$

for $j$ from 1 to $m'_i$,

- for each $i = 1, ..., N$ include the points

$$P_{i,j} = \left( 2i, \frac{j(d' + 1)}{m_i + 1} \right)$$
for $j$ from 0 to $m_j + 1$,

– include the points

$$P_{-\infty, j} = \left( 0, \frac{j(d' + 1)}{m'_0 + 1} \right)$$

for $j$ from 1 to $m'_0$ as well as the points

$$P_{+\infty, j} = \left( 2(N + 1), \frac{j(d' + 1)}{m'_N + 1} \right)$$

for $j$ from 1 to $m'_N$,

– for $i = 1, \dots, N$, add the segment $I_{i-1, \ell} P_{i,j}$ (resp. $P_{i,j} I_{i,r}$) if

$$\sum_{k=0}^{j-1} \mathrm{LEFT}_{i,k} < \ell \le \sum_{k=0}^{j} \mathrm{LEFT}_{i,k} (\mathrm{resp.} \ \sum_{k=0}^{j-1} \mathrm{RIGHT}_{i,k} < r \le \sum_{k=0}^{j} \mathrm{RIGHT}_{i,k})$$

– add the segments $P_{-\infty,j} I_{0,j}$ for $j = 1, \dots, m'_0$ and the segments $I_{N,j} P_{\infty,j}$ for $j = 1, \dots, m'_N$

It is clear that

**Proposition 26** $\mathrm{Gr}(Q) \subset (0, 2N) \times (0, d' + 1)$ is homomorphic to $V_{\mathbb{R}}(Q) \subset \mathbb{R}^2$.

We finally explain how to add vertical lines back. We remind that $c(X)$ is the gcd of all the coefficients $c_i(X)$ of $P(X, Y)$ written as an element of $\mathbb{Z}[X][Y]$ and we consider the square-free part $c^*(X)$ of $c(X)$. Define:

– $c_1(X) := \mathrm{gcd}(c^*(X), D_X(X))$ and $c_2(X) := \mathrm{quo}(c^*(X), c_1(X))$,

– $\mathcal{V}_1 := \{(x, y) \in \mathbb{R}^2 | c_1(x) = 0\}$ and $\mathcal{V}_2 := \{(x, y) \in \mathbb{R}^2 | c_2(x) = 0\}$.

Hence $\mathcal{V}_1$ is the subset of vertical lines of $V_{\mathbb{R}}(P)$ passing through zeroes of $D_X X$ while $\mathcal{V}_2$ is the subset of those passing between roots of $D_X$. The computation of $c_1(X)$ and $c_2(X)$ has respectively bit complexities of $\tilde{O}(d^4\tau + d^5)$ and $\tilde{O}(d\tau + d^2)$ according to Proposition 6 and Proposition 7. To add back the lines in $\mathcal{V}_1$ to $V_{\mathbb{R}}(Q)$, it suffices to identify the real roots of $c_1(X)$ as roots of $D_X(X)$, i.e. to decide whether the vertical line defined by $X = \alpha_i$ belongs to $V_{\mathbb{R}}(P)$. Such identification has bit complexity $\tilde{O}(d^5\tau + d^6)$ according to Proposition 12. To add back the lines in $\mathcal{V}_2$ to $V_{\mathbb{R}}(Q)$, it suffices to order the roots of $c_2$ and the roots of $D_X$. This has bit complexity $\tilde{O}(d^5\tau + d^6)$ according to Proposition 12.

**Proposition 27** Let $P \in \mathbb{Z}[X, Y]$ a non-zero square-free polynomial of total degree $d$ and integer coefficients of bitsize bounded by $\tau$. Adding back the vertical lines of $V_{\mathbb{R}}(P)$ to $V_{\mathbb{R}}(Q)$ has bit complexity $\tilde{O}(d^5\tau + d^6)$.

For a complete combinatorial description of the topology of $V_{\mathbb{R}}(P)$ we define the finite list

$$\mathcal{L}(P) = [N'_0, L'_1, \dots, L'_\delta, N'_\delta]$$

where

$$- L'_i = [[m_i, w_i], [[\ell_{i,j}, r_{i,j}], 0 \le j \le m_i + 1]] \text{ for } i = 1, \dots, \delta,$$
$$- N'_{i} = [m'_{i}, v_{i}] \text{ for } i = 0, \dots, \delta,$$

where $w_i = 1$ if the line $X = \alpha_i$ belongs to $V_{\mathbb{R}}(P)$ for $i = 1, \dots, \delta$ and $w_i = 0$ otherwise and $v_i$ is the number of distinct vertical lines $X = x$ with $\alpha_i < x < \alpha_{i+1}$ for $i = 1, \dots, \delta - 1$ and $v_0$ (resp. $v_\delta$) is the number of distinct vertical lines $X = x$ with $x < \alpha_1$ (resp. $x > \alpha_\delta$). Finally the simple planar graph $\text{Gr}(P)$ is defined as

$$\text{Gr}(Q) \cup \bigcup_{\substack{i=1,\dots,\delta \\ w_i=1}} V_i \cup \bigcup_{\substack{i=0,\dots,\delta \\ \ell=1,\dots,v_i}} V_{i,\ell}$$

with $V_i$ the vertical segment defined by $X = 2i, 0 < Y < d' + 1$ and $V_{i,\ell}$ for $i = 0, \dots, \delta, \ell = 1, \dots, v_i$ is the vertical segment defined by the equation

$$X = 2i + \frac{2\ell}{v_i + 1}, 0 < Y < d' + 1.$$

It is clear that

**Proposition 28** $\text{Gr}(P) \subset (0, 2\delta) \times (0, d' + 1)$ is homomorphic to $V_{\mathbb{R}}(P) \subset \mathbb{R}^2$.

**Example 18** Continuing Example 17, we have three vertical lines of equation

$$X = \frac{-1}{4}, X = \frac{1}{8}, X = \frac{1}{16}$$

We obtain

$$\mathcal{L}(P) = [N'_{0}, L'_{1}, N'_{1}, L'_{2}, N'_{2}, L'_{3}, N'_{3}, L'_{4}, N'_{4}, L'_{5}, N'_{5}]$$

where

$$- N'_{0} = [3, 0]$$

$$- L_{1} = [[2, 0], [[0, 0], [2, 2], [1, 1], [0, 0]]]$$

$$- N_{1} = [3, 0]$$

$$- L_{2} = [[4, 1], [[0, 0], [1, 1], [1, 1], [0, 2], [1, 1], [0, 0]]]$$

$$- N_{2} = [5, 0]$$

$$- L_{3} = [[2, 0], [[1, 0], [2, 2], [2, 2], [0, 1]]]$$

$$- N_{3} = [5, 2]$$

$$- L_{4} = [[4, 0], [[0, 0], [1, 1], [2, 0], [1, 1], [1, 1], [0, 0]]]$$

$$- N_{4} = [3, 0]$$

$$- L_{5} = [[2, 0], [[0, 0], [1, 1], [2, 2], [0, 0]]]$$

$$- N_{5} = [3, 0]$$

Finally, summarizing our results, we proved Theorem 1.

Acknowledgements

We are grateful to the anonymous referees for their relevant remarks and suggestions.
<figure><img src="image_13.png" /><figcaption>Fig. 9: Simple planar graph isotopic to the curve in Example 17</figcaption></figure>

## Data sharing

Data sharing not applicable to this article as no datasets were generated or analysed during the current study.
References

1. Elias P. Tsigaridas Adam W. Strzebonski. Univariate real root isolation in an extension field and applications. *Journal of Symbolic Computation*, 2018.

2. Lionel Alberti and Bernard Mourrain. Regularity criteria for the topology of algebraic curves and surfaces. In *IMA Conference on the Mathematics of Surfaces*, pages 1–28, 2007.

3. Lionel Alberti and Bernard Mourrain. Visualisation of implicit algebraic curves. In *Pacific Conference on Computer Graphics and Applications*, pages 303–312, 2007.

4. Lionel Alberti, Bernard Mourrain, and Julien Wintz. Topology and arrangement computation of semi-algebraic planar curves. *Computation Aided Geometric Design*, 25(8):631–651, 2008.

5. M. Badrato and A. Zanoni. long integers and polynomial evaluation with estrin's scheme. *In Proc. SYNACS'11*, pages 39–46, 2011.

6. S. Basu, R. Pollack, and M.-F. Roy. *Algorithms in real algebraic geometry*, volume 10 of *Algorithms and Computation in Mathematics*. Springer-Verlag, Berlin, 2006 (second edition). Revised version of the second edition online at http://perso.univ-rennes1.fr/marie-francoise.roy/.

7. R. Becker, M. Sagraloff, V. Sharma, and C. Yap. A Near-Optimal Subdivision Algorithm for Complex Root Isolation based on the Pellet Test and Newton Iteration. *ArXiv e-prints*, September 2015.

8. Eric Berberich, Pavel Emeliyanenko, Alexander Kobel, and Michael Sagraloff. Exact symbolic-numeric computation of planar algebraic curves. *Theoretical Computer Science*, 491:1 – 32, 2013.

9. Yacine Bouzidi, Sylvain Lazard, Guillaume Moroz, Marc Pouget, Fabrice Rouillier, and Michael Sagraloff. Solving bivariate systems using rational univariate representations. *J. Complexity*, 37:34–75, 2016.

10. M. Burr, S.W. Choi, B. Galehouse, and Chee Yap. Complete subdivision algorithms, ii: Isotopic meshing of singular algebraic curves. In *ISSAC*, 2008.

11. J. Cheng, S. Lazard, L. Penaranda, M. Pouget, F. Rouillier, and E. Tsigaridas. On the topology of planar algebraic curves. *Mathematics in Computer Science*, 1(14):113–137, 2011.

12. Daouda Niang Diatta, Bernard Mourrain, and Olivier Ruatta. On the computation of the topology of a non-reduced implicit space curve. In *ISSAC*, 2008.

13. A. Eigenwillig, M. Kerber, and N. Wolpert. Fast and exact geometric analysis of real algebraic plane curves. In *ISSAC*, pages 151–158, 2007.

14. L. Gonzalez-Vega and M. El Kahoui. An improved upper complexity bound for the topology computation of a real algebraic curve. *Journal of Complexity*, 12:527–544, 1996.

15. L. Gonzalez-Vega and I. Necula. Efficient topology determination of implicitly defined algebraic plane curves. *Comput. Aided Geom. Design*, 19(9):719–743, 2004.

16. Michael Kerber. *Geometric algorithms for algebraic curves and surfaces*. PhD thesis, Saarland University, 2009.

17. Michael Kerber and Michael Sagraloff. A worst-case bound for topology computation of algebraic curves. *Journal of Symbolic Computation*, 47(3):239 – 258, 2012.

18. Michael Kerber and Michael Sagraloff. Root refinement for real polynomials using quadratic interval refinement. *Journal of Computational and Applied Mathematics*, 280:377 – 395, 2015.

19. Alexander Kobel and Michael Sagraloff. On the complexity of computing with planar algebraic curves. *Journal of Complexity*, 31(2):206 – 236, 2015.

20. Kurt Mehlhorn, Michael Sagraloff, and Pengming Wang. From approximate factorization to root isolation. In *Proceedings of the 38th International Symposium on Symbolic and Algebraic Computation*, ISSAC '13, pages 283–290, New York, NY, USA, 2013. ACM.

21. Kurt Mehlhorn, Michael Sagraloff, and Pengming Wang. From approximate factorization to root isolation with application to cylindrical algebraic decomposition. *Journal of Symbolic Computation*, 66:34 – 69, 2015.
22. Victor Y. Pan. Univariate polynomials: Nearly optimal algorithms for numerical factorization and root-finding. *J. Symb. Comput.*, 5(33):701-733, 2002.

23. Victor Y. Pan and Elias P. Tsigaridas. On the boolean complexity of real root refinement. In *ISSAC*, pages 299–306, 2013.

24. Michael Sagraloff and Kurt Mehlhorn. Computing real roots of real polynomials. *Journal of Symbolic Computation*, 73:46 – 86, 2016.

25. J. von zur Gathen and J. Gerhard. *Modern computer algebra*. Cambridge University Press, New York, 1999.

26. Julien Wintz and Bernard Mourrain. A subdivision arrangement algorithm for semi-algebraic curves: An overview. In *Pacific Conference on Computer Graphics and Applications*, pages 449–452, 2007.