WorksComputer Science
On Presburger Arithmetic Expanded with Prime Numbers
Abstract
We prove unconditionally that the first-order theory of Presburger arithmetic expanded by a predicate for the primes is undecidable. Bateman, Jockusch and Woods proved this in 1993 assuming Dickson's conjecture. We use the counter-machine framework of Karimov, Nieuwveld and Ouaknine and their idea of using `arbitrary permutations', and the number-theoretic input comes from Hildebrand and Maier's 1988 proof that the limit points of consecutive normalised prime gaps have positive measure. We use a discrete version, which they obtain before limits are taken. The key lemma is that although Hildebrand and Maier's result does not seem to give arbitrary permutations of consecutive prime gaps, it gives arbitrary permutations for the differences for two finite blocks of consecutive primes and . Moreover, with the same key lemma, we show that Presburger arithmetic expanded with the function that maps to the th prime defines multiplication.
Introduction
Presburger arithmetic, the first-order theory of , denoted FO, is well known to be decidable. Naturally, the question arose of which seemingly weaker versions of multiplication can be added to Presburger arithmetic to obtain undecidability and which define multiplication. For instance, expanding Presburger arithmetic with a predicate for divisibility, coprimality, or the set of squares makes multiplication definable; see the survey of Bès [3] for these and other examples. One obvious candidate remained open: Is access to knowing whether a number is prime sufficient to establish undecidability? Can one define multiplication?
Bateman, Jockusch, and Woods [2] studied two expansions of Presburger arithmetic by the predicate P of primes using Dickson’s conjecture, which is also sometimes referred to as the linear case of Schinzel’s Hypothesis H.
Conjecture 1.1 (Dickson’s conjecture). Let and such that for every prime number , there is a number such that none of is divisible by . Then there are infinitely many such that are simultaneously prime.
The conjecture is strong: it implies the twin prime conjecture. Bateman, Jockusch, and Woods show that FO is decidable assuming Dickson’s conjecture (and even more strongly, that the monadic second-order theory of this expansion would be decidable). An unconditional proof of this decidability would effectively settle the twin prime conjecture. Moreover, they showed that Dickson’s conjecture implies that multiplication is definable in , which implies the theory is undecidable. They showed that for any , there are numbers and such that , , satisfies the premise of the conjecture while no number in between is ever prime. Hence, one gets access to the image of a quadratic polynomial and thus multiplication.
Assuming Dickson’s conjecture, Kaplan and Shelah [8] showed that FO is decidable and does not define order. As order is implicit in Presburger arithmetic via , order seems essential for undecidability. For instance, Goldbach’s conjecture is easily expressed in FO, whereas, in Kaplan and Shelah’s structure, one can naturally express only a weaker version: every even number is a sum or difference of two primes.
An unconditional proof of the undecidability of FO has remained open; the problem is discussed by Bès [3], Cégielski, Richard, and Vsemirnov [4], Kaplan and Shelah [8], and Karimov, Nieuwveld, and Ouaknine [10]. We show undecidability in this note.
Theorem 1.2. The theory FO is undecidable.
Despite establishing undecidability, we do not obtain a definition of multiplication. We also study the theory FO, where is the th prime, whose decidability was questioned in [3, 4]. So . To make total, we set , but this choice does not matter.
Theorem 1.3. Multiplication is definable in the structure .
Intuition of the proof.
We prove Theorem 1.2 using the recent framework of Karimov, Nieuwveld and Ouaknine [10]: it is enough to show that a structure simulates counter machines. A counter machine is a (Minsky) machine with finitely many states and counters that can be incremented, decremented and tested for zero, whose halting problem is undecidable in general. A structure simulates counter machines if every counter machine can be translated into a first-order sentence that holds if and only if the machine halts. Halting asserts the existence of an encoded trace of the halting computation, i.e., the successive configurations of the machine for which initial and halting configurations and a transition relation must be first-order expressible. Karimov et al. informally call structures that simulate counter machines rich as they need to realise every suitable pattern of some sort. Although the primes are expected to behave quite randomly within the set of natural numbers, controlling exact prime configurations remains difficult.
A first attempt would be to look at the results on arithmetic progressions in primes of Green and Tao [5]. Kaplan and Shelah [9 Propostion 3.6] note that it implies that for any set , there are infinitely many numbers such that for , is prime if and only if . That is, the primes contain every finite pattern. However, we need to multiply by the parameter , which is impossible in Presburger arithmetic.
A second attempt would be to look at consecutive prime gaps and presume that they have arbitrary permutations. That is, for any and permutation of , there is a finite sequence of consecutive primes such that . In this case, we would only need inequalities and subtraction, which are definable in , and the argument of [10] would apply almost verbatim.
Unfortunately, it is not known whether consecutive prime gaps have arbitrary permutations. There are two kinds of results in this direction. First, monotone patterns occur infinitely often [1], but we are not aware of any generalisation to any other fixed pattern. Secondly, there is a result by Hildebrand and Maier.
Theorem 1.4 (Hildebrand–Maier [6]). Let . Then there is a constant such that for all sufficiently large , the set of limit points of
has Lebesgue measure at least .
If were larger than , consecutive prime gaps would have arbitrary permutations. Although is not explicitly computed, it appears to be much smaller, and so we cannot conclude arbitrary permutations. Differences of two limit points would allow arbitrary permutations, but the two limit points may arise at unrelated scales . We therefore work with the discrete count (Theorem 4.1), where any two runs, i.e., finite blocks of consecutive primes, can be compared directly.
Lemma 1.5 (Two-run lemma). For every and every permutation of there are two runs
with the following property. Put and . Then
(a) , and
(b) every gap of the second run exceeds : for .
From this lemma, item (a) gives arbitrary permutations while item (b) allows us to determine whether a given and have the same index and thus whether their difference is used in the encoding. We make this precise in the proof of Theorem 1.2 in § 2.
The functional version of the result, Theorem 1.3, follows similarly. Consider two runs and , and let . By Lemma 1.5, there are and such that for , holds exactly when is a square. Conversely, if holds and for all that are consecutive numbers satisfying , any number satisfying is a square. Hence, multiplication is definable.
From two runs to undecidability
We prove Theorem 1.2 using the counter-machine framework of [10] while assuming Lemma 1.5.
Counter-machine simulation
We recall the notion from [10 §1.2], specialised to index tuples of length one. A structure with domain simulates counter machines if there are , maps and (the encoded sequence and the elements representing its terms, respectively), and formulas , (computable from ), , and , such that for all :
(1) Seq is surjective onto the finite sequences of natural numbers;
(2) , and the entries of are distinct;
(3) Representation: holds if and only if occurs in ;
(4) Constant value : holds if and only if for some with ;
(5) Successor: holds if and only if and for some ;
(6) Increment: holds if and only if , and ;
(7) Equality: holds if and only if , and .
Theorem 2.1 ([10 Theorem 2]). Every structure that simulates counter machines has an undecidable first-order theory.
The proof of this theorem translates a given counter machine into a first-order sentence that simulates its trace. To check that this is indeed a valid trace, one only needs to compare nearby terms in the trace. If the counter machine halts, this trace is finite, which some witnesses. That is, holds, and for this , is exactly the trace of the counter machine and encodes the corresponding sequence over which one iterates in the first-order formula.
In Presburger arithmetic, we write for , for , and for the unique satisfying when . Statements such as “ is a prime in ” and “ are consecutive primes” are thus first-order.
Applying counter machines to prime gaps
We use and write . For primes and write if , that is,
Let be the formula stating that and that for every prime there is exactly one prime with . For valid and a prime we call this the match of and write . Both Valid and the graph of Match are first-order definable in . Put . We use only in comparisons: stands for the formula , and similarly for .
Proposition 2.2. If Lemma 1.5 holds, then simulates counter machines.
Proof. If Valid(x) fails, let Seq(x) and Rep(x) be empty sequences. Otherwise, call the primes in marks, let Rep(x) list the primes in in increasing order, and set
Writing for elements of Rep(x), the formulas are:
: Valid(x), , and ;
: , and exactly marks satisfy ;
: , , , and no prime lies strictly between and ;
: , , and exactly one mark satisfies ;
: , , and no mark satisfies or .
“Exactly ” is a first-order statement computable from .
Items (2)–(7). If Valid(x) fails, every formula is false and both sequences are empty. Otherwise (2)–(5) are immediate. For (6) and (7), let and . If , then is the number of marks with . If instead , and no mark satisfies . Hence holds if and only if . Likewise holds if and only if , by the same argument applied to both orders of and .
Item (1). The empty sequence comes from any x with Valid(x) false. Let be non-empty, choose , and set . Order the positions by the keys
The keys are distinct, and exactly of the first positions have a key below . Let list the positions in increasing order of key, and let and be the runs given by Lemma 1.5 applied to . Put
For we have , since . For we have by (b), so . Hence is valid and , so . The marks are and . By (a), holds if and only if , so .
Proof of Theorem 1.2, given Lemma 1.5. Combine Proposition 2.2 with Theorem 2.1.
Remark 2.3. Inspecting the sentence constructed in the proof of [10 Theorem 2] shows that it has the form with a -formula. Hence already the -fragment of is undecidable, where the 6 comes from . In fact can be eliminated: taking and applying Lemma 1.5 with in place of , with the extra index placed last in , so that , the interval contains exactly in the proof of Proposition 2.2, since and the gaps of the -run exceed . This gives the -fragment. The number of inner quantifiers in our construction is unbounded, since uses quantifiers of both kinds.
The nth prime function and multiplication
We next prove Theorem 1.3 while assuming Lemma 1.5. We first recall a classical result from Putnam [11]. Let be the predicate for the square numbers.
Lemma 3.1. The structure defines multiplication.
Proof. First note that if and only if is a square, is also a square and no square lies in between. Then the identity shows that if and only if .
Proof of Theorem 1.3, given Lemma 1.5. By Lemma 3.1 it suffices to define . The positive squares are the sequence , , , which we encode as follows. For write , and let be the formula
Let be the formula
Note that holds whenever , and implies . If are consecutive among the numbers satisfying , then .
If holds, then and every number that satisfies is a square. Indeed, if held, the next number satisfying would be 5, contradicting . Similarly, cannot hold. By induction along the recurrence, holding means is a square.
Conversely, let , and let list first the squares in , then 1, then the non-squares in . Lemma 1.5 applied to gives runs of consecutive primes, so let and for suitable . By (a), holds exactly for the squares , so holds. Therefore,
Proof of Lemma 1.5
We begin with the discrete version of Hildebrand and Maier’s Theorem 1.4. For a run , define its gap vector as . For , , , and , let
A box is hit if it contains the gap vector of a run of consecutive primes.
Theorem 4.1 ([6]). For every there are and such that for all there are arbitrarily large (depending on ) for which at least of the boxes are hit.
This is precisely inequality (17) in Hildebrand and Maier’s paper. To recall the argument, they construct a matrix containing tuples of consecutive primes (their equation (14)), and show that each of the boxes contains at most such tuples (their equation (19)). Hence boxes contain such tuples, proving (17). This holds at a single value of , and for arbitrarily large values of .
The next lemma is a pigeonhole-principle argument showing that, for a given vector , a large enough subset of contains two points that differ by a small multiple of .
Lemma 4.2. Let , , and with . Then there are and with .
Proof. The lines partition the box . Each line meets in consecutive points for some and . Cut each such progression into pieces of consecutive points, the first possibly shorter. As two points in the same piece differ by with , it suffices to show there are fewer than pieces.
The number of pieces is at most (at most the number of pieces containing no ) plus the number of lines meeting (the number of pieces containing a ). A point satisfies , so for some with , or for some with . This occurs at most times, and so there are at most pieces. □
We can now prove Lemma 1.5.
Proof of Lemma 1.5. Fix and a permutation of , let be the desired rank of , and set . The idea is to find two runs and where we set for . Then we ensure that each is, up to a common scaling factor, approximately , with an error of less than on the same scale. That is, the gap vectors and differ by roughly a multiple of , where . To find such runs, we apply Lemma 4.2 to the boxes hit in Theorem 4.1.
Let be as in Theorem 4.1, an integer with , and an integer with
Take and as in Theorem 4.1, let be the set of indices of hit boxes , let those with for all , and write for the side length of the boxes. Then, . As , at most boxes have some , so
Lemma 4.2 gives with . Take a run with gap vector in , and a run with gap vector in . Since the side-length boxes are steps apart in coordinate , we have
Summing over gives two telescoping sums, which imply
If , then , which proves (a). For (b), , while every gap of the -runs is at least . □ৰাকী
Discussion
The proof of Theorem 1.2 does not show that multiplication is definable in , while Theorem 1.3 shows it is definable in . The key difference is that the functional version allows arithmetic on prime indices. Hence, we expect that the techniques from this note cannot settle definability of multiplication in , and that one needs more precise information about linear relations between primes such as those coming from Dickson’s conjecture.
By Remarks 2.3 and 3.2, the -fragments of both and are undecidable. We expect that these results are not optimal, and that the -fragments of both theories are also undecidable. For example, assuming Dickson’s conjecture, for every finite sequence of natural numbers, there is a number such that for . Using the techniques from § 2.1, we can encode a given counter machine in the -fragment of , giving undecidability. Meanwhile, we expect that the existential fragment of is decidable again assuming Dickson’s conjecture.
Although order is implicit in Presburger arithmetic, it is also definable in the structure : By a result of Tao [12], every odd number at least 3 is the sum of at most 5 primes, so every non-negative even number is the sum of at most 6 primes. Thus, if and only if is the sum of at most 6 primes. Hence, we can recover the natural numbers in the structure , making its first-order theory undecidable. Definability of order seems necessary, as Kaplan and Shelah [8] showed that is decidable assuming Dickson’s conjecture.
Acknowledgements
The author was supported by the Glasstone Benefaction, University of Oxford [Violette and Samuel Glasstone Research Fellowships in Science 2025].
AI declaration. Claude Opus 5.5 was used to prepare this note. In particular, when prompted with Lemma 1.5 and Hildebrand and Maier’s paper [6], it returned a first draft of the proof presented in § 3.1. The remainder of the proof is our own, although AI helped frame and smooth our construction. Furthermore, AI was used to proofread this note and suggest improvements. The author takes full responsibility for the correctness of the results.
References
Department of Computer Science, University of Oxford
References
- [1]W. D. Banks, T. Freiberg, and C. L. Turnage-Butterbaugh, Consecutive primes in tuples, Acta Arith. 167 (2015), 261–266.DOI
- [2]P. T. Bateman, C. G. Jockusch, and A. R. Woods, Decidability and undecidability of theories with a predicate for the primes, J. Symbolic Logic 58 (1993), 672–687.DOI
- [3]A. Bès, A survey of arithmetical definability, Bull. Belg. Math. Soc. Simon Stevin (2001), no. suppl., 1–54, Suppl. (A tribute to Maurice Boffa).
- [4]P. Cégielski, D. Richard, and M. Vsemirnov, On the additive theory of prime numbers, Fund. Inform. 81 (2007), 83–96.DOI
- [5]B. Green and T. Tao, Linear equations in primes, Ann. of Math. (2) 171 (2010), 1753–1850.arxiv.org/abs/math/0606088
- [6]A. Hildebrand and H. Maier, Gaps between prime numbers, Proc. Amer. Math. Soc. 104 (1988), 1–9.DOI
- [8]I. Kaplan and S. Shelah, Decidability and classification of the theory of integers with primes, J. Symbolic Logic 82 (2017), 1041–1050.arxiv.org/abs/1601.07099
- [9]Itay Kaplan and Saharon Shelah, Decidability and classification of the theory of integers with primes, Journal of Symbolic Logic 82 (2017), no. 3, 1041–1050.arxiv.org/abs/1601.07099
- [10]T. Karimov, J. J. Nieuwveld, and J. Ouaknine, Rich sequences and decidability of arithmetic theories, 2026, Preprint, arXiv:2609.20415.arxiv.org/abs/2609.20415
- [11]H. Putnam, Decidability and essential undecidability, J. Symbolic Logic 22 (1957), 39–54.DOI
- [12]T. Tao, Every odd number greater than 1 is the sum of at most five primes, Math. Comp. 83 (2014), 997–1038.arxiv.org/abs/1201.6656