Decision problems for linear recurrences involving arbitrary real numbers

We study the decidability of the Skolem Problem, the Positivity Problem, and the Ultimate Positivity Problem for linear recurrences with real number initial values and real number coefficients in the bit-model of real computation. We show that for each problem there exists a correct partial algorithm which halts for all problem instances for which the answer is locally constant, thus establishing that all three problems are as close to decidable as one can expect them to be in this setting. We further show that the algorithms for the Positivity Problem and the Ultimate Positivity Problem halt on almost every instance with respect to the usual Lebesgue measure on Euclidean space. In comparison, the analogous problems for exact rational or real algebraic coefficients are known to be decidable only for linear recurrences of fairly low order.


Introduction
A real linear recurrence sequence is a sequence (u k ) k of real numbers satisfying a linear recurrence relation of the form u k+n = c 1 u k+n−1 + · · · + c n u k . The Skolem-Mahler-Lech theorem asserts that the zero set {k ∈ N | u k = 0} of such a sequence is of a particularly simple form: it is the union of a finite set F and an empty or infinite set I which is the union of a finite number of arithmetic progressions. For given rational or integer coefficients c 1 , . . . , c n and initial values u 1 , . . . , u n the set I can be effectively computed [BM76]. The same is not known of the set F . It is well known [EvdPSW03] that the problem of computing the set F is equivalent to the problem of deciding whether a given linear recurrence has a zero. The latter problem, often referred to as the Skolem Problem in the literature, has proven to be infamously difficult. It is generally believed to be decidable for linear recurrences of any order, but known to be decidable only up to order four [TMS84,Ver85]. Two closely related decision problems of note are the Positivity Problem, which asks for given a linear recurrence to decide whether all of its terms are non-negative, and the Ultimate Positivity Problem, which asks for given a linear recurrence to decide whether all but finitely many of its terms are non-negative. In [OW14b] it was shown that both Positivity and Ultimate Positivity are decidable up to order five. At the same time it was shown that a feasible algorithm for solving maximal partial decidability for all orders. The proof is considerably more elementary than its counterparts for integer coefficients. The use of Baker's theorem and similar deep results from analytic number theory can be entirely avoided. On the other hand new problems appear in the real number setting that are absent from the discrete setting. The study of the asymptotic behaviour of a linear recurrence relies heavily on the study of its exponential polynomial solution. It is easy to see that in the real number setting the exponential polynomial solution is not in general computable from the linear recurrence. This is where new ideas are required. It is relatively easy to see that one can still compute those coefficients of the exponential polynomial solution which belong to simple characteristic roots. This will suffice to computably recognise all robust instances of the Skolem Problem and the Positivity Problem, and all robust "yes"-instances of the Ultimate Positivity Problem. For the Ultimate Positivity Problem there exist robust "no"-instances whose dominant characteristic roots are not simple, which implies that the corresponding coefficients in the exponential polynomial solution do not depend continuously on the input. These instances are by far the most difficult ones to handle. They will be treated by reduction to the first-order theory of the reals. Recall that the first-order theory of the reals is the first-order theory of the structure R, 0, 1, +, ×, −, >, = . By the Tarski-Seidenberg theorem [BPR06,Theorem 2.77] this theory is decidable. The main ideas in this case are best illustrated with the help of a simple example: Example 1.1. Consider the linear recurrence u 1 = π, u 2 = 2π, u 3 = π, u k+1 = 3u k − 3u k−1 + u k−2 . Its characteristic polynomial is P (x) = x 3 − 3x 2 + 3x − 1 = (x − 1) 3 and its exponential polynomial solution is u k = π + kπ − k(k − 1)π. It is hence a "no"-instance of the Ultimate Positivity Problem. Let us show how we can verify this computationally when the coefficients and initial values are given as sequences of approximations. This is not completely straightforward since, as mentioned earlier, the exponential polynomial solution does not depend continuously on the input.
Choose a small rational number ε > 0. We can compute the roots of the characteristic polynomial to error ε to verify that all complex roots are contained in the open disk B(1, ε) of radius ε > 0 centred at 1. We can numerically count the roots in this disk with multiplicity, to find that there are three roots counted with multiplicity. Therefore there are only finitely many possibilities for the configuration of these roots: (1) R 1 : There is one real root ρ with multiplicity 3.
Each possible root configuration R j can be assigned a domain D R j which is the set of all "valid" assignments to the variables that occur in the root configuration. For instance, D R 2 = (ρ 0 , ρ 1 ) ∈ (1 − ε, 1 + ε) 2 | ρ 0 > ρ 1 and D R 5 = (1 − ε, 1 + ε) × (B(1, ε) ∩ H) where H = {z ∈ C | Im z > 0}. Note that up to identifying C with R 2 each domain is a definable set in the first-order theory of the reals. We can substitute a point in the domain of a possible root configuration R for the variables of R to obtain a linear recurrence, which we call the associated linear recurrence of that point. Any such linear recurrence is a "small perturbation" of our original linear recurrence, enriched with additional information about the algebraic multiplicities of its characteristic roots. In particular our original linear recurrence can be recovered as the associated linear recurrence of some point in the domain of some possible root configuration -in this concrete case it is the linear recurrence associated with 1 ∈ D R 1 .
To establish that our instance is not ultimately positive it would hence suffice to show that for all points in the domain of all possible root configurations the coefficient of the dominant real term in the exponential polynomial solution of the associated linear recurrence is negative. This is a well-known result about linear recurrences. See Lemma 3.2 below for a formal statement.
Let us carry this out for the root configuration R 2 . The dominant term in the exponential polynomial solution of the associated linear recurrence is kρ k−1 0 . An explicit symbolic calculation shows that its coefficient is equal to We can compute rational approximations v 1 , v 2 , v 3 of the initial values to error ε. It then suffices to show that the following sentence holds true: This sentence can be formulated in the first-order theory of the reals. Its truth is hence decidable by the Tarski-Seidenberg theorem. It is clear that the sentence is indeed true for sufficiently small ε > 0. This yields a semi-decision procedure for showing that for all points in D R 2 the coefficient of the dominant real term in the exponential polynomial solution of the associated linear recurrence is negative. A similar reduction to the first-order theory of the reals can be carried out for the remaining root configurations R 1 , R 3 , . . . , R 5 to show that the given linear recurrence is a robust "no"-instance of Ultimate Positivity.
Of course, we have merely verified a particular sufficient condition which happened to hold true for this specific instance. The full algorithm will be slightly more involved, but it will follow the same ideas.

Decision Problems for continuous data
We work within the framework of represented spaces as introduced by Kreitz and Weihrauch [KW85] for countably based spaces and extended by Schröder [Sch02a,Sch02b] to quotients of countably based spaces. See [Wei00,BP03,Pau16] for introductions to this approach to computable analysis at varying levels of abstraction. It will suffice for our purpose to work with admissibly represented countably based T 0 spaces. We will mainly use the notation from [Pau16]. In particular for a represented space X we denote by K(X) the represented space of compact sets with the sequentialisation of the upper Vietoris topology, by (X) the space of open sets with the Scott topology, and by A(x) the space of closed sets where a closed set A is identified with its complement A C ∈ (X). For the benefit of readers unfamiliar with computable analysis we will briefly recall the very basic ideas for computing on the space R n .
A rational interval is a closed interval with rational endpoints. A rational box is a finite product of rational intervals. A point x ∈ R n can be represented by a sequence (B j ) j of rational boxes such that each box contains x and j∈N B j = {x}. Any such sequence is called a name for x. The point x is called computable if it has a computable name, i.e., there exists an algorithm which on input j ∈ N outputs a box B j such that the resulting infinite sequence (B j ) j is a name for x. A function f : R n → R m is computable if there exists an algorithm which takes as input 1 a name (B j ) j of a point x and a natural number k ∈ N and outputs a rational box C k , such that for every fixed name (B j ) j the resulting infinite sequence (C k ) k is a name for f (x). It is easy to see that any computable function is necessarily continuous with respect to the usual topology on R n .
One may object that this notion of computability models an unrealistic situation in which one has arbitrarily good approximations to a real vector available. However, it is easy to prove that f : R n → R m is computable if and only if there exists an algorithm which takes as input a rational box B and a positive rational number ε > 0, and returns as output a finite list of boxes C 1 , . . . , C s such that each C j has width at most ε, each C j intersects the range f (B), and C 1 ∪ · · · ∪ C s ⊇ f (B). Moreover, such an algorithm can be effectively computed from an algorithm which computes f in the above sense and vice versa. Thus, this notion of computability captures precisely the idea that one can compute arbitrarily good information on f (x) when x is given to finite accuracy.
Let us now discuss decision problems in this context. With any subset A ⊆ R n one can associate a decision problem: given x ∈ R n as input halt in finite time and output 1 if and only if x ∈ A or output 0 if x / ∈ A. It is easy to see that for continuity reasons the only subsets of R n that are decidable in this sense are the empty set and R n itself.
The next best thing one can hope for is to find an algorithm which decides the problem in as many points as possible. This is somewhat of a folklore idea in computable analysis, but there does not appear to be an established standard terminology in the literature. Let X be a represented space. A partial 2 algorithm for deciding a set A ⊆ X is an algorithm which takes as input a name of a point x ∈ X and either diverges or halts in finite time and 1 An infinite input sequence can for instance be implemented as an infinite stream that is written on a special input tape or as an oracle.
2 The term "partial algorithm" is used here in the traditional sense of theoretical computer science. In breach with the usual convention in computable analysis the algorithm's behaviour is constrained on the entire space. A computable analyst may hence prefer to view such an algorithm as a total algorithm with values in Kleene space K = {0, 1, ⊥}.
outputs 0 or 1. We require that such an algorithm be extensional, i.e., that its termination and output on termination depend only on the point x but not on the choice of name 3 . We further require that it be correct, i.e., that it halt and return 1 only when x ∈ A and that it halt and return 0 only when x / ∈ A. Its halting set is the set of points for which it halts. This set is well-defined by the extensionality assumption. A partial algorithm for deciding A is called maximal if its halting set contains the halting set of all other partial algorithms for deciding A. We call A maximally partially decidable if there exists a maximal partial algorithm for deciding A.
Proposition 2.1. Let X be an admissibly represented countably based T 0 space. A partial algorithm for deciding A is maximal if and only if its halting set is equal to the set of points of continuity of the characteristic function χ A : X → {0, 1}, where {0, 1} carries the discrete topology.
Proof. It is easy to see that the halting set of an algorithm for deciding A must be contained in the set of points of continuity of the characteristic function. Conversely, if x is a point of continuity of χ A then there exists a basic open set B which contains x such that χ A is constant on B. There exists an algorithm which halts on B and outputs the constant value of χ A . It follows that any maximal partial algorithm for deciding A must contain x in its halting set.
In other words, a maximal partial algorithm for deciding A is an algorithm that takes as input x ∈ X, halts and outputs 1 if x is contained in the interior of A, halts and outputs 0 if x is contained in the interior of the complement of A, and diverges if x is contained in the boundary of A. In particular, every set is maximally partially decidable relative to some oracle, and if X is a discrete space then A ⊆ X is maximally partially decidable if and only if it is decidable. Therefore maximal partial decidability seems to be, in some sense, a more appropriate generalisation of decidability over N than "naive" decidability. One should however bear in mind that this is a relative notion: The set of rational numbers Q, say, is a maximally partially decidable subset of R. A maximal partial correct algorithm is given by the algorithm that never halts. Once maximal partial decidability of a problem is established one is hence naturally lead to the study of the "absolute size" of the halting set.
It will be convenient to introduce the following terminology for decision problems: Let A ⊆ X be a set. Call any point x ∈ X an instance of (the decision problem associated with) A. If x ∈ A then x is called a "yes"-instance. If x / ∈ A then x is called a "no"-instance. If x is a point of continuity of the characteristic function χ A , i.e., if x is not contained in the boundary of A, then x is called a robust instance of A.
Finally, the following convention will be very useful: We say that a property P holds true for a point p ∈ X up to an arbitrarily small perturbation if for every open set U ∈ (X) which contains x there exists y ∈ U such that P holds true for y.
As mentioned in the introduction, maximal partial decidability is equivalent to "almost deciding" a trichotomy when the input is known only to finite accuracy. We formulate this only for the case of R n but it generalises easily to all locally compact spaces.
Proposition 2.2. Let A ⊆ R n be a set. Then A is maximally partially decidable if and only if there exists an algorithm which takes as input a rational box B, halts and outputs 1 if B is contained in the set of robust "yes"-instances of A, halts and outputs 0 if B is contained in the set of robust "no"-instances of A, halts and outputs −1 if B contains robust "yes"-instances as well as robust "no"-instances, and diverges in all other cases.
Moreover, such an algorithm can be effectively computed from a maximal partial algorithm for deciding A and vice versa.
Proof. It is obvious that the existence of such an algorithm implies maximal partial decidability.
Assume that A is maximally partially decidable. Then the set of robust "yes"-instances is computable as an element of the represented space (R n ) of open sets with the Scott topology. The same holds true for the set of "no"-instances.
An encoding of a rational box B can be effectively translated to a name of the same box as an element of the space K(R n ) of compact subsets with the sequentialisation of the upper Vietoris topology. One can therefore semi-decidable if all instances contained in B are robust "yes"-instances or if all instances contained in B are robust "no"-instances.
We can also effectively compute a name of the interior of B as an element of the space (R n ) of open sets with the Scott topology. Now, if B contains a robust "yes"-instance then the interior B • of B contains a robust "yes"-instance. We can thus semi-decide if B contains a robust "yes"-instance by computing the intersection of B • with the set of robust "yes"-instances as an element of (R n ) and semi-deciding if the result is non-empty. By symmetry the same is true for robust "no"-instances. The claim follows.
Throughout this section we have focussed our attention on countably based spaces. This will be sufficient for the purpose of this paper. It should be pointed out however, that Proposition 2.1 may fail for non-countably-based spaces. To see this, let be the computable metric space of square-summable real sequences with the metric induced by the usual inner product ·, · . Let 2 ⊆ R 2 denote the admissibly represented space of linear functionals on 2 , with the representation inherited from the exponential R 2 in the category of represented spaces. As usual, the space 2 can be identified with 2 (with a weaker topology) by virtue of the self-duality of Hilbert spaces. In particular, the inner product ·, · can be defined on 2 . It is shown in [BS05] that the space 2 is computably It is further shown that the space 2 is computably isomorphic to the quotient space where (x n ) n ∼ (y n ) n if and only if (x n ) n≥1 = (y n ) n≥1 . In other words, a point x ∈ 2 can be represented by the sequence (x n ) n and its 2 -norm, while a point x ∈ 2 can be represented by the sequence (x n ) n and some upper bound on its 2 -norm. Now, let p ∈ 2 be a computable point with uncomputable 2 -norm (see e.g. [Neu15, Theorem 5.9] for a construction of a such a point). Consider the hyperplane H = x ∈ 2 | p, x = 0 . Then the complement of H is open and dense but contains no non-empty semi-decidable subset. To see the last claim, assume that there exists an algorithm whose halting set is a non-empty subset U of the complement of H.
Then there exists an integer m such that the algorithm halts on all points of the form (N, From this it follows that for every N > x 2 1 + · · · + x 2 m there exists a positive integer ν(N ) such that the algorithm halts on all sequences in 2 that start with N, x 1 , . . . , x m , followed by ν(N ) zeroes. In particular the algorithm halts on all sequences By solving the equation p, s(α) = 0 for α and using that the halting set is assumed not to intersect H, we find that Since N may be chosen arbitrarily large, this yields an algorithm for computing the norm of p, contradicting our initial assumption. It follows that H is maximally partially decided by the algorithm that never halts. The halting set of this algorithm is clearly much smaller than the points of continuity of the characteristic function of H.
This suggests that a reasonable alternative approach to the study of the "partial decidability" of subsets of admissibly represented spaces may be obtained by taking the characterisation given in Proposition 2.1 as the definition directly. Letting K = {0, 1, ⊥} be endowed with the topology generated by the sets {0} and {1}, one can study the computability of the continuous function χ A : X → K which sends the interior of A to 1, the complement of the closure of A to 0, and the boundary of A to ⊥. For countably based X one recovers the definition of maximal partial decidability via Proposition 2.1. Since the hyperplane H above is maximally partially decided by the algorithm that never halts, the function χ H is "nowhere computable" in the sense that its restriction to every open subset of 2 is uncomputable. The function χ A arises quite naturally as the continuous coreflection of the characteristic function χ A : X → K in the sense of Escardó [Esc98, Proposition 2.6.1] -an idea that already goes back to Scott [Sco72]. It is also the best continuous approximation to χ A in the very strong sense of [Neu19].

Linear Recurrences
A real linear recurrence sequence is a sequence (u k ) k such that there exists a positive integer n ∈ N and real numbers c 1 , . . . , c n ∈ R such that for all k > n. This sequence can hence be encoded by the vector Note that this encoding is not unique. The order of a linear recurrence sequence is the smallest possible n such that (u k ) k satisfies a relation of the above form. From a computational point of view it is important to treat different encodings of the same sequence as different problem instances. This will be illustrated in Example 3.1 below. We define a linear recurrence to be a vector (c, u) ∈ R 2n for some n ∈ N. The number n is called the order of (c, u). Note that the sequence (u k ) k generated by the linear recurrence (c, u) could satisfy a linear recurrence relation of strictly lower order. In other words, the order of the linear recurrence is in general not the same as the order of the linear recurrence sequence (u k ) k it generates. The space of all linear recurrences is identified with the represented space n∈N R 2n .
The companion matrix of a linear recurrence (c, u) is the matrix The characteristic polynomial of (c, u) is the polynomial i.e., up to sign, the characteristic polynomial of its companion matrix. The complex roots of the characteristic polynomial are called the characteristic roots of (c, u).
The exponential polynomial solution plays a crucial role in the study of the asymptotic behaviour of linear recurrences. Its definition is a bit subtle in our context. A formal complex polynomial is a vector Q = (a 0 , . . . , a m ) ∈ C m , which we also write as Q(x) = a 0 +· · ·+a m x m . The formal degree of Q is the number m. We do not assume here that a m = 0, hence the name "formal degree".
A formal exponential polynomial is a function f : N → C of the form where the P j 's are formal polynomials and the λ j 's are distinct complex numbers. A formal exponential polynomial is assumed to be encoded as a vector in C d 1 × · · · × C ds × C s , where d 1 , . . . , d s are the formal degrees of P 1 , . . . , P s . The space of formal exponential polynomials is the co-product over all spaces of this form. A formal exponential polynomial is formally real-valued if for every λ j ∈ C \ R there exists an index l with λ l =λ j and P l =P j . Note that this is stronger than to require for the function f (k) to be real-valued. The formal exponential polynomial 1 k + 0 · i k is real-valued but not formally real-valued.
The exponential polynomial solution of a linear recurrence (c, u) is the unique formal exponential polynomial f (k) = P 1 (k)λ k 1 + · · · + P s (k)λ k s satisfying u k = f (k) for all k, where λ 1 , . . . , λ s are the distinct characteristic roots of the characteristic polynomial P of (c, u) and the formal degree of the formal polynomial P j is the multiplicity of λ j as a root of P . Its existence and uniqueness follow from existence and uniqueness of the Jordan normal form of the companion matrix of (c, u). Note that the encoding of f as a vector in C d 1 ×· · ·×C ds ×C s is unique only up to permutation. The exponential polynomial solution is clearly formally real valued. Conversely, every formally real-valued exponential polynomial in C d 1 × · · · × C ds × C s is the exponential polynomial solution of a unique linear recurrence (c, u) ∈ R 2(d 1 +···+ds) .
The dominant characteristic roots are the roots of the characteristic polynomial of maximal modulus. Let d be the greatest multiplicity among dominant characteristic roots. The formal dominant part of the exponential polynomial solution is the formal exponential polynomial where λ j 1 , . . . , λ jt are the dominant characteristic roots of multiplicity d and a j 1 , . . . , a jt are the coefficients of x d in the formal polynomials P j 1 , . . . , P jt . Note that it is possible for any of the a j l 's to vanish, so that the formal dominant part could vanish everywhere as a function.
We can now introduce the problems of interest more formally. The Positivity Problem is the decision problem for the set The Ultimate Positivity Problem is the decision problem for the set The Skolem Problem is the decision problem for the set Here we have chosen to treat different encodings of the same linear recurrence sequence as different problem instances. Since the above decision problems pertain to extensional properties of the sequences themselves, it may seem more natural to consider them on the quotient of the space n∈N R 2n under the identification of linear recurrences that encode the same sequence. Such identifications are commonly performed in the computable analysis literature in analogous situations, such as in the definition of the space of polynomials [CH20,Hoy20,dBPS20] or the space of analytic functions [PS18].
Example 3.1. The following example should illustrate why one should discuss decidability on the level of encodings rather than on the level of sequences, why one should treat the exponential polynomial solution as a formal exponential polynomial, and why the asymptotic behaviour of the formal dominant part is more relevant than the asymptotic behaviour of the exponential polynomial as a function.
Consider the sequence (u k ) k with u k = 1 for all k. This sequence is strictly positive and therefore a-fortiori ultimately positive and without zeroes.
The sequence can be viewed as a first-order linear recurrence satisfying the linear recurrence relation u k = u k−1 . It can therefore be encoded as the vector (1, 1) ∈ R 2 . Its characteristic polynomial is P (x) = x − 1, its only characteristic root is 1 with multiplicity 1, and its exponential polynomial solution is f (k) = 1 · 1 k . The formal exponential polynomial f is equal to its formal dominant part. It is easy to see that this linear recurrence remains strictly positive under small perturbations of the coefficients and initial values. It is therefore a robust "yes"-instance of Positivity and Ultimate Positivity and a robust "no"-instance of the Skolem Problem. The same sequence can also be viewed as a second-order linear recurrence satisfying the linear recurrence relation u k = 2u k−1 − u k−2 . This yields a different encoding as the vector (2, −1, 1, 1) ∈ R 4 . The characteristic polynomial of this linear recurrence is Q(x) = x 2 − 2x + 1 = (x − 1) 2 , its only characteristic root is 1 with multiplicity 2, and its exponential polynomial solution is g(k) = (0 · k + 1) · 1 k . The formal dominant part of g is 0 · k · 1 k . Note that the formal exponential polynomial g is equal as a function to the formal exponential polynomial f above. For N ∈ N, consider the linear recurrence encoded by The exponential polynomial solution becomes (− 1 N k + 1) · 1 k . For k = N this new linear recurrence has a zero and for k > N it becomes strictly negative. Since N can be chosen arbitrarily large, we obtain arbitrarily small perturbations of the initial values such that the resulting linear recurrence is a "no"-instance of Positivity and Ultimate Positivity and a "yes"-instance of the Skolem Problem. Therefore, this linear recurrence is not a robust instance of any of these problems.
It is easy to extend the idea of Example 3.1 to show that the problems of interest become trivial on the represented space n∈N R 2n / ∼, where ∼ is the relation that identifies linear recurrences which encode the same sequence, in the sense that all three problems are maximally partially decided by the algorithm that never halts. The same holds true if one is given a linear recurrence sequence (u k ) k as an element of the represented space R N together with a bound n on its order. Another sensible way of encoding a linear recurrence sequence (u k ) k is to provide a matrix A and two vectors v and w such that u k = vA k w. But this is easily seen to be equivalent to the encoding that we have chosen. Finally, it also makes sense to encode a linear recurrence directly as a formal exponential polynomial. This is clearly a strictly stronger representation than the one we have chosen. It is relatively straightforward to show based on the proofs given in this paper that the Skolem Problem, the Positivity Problem, and the Ultimate Positivity Problem for exponential polynomials are maximally partially decidable. This is in fact much easier than the analogous problem for linear recurrences given by a vector of coefficients and a vector of initial values.
We will make frequent use of the following well-known result on linear recurrences. For a proof see e.g. [BG07, Theorem 2].
Lemma 3.2. Let (c, u) be a linear recurrence which is not identically zero. Assume that (c, u) has a dominant characteristic root which is not a positive real number. Let λ 1 , . . . , λ n ∈ C \ [0, +∞) be the non-positive dominant characteristic roots of (c, u). Let P 1 , . . . , P n be their respective coefficients in the exponential polynomial solution. Then the exponential polynomial P 1 (k)λ k 1 + · · · + P n (k)λ k n is either identically zero or admits infinitely many positive and infinitely many negative values.
The next result says that a linear recurrence depends continuously on its exponential polynomial solution. In other words, small perturbations of the exponential polynomial solution induce small perturbations of the linear recurrence. This fact will be extremely useful.
Proposition 3.3. Let n ∈ N. Let d 1 , . . . , d s ∈ N with d 1 + · · · + d s = n. There exists a surjective computable map which sends a vector that encodes a formally real-valued formal exponential polynomial f to the unique linear recurrence (c, u) with f (k) = u k for all k ∈ N. Proof. Assume we are given as input a vector (P 1 , . . . , P s , (λ 1 , . . . , λ s )) ∈ C d 1 × · · · × C ds × C s , where the P j 's are interpreted as formal polynomials, such that the exponential polynomial f (k) = P 1 (k)λ k 1 + · · · + P s (k)λ k s is formally real-valued for all k. To obtain the vector u we can simply evaluate f for k = 1, . . . , n. A priori this yields u 1 , . . . , u n as complex numbers, but since these numbers are guaranteed to be real we can compute their real part to obtain the same numbers as real numbers.
To obtain the coefficients c of the linear recurrence, we can effectively compute the vector of coefficients of the polynomial (x − λ 1 ) d 1 · · · · · (x − λ s ) ds as a vector of complex numbers. Since all coefficients are guaranteed to be real we can compute the real part of each entry to obtain c as a real vector.
Similarly, the coefficients of a linear recurrence depend continuously on its characteristic roots in the following sense: Proposition 3.4. Let n ∈ N. Let D ⊆ C n be the set of all complex vectors whose entries constitute the roots of some monic polynomial with real coefficients, counted with multiplicity. Let h : D → R n be the function that sends a complex vector (λ 1 , . . . , λ n ) to the unique vector (c 1 , . . . , c n ) ∈ R n such that (x − λ 1 ) · · · · · (x − λ n ) = x n − c 1 x n−1 − · · · − c n . Then the map h is computable.

On the computability of the exponential polynomial solution
The aim of this section is to establish that the coefficients in the exponential polynomial solution of any simple dominant characteristic root are computable. First we recall that the characteristic roots are computable: Theorem 4.1 [Spe69]. There exists an algorithm which takes as input a complex vector (a 0 , . . . , a d ) ∈ d≥1 C d+1 with a d = 0 and outputs a vector (λ 1 , . . . , λ d ) ∈ C d such that (λ 1 , . . . , λ d ) contains the roots of the polynomial a 0 +a 1 z +· · ·+a d z d , counted with multiplicity.
It is worth mentioning that the algorithm in Theorem 4.1 is non-extensional: the output vector depends on the name of the input vector and not just on the vector itself. This is not surprising, since it is well known that there is no continuous single-valued function which assigns to the coefficient vector of a complex polynomial its vector of complex roots.
Lemma 4.2. Let (c, u) be a linear recurrence. Let λ be a characteristic root of (c, u). Then the geometric multiplicity of λ in the companion matrix of (c, u) is equal to 1. Let (x 1 , . . . , x n ) be an eigenvector of A. Then for all j = 2, . . . , n we have the equation x j−1 = λx j . Since any eigenvector is by definition non-zero it follows that x n = 0. It then follows that (λ n−1 , . . . , λ, 1) is an eigenvector and that every eigenvector is a multiple of this one. Hence the geometric multiplicity of λ is equal to 1. Proof. The union of all generalised eigenspaces for any eigenvalue λ of A is uniformly computable from λ as an element of A(C n ). It follows that the union of all generalised eigenspaces for all λ = µ can be computed as an element of A(C n ). By intersecting with the unit sphere we can compute the set of all normalised generalised eigenvectors for all eigenvalues λ = µ as an element of K(C n ). Since linear independence is semi-decidable it follows that the linear span of the generalised eigenvectors which belong to eigenvalues other than µ is computable as an element of A(C n ). Since this is a linear space whose dimension is known to be n   where I is the m × m identity matrix and M is some invertible (n − m) × (n − m)-matrix.

Proof. The companion matrix is
The exponential polynomial solution of the linear recurrence (c, u) is thus given by where C is an (n − m) × (n − m)-matrix in Jordan normal form whose eigenvalues are different from µ. It follows that the term belonging to µ k is indeed (v 1 , . . . , v m ) T J k (w 1 , . . . , w m ). It is clear that this can be computed as a complex vector. If µ is guaranteed to be real we can compute the real part of each entry of the vector to obtain the same vector as a real vector.
Lemma 4.5. There exists an algorithm which takes as input a vector (a 0 , . . . , a n ) ∈ R n+1 with a n = 0 and a rational number ε > 0 and halts if and only if the polynomial P (z) = a 0 + · · · + a n z n has a real root and the largest real root of P is simple, and on halting returns a rational approximation of the largest real root of P to accuracy ε.
Proof Sketch. Compute a list of intervals I 1 , . . . , I s of width at most ε such that every real root of P is contained in some interval I j . Let I k be such that the left endpoint of I k is larger than the right endpoint of every interval I j with j = k. Test to accuracy ε if P changes its sign on the endpoints of I k . If this is the case evaluate P on I using interval arithmetic with precision ε. If the resulting interval does not contain zero halt and output the centre of I k .
If any of the above tests fail, rerun the algorithm with ε/2 instead of ε.
Lemma 4.6. There exists an algorithm which takes as input a linear recurrence (c, u) and a rational number ε > 0, halts if and only if the linear recurrence has a unique and simple dominant characteristic root ρ which in addition is a positive real number, and on halting outputs ρ together with a rational approximation to error ε of its coefficient a ∈ R in the exponential polynomial solution of (c, u).
Proof. Given any linear recurrence (c, u) we can compute a vector in C n containing all the complex roots of its characteristic polynomial. We can then semi-decide if the vector contains a unique element µ of maximal modulus. Moreover, we can semi-decide if there exists a rational box B which is symmetric about the real axis and contains µ and no other characteristic roots. This then establishes that µ is a simple root of the characteristic polynomial and a real number. By computing Re µ we obtain a name of µ as a real number. We can then semi-decide if µ > 0. By Corollary 4.4 we can compute the coefficient a of µ in the exponential polynomial solution.

"Yes"-instances of Ultimate Positivity
Proposition 5.1. A linear recurrence (c, u) ∈ R 2n is a robust "yes"-instance of the Ultimate Positivity Problem if and only if it has a unique and simple dominant characteristic root which in addition is a positive real number whose coefficient in the exponential polynomial solution is a positive real number. Moreover, there exists an algorithm which takes as input a real linear recurrence and halts if and only if the linear recurrence is a robust "yes"-instance of the Ultimate Positivity Problem.
Proof. Clearly any instance of the described form is a "yes"-instance. We can apply the algorithm from Lemma 4.6 to check whether there exists a unique and simple dominant characteristic root which in addition is a positive real number, and if so compute its coefficient in the exponential polynomial solution. We can then semi-decide if this coefficient is positive. This shows that the set of instances of the described form is semi-decidable, which implies that any such instance is robust. It now remains to show that there are no further robust "yes"-instances. Let (c, u) be a "yes"-instance of order n. Assume that (c, u) is not of the described form. Then either (c, u) does not have a unique and simple dominant characteristic root ρ which in addition is a positive real number, or it does and the coefficient of ρ k in the exponential polynomial solution is non-positive.
Assume first that (c, u) has a unique and simple dominant characteristic root ρ which in addition is a positive real number, but its coefficient c in the exponential polynomial solution is non-positive. By Proposition 3.3 it suffices to show that there exist arbitrarily small perturbations of the exponential polynomial solution which fail to be ultimately positive. By an arbitrarily small perturbation of the formal exponential polynomial we can ensure that ρ is the only dominant characteristic root and that its coefficient is strictly negative. This slightly perturbed sequence will be negative for all large values of k. It follows that (c, u) is not robust.
It remains to consider the case where (c, u) does not have a unique and simple dominant characteristic root ρ which is a positive real number. We can further assume that the dominant characteristic roots of (c, u) have strictly positive modulus. Otherwise we have c = 0, which immediately implies that (c, u) is not robust. Since we assume that (c, u) is a "yes"-instance it follows from Lemma 3.2 that (c, u) has to have a dominant characteristic root ρ which is a positive real number. Hence, either ρ is not simple or there exists another dominant characteristic root λ ∈ C \ [0, +∞).
If there exists a dominant characteristic root λ ∈ C \ [0, +∞) then under arbitrarily small perturbations of the exponential polynomial solution the root λ becomes strictly larger in modulus than ρ and its coefficient can be ensured to be non-zero. By Proposition 3.3 this induces an arbitrarily small perturbation of the instance (c, u). It follows from Lemma 3.2 that the perturbed instance is a "no"-instance of the Positivity Problem. Hence (c, u) is not robust.
Finally assume that ρ is not simple. Let D ⊆ C n and h : D → R n be as in Proposition 3.4. Choose p ∈ D with h(p) = c. By continuity of h a small perturbation of p within D induces a small perturbation of the coefficients of c and therefore a small perturbation of the input (c, u). Since ρ is not simple the vector p contains at least two entries equal to ρ. By an arbitrarily small perturbation of p we can make these two entries into two complex conjugate numbers whose modulus is strictly larger than ρ. By an arbitrarily small perturbation of the exponential polynomial solution of the resulting perturbed instance we can further ensure that the coefficients of these complex conjugate characteristic roots in the exponential polynomial solution are non-zero. It follows from Proposition 3.3 that this induces an arbitrarily small perturbation of the original instance. By Lemma 3.2 the resulting perturbed instance is not ultimately positive.

Positivity
Lemma 6.1. Let (c, u) be a linear recurrence. Assume that (c, u) has a unique and simple dominant characteristic root ρ, which in addition is a positive real number. Let a ∈ R be 16:16

E. Neumann
Vol. 17:3 the coefficient of ρ k in the exponential polynomial solution. Then we can compute an index N ∈ N such that |a|ρ k > |u k − aρ k | for all k ≥ N .
Proof. By Lemma 4.6 we can compute ρ and its coefficient a in the exponential polynomial solution uniformly in (c, u) subject to the promise that (c, u) is of the required form.
Proposition 6.2. A "yes"-instance (c, u) of the Positivity Problem is robust if and only if it is a robust "yes"-instance of the Ultimate Positivity Problem and satisfies u k > 0 for all k. Moreover, there exists an algorithm which takes as input a linear recurrence and halts if and only if it is a robust "yes"-instance of the Positivity Problem.
Proof. Since Positivity implies Ultimate Positivity it is clear that any robust "yes"-instance of the Positivity Problem must be a robust "yes"-instance of the Ultimate Positivity Problem. We claim that if (c, u) is a "yes"-instance of the Positivity Problem with u k = 0 for some k, then there exists an arbitrarily small perturbation of the instance with u k < 0. Indeed, we can choose k to be minimal with this property. If u k is an initial value then we can slightly perturb u k to make it negative. Otherwise we have u k = c 1 u k−1 + · · · + c n u k−n with u k−j > 0 for j = 1, . . . , n by minimality of k. Then an arbitrarily small perturbation of c 1 , say, will make u k negative. This proves the claim. Now consider the following algorithm: given an instance (c, u) of the Positivity Problem, semi-decide if it has a positive real dominant characteristic root ρ which is simple and strictly larger than the modulus of any other characteristic root. If this semi-decision procedure halts, compute the coefficient a of ρ k in the exponential polynomial solution. This is possible thanks to Lemma 4.6 Test if a > 0. If this test halts then compute an index N such that aρ k > |u k − aρ k | for all k ≥ N . This is possible thanks to Lemma 6.1. Then test for all k < N if u k > 0.
Together with the characterisation of robust "yes"-instances of the Ultimate Positivity Problem given in Proposition 6.2 it is now clear that this algorithm halts if and only if (c, u) is a robust "yes"-instance of the Positivity Problem.
Theorem 6.3. The Positivity Problem is maximally partially decidable.
Proof. It is obvious that all "no"-instances of Positivity are robust and algorithmically recognisable. Proposition 6.2 establishes that all robust "yes"-instances are algorithmically recognisable.

The Skolem Problem
Proposition 7.1. No "yes"-instance of the Skolem Problem is robust.
Proof. Let (c, u) be a "yes"-instance of the Skolem Problem. Let us assume that (c, u) has a dominant characteristic root λ with non-zero imaginary part. An analogous but simpler proof establishes the claim in case that there exists a real dominant characteristic root.
Since the vector of coefficients c depends continuously on the vector of characteristic roots we can assume, up to slightly perturbing (c, u), that λ is simple, that λ andλ are the only dominant characteristic roots, and that λ/|λ| is a root of unity. The exponential polynomial solution of (c, u) is then of the form cλ k +cλ k + r(k), with |r(k)| < ab k for some a ≥ 0 and b < M . Writing λ = M e iϕ and c = α + iβ we have cλ k +cλ k = 2M (α cos(kϕ) − β sin(kϕ)) .

E. Neumann
Vol. 17:3 Thus, cλ k +cλ k does not vanish so long as the point (α, β) lies outside the set S = (x, y) ∈ R 2 | ∃k.x cos(kϕ) − y sin(kϕ) = 0 . Since e iϕ is a root of unity the expressions cos(kϕ) and sin(kϕ) admit only finitely many different values for k ∈ N. Additionally, the expressions cos(kϕ) and sin(kϕ) never vanish simultaneously. Therefore the set S is a finite union of straight lines in R 2 . It follows that there exist arbitrarily small perturbations of α and β such that α cos(kϕ) − β sin(kϕ) never vanishes. Since this expression only admits finitely many values it follows that |u k | > εM k − ab k with ε > 0 and b < M .
In particular up to arbitrarily small perturbation (c, u) has only finitely many zeroes k 1 < k 2 < · · · < k m . As above we can find arbitrarily small γ and δ such that (γ+iδ)λ k j +(γ−iδ)λ k j is non-zero for j = 1, . . . , m. Replace the coefficient c in the exponential polynomial solution of (c, u) by c + (γ + iδ) andc withc + (γ − iδ). Then the zeroes k 1 , . . . , k m are removed by construction. By choosing γ and δ sufficiently small we can ensure that no new zeroes are added. By Proposition 3.3 this induces an arbitrarily small perturbation of the instance (c, u).
Proposition 7.2. A "no"-instance of the Skolem Problem is robust if and only if one of the two following conditions is met: (1) It has a simple real dominant characteristic root ρ with |ρ| > |µ| for all characteristic roots µ = ρ, and the coefficient of ρ in the exponential polynomial solution is non-zero. Proof. Assume that a "no"-instance (c, u) of the Skolem Problem has a complex dominant characteristic root λ ∈ C \ R. By Proposition 3.4 a small perturbation of the characteristic roots induces a small perturbation of the instance (c, u), so that we can assume up to an arbitrarily small perturbation of (c, u) that λ is simple, not a root of unity, and that that λ and λ are the only dominant characteristic roots of (c, u). Let M = |λ|. It follows from Dirichlet's approximation theorem that the sequence (λ/M ) k is dense in the unit circle S 1 ⊆ C. In particular, for every ε > 0 there exist infinitely many k ∈ N such that |(λ/M ) k | < ε. If follows that there exists an index K such that |u K /M K | < ε. Now, the linear recurrence sequence It is represented by a formal exponential polynomial which is ε-close to the exponential polynomial solution of (c, u). Since ε can be chosen to be arbitrarily small, this yields an arbitrarily small perturbation of (c, u) which is a "yes"-instance of the Skolem Problem. It follows that (c, u) is not robust. If (c, u) has a real dominant characteristic root which is not simple then a small perturbation of (c, u) has a complex dominant characteristic root. It equally follows that (c, u) is not robust.
Thus, if (c, u) is a robust "no"-instance of the Skolem Problem then its dominant characteristic roots are all simple and real. Assume that (c, u) has only one dominant characteristic root ρ. Let M be its absolute value. Note that M > 0 since we assume that the instance is a "no"-instance. If the coefficient of ρ k in the exponential polynomial solution is zero, then for all ε > 0 there exists an index K such that |u K /M K | < ε. Then the linear recurrence sequence w k = u k − u K ρ K ρ k has a zero and is represented by a formal exponential polynomial which is ε-close to the exponential polynomial solution of (c, u). It follows that (c, u) is not robust. On the other hand, if the coefficient of ρ k is non-zero then it is easy to see that the instance is a robust "no"-instance. Now assume that (c, u) has exactly two dominant characteristic roots ρ > 0 and −ρ < 0. If the coefficient in the exponential polynomial solution of ρ k , say, is zero then by an arbitrarily small perturbation we can ensure that ρ is the only dominant characteristic root of (c, u) and it follows that (c, u) is not robust. Hence the coefficients of ρ k and of (−ρ) k must be non-zero. If they have the same absolute value then the formal dominant part of the exponential polynomial solution vanishes either for all odd indexes or for all even indexes. Again it follows that for all ε > 0 there exists K such that |u K /ρ K | < ε and by the same argument as before it follows that (c, u) is not robust. On the other hand, if the coefficients of ρ k and (−ρ) k are non-zero and have different absolute values then it is easy to see that the resulting instance is a robust "no"-instance of the Skolem Problem. This concludes the characterisation of the robust "no"-instances.
To semi-decide if a given instance (c, u) is a "no"-instance, run the following two tests in parallel: (1) (c, u) has a simple real dominant characteristic root with |ρ| > |µ| for all characteristic roots µ = ρ, and the coefficient of ρ in the exponential polynomial solution is non-zero.
That the first test is effective follows essentially from Lemma 4.6. The second test can be carried out effectively by similar ideas: Choose a rational number ε > 0. Compute a list of rational boxes B 1 , . . . , B s ⊆ C of width ε such that each box is guaranteed to contain a complex root of the characteristic polynomial and each root of the characteristic polynomial is contained in a box. Test if there exist boxes B + and B − which intersect the real axis and contain a unique root, such that all real numbers contained in B + are positive, all real numbers contained in B − are negative, the modulus of all numbers contained in B + is strictly larger than the modulus of all numbers contained in boxes other than B + and B − , and the same is true for the modulus of all numbers contained in B − . Clearly this can be tested effectively in finite time. If this test does not succeed then retry with ε/2 replacing ε. If the test succeeds then there is a unique characteristic root ρ + ∈ B + and a unique characteristic root ρ − ∈ B − , both of which are simple and real. We can effectively compute the respective coefficients of ρ + and ρ − in the exponential polynomial solution of (c, u) thanks to Corollary 4.4 and test if they are distinct and non-zero.
Whenever one of the tests terminates we can effectively compute positive real numbers δ and r such that the absolute value of the formal dominant part of the exponential polynomial solution is bounded from below by δr k . It then follows as in the proof of Lemma 6.1 that we can compute an index K ∈ N such that |u k | > 0 for all k ≥ K. To verify that the given instance is a "no"-instance it hence suffices to verify that u k > 0 for all k < K.
It is clear that if this algorithm halts then the given instance is a "no"-instance. Conversely, if the instance is a robust "no"-instance then it meets one of the two criteria above. If it meets the fist criterion then the first test will terminate. If it meets the second criterion then the second test will terminate.

Approximate root clusterings and possible root configurations
Finally we turn to the problem of computably recognising robust "no"-instances of Ultimate Positivity. This will be considerably more involved than the previous results, and further preparatory work is required. The ideas we introduce here have been motivated in Example 1.1 in the introduction. Let P ∈ R[x] be a non-constant univariate real polynomial. An approximate root clustering for p is a finite list where each B j ⊆ C is a rational box, i.e., a product of intervals with rational endpoints, and each N j is a positive integer, such that (1) Every complex root of P is contained in one of the boxes B j .
(2) For all j = 1, . . . , s the number N j is the number of roots of p in B j counted with multiplicity. where ρ 1 , . . . , ρ d and λ 1 , . . . , λ e are distinct variables and r 1 , . . . , r d , m 1 , . . . , m e are positive integers with r 1 + · · · + r d + 2m 1 + · · · + 2m e = N j . For every j = 1, . . . , d the number r j is called the multiplicity of the variable ρ j and for j = 1, . . . , e the number m j is called the multiplicity of the variable λ j . The intention is that the variables ρ 1 , . . . , ρ d represent real roots with multiplicities r 1 , . . . , r d and λ 1 , . . . , λ e represent complex roots with positive imaginary part and multiplicities m 1 , . . . , m e . Let (B j , N j ) be a complex cluster. A possible root configuration for (B j , N j ) is a list We call the variables of the form ρ j the real variables and the variables of the form λ j the complex variables of the possible root configuration. Formally, a real variable is a variable that occurs in the first list associated with some R j and any other variable is a complex variable.
Proposition 8.1. Given a non-constant real polynomial P ∈ R[x], encoded as a vector (a n , . . . , a 0 ) ∈ R n+1 where p(x) = a n x n + · · · + a 0 and a n = 0, and a natural number p ∈ N we can compute an approximate root clustering for P such that each B j has width at most 2 −p .
Proof Sketch. By Theorem 4.1 we can compute a complex vector (µ 1 , . . . , µ n ) ∈ C n which contains all roots of P such that a root of multiplicity m occurs precisely m times in this vector. Choose a small rational number δ > 0. Approximate each µ j to accuracy δ/2 and put a rational box C j of width δ around this rational approximation. Arrange these boxes into clusters of the form C j 1 , . . . , C j k such that the unions C j 1 ∪ · · · ∪ C j k are connected and each C j i is disjoint from all boxes C k with k / ∈ {j 1 , . . . , j k }. Initialise an empty list L = . For each such cluster compute a rational box B that contains C j 1 ∪ · · · ∪ C j k and add the element (B, k) to the list L. The boxes B in the list L may have width larger than 2 −p and the resulting list L may not be an approximate root clustering since the reflection of a real cluster about the real line may intersect another cluster, or the reflection of a complex cluster about the real line may intersect more than one other cluster. If either of these cases occurs repeat the algorithm with δ/2 replacing δ. It is easy to see that for sufficiently small δ this algorithm will produce an approximate root clustering as desired.
Proposition 8.2. Given an approximate root clustering (B 1 , N 1 ), . . . , (B s , N s ) we can compute a list containing all possible root configurations for this clustering.
Let P ∈ R[x] be a non-constant real polynomial. Let C = (B 1 , N 1 ), . . . , (B s , N s ) be an approximate root clustering. Let R be a possible root configuration for C. Let ρ 1 , . . . , ρ d be its real variables and let λ 1 , . . . , λ e be its complex variables. Let r 1 , . . . , r d and m 1 , . . . , m e be their respective multiplicities. Introduce new variablesλ 1 , . . . ,λ e . The characteristic polynomial of R is the polynomial with coefficients in Z[x, ρ 1 , . . . , ρ d , λ 1 ,λ 1 , . . . , λ e ,λ e ]. Writing this polynomial in the form x n − c 1 x n−1 − · · · − c n−1 x − c n we obtain a linear recurrence relation u k+1 = c 1 u k + · · · + c n u k+1−n with coefficients c j ∈ Z[ρ 1 , . . . , ρ d , λ 1 ,λ 1 , . . . , λ e ,λ e ]. This yields a "formal" linear recurrence (c, u), where u 1 , . . . , u n are fresh variables. Call this the linear recurrence associated with R. Call its companion matrix the companion matrix of R and call its exponential polynomial where the φ j 's and ψ j 's are rational functions with rational number coefficients. It is clearly computable from R. Let R be a possible root configuration for an approximate root clustering C. Let (B a+1 , N a+1 ), . . . , (B b , N b ) be the list of complex clusters in C in the upper half plane. Let (B 1 , N 1 ), . . . , (B a , N a ) be the list of real clusters in C. Then R consists of possible root configurations R 1 , . . . , R a , C 1 , . . . , C b−a for the individual clusters. Let ρ 1 , . . . , ρ d be the real variables which occur in R and let λ 1 , . . . , λ e be the complex variables. Assume without loss of generality that there exists an integer w such that λ 1 , . . . , λ w belong to root configurations for real clusters and that λ w+1 , . . . , λ e belong to root configurations for complex clusters. Let β : {1, . . . , d} → {1, . . . , a} be the function that assigns to an integer j the root configuration R β(j) in which the variable ρ j occurs. Let γ : {1, . . . , w} → {1, . . . , a} be the function that assigns to an integer j the root configuration R γ(j) in which the variable λ j occurs. Let δ : {w + 1, . . . , e} → {1, . . . , b − a} be the function that assigns to an integer j the root configuration C δ(j) in which the variable λ j occurs. The domain D R ⊆ R d × C e of R is the set of all vectors (x 1 , . . . , x d , z 1 , . . . , z e ) ∈ R d × C e such that x 1 > · · · > x d , z j = z k for j = k, Im(z j ) > 0 for all j = 1, . . . , e, x j ∈ B β(j) for all j = 1, . . . , d, z j ∈ B γ(j) for all j = 1, . . . , w, and z j ∈ B a+δ(j) for all j = w + 1, . . . , e.
Thus, the domain of R is the set of all "valid assignments" to the variables ρ 1 , . . . , ρ d , and λ 1 , . . . , λ e . To any point (α, u) ∈ D R × R n corresponds a real linear recurrence which is obtained by substituting α for ρ 1 , . . . , ρ d , λ 1 , . . . , λ e and u for the variables representing initial values in the linear recurrence associated with R. We call this the linear recurrence associated with α with initial values u.
We conclude with two obvious observations: There exists a computable function ϕ : n∈N R 2n × (0, 1) → (0, +∞) with the following property: Let (c, u) be a linear recurrence with characteristic polynomial P . Let C be an approximate root clustering for P to accuracy ε > 0. Let R be a possible root configuration for C. Let α ∈ D R and let v ∈ R n with |v − u| < ε. Then the linear recurrence associated with α with initial values v is ϕ(c, u, ε)-close to (c, u). Moreover, for all (c, u) ∈ n∈N R 2n we have ϕ(c, u, ε) → 0 as ε → 0.
Lemma 8.4. Let C be an approximate root clustering for a polynomial P . Let R be a possible root configuration for C. Then the domain D R is definable in the first-order theory of the reals as a subset of R e × R 2d . Proof. Consider the following algorithm. For all p ∈ N do the following: (1) Compute an approximate root clustering C of the characteristic polynomial of (c, u) to accuracy 2 −p .
(2) Compute a rational box B of width 2 −p that contains the vector u of initial values.
(3) For all possible root configurations R of C do the following: (a) Symbolically compute the exponential polynomial solution of the linear recurrence associated with R. (b) Use the symbolic exponential polynomial solution to construct a sentence in the first-order theory of the reals which expresses that for all points α ∈ D R and all v ∈ B the formal leading coefficient of the largest real characteristic root in the exponential polynomial solution of the linear recurrence associated with α with initial values v is negative or there exists a characteristic root λ ∈ C \ [0, +∞) whose modulus is larger than any positive real characteristic root such that the coefficient of λ is non-zero. If there exist no real roots then only include the second condition. (c) Employ the Tarski-Seidenberg theorem to decide whether the above sentence is true.
If it is true continue with the next root configuration, or leave the loop if there are no root configurations left. If the sentence is false break out of the loop and continue with the next p. (4) If all sentences constructed in the above loop are true, then halt.
We claim that this algorithm halts on a given instance (c, u) if and only if the instance is a robust "no"-instance. By construction if the algorithm halts then the instance (c, u) either has no positive real characteristic roots or the formal leading coefficient of the largest positive real root ρ in the exponential polynomial solution of (c, u) is negative, or there exists a characteristic root λ ∈ C \ [0, +∞) with |λ| > ρ such that the coefficient of λ is non-zero. It follows from Lemma 3.2 that (c, u) is a "no"-instance of Ultimate Positivity.
Conversely, assume that (c, u) is a robust "no"-instance. Suppose for the sake of contradiction that the algorithm does not halt. Then by Lemma 8.3 there exists an arbitrarily small perturbation (d, v) of (c, u) such that either (d, v) has no positive real characteristic roots and the coefficients of all characteristic roots are zero or the formal leading coefficient of the largest positive real characteristic root ρ in the exponential polynomial solution of (d, v) is non-negative and the coefficient of every complex or negative characteristic root with strictly larger modulus is zero. If the former is the case then the sequence generated by (d, v) is identically equal to zero and hence a "yes"-instance of Ultimate Positivity. Let us now assume that (d, v) has a positive real characteristic root. By Proposition 3.3 a small perturbation of the exponential polynomial solution of (d, v) induces a small perturbation of the linear recurrence (d, v). By an arbitrarily small perturbation of the exponential polynomial we can ensure that the largest positive characteristic root ρ has a positive leading coefficient and that every complex or negative characteristic root with a non-zero coefficient has strictly smaller modulus than ρ. The resulting instance is then clearly a "yes"-instance of the Ultimate Positivity Problem. It follows that the original instance is not robust. Unlike the previous results Theorem 9.1 falls short of providing a satisfactory characterisation of the robust "no"-instances of Ultimate Positivity. It is therefore worth pointing out that at least the robust simple instances of the Ultimate Positivity Problem admit a nice characterisation. A simple instance is one whose characteristic roots are all simple. With the help of Corollary 4.4 these instances are much easier to computably recognise than the general ones.
Proposition 9.2. A simple instance of the Ultimate Positivity Problem is robust if and only if it satisfies one of the two following conditions: (1) It has a positive real dominant characteristic root ρ with |ρ| > |λ| for all other characteristic roots, and the coefficient of ρ in the exponential polynomial solution is non-zero. If the coefficient is negative then it is a robust "no"-instance. Otherwise it is a robust "yes"-instance.
(2) It has a characteristic root λ ∈ C \ [0, ∞) with |λ| > ρ for all positive characteristic roots ρ whose coefficient in the exponential polynomial polynomial is non-zero. In this case it is a robust "no"-instance.

On the measure of the robust instances
We observe that the simple "yes"-instances of the Positivity Problem and the Ultimate Positivity Problem have full measure. This is certainly false for the Skolem Problem, since the robust instances of the Skolem Problem are not even dense in R 2n . Proof. Consider all spaces R s,t = R s × C t with s + 2t = n. These can all be identified with the space R n . On each of these spaces we have a map h s,t : R s,t → R n which sends the vector (ρ 1 , . . . , ρ s , λ 1 , . . . , λ t ) to the n lowest coefficients of the monic polynomial (x − ρ 1 ) · · · · · (x − ρ s )(x − λ 1 )(x − λ 1 ) · · · · · (x − λ t )(x − λ t ).
As this map is again differentiable, it sends null sets to null sets. The set D s,t = (ρ 1 , . . . , ρ s , α 1 , . . . , α s ,λ 1 , . . . , λ t , β 1 , . . . , β t ) ∈ E s,t | α i = 0 for some i or β i = 0 for some i is clearly a null set, so that its image in R 2n under m s,t is again a null set. It follows that we may remove all sets of the form m s,t (D s,t ) from R 2n to be left with a set of full measure. In summary, the set of linear recurrences (c, u) whose characteristic roots are all distinct and have non-zero coefficients in the exponential polynomial solution has full measure. All of these linear recurrences are robust instances of the Ultimate Positivity Problem. The remaining non-robust instances of the Positivity Problem are "yes"-instances which have a zero. Within the space E s,t the linear recurrences which have a zero can be identified with the union of the sets Z k = (ρ 1 , . . . , ρ s , α 1 , . . . , α s , λ 1 , . . . , λ t , β 1 , . . . , β t ) ∈ E s,t | α 1 ρ k 1 + · · · + α s ρ k s + β 1 λ k 1 + β 1 λ 1 k + · · · + β t λ k t + β t λ t k = 0 .
Under the identification of E s,t with an open subspace of R 2n , each Z k is the zero set of a differentiable real-valued function f . Its gradient does not vanish in E s,t \ D s,t , so that Z k ∩ (E s,t ∩ D s,t ) has measure zero. It follows that the remaining non-robust instances also have measure zero. Thus everything is shown.