# Deciding Cuspidality of Manipulators through Computer Algebra and Algorithms in Real Algebraic Geometry

Damien Chablat, Rémi Prébet, Mohab Safey El Din, Durgesh Salunkhe, Philippe Wenger

► To cite this version:

Damien Chablat, Rémi Prébet, Mohab Safey El Din, Durgesh Salunkhe, Philippe Wenger. Deciding Cuspidality of Manipulators through Computer Algebra and Algorithms in Real Algebraic Geometry. ISSAC 2022 - 47th International Symposium on Symbolic and Algebraic Computation, Jul 2022, Lille, France. 10.1145/3476446.3535477. hal-03596704v3

HAL Id: hal-03596704

https://hal.science/hal-03596704v3

Submitted on 25 Jul 2022

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
# Deciding Cuspidality of Manipulators through Computer Algebra and Algorithms in Real Algebraic Geometry

Damien Chablat

LS2N, CNRS

F-44321 Nantes, France

Damien.Chablat@cnrs.fr

Rémi Prébet

Sorbonne Université, CNRS, LIP6

F-75005 Paris, France

remi.prebet@lip6.fr

Mohab Safey El Din

Sorbonne Université, CNRS, LIP6

F-75005 Paris, France

mohab.safey@lip6.fr

Durgesh H. Salunkhe

LS2N, CNRS

F-44321 Nantes, France

durgesh.salunkhe@ls2n.fr

Philippe Wenger

LS2N, CNRS

F-44321 Nantes, France

Philippe.Wenger@ls2n.fr

## ABSTRACT

Cuspidal robots are robots with at least two inverse kinematic solutions that can be connected by a singularity-free path. Deciding the cuspidality of generic 3R robots has been studied in the past, but extending the study to six-degree-of-freedom robots can be a challenging problem. Many robots can be modeled as a polynomial map together with a real algebraic set so that the notion of cuspidality can be extended to these data.

In this paper we design an algorithm that, on input a polynomial map in $n$ indeterminates, and $s$ polynomials in the same indeterminates describing a real algebraic set of dimension $d$, decides the cuspidality of the restriction of the map to the real algebraic set under consideration. Moreover, if $D$ and $\tau$ are, respectively the maximum degree and the bound on the bit size of the coefficients of the input polynomials, this algorithm runs in time log-linear in $\tau$ and polynomial in $((s+d)D)^{O(n^2)}$.

It relies on many high-level algorithms in computer algebra which use advanced methods on real algebraic sets and critical loci of polynomial maps. As far as we know, this is the first algorithm that tackles the cuspidality problem from a general point of view.

## 1 INTRODUCTION

*Problem statement.* Let $f = (f_1, \dots, f_s)$ be a sequence of polynomials in $\mathbb{Q}[x_1, \dots, x_n]$ and $V = V(f) \subset \mathbb{C}^n$ be the algebraic set it defines (i.e. the set of common complex solutions to the $f_i$'s). We denote by $V_{\mathbb{R}} = V \cap \mathbb{R}^n$ the real trace of $V$. Let $\mathcal{R} = (r_1, \dots, r_d)$ be a sequence of polynomials in $\mathbb{Q}[x_1, \dots, x_n]$. By a slight abuse of notation, we still denote by $\mathcal{R}$ the map

$$ \mathcal{R}: \mathbf{y} \in \mathbb{C}^n \mapsto (r_1(\mathbf{y}), \dots, r_d(\mathbf{y})) \in \mathbb{C}^d. $$

In the whole paper, we make the following assumption:

(A) the ideal generated by $f$, which we denote by $\langle f \rangle$, is radical and equidimensional of dimension $d$ and $V_{\mathbb{R}}$ is not contained in the singular set of $V$.

We denote by $\mathrm{crit}(\mathcal{R}, V)$ the union of the set of critical points of the restriction of $\mathcal{R}$ to $V$ and the set of singular points of $V$ (see e.g. [31, Appendix A.2.] for a definition of these objects). Further, we denote by $\mathrm{sval}(\mathcal{R}, V)$ the set of singular values of the restriction of $\mathcal{R}$ to $V$, i.e. the image by $\mathcal{R}$ of the set $\mathrm{crit}(\mathcal{R}, V)$:

$$ \mathrm{sval}(\mathcal{R}, V) = \mathcal{R}(\mathrm{crit}(\mathcal{R}, V)). $$

Under assumption (A), the set $\mathrm{crit}(\mathcal{R}, V)$ is the set of common complex solutions to the polynomials in $f$ and the set of minors of size $n$ of the Jacobian matrix $\mathrm{Jac}[f, \mathcal{R}]$ associated to $f, \mathcal{R}$ (see e.g. [31, Lemma A.2.]).

The restriction of the map $\mathcal{R}$ to $V$ is said to be proper at a point $\mathbf{y} \in \mathbb{C}^d$ if there exists a ball $B \subset \mathbb{C}^d$ containing $\mathbf{y}$ such that $\mathcal{R}^{-1}(B) \cap V$ is closed and bounded. The restriction of $\mathcal{R}$ to $V$ is said to be proper if it is proper at every point of $\mathbb{C}^d$.

We denote by $\mathrm{nprop}(\mathcal{R}, V)$ be the set of points of $\mathbb{C}^d$ at which $\mathcal{R}$ is not proper. According to [22, Theorem 3.8.] it is contained in a proper algebraic set of $\mathbb{C}^d$.

Finally we denote by $\mathrm{atyp}(\mathcal{R}, V)$ the set of atypical values of the restriction of $\mathcal{R}$ to $V$, that is the union $\mathrm{sval}(\mathcal{R}, V) \cup \mathrm{nprop}(\mathcal{R}, V)$, and let

$$ \mathrm{spec}(\mathcal{R}, V) = \mathcal{R}^{-1}(\mathrm{atyp}(\mathcal{R}, V)) \cap V $$

the set of special points of the restriction of $\mathcal{R}$ to $V$ that map to atypical values. We denote by $\overline{\mathrm{atyp}(\mathcal{R}, V)}^z$ the Zariski closure in $\mathbb{C}^d$ of the set of atypical values.

Following the formalism introduced in [35], we say that the restriction of the map $\mathcal{R}$ to $V_{\mathbb{R}}$ is cuspidal if there exist two distinct points $\mathbf{y}$ and $\mathbf{y}'$ in $V_{\mathbb{R}}$ such that the following holds:

(i) $\mathcal{R}(\mathbf{y}) = \mathcal{R}(\mathbf{y}')$;

(ii) there exists a connected component $C$ of $V_{\mathbb{R}} - \mathrm{crit}(\mathcal{R}, V)$ which contains both $\mathbf{y}$ and $\mathbf{y}'$.

If two such points $\mathbf{y}$ and $\mathbf{y}'$ exist, we say that they form a cuspidal couple of the restriction of $\mathcal{R}$ to $V_{\mathbb{R}}$. Note that such a couple is not unique in general.

The above definition goes back to some original works in robotics and mechanism design which we present below. The goal of this paper is to design an algorithm which, given as input $f$ and $\mathcal{R}$ as above, decides whether the restriction of $\mathcal{R}$ to $V_{\mathbb{R}}$ is cuspidal.

*Motivations from robotics.* Cuspidal robots were discovered in the end of the eighties [28]. A cuspidal robot can move from one of its inverse kinematic solutions to another without meeting a singular configuration. A major consequence is that there is no simple way to know in which solution the robot operates during motion planning trajectories for cuspidal robots is more challenging than for their noncuspidal counterparts [37]. Knowing whether a robot under design is cuspidal or not is thus of primary importance.

Most existing industrial robots are known to be noncuspidal because they rely on some specific geometric design rules such
as their last three joint axes intersecting at a common point [36]. Recently, however, new robots have been proposed that do not follow the aforementioned design rule, which, in turn, could make them cuspidal (see for e.g., https://achille0 medium.com/why-has-no-one-heard-of-cuspidal-robots-fa2fa60ffe9b).

Hence, obtaining an algorithm for deciding cuspidality is of first importance in this context of mechanism design.

**Prior works.** Cuspidal robots have been studied mostly for a specific family of robots made with three revolute joints mutually orthogonal [38]. Such robots, were shown to be cuspidal if and only if they have at least one cusp point in their workspace [18, 32]. Accordingly, an algorithm can be written that, starting from the inverse kinematic polynomial associated with the robot at hand, counts the number of triple root of this polynomial. If this number is nonzero, it means that the robot has at least one cusp and it is thus cuspidal [13]. For a general robot, no necessary and sufficient condition is known to decide if this robot is cuspidal or not. Thus, no general algorithm has been devised that can decide if a given arbitrary robot is cuspidal or not.

The algorithm we design in this paper for deciding cuspidality relies on a family of algorithms for solving polynomial systems over the reals with different specifications. Further, we assume that all data $f$ and $\mathcal{R}$ have coefficients in $\mathbb{Q}$ so that bit complexity issues can be covered without any restriction w.r.t. the application context we target.

The first routine we use takes as input a polynomial system of $s$ equations and inequalities in $\mathbb{Q}[x_1, \dots, x_n]$ and returns an encoding of at least one point per connected component of the real solution set to the input system. When the input polynomials have degree at most $D$, this can be done in time singly exponential in $n$ and polynomial in $D$ and $s$ using the critical point method introduced in [20] and developed in [2, 26, 29]. The algorithm in [26] is the one which we will specifically use.

The second routine we rely on still takes as input a polynomial system of equations and inequalities, as well as the encoding of some query points in the solution set $S \subset \mathbb{R}^n$ to the input system. It then computes an encoding for a semi-algebraic curve, called a roadmap, which has a non-empty and connected intersection with all connected components of $S$ and contains all the query points. This is done in time singly exponential in $n$, polynomial in $D$ and $s$ using more advanced critical point methods initiated by Canny in [6-9] and improved later on in [2-4, 30, 31].

**Main results.** In this paper we design an algorithm for deciding the cuspidality on input $f$ and $\mathcal{R}$ under assumption (A). Recall that $V = V(f)$ is the algebraic set defined by $f$ and that $V_{\mathbb{R}} = V \cap \mathbb{R}^n$. When the restriction of the map $\mathcal{R}$ to $V_{\mathbb{R}}$ is cuspidal, the algorithm has the ability to output a witness of cuspidality, i.e. a cuspidal couple and an encoding of a semi-algebraic path which connects them in $V_{\mathbb{R}}$ without meeting crit($\mathcal{R}$, $V$).

Next, we analyze the bit complexity of this algorithm and prove that cuspidality can be decided in time singly exponential in $n$, polynomial in the maximum degree of the input polynomials, the integer $d$ and log-linear in the maximum bit size of the input coefficients. We use the big-O notation in a standard way [12, Section 3.1]. Further, for $\tau \in \mathbb{R}$, $\tau^*$ denotes the class $O(\tau \log(\tau)^a)$ for some constant $a > 0$.

This leads to the following statement.

**THEOREM 1.** Let $f = (f_1, \dots, f_s)$ and $\mathcal{R} = (r_1, \dots, r_d)$ be two sequences of polynomials in $\mathbb{Q}[x_1, \dots, x_n]$, let $V = V(f)$ and $V_{\mathbb{R}} = V \cap \mathbb{R}^n$. Let $D$ be the maximum degree of these polynomials and let $\tau$ be a bound on the bit size of the coefficients of the input polynomials. Then, under assumption (A), one can decide the cuspidality of the restriction of the map $\mathcal{R}$ to $V_{\mathbb{R}}$ using at most

$$ \tau^*((s+d)D)^{O(n^2)} $$

bit operations.

We also illustrate how this algorithm runs on classical examples from robotics.

**Structure of the paper.** Section 2 is devoted to recall preliminaries about the subroutines we use and Thom's isotopy lemma which is a key ingredient to the correctness proof of our algorithm. Section 3 is devoted to the formal description of our algorithm and its proof of correctness. The complexity analysis is completed in Section 4. Finally, Section 5 illustrates how our algorithm runs on a concrete application from robotics.

# 2 AUXILIARY ALGORITHMS AND RESULTS

## 2.1 Sample points algorithms

Recall that a semi-algebraic set has only finitely many connected components [5, Theorem 2.4.4.]. Hence computing at least one point in each of these components constitutes a basic subroutine of many algorithms that handle semi-algebraic sets.

To encode such points, we use so called zero-dimensional parametrizations. A zero-dimensional parametrization $\mathcal{P} = (\Omega, \lambda)$ is a couple as follows:

* $\Omega = (\omega, \rho_1, \dots, \rho_n)$ of polynomials in $\mathbb{R}[u]$ where $u$ is a new variable and $\omega$ is a monic square-free polynomial and $\deg(\rho_i) < \deg(\omega)$;

* $\lambda$ is a linear form $\lambda_1x_1 + \dots + \lambda_nx_n$ in $\mathbb{R}[x_1, \dots, x_n]$

such that

$$ \lambda_1\rho_1 + \dots + \lambda_n\rho_n = u \frac{\partial\omega}{\partial u} \mod \omega. $$

Such a data-structure encodes the finite set of points, denoted by $Z(\mathcal{P})$, defined as follows

$$ Z(\mathcal{P}) = \left\{ \left( \frac{\rho_1(\vartheta)}{\partial\omega/\partial u(\vartheta)}, \dots, \frac{\rho_n(\vartheta)}{\partial\omega/\partial u(\vartheta)} \right) \in \mathbb{C}^n \mid \omega(\vartheta) = 0 \right\}. $$

We define the degree of such a parametrization $\mathcal{P}$ as the degree of the polynomial $\omega$.

We describe a subroutine which takes as input two sequences of polynomials $g = (g_1, \dots, g_s)$ and $h = (h_1, \dots, h_t)$ in $\mathbb{R}[x_1, \dots, x_n]$ and outputs a sequence of zero-dimensional parametrizations

$$ \mathcal{P}_1, \dots, \mathcal{P}_r $$

such that

$$ Z(\mathcal{P}_1) \cup \dots \cup Z(\mathcal{P}_r) $$

has a non-empty intersection with all connected components of the semi-algebraic set of $\mathbb{R}^n$ defined by

$$ g_1 = \dots = g_s = 0, \quad h_1 > 0, \dots, h_t > 0. $$
Further, we denote by $\mathcal{S}(\mathbf{g}, \mathbf{h}) \subset \mathbb{R}^n$ the semi-algebraic set defined by the above systems so that $\mathcal{S}(0, \mathbf{h})$ is the open semi-algebraic set defined by $h_1 > 0, \dots, h_t > 0$.

We assume that $\mathbf{g}$ and $\mathbf{h}$ have coefficients in $\mathbb{Q}$ of maximum bit size $\tau$. In that case, the polynomials in the output zero-dimensional parametrizations also have coefficients in $\mathbb{Q}$. We recall the following result which allows us to control the cost of computing sample points in semi-algebraic sets.

**PROPOSITION 2 ([2, ALGORITHM 12.64]).** There exists an algorithm SAMPLEPOINTS which on input $\mathbf{g}$ and $\mathbf{h}$ as above, with $D$ the maximum degree of the $g_i$'s and the $h_i$'s, computes at least one point per connected components of $\mathcal{S}(\mathbf{g}, \mathbf{h})$ by means of zero-dimensional parametrizations of degree bounded by $D^{O(n)}$ using

$$\tau(tD)^{O(n)}$$

bit operations.

Ideas underlying SAMPLEPOINTS are the following. First, it considers the hypersurface defined by $g = 0$ where $g = g_1^2 + \dots + g_s^2$ to handle a unique equation. Next, it introduces an infinitesimal $\epsilon$ to reduce the original problem to the one of computing sample points in each connected component of the closed semi-algebraic set defined by

$$g = 0, \quad h_1 \ge \epsilon, \dots, h_t \ge \epsilon.$$

The latter is done through [2, Proposition 13.1] which allows one to reduce the original problem to the one of computing sample points in real algebraic sets. The latter is done through the so-called critical point method which consists in computing the critical points of a well-chosen polynomial map reaching its extrema on all connected components of the considered real algebraic set.

Such a solving scheme has been refined and improved in particular cases such as the one considered in [26, Section 3.], where the semi-algebraic set is open and where explicit complexity constants in the big-O exponent are well controlled. The following result is a simplification of the statement in [26, Corollary 3].

**COROLLARY 3 ([26, COROLLARY 3]).** There exists an algorithm SAMPLEPOINTS RATIONAL which on input $\mathbf{h}$ as above, with $D$ the maximum degree of the $h_i$'s, computes a set of points $\mathcal{Q}$ in $\mathbb{Q}^n$ of cardinality at most $D^{O(n)}$ and such that $\mathcal{Q}$ meets every connected components of $\mathbb{R}^n - \mathbf{V}(\mathbf{h})$ using

$$\tau(tD)^{O(n)}$$

bit operations.

## 2.2 Algorithms for connectivity queries

We also use algorithms which answer connectivity queries on semi-algebraic sets. This is done in two steps. First, on input data which encode a semi-algebraic set $S$ under consideration and query points $\mathcal{P}$, one computes a semi-algebraic curve containing $\mathcal{P}$ and whose intersection with all connected components of $S$ is non-empty and connected. Hence, we have reduced the original connectivity queries to connectivity queries on a semi-algebraic curve. To solve the latter, we rely on classical tools of computer algebra such as resultants and real root isolation which are used in algorithms such as the ones in [11, 16, 17, 24, 33] for this purpose.

A few words about the encoding of such semi-algebraic curves are in order. Note that a semi-algebraic curve is the intersection of an algebraic curve with a given semi-algebraic set. Further, as in e.g. [31, Section 1.2.] (see also references therein), we encode an algebraic curve with a one-dimensional rational parametrization $\mathcal{R} = (\Omega, (\lambda, \mu))$ which is a couple as follows:

* $\Omega = (\omega, \rho_1, \dots, \rho_n)$ of polynomials in $\mathbb{R}[u, v]$ where $u$ and $v$ are new variables and $\omega$ is a monic in $u$ and $v$, square-free polynomial and $\deg(\rho_i) < \deg(\omega)$;

* $(\lambda, \mu)$ is a couple of linear forms

$$\lambda_1 x_1 + \dots + \lambda_n x_n \quad \text{and} \quad \mu_1 x_1 + \dots + \mu_n x_n \\ \text{in } \mathbb{R}[x_1, \dots, x_n],$$

such that

$$\lambda_1 \rho_1 + \dots + \lambda_n \rho_n = u \frac{\partial \omega}{\partial u} \mod \omega,$$

and

$$\mu_1 \rho_1 + \dots + \mu_n \rho_n = v \frac{\partial \omega}{\partial u} \mod \omega.$$

Such a data-structure encodes the algebraic curve $Z(\mathcal{R})$, defined as the Zariski closure of the following constructible set of $\mathbb{C}^n$

$$\left\{ \left( \frac{\rho_1(\vartheta, \eta)}{\partial \omega / \partial u(\vartheta, \eta)}, \dots, \frac{\rho_n(\vartheta, \eta)}{\partial \omega / \partial u(\vartheta, \eta)} \right) \middle| \omega(\vartheta, \eta) = 0, \frac{\partial \omega}{\partial u}(\vartheta, \eta) \neq 0 \right\}.$$

We define the degree of such a parametrization $\mathcal{R}$ as the degree of $\omega$ which coincides with the degree of $Z(\mathcal{R})$. Note that such a parametrization $\mathcal{R}$ of degree $\delta$ involves $O(n\delta^2)$ coefficients.

As above, we consider sequences of polynomials $\mathbf{g} = (g_1, \dots, g_s)$ and $\mathbf{h} = (h_1, \dots, h_t)$ in $\mathbb{Q}[x_1, \dots, x_n]$ and we let $\mathcal{S}(\mathbf{g}, \mathbf{h})$ be the semi-algebraic set defined by

$$g_1 = \dots = g_s = 0, \quad h_1 > 0, \dots, h_t > 0.$$

We also let $\mathcal{P}$ be a zero-dimensional parametrization with coefficients in $\mathbb{Q}$.

We consider an algorithm which, on input $\mathbf{g}, \mathbf{h}$ and $\mathcal{P}$ computes a one-dimensional rational parametrization $\mathcal{R}$ with coefficients in $\mathbb{Q}$ such that:

* the finite set of points $Z(\mathcal{P})$ is contained in the algebraic curve $Z(\mathcal{R})$;

* the intersection of the algebraic curve $Z(\mathcal{R})$ with the semi-algebraic set defined by

$$h_1 > 0, \dots, h_t > 0$$

is contained in $\mathcal{S}(\mathbf{g}, \mathbf{h})$ and has a non-empty and connected intersection with all its connected components.

Such an output is called a roadmap for the couple $(\mathcal{S}(\mathbf{g}, \mathbf{h}), Z(\mathcal{P}))$ since it designs a semi-algebraic curve which captures the connectivity of $\mathcal{S}(\mathbf{g}, \mathbf{h})$ as well as the relative position of all the points in $(\mathcal{S}(\mathbf{g}, \mathbf{h}) \cap Z(\mathcal{P}))$. Hence connectivity queries on $\mathcal{S}(\mathbf{g}, \mathbf{h})$ are reduced to connectivity queries on the curve defined by the roadmap.

**PROPOSITION 4 ([1]).** Let $\mathbf{g}, \mathbf{h}$ and $\mathcal{P}$ be respectively two polynomial sequences and a zero-dimensional parametrization as above. Assume the entries of $\mathbf{g}$ and $\mathbf{h}$ have degree bounded by $D$ and let $\delta$ be the degree of $\mathcal{P}$. Let $\tau$ be a bound on the bit size of the input coefficients. There exists an algorithm ROADMAP which computes a one dimensional rational parametrization as above using

$$\tau^{\star} t^{O(n)} \delta^{O(n^2)}$$
bit operations. Besides, the degree of the output rational parametrization is polynomial in $t^{n+1}\delta D^{n^2}$.

On input a description of a semi-algebraic curve as above, answering connectivity queries on this curve can be done in time which is polynomial in the degree of the input algebraic curve. This is done by running algorithms that compute a piecewise linear curve that is semi-algebraically homeomorphic to the curve, and which can be considered as a graph. Then, deciding connectivity queries on this curve is reduced to deciding connectivity queries on a graph, which is a classically solved algorithmic problem (see for e.g. [12, Section 22.2]).

An isotopy of $\mathbb{R}^n$ is an application $\mathcal{H}: \mathbb{R}^n \times [0, 1] \to \mathbb{R}^n$ such that $\mathbf{y} \in \mathbb{R}^n \mapsto \mathcal{H}(\mathbf{y}, 0)$ is the identity map of $\mathbb{R}^n$ and for all $t \in [0, 1]$, the map $\mathbf{y} \in \mathbb{R}^n \mapsto \mathcal{H}(\mathbf{y}, t)$ is a homeomorphism. Then we say that two subsets $Y$ and $Z$ of $\mathbb{R}^n$ are isotopy equivalent if there exists an isotopy $\mathcal{H}$ of $\mathbb{R}^n$ such that $\mathcal{H}(Y, 1) = Z$.

**PROPOSITION 5** ([11, 16, 24]). Let $\mathcal{R}$ be a one-dimensional rational parametrization, $\mathbf{h}$ a finite sequence of polynomials and $\mathcal{P}$ a zero-dimensional parametrization such that $Z(\mathcal{P}) \subset Z(\mathcal{R})$, all of them with coefficients in $\mathbb{Q}$. Let $\delta_{\mathcal{P}}$ and $\delta_{\mathcal{R}}$ be the respective degrees of $\mathcal{P}$ and $\mathcal{R}$ and $D$ be the maximum of $\delta_{\mathcal{P}}$ and the degrees of the polynomials in $\mathbf{h}$. Let $\tau$ be a bound on the bit size of the coefficients on the input polynomials.

There exists an algorithm GRAPHISOTOP which, on input $\mathcal{R}, \mathbf{h}$ and $\mathcal{P}$ computes a graph $\mathcal{G} = (\mathcal{V}, \mathcal{E})$, with $\mathcal{V} \subset \mathbb{R}^n$ such that:

* the piecewise linear curve $\mathcal{C}_{\mathcal{G}}$ associated to $\mathcal{G}$, is isotopy equivalent to $Z(\mathcal{R}) \cap \mathcal{S}(0, \mathbf{h})$;

* the points of $\mathcal{V}$ and $Z(\mathcal{P}) \cap \mathcal{S}(0, \mathbf{h})$ are in one-to-one correspondence through the isotopy.

Moreover the algorithm outputs a procedure $\text{VERT}_{\mathcal{G}}$, that on input a zero-dimensional parametrization $\mathcal{Q}$ such that $Z(\mathcal{Q}) \subset Z(\mathcal{P})$, computes, using a number of bit operations polynomial in $\tau\delta_{\mathcal{P}}$, the subset $\mathcal{V}_{\mathcal{Q}}$ of vertices of $\mathcal{V}$ that are associated to

$$Z(\mathcal{Q}) \cap \mathcal{S}(0, \mathbf{h}).$$

This is done using at most $\tau^*(\delta_{\mathcal{P}}D)^{O(1)}$ bit operations.

Hence, given a graph $\mathcal{G} = (\mathcal{V}, \mathcal{E})$ computed by GRAPHISOTOP the following characterization occurs: two points of $Z(\mathcal{P}) \cap \mathcal{S}(0, \mathbf{h})$ are connected in $Z(\mathcal{R}) \cap \mathcal{S}(0, \mathbf{h})$ if and only if the vertices in $\mathcal{V}$, associated to these points, are connected in $\mathcal{G}$.

## 2.3 On Thom's isotopy lemma

In semi-algebraic geometry, we are interested about describing and classifying the topology of slices of the studied varieties. This is done through homeomorphisms we call trivializations. Let $X, Y$ and $Y'$ be semi-algebraic sets such that $Y' \subset Y$, and let $\varphi: X \to Y$ be a continuous semi-algebraic map. A semi-algebraic trivialization of $\varphi$ over $Y'$ with fiber $F$ is a semi-algebraic homeomorphism $\Psi^{-1}: Y' \times F \to \varphi^{-1}(Y')$ such that the following diagrams commutes

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

where $\pi$ is the projection onto $Y'$. We say that $\Psi^{-1}$ is compatible with $X' \subset X$ if there is $F' \subset F$ such that $\Psi^{-1}(Y' \times F') = X' \cap \varphi^{-1}(Y')$.

Thom's first isotopy lemma is a classical result of differential geometry that allows to construct diffeomorphisms between submanifolds [19]. In the context of real algebraic geometry, given semi-algebraic data, a semi-algebraic version of this theorem has been obtained in [15, Theorem 1]. This is done by replacing integration of some vector fields by trivialization of some proper submersions using a result previously obtained in [14, Theorem 2.4]. We present hereafter a consequence of [15, Theorem 1] in the framework of our study that will be ubiquitous in the correctness proof of our algorithm for deciding cuspidality. The theorem below and some induced properties of the sets in consideration can be related, as done in [27], to the work of [25] on the discriminant varieties, but for a polynomial map instead of projections. We choose here to prove statements adapted to the situation.

**THEOREM 6.** Let $f = (f_1, \dots, f_s)$ be a sequence of polynomials in $\mathbb{R}[x_1, \dots, x_n]$ and $V \subset \mathbb{C}^n$ be the algebraic set it defines. Suppose that $f$ satisfies assumption (A) and let $\mathcal{R} = (r_1, \dots, r_d) \subset \mathbb{R}[x_1, \dots, x_n]$. Then for any connected component $C$ of $\mathbb{R}^d$ – atyp$(\mathcal{R}, V)$ and for any $\mathbf{p} \in C$, there exists a semi-algebraic trivialization of the restriction of $\mathcal{R}$ to $V_{\mathcal{R}}$ over $\mathbb{R}^d$ which is compatible with $C$. In other words, there exists a homeomorphism

$$\Psi = (\mathcal{R}, \Psi_0): \mathbb{R}^{-1}(C) \cap V_{\mathcal{R}} \to C \times (\mathbb{R}^{-1}(\mathbf{p}) \cap V_{\mathcal{R}}),$$

such that for every connected component $H$ of $\mathbb{R}^{-1}(C) \cap V_{\mathcal{R}}$,

$$\Psi_0(H) = \mathbb{R}^{-1}(\mathbf{p}) \cap H,$$

which is a singleton.

**PROOF.** Let $C$ be a connected component of $\mathbb{R}^d$ – atyp$(\mathcal{R}, V)$, it is an open semi-algebraic set, which does not meet $\text{sval}(\mathcal{R}, V)$. Since $C$ does not meet $\text{nprop}(\mathcal{R}, V)$ as well, the restriction $\mathcal{R}: \mathbb{R}^{-1}(C) \cap V_{\mathcal{R}} \to C$ is a surjective proper submersion. Then we apply the semi-algebraic version of Thom's isotopy lemma [15, Theorem 1] as follows. Let $\mathbf{p} \in C$, there exists a semi-algebraic homeomorphism

$$\Psi = (\mathcal{R}, \Psi_0): \mathbb{R}^{-1}(C) \cap V_{\mathcal{R}} \to C \times (\mathbb{R}^{-1}(\mathbf{p}) \cap V_{\mathcal{R}}).$$

such that $\Psi^{-1}$ is a semi-algebraic trivialization of the restriction of $\mathcal{R}$ to $V_{\mathcal{R}}$ over $\mathbb{R}^d$ which is compatible with $C$. Besides, by assumption (A) and [31, Lemma A.2.], for any $\mathbf{p} \in C$ the Jacobian matrix of $(f, \mathcal{R})$ has full rank at all points $\mathbb{R}^{-1}(\mathbf{p}) \cap V$, so that these fibers are finite. Let $H$ be a connected component of $\mathbb{R}^{-1}(C) \cap V_{\mathcal{R}}$, since $\Psi_0$ is continuous, then so is $\Psi_0(H) \subset \mathbb{R}^{-1}(\mathbf{p}) \cap V$, which is then, a singleton. Besides since $\Psi^{-1}$ is a trivialization compatible with $C$, with fiber $\mathbb{R}^{-1}(\mathbf{p}) \cap V$, then for any $\mathbf{y} \in \mathbb{R}^{-1}(\mathbf{p}) \cap H$, $\Psi_0(\mathbf{y}) = \mathbf{y}$. Therefore, since $\mathbb{R}^{-1}(\mathbf{p}) \cap H$ is a singleton and intersects the singleton $\Psi_0(H)$, they are equal. $\square$

# 3 ALGORITHM

## 3.1 Algorithm description

We present hereafter Algorithm 1 which takes as input $f$ and $\mathcal{R}$ as above, satisfying (A) and which decides the cuspidality of the restriction of $\mathcal{R}$ to the real solution set $V_{\mathcal{R}} = V \cap \mathbb{R}^n$ where $V = V(f)$.

It proceeds by computing a zero-dimensional parametrization $\mathcal{P}$ of a set of points that provides cuspidal couples of the restriction
of $\mathcal{R}$ to $V_{\mathcal{R}}$ whenever such a couple exists. In other words, if no cuspidal couple can be found among $Z(\mathcal{P})$, then the restriction of $\mathcal{R}$ to $V_{\mathcal{R}}$ is not cuspidal.

Hence, to solve our cuspidality problem, it suffices to compute a graph which is isotopy equivalent to a roadmap of $V_{\mathcal{R}}$ - crit($\mathcal{R}$, $V$) connecting the points of $Z(\mathcal{P})$ that lie in the same connected component of $V_{\mathcal{R}}$ - crit($\mathcal{R}$, $V$).

In addition to the high-level procedures presented in the previous section, we use here some basic subroutines to manipulate rational parametrizations, polynomials and graphs. In the following, $\mathcal{P}$ will denote a zero-dimensional parametrization of $\mathbb{R}^n$ encoding the empty set, and () will denote the empty sequence. Besides, given a polynomial sequence $h = (h_i)_{1 \le i \le l}$ we will note $\pm h = (\pm h_i)_{1 \le i \le l}$.

The procedure UNION takes as input two zero-dimensional parametrizations $\mathcal{P}$ and $\mathcal{P}'$ of degree $\delta_{\mathcal{P}}$ and $\delta_{\mathcal{P}'}$ and returns a zero-dimensional parametrization of $Z(\mathcal{P}) \cup Z(\mathcal{P}')$ of degree $\delta_{\mathcal{P}} + \delta_{\mathcal{P}}'$. See [31, Lemma J.3.] for a description of this procedure.

The procedures CRIT and ATYPICALVALUES take as input a polynomial map $\mathcal{R}$ and a finite sequence of polynomials $h$. Assuming that $h$ satisfies assumption (A), these two procedures output finite sequences of polynomials whose complex zero-sets are respectively crit($\mathcal{R}$, $V(h)$) and a proper subset of $\mathbb{C}^d$ containing $\overline{\text{atyp}(\mathcal{R}, V(h))}^z$. We refer to [31, Lemma A.2] for a description of CRIT. The latter is obtained using more involved algebraic elimination routine we describe in Section 4.

Let $\mathcal{G} = (\mathcal{V}, \mathcal{E})$ be a graph and let $v, v' \in \mathcal{V}$ be two vertices. We say that $v$ and $v'$ are connected in $\mathcal{G}$ if there exists a sequence $(v_1, \dots, v_m)$ of vertices in $\mathcal{V}$ such that for all $1 \le i < m$,

$$v_1 = v, \quad v_2 = v' \quad \text{and} \quad \{v_i, v_{i+1}\} \in \mathcal{E}.$$

The procedure GRAPHCONNECTED takes as input $\mathcal{G} = (\mathcal{V}, \mathcal{E})$ and $(v, v')$ and outputs True if and only if $v$ and $v'$ are connected in $\mathcal{G}$. Else it outputs False. This subroutine is classic among graph problems, and can be done using well-known algorithms such as the breadth-first search algorithm [12, Section 22.2].

## 3.2 Correctness proof

The correction of Algorithm 1 is stated by the following proposition.

**PROPOSITION 7.** Let $f = (f_1, \dots, f_s)$ and $\mathcal{R} = (r_1, \dots, r_d)$ be two sequences of polynomials in $\mathbb{Q}[x_1, \dots, x_n]$, let $V = V(f)$ and $V_{\mathcal{R}} = V \cap \mathbb{R}^n$. Then, under assumption (A), the restriction of the map $\mathcal{R}$ to $V_{\mathcal{R}}$ is cuspidal if and only if, with inputs $f$ and $\mathcal{R}$, Algorithm 1 outputs True.

The rest of this section is devoted to prove this correctness statement. We assume by now the assumptions of Proposition 7 to hold.

Note that fibers of the restriction of $\mathcal{R}$ to $V$ are generically finite by [34, Theorem 1.25], and in particular by [31, Lemma A.2], for every $\mathbf{p} \in \mathbb{C}^d$ - atyp($\mathcal{R}$, $V$), the fiber $\mathcal{R}^{-1}(\mathbf{p}) \cap V$ is finite.

We start by an elementary lemma establishing that two distinct “regular” points of $\mathcal{R}$ on $V_{\mathcal{R}}$, having the same image through $\mathcal{R}$, must be separated by $\text{spec}(\mathcal{R}, V)$.

**LEMMA 8.** Let $\mathbf{y}$ and $\mathbf{y}'$ be two distinct points of $V_{\mathcal{R}} - \text{spec}(\mathcal{R}, V)$ such that $\mathcal{R}(\mathbf{y}) = \mathcal{R}(\mathbf{y}')$. Then $\mathbf{y}$ and $\mathbf{y}'$ belong to distinct connected components of $V_{\mathcal{R}} - \text{spec}(\mathcal{R}, V)$.

**Algorithm 1 Cuspidality algorithm**

**Input:** Two sequences $f = (f_1, \dots, f_s)$ and $\mathcal{R} = (r_1, \dots, r_d)$ of polynomials in $\mathbb{Q}[x_1, \dots, x_n]$ that satisfy assumption (A).

**Output:** A decision, True or False, on the cuspidality of the restriction of $\mathcal{R}$ to $V_{\mathcal{R}} = V \cap \mathbb{R}^n$ where $V = V(f)$.

1. $\mathbf{g} \leftarrow \text{ATYPICALVALUES}(\mathcal{R}, f)$;

2. $\mathcal{Q} \leftarrow \text{SAMPLEPOINTSRATIONAL}(\mathbf{g})$;

3. $\mathcal{P} \leftarrow \mathcal{P}_{\emptyset}$;

4. **for** $\mathbf{q} = (\mathbf{q}_1, \dots, \mathbf{q}_d) \in \mathcal{Q}$ **do**

5. $\mathcal{R}_{\mathbf{q}} \leftarrow (r_1 - \mathbf{q}_1, \dots, r_d - \mathbf{q}_d)$;

6. $\mathcal{P}_{\mathbf{q}} \leftarrow \text{SAMPLEPOINTS}((f, \mathcal{R}_{\mathbf{q}}), (1))$;

7. $\mathcal{P} \leftarrow \text{UNION}(\mathcal{P}, \mathcal{P}_{\mathbf{q}})$;

8. **end for**

9. $\Delta \leftarrow \text{CRIT}(\mathcal{R}, f)$;

10. $\mathcal{R} \leftarrow \text{ROADMAP}(f, \pm \Delta, \mathcal{P})$;

11. $\mathcal{G} = (\mathcal{V}, \mathcal{E})$, $\text{VERT}_{\mathcal{G}} \leftarrow \text{GRAPHISOTOP}(\mathcal{R}, \pm \Delta, \mathcal{P})$;

12. **for** $\mathbf{q} \in \mathcal{Q}$ **do**

13. $\mathcal{V}_{\mathbf{q}} \leftarrow \text{VERT}_{\mathcal{G}}(\mathcal{P}_{\mathbf{q}})$;

14. **for** $(\mathbf{v}_1, \mathbf{v}_2) \in \mathcal{V}_{\mathbf{q}}^2$ **do**

15. **if** $\text{GRAPHCONNECTED}((\mathbf{v}_1, \mathbf{v}_2), \mathcal{G})$ and $\mathbf{v}_1 \neq \mathbf{v}_2$ **then**

16. **return** True;

17. **end if**

18. **end for**

19. **end for**

20. **return** False.

**PROOF.** Let us proceed by contradiction and suppose there exists a path $\gamma: [0, 1] \to V_{\mathcal{R}} - \text{spec}(\mathcal{R}, V)$ such that $\gamma(0) = \mathbf{y}$ and $\gamma(1) = \mathbf{y}'$. By definition, $\mathcal{R}(\gamma([0, 1])) \subset \mathbb{R}^d - \text{atyp}(\mathcal{R}, V)^z$

Let $C$ be the connected component of $\mathbb{R}^d - \overline{\text{atyp}(\mathcal{R}, V)}^z$ that contains $\mathcal{R}(\gamma([0, 1]))$. According to Theorem 6, there exists a homeomorphism

$$ \Psi: \mathbb{R}^{-1}(C) \cap V_{\mathcal{R}} \to C \times \mathbb{R}^{-1}(\mathcal{R}(\mathbf{y})) \cap V_{\mathcal{R}} \\ \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \Psi_0(z) \quad , $$

such that the image of any connected component of $\mathbb{R}^{-1}(C) \cap V_{\mathcal{R}}$, through $\Psi_0$, is a singleton. Since $\gamma([0, 1])$ is contained in $\mathbb{R}^{-1}(C) \cap V_{\mathcal{R}}$, then $\mathbf{y}$ and $\mathbf{y}'$ belong to the same connected component of $\mathbb{R}^{-1}(C) \cap V_{\mathcal{R}}$, so that $\Psi_0(\mathbf{y}) = \Psi_0(\mathbf{y}')$. Since $\mathcal{R}(\mathbf{y}) = \mathcal{R}(\mathbf{y}')$, then $\mathbf{y} = \mathbf{y}'$ by injectivity of $\Psi$. This contradicts the assumption $\mathbf{y} \neq \mathbf{y}'$ and proves the Lemma. $\square$

In other words, any potential cuspidal couple must contain points from different connected components of the complementary of $\text{spec}(\mathcal{R}, V)$ in $V_{\mathcal{R}}$. This leads naturally to the following construction that we call here a *cuspidality graph*.

**DEFINITION 9.** Let $\mathcal{V} \subset \mathbb{R}^n$ and $\mathcal{G} = (\mathcal{V}, \mathcal{E})$ be a graph. Then we say that $\mathcal{G}$ is a cuspidality graph of the restriction of $\mathcal{R}$ to $V_{\mathcal{R}}$ if the following holds.

(i) The set $\mathcal{V}$ is contained in $V_{\mathcal{R}} - \text{spec}(\mathcal{R}, V)$ and intersects every connected component of $V_{\mathcal{R}} - \text{spec}(\mathcal{R}, V)$.
(ii) Let $\mathbf{v}, \mathbf{v}' \in \mathcal{V}$ be such that $\mathcal{R}(\mathbf{v}) = \mathcal{R}(\mathbf{v}')$. Then $\mathbf{v}$ and $\mathbf{v}'$ are connected in $V_R$ - crit($\mathcal{R}, V$) if and only if they are in $\mathcal{G}$.

(iii) Let $\mathbf{v} \in \mathcal{V}$, then $\mathcal{R}^{-1}(\mathcal{R}(\mathbf{v})) \cap V_R \subset \mathcal{V}$.

Remark that it is straightforward that such a graph exists, and, under assumption (A), it can be supposed to be finite since $V_R$ - spec($\mathcal{R}, V$) has finitely many connected components and $\mathcal{R}$ has finite fibers out of atyp($\mathcal{R}, V$).

Then the following result reduces the problem of deciding the cuspidality of the restriction of $\mathcal{R}$ to $V_R$ to a connectivity problem on a finite graph.

**LEMMA 10.** Let $\mathcal{G} = (\mathcal{V}, \mathcal{E})$ be a cuspidality graph of the restriction of $\mathcal{R}$ to $V_R$. Then the restriction of $\mathcal{R}$ to $V_R$ is cuspidal if and only if there exist two distinct vertices $\mathbf{v}, \mathbf{v}' \in \mathcal{V}$, connected in $\mathcal{G}$, and such that $\mathcal{R}(\mathbf{v}) = \mathcal{R}(\mathbf{v}')$.

**PROOF.** If such points $\mathbf{v}$ and $\mathbf{v}'$ exist, they form a cuspidal couple of the restriction of $\mathcal{R}$ to $V_R$, so that this map is cuspidal.

Conversely, suppose that the restriction of $\mathcal{R}$ to $V_R$ is cuspidal so that there exist two distinct points $\mathbf{y}$ and $\mathbf{y}'$ in $V_R$ - spec($\mathcal{R}, V$) having the same image through $\mathcal{R}$ and that belong to the same connected component $C$ of $V_R$ - crit($\mathcal{R}, V$). Then, by Lemma 8, there exist two distinct connected components $H$ and $H'$ of $V_R$ - spec($\mathcal{R}, V$) such that $\mathbf{y} \in H$ and $\mathbf{y}' \in H'$. Remark that both $H$ and $H'$ are contained in $C$ since $H$ and $H'$ are two connected subsets of $V_R$ - crit($\mathcal{R}, V$) that have a non-empty intersection with $C$.

By the first item of Definition 9, $\mathcal{V} \cap H$ is not empty. Then let $\mathbf{v} \in \mathcal{V} \cap H$, one has $\mathbf{v} \in C$ by the above remark. Hence, by the second item of Definition 9, one only need to prove the existence of $\mathbf{v}' \in \mathcal{V} \cap H'$ such that $\mathcal{R}(\mathbf{v}) = \mathcal{R}(\mathbf{v}')$.

Since $H$ is connected, there exists a path $\gamma: [0, 1] \to H$ such that $\gamma(0) = \mathbf{y}$ and $\gamma(1) = \mathbf{v}$. Recalling that $H \subset V_R$ - spec($\mathcal{R}, V$), then

$$ \mathcal{R}(\gamma([0, 1]) \cap \text{atyp}(\mathcal{R}, V)) = \emptyset. $$

Let $T$ be the connected component of $\mathbb{R}^d - \text{atyp}(\mathcal{R}, V)^2$ that contains $\mathcal{R}(\gamma([0, 1]))$. According to Theorem 6, there exists a homeomorphism

$$ \Psi: \begin{array}{ccc} \mathbb{R}^{-1}(T) \cap V_R & \to & T \times \mathbb{R}^{-1}(\mathcal{R}(\mathbf{y})) \cap V_R \\ \mathbf{z} & \mapsto & (\mathcal{R}(\mathbf{z}), \Psi_0(\mathbf{z})) \end{array}, $$

such that the image of any connected component of $\mathbb{R}^{-1}(T) \cap V_R$, through $\Psi_0$, is a singleton. In particular since $\mathbf{v} \in H$, then $\Psi(\mathbf{v}) = (\mathcal{R}(\mathbf{v}), \Psi_0(\mathbf{y}))$.

Let $\mathbf{v}' = \Psi^{-1}(\mathcal{R}(\mathbf{v}), \Psi_0(\mathbf{y}'))$. By definition, $\mathcal{R}(\mathbf{v}') = \mathcal{R}(\mathbf{v})$, so that by the last item of Definition 9, $\mathbf{v}' \in \mathcal{V}$. Finally, remark that the path

$$ \gamma': \begin{array}{ccc} [0, 1] & \to & \mathbb{R}^{-1}(T) \cap V_R \\ t & \mapsto & \Psi^{-1}(\mathcal{R}(\gamma(t)), \Psi_0(\mathbf{y}')) \end{array}, $$

is defined for all $t \in [0, 1]$ and $\gamma'(0) = \mathbf{y}' \in H'$. Hence $\mathbf{v}' = \gamma'(1) \in H'$ since $H'$ is connected.

In conclusion, there exist $\mathbf{v}$ and $\mathbf{v}'$ in $\mathcal{V}$ having the same image through $\mathcal{R}$, such that $\mathbf{v} \neq \mathbf{v}'$ since $H \cap H' = \emptyset$. Moreover, since $H \cup H' \subset C$, then by the second point of Definition 9, $\mathbf{v}$ and $\mathbf{v}'$ are connected in $\mathcal{G}$. The equivalence is established. $\square$

Finally, we prove that taking the inverse image of a specific sample set of points is enough to satisfy the first item of Definition 9.

<figure><img src="image_3.png" /><figcaption>**Figure 1:** Illustration with $n = 3$ and $d = 2$ of the proof of Lemma 10 where $\mathcal{R}$ is the projection of the surface $V_R \subset \mathbb{R}^n$ drawn above the plane $\mathbb{R}^d$ on the figure. Given a cuspidality graph $\mathcal{G} = (\{\mathbf{v}, \mathbf{v}', \mathbf{v}_1\}, \mathcal{E})$ and a cuspidal couple formed by $\mathbf{y}$ and $\mathbf{y}'$, one finds, using Theorem 6, two vertices $\mathbf{v}$ and $\mathbf{v}'$ that satisfy the statement.</figcaption></figure>

**LEMMA 11.** Let $Q \subset \mathbb{R}^d$ that intersects every connected component of $\mathbb{R}^d - \text{atyp}(\mathcal{R}, V)^2$ and let $\mathcal{P} = V_R \cap \mathbb{R}^{-1}(Q)$. Then $\mathcal{P}$ intersects every connected component of $V_R$ - spec($\mathcal{R}, V$).

**PROOF.** Let $H$ be a connected component of $V_R$ - spec($\mathcal{R}, V$) we need to prove that $H \cap \mathcal{P}$ is not empty. Let $\mathbf{y} \in H$, and let $T$ be the connected component of $\mathbb{R}^d - \text{atyp}(\mathcal{R}, V)^2$ that contains $\mathcal{R}(\mathbf{y})$. By assumption, there exists $\mathbf{p} \in \mathcal{P} \cap T$. Let $\sigma: [0, 1] \to H$ be a path such that $\sigma(0) = \mathcal{R}(\mathbf{y})$ and $\sigma(1) = \mathbf{p}$. Since $\sigma$ lie in $\mathbb{R}^d - \text{atyp}(\mathcal{R}, V)^2$, the path $\sigma([0, 1])$ is still contained in $T$. Then according to Theorem 6, there exists a homeomorphism

$$ \Psi: \begin{array}{ccc} \mathbb{R}^{-1}(T) \cap V_R & \to & T \times \mathbb{R}^{-1}(\mathcal{R}(\mathbf{y})) \cap V_R \\ \mathbf{z} & \mapsto & (\mathcal{R}(\mathbf{z}), \Psi_0(\mathbf{z})) \end{array}, $$

such that the image of any connected component of $\mathbb{R}^{-1}(T) \cap V_R$, through $\Psi_0$, is a singleton.

Let $\gamma: t \in [0, 1] \mapsto \Psi^{-1}(\sigma(t), \Psi_0(\mathbf{y}))$, it satisfies $\gamma(0) = \mathbf{y} \in H$. Since $H$ is connected, then $\mathbf{v} = \gamma(1)$ belongs to $H$. Moreover, since $\sigma(1) = \mathbf{p}$, then by uniqueness $\mathcal{R}(\mathbf{v}) = \mathbf{p}$ so that $\mathbf{v} \in \mathcal{P}$ and $H \cap \mathcal{P}$ is not empty as claimed. $\square$

We can now proceed to prove the correction of Algorithm 1.

**PROOF OF PROPOSITION 7.** Let $g, Q, \mathcal{P}, \Delta, \mathcal{R}$ and $\mathcal{G} = (\mathcal{V}, \mathcal{E})$ be the data obtained in the execution of Algorithm 1. Let us prove that we can derive from $\mathcal{G}$ a graph $\tilde{\mathcal{G}}$ that is a cuspidal graph of the restriction of $\mathcal{R}$ to $V_R$. Then, using this fact and Lemma 10, we prove that the tests on $\mathcal{G}$ that are operated in Algorithm 1, are enough to conclude on the cuspidality of the restriction of $\mathcal{R}$ to
$V_R$. Remark that according to the description of the subroutines ATYPICALVALUES and CRIT, the following holds

$$
\begin{align*}
\overline{\mathrm{atyp}(\mathcal{R}, \bar{V})}^z &= \mathcal{V}(\boldsymbol{g}), \quad \mathcal{V} \cap \mathcal{R}^{-1}(\boldsymbol{Q}) = \bigcup_{\boldsymbol{q} \in \boldsymbol{Q}} \mathcal{V}(\boldsymbol{f}, \mathcal{R} - \boldsymbol{q}) \\
\text{and } \mathrm{crit}(\mathcal{R}, \mathcal{V}) &= \mathcal{V}(\boldsymbol{f}, \Delta).
\end{align*}
$$

Then, according to the first item of Proposition 5 there exists an isotopy $\mathcal{H}$ of $\mathbb{R}^n$ such that $\mathcal{H}(\mathcal{C}_g, 1) = \mathcal{Z}(\mathcal{R}) \cap \mathbb{R}^n - \mathrm{crit}(\mathcal{R}, V)$ where $\mathcal{C}_g$ is the piecewise linear curve of $\mathbb{R}^n$ associated to $\mathcal{G}$. We denote further $\mathbf{y} \mapsto \mathcal{H}(\mathbf{y}, 1)$ by $\mathcal{H}_1$. Let $\tilde{\mathcal{V}} = \mathcal{H}_1(\mathcal{V})$ and

$$
\tilde{\mathcal{E}} = \{ \{\mathcal{H}_1(\boldsymbol{v}), \mathcal{H}_1(\boldsymbol{v}')\} \mid \{\boldsymbol{v}, \boldsymbol{v}'\} \in \mathcal{E} \}.
$$

Let $\tilde{\mathcal{G}} = (\tilde{\mathcal{V}}, \tilde{\mathcal{E}})$ be the graph thus defined. According to the second item of Proposition 5 the equality $\tilde{\mathcal{V}} = \mathcal{Z}(\mathcal{P}) \cap \mathbb{R}^n$ holds since

$$
Z(\mathcal{P}) \subset \mathcal{R}^{-1}(\boldsymbol{Q}) \quad \text{and} \quad \boldsymbol{Q} \cap \overline{\mathrm{atyp}(\mathcal{R}, \bar{V})}^z = \emptyset.
$$

Moreover the following map is a bijection

$$
\mathcal{H}_1 \times \mathcal{H}_1: \quad \begin{array}{rcl} \mathcal{E} & \rightarrow & \tilde{\mathcal{E}} \\ \{\boldsymbol{v}, \boldsymbol{v}'\} & \mapsto & \{\mathcal{H}_1(\boldsymbol{v}), \mathcal{H}_1(\boldsymbol{v}')\} \end{array}
$$

Let us show that $\tilde{\mathcal{G}}$ is a cuspidality graph of the restriction of $\mathcal{R}$ to $V_R$.

By Corollary 3, the finite set $\mathcal{Q} \subset \mathbb{R}^d$ intersects every connected component of $\mathbb{R}^d - \overline{\mathrm{atyp}(\mathcal{R}, \bar{V})}^z$. Then by Lemma 11, every connected component of $V_R - \mathrm{crit}(\mathcal{R}, V)$ has a non-empty intersection with $V_R \cap \mathcal{R}^{-1}(\boldsymbol{Q})$. As $\boldsymbol{Q}$ is finite and does not intersect $\mathrm{sval}(\mathcal{R}, V)$, the set $V_R \cap \mathcal{R}^{-1}(\boldsymbol{Q})$ is a finite union of the sets $V_R \cap \mathcal{R}^{-1}(\boldsymbol{q})$, which are finite by [31, Lemma A.2]. Hence $V_R \cap \mathcal{R}^{-1}(\boldsymbol{Q})$ is finite so that its connected components are reduced to its points. Hence by Proposition 2, $V_R \cap \mathcal{R}^{-1}(\boldsymbol{Q})$ is equal to $Z(\mathcal{P}) \cap \mathbb{R}^n$ which is itself equal to $\tilde{\mathcal{V}}$. Therefore, $\tilde{\mathcal{G}}$ satisfies the first item of Definition 9.

Let $\boldsymbol{v}, \boldsymbol{v}' \in \tilde{\mathcal{V}}$. According to Proposition 4, since $\boldsymbol{v}$ and $\boldsymbol{v}'$ are in $Z(\mathcal{P}) \cap \mathbb{R}^n$, they are connected in $V_R - \mathrm{crit}(\mathcal{R}, V)$ if and only if they are connected in

$$
Z(\mathcal{R}) \cap \mathbb{R}^n - \mathrm{crit}(\mathcal{R}, V).
$$

However by Proposition 5, since $Z(\mathcal{P}) \subset Z(\mathcal{R})$, then $\boldsymbol{v}$ and $\boldsymbol{v}'$
are connected in $Z(\mathcal{R}) \cap \mathbb{R}^n - \mathrm{crit}(\mathcal{R}, V)$ if and only if $\mathcal{H}_1^{-1}(\boldsymbol{v})$
$\mathcal{H}_1^{-1}(\boldsymbol{v}')$ are connected in $\mathcal{G}$. But the latter statement is equivalent
to saying that $\boldsymbol{v}$ and $\boldsymbol{v}'$ are connected in $\tilde{\mathcal{G}}$ since $\mathcal{H}_1 \times \mathcal{H}_1$ is a
bijection. Therefore, $\tilde{\mathcal{G}}$ satisfies the second item of Definition 9.

Finally $\mathcal{G}$ satisfies the last item of Definition 9 since for all $\boldsymbol{v} \in \tilde{\mathcal{V}}$,

$$
V_{\mathbb{R}} \cap \mathcal{R}^{-1}(\mathcal{R}(\boldsymbol{v})) \subset V_{\mathbb{R}} \cap \mathcal{R}^{-1}(\boldsymbol{Q}) = Z(\mathcal{P}) \cap \mathbb{R}^n = \tilde{V}.
$$

In conclusion, $\tilde{\mathcal{G}}$ is a cuspidal graph of the restriction of $\mathcal{R}$ to $V_R$.
Let us prove now that, the restriction of $\mathcal{R}$ to $V_R$ is cuspidal if and
only if, on inputs $f$ and $\mathcal{R}$, Algorithm 1 outputs True.

If Algorithm 1 outputs True, there exists $\boldsymbol{q} \in \boldsymbol{Q}$ and $\boldsymbol{v}_1, \boldsymbol{v}_2 \in \mathcal{V}_{\boldsymbol{q}}$ that are connected in $\mathcal{G}$. Let $\boldsymbol{v} = \mathcal{H}_1(\boldsymbol{v}_1)$ and $\boldsymbol{v}' = \mathcal{H}_1(\boldsymbol{v}_2)$, then by definition of $\tilde{\mathcal{V}}, \boldsymbol{v}$ and $\boldsymbol{v}'$ are in $\tilde{\mathcal{V}}$. According to Proposition 5 and the definition of the procedure $\mathrm{VERT}_{\mathcal{G}}$, since $\boldsymbol{v}_1, \boldsymbol{v}_2 \in \mathcal{V}_{\boldsymbol{q}}$, then $\mathcal{R}(\boldsymbol{v}) = \mathcal{R}(\boldsymbol{v}') = \boldsymbol{q}$. Besides, by definition of $\tilde{\mathcal{E}}, \boldsymbol{v}$ and $\boldsymbol{v}'$ are connected in $\tilde{\mathcal{G}}$ so that by Lemma 10, the restriction of $\mathcal{R}$ to $V_R$ is cuspidal.

Conversely, suppose that the restriction of $\mathcal{R}$ to $V_R$ is cuspidal.
Then by Lemma 10 there exist two distinct points $\boldsymbol{v}, \boldsymbol{v}' \in \tilde{\mathcal{V}}$, con-
nected in $\tilde{\mathcal{G}}$, such that $\mathcal{R}(\boldsymbol{v}) = \mathcal{R}(\boldsymbol{v}')$. Since $\mathcal{R}(\tilde{\mathcal{V}}) \subset \boldsymbol{Q}$, there exists
$\boldsymbol{q} \in \boldsymbol{Q}$ such that $\boldsymbol{q} = \mathcal{R}(\boldsymbol{v}) = \mathcal{R}(\boldsymbol{v}')$. For such a point $\boldsymbol{q}$ let $\mathcal{P}_{\boldsymbol{q}}$ and
$\mathcal{V}_{\boldsymbol{q}}$ computed in Algorithm 1 at respectively step 2 and step 13.
Recall that $\mathcal{P}_{\boldsymbol{q}}$ is the zero-dimensional parametrization encoding
$V_R \cap \mathcal{R}^{-1}(\boldsymbol{q})$ and $\mathcal{V}_{\boldsymbol{q}}$ the subset of vertices of $\mathcal{V}$, that are associ-
ated to the points of $V_R \cap \mathcal{R}^{-1}(\boldsymbol{q})$ through $\mathcal{H}_1$. Hence according to
Proposition 5 and the description of $\mathrm{VERT}_{\mathcal{G}}$, $\mathcal{H}_1^{-1}(\boldsymbol{v})$ and $\mathcal{H}_1^{-1}(\boldsymbol{v}')$
are distinct and belong to $\mathcal{V}_{\boldsymbol{q}}$. Since $\boldsymbol{v}$ and $\boldsymbol{v}'$ are connected in $\tilde{\mathcal{G}}$,
then so are

$$
\mathcal{H}_1^{-1}(\boldsymbol{v}) \text{ and } \mathcal{H}_1^{-1}(\boldsymbol{v}')
$$

in $\mathcal{G}$. Hence $\mathrm{GRAPHCONNECTED}((\mathcal{H}_1^{-1}(\boldsymbol{v}), \mathcal{H}_1^{-1}(\boldsymbol{v}'))$, $\mathcal{G}$) will out-
puts True so that Algorithm 1 outputs True.
$\square$

4 COMPLEXITY ANALYSIS

This section is devoted to the proof of the following proposition.
Together with Proposition 7, it establishes Theorem 1.

PROPOSITION 12. Let $f = (f_1, \dots, f_s)$ and $\mathcal{R} = (r_1, \dots, r_d)$ be two sequences of polynomials in $\mathbb{Q}[x_1, \dots, x_n]$ and $D$ be the maximum degree of these polynomials. Let $\tau$ be a bound on the bit size of the coefficients of the input polynomials. Then, under assumption (A), with inputs $f$ and $\mathcal{R}$, the execution of Algorithm 1 terminates using at most

$$
\tau^*((s+d)D)^{O(n^2)}
$$

bit operations.

PROOF. Fix $f$ and $\mathcal{R}$, we note $V = \mathcal{V}(f)$ and $V_R = V \cap \mathbb{R}^n$. Assume that assumption (A) holds that is that $V$ is equidimensional of dimension $d$. Let $\delta$ and $\mu$ be the maximum degree of the polynomials in respectively $f$ and $\mathcal{R}$ so that $D = \max\{\delta, \mu\}$, and let $\tau$ be a bound on the bitsize of the input coefficients. We proceed by considering each step of Algorithm 1.

Step 1. The first step of the algorithm consists in computing polynomials whose complex zero-set is the Zariski closure of the set of atypical values. According to [23, Theorem 4.1.], the set atyp$(\mathcal{R}, V)$ is contained in an hypersurface of $\mathbb{C}^d$ degree bounded by

$$
\delta^{n-d} (n\delta + d(\mu - \delta))^d.
$$

Then the polynomials in the finite sequence $\boldsymbol{g}$, given by the call to ATYPICALVALUES, have degree bounded by $n^d D^n$. To compute a polynomial defining them, we rely on the quantifier elimination algorithm in [2, Chap. 14]. Precisely, the set of non-properness can be defined naturally by a quantified formula expressing that $y$ is in the set of non-proplessness if and only if for any $r > 0$ there exists $\epsilon > 0$ such that for any $y' \in \mathbb{R}^d$ and $x' \in \mathcal{R}^{-1}(\boldsymbol{y}') \cap V_R$, $\|y-y'\|^2 < \epsilon$ implies that $\|x'\| > r$. There is one alternate of quantifiers with blocks of quantified variables of lengths 1, $n+d+1$. Solving such a quantifier elimination problem is done using $\tau(sD)^{O((n+d)d)} \subset \tau(sD)^{O(nd)}$ bit operations by [2, Theorem 14.22] and it outputs $(sD)^{O(nd)}$ polynomials of degree in $D^{O(n)}$. Computing a polynomial encoding the critical values is done still using quantifier elimination but in an even simpler way: these are the projections of the values of $\mathcal{R}$ taken at the system $f_1, \dots, f_s$ and the $n-d+1$ minors of the Jacobian matrix associated to $f, \mathcal{R}$.
Step 2. Since $\overline{\mathrm{atyp}(\mathcal{R}, V)^2} = \mathcal{V}(g)$, then by Corollary 3, the call to $\mathrm{SAMPLEPOINTS}$ RATIONAL outputs a set $\mathcal{Q}$ of cardinality $N$ bounded by $n^{\mathcal{O}(d^2)} D^{\mathcal{O}(nd)}$, using at most

$$\tau n^{\mathcal{O}(d^2)} D^{\mathcal{O}(nd)}$$

bit operations. We denote further $\mathcal{Q} = \{q^1, \dots, q^N\}$.

Steps 4-8. Suppose that in the **for** loop, we consider successively $q^1$ to $q^N$. Let $0 \le i \le N$, and let $\delta_{\mathcal{P},i}$ be the degree of $\mathcal{P}$ at the end of the $i$-th iteration. By Proposition 2, for every $1 \le i \le N$, at step 6, $\mathrm{SAMPLEPOINTS}((f, \mathcal{R} - q_i), 0)$ returns a zero-dimensional parametrization of degree bounded by $D^{\mathcal{O}(n)}$. Then, we have

$$\delta_{\mathcal{P}}^i \le \delta_{\mathcal{P}}^{i-1} + D^{\mathcal{O}(n)}.$$

Since $\delta_{\mathcal{P},0} = 0$ then $\delta_{\mathcal{P},N}$ is bounded by $n^{\mathcal{O}(d^2)} D^{\mathcal{O}(nd)}$ since $N$ is bounded by $n^{\mathcal{O}(d^2)} D^{\mathcal{O}(nd)}$. Since the input has constant size, each call of $\mathrm{SAMPLEPOINTS}$, at step 6, costs at most $\tau D^{\mathcal{O}(n)}$ bit operations. Besides, since the $\delta_{\mathcal{P},i}$'s are in increasing order, according to [31, Lemma A.2.], each call to UNION, at step 7, is polynomial in $\delta_{\mathcal{P},N}$.

Therefore, at step 8, $\mathcal{P}$ has degree $\delta_{\mathcal{P}}$ bounded by $n^{\mathcal{O}(d^2)} D^{\mathcal{O}(nd)}$ and the total loop execution is using at most $\tau n^{\mathcal{O}(d^2)} D^{\mathcal{O}(nd)}$ bit operations.

Step 9. Next, $\mathrm{CRIT}(\mathcal{R}, f)$ returns a sequence of polynomials $\Delta$ by computing the determinant of all the $n \times n$ submatrices $\mathrm{Jac}[f, \mathcal{R}]$ according to [31, Lemma A.2.]. One sees that there are $\binom{s+d}{n}$ such minors, which have degrees bounded by $n(D-1)$.

Step 10. According to the previous step, and by Proposition 4, $\mathrm{ROADMAP}(f, \pm\Delta, \mathcal{P})$ returns a one-dimensional rational parametrization $\mathcal{R}$ using at most

$$\tau^* \begin{pmatrix} s+d \\ n \end{pmatrix}^{\mathcal{O}(n)} n^{\mathcal{O}(d^2)} D^{\mathcal{O}(nd)} (nD)^{\mathcal{O}(n^2)}$$

bit operations which is then bounded by $\tau^*((s+d)D)^{\mathcal{O}(n^2)}$. Moreover the degree of $\mathcal{R}$ is bounded by $((s+d)D)^{\mathcal{O}(n^2)}$.

Step 11. According to the previous step, and by Proposition 5, the call to $\mathrm{GRAPHISOTOP}$, with input $(f, \pm\Delta, \mathcal{P})$, costs at most

$$\tau^* ((s+d)D)^{\mathcal{O}(n^2)}$$

bit operations.

Steps 12-19. At each iteration, the call to $\mathrm{VERT}\mathcal{G}$ at step 13 requires a number of operations which is polynomial in $\delta_{\mathcal{P}}$. Besides the procedure $\mathrm{GRAPHCONNECTED}$, who has bit complexity linear in $\delta_{\mathcal{P}}$ is called at most $N$ times in the **for** loop of steps 14-18. Hence, the **for** loop of steps 12-19 requires at most $n^{\mathcal{O}(d^2)} D^{\mathcal{O}(nd)}$ bit operations.

In conclusion the whole execution of Algorithm 1 uses at most $\tau^*((s+d)D)^{\mathcal{O}(n^2)}$ bit operations, which proves the proposition. $\square$

# 5 AN EXAMPLE: ORTHOGONAL 3R SERIAL ROBOT

The cuspidal behaviour of 3R serial robots has been analyzed extensively in the past [18, 39]. In this section, we present an example of an orthogonal 3R serial robot in order to put forth the application of the algorithm. Such a robot is modeled as a map that maps the

joint angles of the robot to the position of the end-effector. The joint angles belong to the so-called the joint space, while the set of the positions of the end-effector is called the workspace. The robot illustrated in this section is similar to the one discussed in [18] and is known to be cuspidal. Such a robot is defined by its D-H parameters (see [21, 32]), which are here, following the conventions, $d = [0, 1, 0]$, $a = [1, 2, 3/2]$ and $\alpha = [\pi/2, -\pi/2, 0]$.

<figure><img src="image_4.png" /><figcaption>Figure 2: An example of orthogonal 3R serial robot</figcaption></figure>

From [32], the robot can be associated to this kinematic map,

$$\mathcal{K}: \begin{array}{ccc} \mathbb{R}^3 & \rightarrow & \mathbb{R}^3 \\ \theta = (\theta_1, \theta_2, \theta_3) & \mapsto & (x_1(\theta), x_2(\theta), x_3(\theta)) \end{array}$$

where for all $(\theta_1, \theta_2, \theta_3) \in \mathbb{R}^3$,

$$\begin{align*} x_1(\theta_1, \theta_2, \theta_3) &= \frac{1}{2} c_1 c_2 (3c_3 + 4) - \frac{1}{2} s_1 (3s_3 + 2) + c_1 \\ x_2(\theta_1, \theta_2, \theta_3) &= \frac{1}{2} s_1 c_2 (3c_3 + 4) + \frac{1}{2} c_1 (3s_3 + 2) + s_1 \\ x_3(\theta_1, \theta_2, \theta_3) &= -\frac{1}{2} s_2 (3c_3 + 4) \end{align*}$$

and for $i \in \{1, 2, 3\}$, $c_i = \cos(\theta_i)$ and $s_i = \sin(\theta_i)$. The singular postures of the robot are the points $(\theta_1, \theta_2, \theta_3) \in \mathbb{R}^3$ where the determinant of the Jacobian matrix $\mathrm{Jac}\mathcal{K}$ of $\mathcal{K}$ vanishes. Let $f = (f_1, f_2, f_3)$ and $\mathcal{R} = (r_1, r_2, r_3)$ be sequences of polynomials in $\mathbb{Q}[c_1, s_1, c_2, s_2, c_3, s_3]$ where for all $i \in \{1, 2, 3\}$

$$f_i = c_i^2 + s_i^2 - 1 \quad \text{and} \quad r_i = x_i(\theta_1, \theta_2, \theta_3).$$

Then, the points $(\theta_1, \theta_2, \theta_3) \in \mathbb{R}^3$ annihilating $\mathrm{det}(\mathrm{Jac}\mathcal{K})$ are exactly the points of $\mathbb{R}^3$ such that $(c_1, s_1, c_2, s_2, c_3, s_3) \in \mathrm{V}_{\mathbb{R}}$ and the matrix $\mathrm{Jac}[f, \mathcal{R}]$ has not full rank. Since $f$ satisfies assumption (A), the latter points are exactly the points of $\mathrm{crit}(\mathcal{R}, \mathcal{V}(f)) \cap \mathbb{R}^n$.

Therefore, the robot can be also modeled as the restriction of the polynomial map associated to $\mathcal{R}$ to the real algebraic set $\mathrm{V}_{\mathbb{R}} = \mathcal{V} \cap \mathbb{R}^n$, where $\mathcal{V} = \mathcal{V}(f)$, and deciding the cuspidality of this map amounts to decide the cuspidality of the robot. Since assumption (A) is satisfied, we can apply Algorithm 1 to $f$ and $\mathcal{R}$ and make this decision.

The set $\mathrm{crit}(\mathcal{R}, \mathcal{V})$ is defined by the vanishing of the following polynomial

$$\Delta = -6(3c_3 + 4)(c_2c_3 - 2c_2s_3 - s_3).$$
Remark that this polynomial does not depend on $c_1$ nor $s_1$. Since $V$ is bounded by design, the restriction of $\mathcal{R}$ to $V$ is proper so that $\text{atyp}(\mathcal{R}, V) = \mathcal{R}(\text{crit}(\mathcal{R}, V))$. Hence the polynomial $g$ whose zero-set is $\text{atyp}(\mathcal{R})^2$ does not depend on $c_1$ nor $s_1$ as well. The computation of this polynomial can be done by algebraic elimination and can be found in [18].

The application of Algorithm 1 gives a rise to two main sets. First, the computation of a sample set of points that meets every connected component of $\mathbb{R}^3 - \text{atyp}(\mathcal{R}, V)^2$, is done trough the WIT-NESSPOINTS function, which is available in Maple 2020. The output set $\mathcal{P}$ is represented in Figure 3 where we adopted a two dimensional representation. Since $\rho = \sqrt{x_1^2 + x_2^2}$ and $x_3$ do not depend on $c_1$ nor $s_1$, as well as the polynomial $g$ defining $\text{atyp}(\mathcal{R}, V)^2$, it makes sense to look at the projection of $\text{atyp}(\mathcal{R})^2$ and $\mathcal{P}$ on the plane associated to $(\rho, x_3)$.

<figure><img src="image_5.png" /><figcaption>Figure 3: Projection on the plane $(\rho, x_3)$ of the set atypical values (red curve) of an orthogonal 3R serial robot and the points (blue diamonds) of the sample set $\mathcal{P}$ that meets every connected component of the complementary of $\text{atyp}(\mathcal{R})^2$.</figcaption></figure>

Then, taking the inverse solutions of these points through $\mathcal{R}$, we compute a roadmap of $V_{\mathcal{R}} - \text{crit}(\mathcal{R}, V)$ passing through these points. Hence one can easily identify points that belong to the same connected component of $V_{\mathcal{R}} - \text{crit}(\mathcal{R}, V)$. Hereafter we describe briefly how do we compute this roadmap. The first step consists in deforming the semi-algebraic set $S = V_{\mathcal{R}} - V(\Delta)$ into the closed semi-algebraic set that is the union of

$$S^+ = V_{\mathcal{R}} \cap \{\mathbf{x} \in \mathbb{R}^6 \mid \Delta \ge \epsilon\}$$
and $$S^- = V_{\mathcal{R}} \cap \{\mathbf{x} \in \mathbb{R}^6 \mid \Delta \le -\epsilon\}$$

with $\epsilon$ small enough. Since $V_{\mathcal{R}}$ is bounded by design, according to [9] or [10, Proposition 3.5], computing a roadmap of this deformation is enough to obtain a roadmap of $S$. This is done using classical

computation of critical loci of projections and fibers of a projection to repair connectivity failures as described in e.g. [6, 9]. Moreover we add fibers that pass through the points of $\mathcal{P}$ to determine the connected component of $S$ where they belong.

In Figure 4 we draw a roadmap of the projection of $V_{\mathcal{R}} - \text{crit}(\mathcal{R}, V)$ on the plane associated to $(c_2, s_2, c_3, s_3)$ that is obtained through the above process. Indeed since the polynomial $\Delta$ does not depend on $c_1$ nor $s_1$, we choose to restrict our connectivity description on this projection, since extending it to the whole space is immediate. Finally, since the projection of $V_{\mathcal{R}}$ on $(c_2, s_2, c_3, s_3)$ is two dimensional, we choose to plot instead the angles $\theta_1, \theta_2$ that are, modulo $2\pi$, uniquely associated to the data computed.

We choose here to represent only four inverse solutions of one point of $\mathcal{P}$ since one can find two cuspidal couples among them. Indeed, looking at Figure 4, one sees that two dots are on a blue line, while the two others are on a green one.

<figure><img src="image_6.png" /><figcaption>Figure 4: The angles that are associated to the projection on the plane associated to $(c_2, s_2, c_3, s_3)$ of the sets under consideration. The sets $S^+$, $S^-$ are represented as the areas in respectively green and blue while the red line represents the set $V(\Delta)$. Besides the black dots are the four inverse images of one sample point of $\mathcal{P}$. Finally we represent the roadmap of the projection of $S^+ \cup S^-$, containing these points, as the union of the green and blue lines, which belong to respectively $S^+$ and $S^-$.</figcaption></figure>

## REFERENCES

[1] S. Basu, R. Pollack, and M.-F. Roy. Computing roadmaps of semi-algebraic sets on a variety. *Journal of the American Mathematical Society*, 13(1):55–82, 2000.

[2] S. Basu, R. Pollack, and M.-F. Roy. *Algorithms in Real Algebraic Geometry*. 10. Springer, Berlin, Heidelberg, 3 edition, 2016.

[3] S. Basu and M.-F. Roy. Divide and conquer roadmap for algebraic sets. *Discrete & Computational Geometry*, 52(2):278–343, 2014.

[4] S. Basu, M.-F. Roy, M. Safey El Din, and É. Schost. A baby step–giant step roadmap algorithm for general algebraic sets. *Foundations of Computational Mathematics*, 14(6):1117–1172, 2014.
[5] J. Bochnak, M. Coste, and M.-F. Roy. *Real algebraic geometry*, volume 36. Springer Science & Business Media, 1998.

[6] J. F. Canny. *The complexity of robot motion planning*. MIT press, 1988.

[7] J. F. Canny. Constructing roadmaps of semi-algebraic sets i: Completeness. *Artificial Intelligence*, 37(1-3):203-222, 1988.

[8] J. F. Canny. Computing roadmaps of general semi-algebraic sets. In *International Symposium on Applied Algebra, Algebraic Algorithms, and Error-Correcting Codes*, pages 94-107. Springer, 1991.

[9] J. F. Canny. Computing roadmaps of general semi-algebraic sets. *The Computer Journal*, 36(5):504-514, 1993.

[10] J. Capco, J. Schicho, and M. Safey El Din. Positive dimensional parametric polynomial systems, connectivity queries and applications in robotics. *Journal of Symbolic Computation*, June 2021.

[11] J.-S. Cheng, K. Jin, and D. Lazard. Certified rational parametric approximation of real algebraic space curves with local generic position method. *Journal of Symbolic Computation*, 58:18-40, 2013.

[12] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. *Introduction to algorithms*. MIT press, third edition, 2009.

[13] S. Corvez. *Study of polynomial system: contribution to the classification of a family of manipulators and calculating the intersection of A-spline curve*. PhD thesis, University of Rennes, Rennes, France, may 2005.

[14] M. Coste and M. Shiota. Nash triviality in families of nash manifolds. *Inventiones mathematicae*, 108(1):349-368, 1992.

[15] M. Coste and M. Shiota. Thom's first isotopy lemma: a semialgebraic version, with uniform bound. In *Real Algebraic and Analytic Geometry*, De Gruyter Proceedings in Mathematics, pages 83-101, Berlin - New York, 1995.

[16] D. N. Diatta, B. Mourrain, and O. Ruatta. On the isotopic meshing of an algebraic implicit surface. *Journal of Symbolic Computation*, 47(8):903-925, 2012.

[17] M. El Kahoui. Topology of real algebraic space curves. *Journal of Symbolic Computation*, 43(4):235-258, 2008.

[18] J. El Omri and P. Wenger. How to recognize simply a non-singular posture changing 3-dof manipulator. In *Proc. 7th Int. Conf. on Advanced Robotics*, pages 215-222, 1995.

[19] C. G. Gibson, K. Wirthmüller, A. A. Du Plessis, and E. J. Looijenga. *Topological stability of smooth mappings*, volume 552. Springer, 1 edition, 1976.

[20] D. Y. Grigoriev and N. Vorobjov. Solving systems of polynomial inequalities in subexponential time. *Journal of symbolic computation*, 5(1-2):37-64, 1988.

[21] D. J. Hartenberg, Richard S. Kinematic synthesis of linkages. McGraw-Hill series in mechanical engineering. McGraw-Hill, New York San Francisco Toronto [etc, 1964].

[22] Z. Jelonek. Testing sets for properness of polynomial mappings. *Mathematische Annalen*, 315(1):1-35, 1999.

[23] Z. Jelonek and K. Kurdyka. Quantitative generalized bertini-sard theorem for smooth affine varieties. *Discrete & Computational Geometry*, 34(4):659-678, 2005.

[24] K. Jin and J. Cheng. On the complexity of computing the topology of real algebraic space curves. *Journal of Systems Science and Complexity*, 34(2):809-826, 2021.

[25] D. Lazard and F. Rouillier. Solving parametric polynomial systems. *Journal of Symbolic Computation*, 42(6):636-667, 2007.

[26] H. P. Le and M. Safey El Din. Solving parametric systems of polynomial equations over the reals through hermite matrices. *Journal of Symbolic Computation*, 112:25-61, 2022.

[27] G. Moroz, F. Rouiller, D. Chablat, and P. Wenger. On the determination of cusp points of 3-rpr parallel manipulators. *Mechanism and Machine Theory*, 45(11):1555-1567, 2010.

[28] V. Parenti-Castelli and C. Innocenti. Position analysis of robot manipulators: Regions and subregions. In *Proceedings of 1988 conference on Advances in Robot Kinematics*, pages 151-158, Ljubljana, sep 1988.

[29] M. Safey El Din and E. Schost. Polar varieties and computation of one point in each connected component of a smooth real algebraic set. In *Proceedings of the 2003 international symposium on Symbolic and algebraic computation*, pages 224-231, 2003.

[30] M. Safey El Din and É. Schost. A baby steps/giant steps probabilistic algorithm for computing roadmaps in smooth bounded real hypersurface. *Discrete & Computational Geometry*, 45(1):181-220, 2011.

[31] M. Safey El Din and É. Schost. A nearly optimal algorithm for deciding connectivity queries in smooth and bounded real algebraic sets. *Journal of the ACM* (JACM), 63(6):1-37, 2017.

[32] D. Salunkhe, C. Spartalis, J. Capco, D. Chanlat, and P. Wenger. [accepted]Necessary and sufficient condition for a generic 3r serial manipulator to be cuspidal. *Mechanism and Machine Theory*, 20(4), Jan 2022.

[33] R. Seidel and N. Wolpert. On the exact computation of the topology of real algebraic curves. In *Proceedings of the twenty-first annual symposium on Computational geometry*, pages 107-115, 2005.

[34] I. R. Shafarevich. *Basic algebraic geometry*, volume 1. Springer, 2013.

[35] P. Wenger. A New General Formalism for the Kinematic Analysis of All Non-redundant Manipulators. In *Proceedings of the 1992 IEEE International Conference on Robotics and Automation*, pages 442-447, Nice, France, May 1992.

[36] P. Wenger. Design of cuspidal and noncuspidal manipulators. In *Proceedings of IEEE Int. Conf. Rob. and Aut.*, pages 2172-2177, 1997.

[37] P. Wenger. Uniqueness Domains and Regions of Feasible Paths for Cuspidal Manipulators. *IEEE Transactions on Robotics*, 20(4):745-750, aug 2004.

[38] P. Wenger. Cuspidal and noncuspidal robot manipulators. *Robotica*, 25(6), nov 2007.

[39] P. Wenger and J. El Omri. Changing posture for cuspidal robot manipulators. In *Proceedings of IEEE International Conference on Robotics and Automation*, volume 4, pages 3173-3178, Minneapolis, MN, USA, 1996. IEEE.