Polynomial-Time Tractable Problems over the -Adic Numbers
Abstract
We study the computational complexity of fundamental problems over the -adic numbers and the -adic integers . Guépin, Haase, and Worrell [9] proved that checking satisfiability of systems of linear equations combined with valuation constraints of the form for is NP-complete (both over and over ), and left the cases and open. We solve their problem by showing that the problem is NP-complete for and for , but that it is in P for and for . We also present different polynomial-time algorithms for solvability of systems of linear equations in with either constraints of the form or of the form for . Finally, we show how our algorithms can be used to decide in polynomial time the satisfiability of systems of (strict and non-strict) linear inequalities over together with valuation constraints for several different prime numbers simultaneously.
Keywords and phrases:
-adic numbers, existential theory, linear theory, constraint satisfaction, linear program feasibility, NP-hardness, polynomial-time algorithmFunding:
Manuel Bodirsky: The author received funding from the ERC (Grant Agreement no. 101071674, POCOCOP). Views and opinions expressed are however those of the authors only and do not necessarily reflect those of the European Union or the European Research Council Executive Agency.Copyright and License:
2012 ACM Subject Classification:
Theory of computation Logic and verification ; Theory of computation Complexity theory and logicAcknowledgements:
The authors would like to thank Philip Dittmann and Pierre Touchard for helpful discussions regarding quantifier elimination for .Editors:
Paweł Gawrychowski, Filip Mazowiecki, and Michał SkrzypczakSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
The satisfiability problem for systems of polynomial equations is an immensely useful computational problem; however, it has a quite bad worst-time complexity: it is NP-hard in arbitrary fields, undecidable over [14], not known to be decidable over , and not known to be in NP for [15]. In contrast, the satisfiability problem for systems of linear equations has a much better computational complexity: it can be solved in polynomial time over and, equivalently, over , and even over (see, e.g., [16]). It is therefore natural to search for meaningful extensions of the satisfiability problem for linear systems that retain some of the pleasant computational properties; in particular, extensions that remain in the complexity class P. It is also interesting to search for meaningful restrictions of the satisfiability problem for systems of polynomial equations that are no longer computationally hard.
One of the well-studied expansions of linear systems is the expansion by linear inequalities. Note that can be expressed over by (and it can also be expressed over and , but we then need a different formula), so this expansion can also be viewed as a restriction of the mentioned problem for systems of polynomial equations. The satisfiability problem for linear inequalities is known to be NP-complete over , but remains in P over and (e.g., via the ellipsoid method; see, e.g., [16]).
Other interesting, but less well-known expansions of the linear existential theory of and come from -adic valuations , for a prime number: For , one defines , and one extends this to by . The complexity of the satisfiability problem for systems of linear equalities combined with valuation constraints of the form for has been studied by Guépin, Haase, and Worrell [9]. Their results show that the problem over is in NP, even if the constants are represented in binary and is part of the input. This is remarkable, because for any that satisfies , the number has exponential size in , i.e., doubly exponential size in the input size. So we cannot simply guess and verify a solution in binary representation.
The results of Guépin, Haase, and Worrell are actually stated in a different setting: they phrase their result over the -adic numbers. The -adic valuation gives rise to a (non-archimedean) absolute value, defined for by . The field of -adic numbers is the completion of with respect to , similarly as is defined to be the completion of with respect to the standard absolute value. The ring of -adic integers is the subring of with domain , where denotes the natural extension of the -adic valuation to . Guépin, Haase, and Worrell [9] phrase their mentioned results as satisfiability problems over ; however, the problems are equivalent to the respective problems over ; see Proposition 6. They then use their algorithm to prove that the entire existential theory of in a suitable (linear) language is in NP.
Guépin, Haase, and Worrell moreover obtain some hardness results: they prove that the satisfiability problem for systems of linear equations over and over with valuation constraints of the form is NP-hard for . They also state: “While we believe it to be the case, it remains an open problem whether an NP lower bound can also be established for the cases .” [9, Remark 23].
We solve this problem and prove that satisfiability is NP-complete in the case for both and . For , however, we prove containment in P. Interestingly, our algorithm can also cope with constraints of the form , even if is larger than (Theorem 18). We also find an algorithm that can test the satisfiability of linear systems for in the presence of constraints of the form (Proposition 8); it is the combination of both upper and lower valuation bounds that makes the problem hard.
Our algorithm can also be used for the satisfiability problem for valuation constraints in combination with linear inequalities over . We prove that the satisfiability of systems of (weak and strict) linear inequalities together with various valuation constraints, for instance of the form , can be decided in polynomial time (Theorem 31). We do allow valuation constraints for different primes in the input; we allow binary representations of all coefficients in the input. The proof uses the fact that linear programming is in P [16, Section 13], and the approximation theorem for finitely many inequivalent absolute values for ([13, Ch. XII, Thm. 1.2]).
Related Work.
The computational complexity for satisfiability problems of semilinear expansions of linear inequalities over (equivalently: over has been studied in [3]. The results there state that every expansion of the satisfiability problem for linear inequalities by other semilinear relations is NP-hard, unless all relations are essentially convex, i.e., have the property that for any two , all but finitely many rational points on the line segment between and are also contained in ; moreover, if all relations are essentially convex, then the satisfiability problem is in P [3, Theorem 5.2]. This result has later been generalised to expansions of linear equalities instead of inequalities [12]. Valuation constraints are clearly not essentially convex; however, they are also not semilinear, and not even semialgebraic, and hence are not covered by the results from [3] and from [12].
Different computational tasks for the -adic numbers have been studied by Dolzmann and Sturm [5], and more recently by Haase and Mansutti [10]: they showed that whether a given system of linear equations with valuation constraints (where the valuation constraints in [10] are more expressive than the ones from [5], which are more expressive than ours) has a solution in for all prime numbers is in coNExpTime.
Another recent results is a polynomial-time algorithm for the dyadic feasibility problem [1], which is the problem of testing the satisfiability of systems of linear inequalities over ; it is unclear how to reduce this problem to the problems studied here and vice versa.
2 Preliminaries
We recall some well-known facts about -adic numbers, see e.g. [8], and how we treat them from a logic and a computational point of view. We write for the set of all prime numbers and we let .
2.1 and
As is by definition the completion of with respect to the -adic absolute value , it is a metric space whose topology is the -adic topology. The -adic absolute value on gives rise to the -adic valuation . It satisfies the following basic properties:
Lemma 1.
For all we have
-
, and
-
, with equality if .
The set forms a subring of called the ring of -adic integers. Its unique maximal ideal is generated by , and for every . This implies the following fact, which we will use several times:
Lemma 2.
For every with there exists a unique such that .
This further implies that every -adic number has a unique -adic expansion:
Lemma 3.
Every with is the limit (in the -adic topology) of a unique series of the form with for every .
As usual, we let (see Figure 1)
2.2 The structure
It will be convenient for some of our results and proofs to take a logic perspective on the -adic numbers; for an introduction to first-order logic, see [11]. A signature is a set of relation and function symbols, each equipped with an arity, which is a natural number. A (first-order) structure of signature consists of a set (the domain, typically denoted by the corresponding capital roman letter ), a function for each function symbol of arity (the case is allowed; in this case, we refer to as a constant symbol), and a relation for each relation symbol of arity ; we then say that denotes , and denotes .
A reduct of is a structure obtained from by taking a subset of the signature. If is a reduct of , then is called an expansion of . A substructure of is a structure with the same signature as and domain such that for every function symbol of arity , the function is the restriction of to , and for every relation symbol of arity , the relation equals .
A first-order -formula is a formula built from first-order quantifiers , Boolean connectives , and atomic formulas that are built from variables, the equality symbol , and the symbols from in the usual way; for a proper definition, we refer to any standard introduction to mathematical logic or model theory, such as [11].
Remark 4.
Often when -adic numbers are treated from a logic perspective, they are introduced as “two-sorted structures”, with one sort for the -adic numbers and one sort for the values, i.e., , and a function symbol for the valuation. For our purposes, however, usual first-order structures (as introduced above) are sufficient.
We work with the structure which has the domain and the signature
where
-
is a binary function symbol that denotes the addition operation of -adic numbers as introduced above;
-
is a constant symbol which denotes as introduced above;
-
is a unary relation symbol that denotes the unary relation ; , , and are defined analogously.
Sometimes, we specify structures as tuples; e.g., we write
and do not distinguish between function and relation symbols and the respective functions and relations. Atomic formulas that are built from the relations , , , and will be called valuation constraints. For , we also use the symbols as a shortcut for , and as a shortcut for .
2.3 Primitive Positive Formulas and CSPs
A formula is called primitive positive if it is of the form
where are atomic. In primitive existential formulas, are allowed to be negated atomic formulas as well, and existential formulas are disjunctions of primitive existential formulas. We use the concepts of primitive positive (and primitive existential, and existential) sentences, theories, definitions, definability, etc., as in the case of first-order logic (see, e.g., [11]), but restricting to primitive positive (primitive existential, and existential) formulas.
The computational problem of deciding the truth of a given primitive positive sentence in a fixed structure is called the constraint satisfaction problem (CSP) of . We refer to the quantifier-free part of as the instance of (i.e., the existential quantifiers will be left implicit), and a satisfying assignment to the variables will also be called a solution to .
If the signature of is infinite, then the computational problem is not yet well-defined, because we still have to specify how to represent the symbols from the signature in the input; the choice of the representation can have an impact on the complexity of the CSP. For the structure introduced above, a natural representation is to represent the relation symbols , , , and by the binary encoding of and . Note that holds if and only if . It will turn out that our polynomial-time algorithms can handle the constants stored in binary (which makes a doubly exponentially large number). The hardness results, however, always make use of only finitely many symbols in the signature, and hence hold independently from the choice of the representation. We will therefore allow binary representations for the values in the valuation constraints, since this allows the strongest formulations of our results.
2.4 Primitive positive interpretations
Primitive positive interpretations can be used to obtain complexity reductions between CSPs. For , a -dimensional primitive positive interpretation of a structure in a structure is given by a partial function from to such that the preimages under of the following sets are primitively positively definable in :
-
and the equality relation on ,
-
each relation of , and
-
each graph of a function of .
Lemma 5 (see, e.g., [2, Theorem 3.1.4]).
Let be a structure with a finite signature and a primitive positive interpretation in a structure . Then has a reduct with a finite signature such that there is a polynomial-time reduction from to .
3 versus
Note that the structure has a substructure with domain . All our algorithms in Section 4 and hardness proofs in Section 5 can be stated equivalently over the uncountable field or over . This is possible due to the following fact, which is a consequence of a result of Weispfenning [17].
Proposition 6.
For every , the structure and its substructure with domain have the same first-order theory.
Proof.
Let be the signature where is a constant symbol and is a binary relation symbol. Weispfenning [17] introduces a certain first-order -theory, which he calls ; both and give rise to models of if is interpreted as and if and only if . He then proves that admits quantifier elimination for linear formulas [17, Theorem 3.6]. That is, every -formula, for (where the symbol for multiplication is missing, which is why these formulas are called “linear”), is over equivalent to a quantifier-free -formula. Clearly, every atomic formula in the signature of can be defined by a -formula over . Let be a first-order sentence in the signature of , and let be the first-order -sentence obtained from by replacing all atomic formulas by their defining -formula. Then is either equivalent to over or it is equivalent to over . It follows that either both and its substructure with domain satisfy , or both and its substructure with domain satisfy , which is what we wanted to show.
Corollary 7.
For each , the existential theory of and the existential theory of the expansion of by all relations of the form , , and , for , are in NP.
Proof.
4 Algorithms
We first discuss how to measure the size of input instances to the computational problems studied in this text. For coprime, define , and define . Occasionally we might allow special coefficients like or ; we set . For matrices with coefficients in we let
where is the maximal number of rows or columns of one of the . This is our measure of size of a computational problem that is given by a set of rational matrices. A rational number in the input is interpreted as the matrix , and a finite set is interpreted as the matrix . For example, the input size of the algorithm in Proposition 8 below is .
We now present two algorithms. The first one, essentially for constraints of the form , is straightforward. The second one, mainly for constraints of the form , is more involved. In both settings, among all such valuation constraints on the same variable, there is a most restrictive one, which can easily be identified (in polynomial time), and therefore our algorithms are only formulated for one valuation constraint of the form (or of the form ) per variable.
Proposition 8.
There is a polynomial time algorithm that decides, given , , , , , and finite sets , whether there exists with such that and for .
Proof.
Let be the solution space of the system of linear equations. If , the algorithm outputs NO. Otherwise write
| (4.1) |
with linearly independent. One can check whether and otherwise compute such and in polynomial time: It is possible to compute one solution of in polynomial time [16, Corollary 3.3a]. Moreover, we can transform by elementary row operations into a matrix in row echelon form in polynomial time [16, Theorem 3.3], and from we can read off the rank of and a basis of
If let , otherwise let , so that the algorithm has to decide whether there exists with for every . If for some we have that and for every , then every satisfies , and the algorithm outputs NO. Otherwise, the algorithm outputs YES. To see that this is the correct answer, assume now that for every we have or for some . Let , where we set if , and let
We claim that
is a solution to all the constraints. For each let
If , then, by our assumption, . Otherwise,
for every , so that the for are pairwise distinct, and therefore, with ,
by the choice of . This shows in particular that , as required.
Remark 9.
We might not be able to compute a solution in the usual binary representation, as already for the single constraint the smallest solution (with respect to the -adic absolute value ) is . The algorithm not only works for the -adic valuation on but for arbitrary so-called discrete valuations on a computable field in which a solution of a given linear equation, a basis for the solution space of a homogeneous linear equation, and the valuation of an element can be computed; the resulting algorithm has a polynomial running time if these computations can be performed in polynomial time.
For our second algorithm we need some preparations. As the algorithm achieves a stronger result, we just mention without proof that the usual Hermite normal form allows to check in polynomial time whether has a solution (see, e.g., [16, Chapter 5]). However, already checking for solutions with for and for requires new ideas. Also, if we want to allow constraints of the form rather than just , one could replace by , but only as long as is polynomial in the input size. This would be the case if the would be coded in unary, but if the are coded in binary, as is our convention (see above), replacing by will blow up the coefficients of the linear equation exponentially. We therefore do not replace by but instead do some extra bookkeeping, exploiting the fact that although we might not be able to compute finite sums of elements of the form in polynomial time, we can at least compute their valuations.
Lemma 10.
There is a polynomial-time algorithm which, given , , and pairs , computes .
Proof.
First remove all with from the list. If then output . Replace each by to assume that . Let . If there exists a unique with , then output . Otherwise assume without loss of generality that . Then . Remove and from the list and append . Repeating this process will terminate after at most steps.
We also need a certain row echelon form. Before we give the definition, we present two motivating examples.
Example 11.
Suppose we want check whether a linear equation
| (4.2) |
with has a solution with for every . Such an exists if and only if : For any such ,
and conversely, if for some , we can let and set the other to (unless , in which case and we can let ).
Example 12.
Suppose we are given a nonempty set and want to check whether for some there exists satisfying (4.2). As long as , we can solve for and obtain
However, computing can be difficult from just the values for , since we are only guaranteed
and it can happen that the inequality is strict. The right hand side is certainly nonnegative as long as and for every . And in fact, when for every , the condition is also necessary for the left hand side to be nonnegative: If , then but for every , so the inequality is actually an equality. Therefore, as long as has minimal valuation among the , for any there exists satisfying (4.2) if and only if . This criterion easily generalizes to systems of several equations where is in row echelon form and each pivot element has minimal valuation in its row. This is what Definition 13 below expresses in the special case of the function .
Definition 13.
A pivot function is a function
such that if and only if . For a pivot function , we say that a matrix is in -minimal row echelon form if the following two conditions are satisfied.
-
(1)
is in row echelon form, i.e., setting for , there exists such that .
-
(2)
Each pivot element of minimizes within its row in the sense that for each ,
Example 14.
To explain why we need more general functions than just , suppose we replace the conditions in Example 12 by for some . Rewriting this as we see that we could instead consider the matrix given by and apply the criterion from Example 12. However, the numbers have exponential representation size. This can be avoided by replacing the condition that each pivot element of minimizes the function within its row by the condition that each pivot element of minimizes the function within its row, where the second argument indicates the column.
We write for the general linear group of degree over the field , i.e., the group of all invertible matrices in . If is a permutation, then denotes the corresponding permutation matrix. For a pivot function and , we write for the pivot function given by
If is a set, then denotes the set of non-empty words over the alphabet , i.e., the set of finite sequences of elements of .
Lemma 15.
Let and assume that for each , the map defined by is a pivot function. For every , , and there exist and such that is in -minimal row echelon form. If is computable in polynomial time, then such and can be computed in polynomial time.
Proof.
We describe how to get and in terms of elementary row and column operations, where the only elementary column operations allowed are swapping two columns. If , then we are done. Otherwise, possibly swap two rows to assume that for some . Choose such that (which implies in particular that , since by assumption). If , then swap the first column with the -th column. Add multiples of the first row to the other rows to achieve that for every . Reduce the fractions in the entries of the matrix. Now take the -submatrix with rows and columns , and iterate (extending each of the following row and column operations to the whole matrix). It is well-known that the representation size of the involved numbers stays polynomial (see, e.g., [16, Theorem 3.3]). This process terminates after at most steps, and the resulting matrix is of the desired form.
In the following, if and , we will write if for every .
Remark 16.
Note that if for some and , then has a solution such that if and only if has a solution such that (the map is a bijection between the solutions to the first system and the solutions to the second system).
The following result allows constraints of the form .
Theorem 17.
There is a polynomial-time algorithm that decides, given , , , , and , whether there exists with such that .
In the case , we can additionally treat constraints of the form . The tuple encodes which constraint applies to which variable. The following is a generalisation of Theorem 17.
Theorem 18.
There is a polynomial-time algorithm that decides, given , , , , , and , whether there exists with such that and, in the case , , and , also .
Proof.
We can assume that if for some , then and . Define the pivot function
where we use the convention . Clearly, is computable in polynomial time (as a function of , , and and ). By Lemma 15 we can compute and in polynomial time such that is in -minimal row echelon form. We may replace by , by , by , and by (adapting the idea from Remark 16 appropriately in the case ), and henceforth assume without loss of generality that and that is already in -minimal row echelon form.
Let and be as in Definition 13. The algorithm then outputs YES if
-
(1)
for every , and
-
(2)
for every ,
and otherwise it outputs NO. Note that Condition (2) can be checked in polynomial time by Lemma 10. Since is in row echelon form, Condition (1) holds if and only if there exists with . To see that the algorithm gives the correct answer, we have to show that (1) and (2) holds if and only if there exists with , and for every with .
For the forward direction, we assume that (1) and (2) hold and construct as follows. For each , let if , and otherwise let . For define iteratively by
| (4.3) |
Since is in row echelon form, the so constructed satisfies . Moreover, for each one has by definition that and if , and one needs to show that the latter conditions also hold for , using that is in -minimal row echelon form.
The full proof can be found in the arXiv-version of the paper [6].
5 NP-hardness and reductions
For a set and , we use as a relation symbol for the unary relation , and later write instead of .
Lemma 19.
Let be a finite cyclic group of order . Then is NP-hard. In particular, the primitive existential theory of is NP-hard.
Proof.
The primitive positive formula defines the binary relation over . A finite graph with vertices and edges can be colored with colors if and only if is satisfiable in . For , the graph coloring problem is NP-hard [7, Section 4], so the claim follows from Lemma 5.
Lemma 20.
For every prime number and every the structure has a primitive positive interpretation in .
Proof.
The quotient map does the job: As is primitively positively definable in , also the pullback of the graph of is primitively positively definable in . Finally, is a primitive positive definition in of the unary relation .
Proposition 21.
The primitive positive theory of is NP-hard for , and is NP-hard for all prime numbers .
Proof.
If , then is NP-hard by Lemma 19. Moreover, by Lemma 20 it has a primitive positive interpretation in and so is NP-hard by Lemma 5.
If is an arbitrary prime number, then is cyclic of order and we have that is NP-hard by Lemma 19. The structure has a primitive positive interpretation in by Lemma 20, and hence is NP-hard by Lemma 5.
Let be a positive integer. In primitive positive formulas over structures whose signature contains and , we use as a shortcut for , and as a shortcut for . We also freely use the term for ; if , then this can be replaced by , and if , then this can be rewritten into a proper primitive positive formula by introducing a new existentially quantified variable , replacing by , and adding a new conjunct .
Lemma 22.
For , the primitive positive formula
defines the relation in . The primitive positive formula
defines the relation in .
Proof.
First let . Suppose that is such that . Let be such that (Lemma 2). Since , there exists , and with and . Then setting to and to , all the three conjuncts of the given formula are satisfied. Conversely, if , then .
For , if is such that , then with and . Conversely, if are such that , then by Lemma 2, so if , then , hence .
The following solves an open problem from [9, Remark 23] for ; the NP-hardness for was already shown in [9, Prop. 22].
Corollary 23.
Let be prime. Then is NP-hard.
Proof.
Note that has a primitive positive interpretation in , because is primitive positive definable in by Lemma 22. Since is NP-hard by Proposition 21, the statement follows from Lemma 5.
Lemma 24.
Let . The relation has the primitive positive definition
in , and in the primitive positive definition
Proof.
If , then with , i.e., (Lemma 2). Conversely, if with , then .
Note that the primitive positive formula in Lemma 24 has exponential representation size, since is a doubly exponentially large number. However, in all hardness proofs where we use this formula, will be a constant and hence the length of the formula will be a constant as well.
Lemma 25.
For all , the relation has the primitive positive definition
in , and in the primitive positive definition .
Proof.
If , then for every , and if , then for every . Conversely, if there exists with (Lemma 2). In , just means , i.e., with .
Lemma 26.
Let . Then has the primitive positive definition
in for , and in the primitive positive definition
Proof.
First let . If , then for every . Conversely, if , then either , in which case for every , or . In this case, there exists (exactly) one with (Lemma 2), and for all . Such an exists by the assumption that .
Now let . If , then , and if , then (Lemma 2). Conversely, if , then .
Theorem 27.
Let be such that . Let be a reduct of whose signature contains . Then is in if is a reduct of one of the structures
| (5.1) | |||
| (5.2) |
and is NP-complete otherwise.
Proof.
The containment of in NP follows from Corollary 7. If contains for some , then the relation is primitively positively definable in and is NP-hard by Corollary 23 and Lemma 5. So suppose that does not contain for any . If does not contain for any , then is a reduct of the structure in (5.1). In this case, the polynomial-time tractability of follows from Proposition 8 and Proposition 6. So suppose that contains for some . If also contains for some , then the relation is primitively positively definable as well, and we are again done. If contains for some , then is primitively positively definable in by Lemma 26, and we are in a case that we have already treated. Otherwise, contains neither of , , and for any , and hence is a reduct of the structure (5.2). The polynomial-time tractability in this case follows from Theorem 18 and Proposition 6.
Theorem 28.
Let be a reduct of whose signature contains . Then is in if is a reduct of one of the structures
| (5.3) | |||
| (5.4) |
and is NP-complete otherwise.
Proof.
The containment of in NP follows again from Corollary 7. If contains neither nor for any , then is a reduct of the structure in (5.4), and the polynomial-time tractability of follows from Theorem 18 and Proposition 6. Otherwise, the relation is primitively positively definable in by Lemma 26. If additionally is primitively positively definable in , then the structure has a primitive positive interpretation in , and the NP-hardness of follows from Proposition 21 via Lemma 5. If not, then by Lemma 22 we may assume that contains neither nor for any . In this case, is a reduct of the structure in (5.3), and the polynomial-time tractability of follows from Proposition 8 and Proposition 6.
6 Combining several primes, and the ordering
The complexity classification results for reducts of from Theorems 27 and 28 translate to complexity classification results for expansions of by relations from
for fixed , via Proposition 6. Interestingly, we can even derive results about expansions of by relations from . Moreover, we may also obtain results about expansions of and of . The key to this is the following consequence of the approximation theorem for absolute values. As in the introduction, define for .
Lemma 29.
Let , , , , and let be distinct prime numbers. For each let be such that . Then there exists with such that for every and we have and .
Proof.
Write the solution space of as in (4.1). The map , is a homeomorphism with respect to the real topology and with respect to each -adic topology. We can therefore assume without loss of generality that , i.e., that and . The claim is then precisely the statement of the approximation theorem for finitely many inequivalent absolute values on a field ([13, Ch. XII, Thm. 1.2]) in the case , applied for each .
Let be the expansion of by new relations for .
Proposition 30.
Let be a conjunction of atomic -formulas. Let be all conjuncts of formed with the symbol , let be all conjuncts of formed with symbols from , and let be all the conjuncts formed with . Then is satisfiable in if and only if is satisfiable in and is satisfiable in for each .
Proof.
The forward implication is trivial. For the converse, let be a satisfying assignment for , let denote the (finite) set of prime numbers such that contains symbols from , and for each let be a satisfying assignment for . The set of satisfying assignments for is open in the real topology, and the set of satisfying assignments for is open in the -adic topology, for each . In particular, there exists such that the whole box is contained in , and similarly for every . Therefore, by Lemma 29, there exists such that satisfies and , hence is a satisfying assignment for .
Proposition 30 only works for strict inequalities, and the corresponding statement would be false for weak inequalities. Algorithmically, however, there is a way to reduce the problem to the satisfiability problem for strict inequalities, and we obtain the following result.
Theorem 31.
Let be a reduct of whose signature contains . If contains
-
for some and with , or
-
and a relation from for some and with ,
-
a relation from and a relation from for some ,
then is NP-complete; otherwise, is in P.
Proof.
If contains a symbol of the form for some , or contains and a symbol of the form or , then the NP-hardness of follows from Theorem 27 and Proposition 6. Moreover, if the signature contains a symbol of the form or and a symbol of the form or , then the NP-hardness of follows from Theorem 28 and Proposition 6. Otherwise, let be an instance of . Similarly to Proposition 30 let
-
be the conjuncts of formed with the symbol ,
-
the conjuncts formed with ,
-
the conjuncts formed with symbols from , and
-
the conjuncts formed with .
Let be the set of such that a symbol from occurs in . For any instance denote by the instance obtained by replacing all by .
We first check with known methods whether there is a solution for (see, e.g., [16, final remark in Section 13.4]). If there is no solution, then output NO. Otherwise, let be the set of conjuncts of . We then test for each whether the formula is still satisfiable (again, using known methods). If is unsatisfiable, then every solution of must satisfy the formula obtained from by replacing with . We then recursively run the entire algorithm on the formula where we replace the conjunct by . Otherwise, if for every , the formula has a solution , then has a solution as well. This is clear if ; otherwise, we note that the function given by applied componentwise preserves , , , and strongly preserves in the sense that if , …, and for at least one . This shows that we may take .
We run the polynomial-time algorithm from Theorem 28 on and for each the polynomial-time algorithm from Theorem 27 on . If one of these algorithms returns NO, then is unsatisfiable by Proposition 6. If all of the algorithms return YES, then has a solution by Proposition 6 and Proposition 30, and therefore also has a solution.
Finally, is in NP as can be shown by repeating the argument from the previous paragraphs for an instance of and using Corollary 7 instead of the polynomial-time algorithms.
7 Conclusions and an open problem
We have presented polynomial-time algorithms for the satisfiability problem of systems of linear equalities combined with various valuation constraints. For such systems, the satisfiability in is equivalent to satisfiability in (Proposition 6). We also prove the matching NP-hardness results, answering open questions from [9] (Theorem 27 and Theorem 28; also see Table 1). Our results can be combined with the polynomial-time tractability result for the satisfiability of (strict and weak) linear inequalities over , and we may even solve valuation constraints for different prime numbers simultaneously (Theorem 31). Our polynomial-time tractability result for linear inequalities with valuation constraints of the form , for constants given in binary, would also follow from a positive answer to the following question, which remains open.
Question 32.
Is there a polynomial-time algorithm for the satisfiability problem of systems of weak linear inequalities where the coefficients of the inequalities are of the form where is represented in binary?
Such an algorithm would also imply a polynomial-time algorithm for mean-payoff-games (see [4] for related reductions) which is a problem currently not known to be in P.
| , | , | , | , | |
| P: Gauss algorithm | P: Hermite normal form | |||
| P: 18 | ||||
| NP-hard: def. 22 | P: reduce to 24 | NP-hard: 21 | P: reduce to 24 | |
| NP-hard: solves | P: 18 | NP-hard: solves | P: 18 | |
| P: special case of | NP-hard: same as | P: same as | ||
| P: special case of | NP-hard: 21 | |||
| P: 8 | NP-hard: solves | |||
| P: 8 or reduce to via 25 | P: reduces to via 25 | |||
| P: 8 | NP-hard: def. via 26 | |||
References
- [1] Ahmad Abdi, Gérard Cornuéjols, Bertrand Guenin, and Levent Tunçel. Dyadic linear programming and extensions. Mathematical Programming, 2024. doi:10.1007/s10107-024-02146-4.
- [2] Manuel Bodirsky. Complexity of Infinite-Domain Constraint Satisfaction. Lecture Notes in Logic (52). Cambridge University Press, Cambridge, United Kingdom; New York, NY, 2021. doi:10.1017/9781107337534.
- [3] Manuel Bodirsky, Peter Jonsson, and Timo von Oertzen. Essential convexity and complexity of semi-algebraic constraints. Logical Methods in Computer Science, 8(4), 2012. An extended abstract about a subset of the results has been published under the title Semilinear Program Feasibility at ICALP’10. doi:10.2168/LMCS-8(4:5)2012.
- [4] Manuel Bodirsky, Georg Loho, and Mateusz Skomra. Reducing stochastic games to semidefinite programming. In the proceedings of the International Colloquium on Automata, Languages, and Programming, ICALP, 2025. https://arxiv.org/abs/2411.09646. doi:10.48550/arXiv.2411.09646.
- [5] Andreas Dolzmann and Thomas Sturm. P-adic constraint solving. In Proceedings of the 1999 International Symposium on Symbolic and Algebraic Computation, ISSAC ’99, pages 151–158, New York, NY, USA, 1999. Association for Computing Machinery. doi:10.1145/309831.309894.
- [6] Arno Fehm and Manuel Bodirsky. Polynomial-time tractable problems over the -adic numbers, 2025. doi:10.48550/arXiv.2504.13536.
- [7] Michael Garey and David Johnson. A guide to NP-completeness. CSLI Press, Stanford, 1978.
- [8] Fernando Gouvêa. p-adic Numbers. Springer, 1997.
- [9] Florent Guépin, Christoph Haase, and James Worrell. On the existential theories of Büchi arithmetic and linear -adic fields. In Logic in Computer Science, LICS. IEEE, 2019. doi:10.1109/LICS.2019.8785681.
- [10] Christoph Haase and Alessio Mansutti. On Deciding Linear Arithmetic Constraints Over p-adic Integers for All Primes. In Filippo Bonchi and Simon J. Puglisi, editors, 46th International Symposium on Mathematical Foundations of Computer Science (MFCS 2021), volume 202 of Leibniz International Proceedings in Informatics (LIPIcs), pages 55:1–55:20, Dagstuhl, Germany, 2021. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.MFCS.2021.55.
- [11] Wilfrid Hodges. A shorter model theory. Cambridge University Press, Cambridge, 1997.
- [12] Peter Jonsson and Johan Thapper. Constraint satisfaction and semilinear expansions of addition over the rationals and the reals. CoRR, abs/1506.00479, 2015. arXiv:1506.00479.
- [13] Serge Lang. Algebra. Springer, 2002. Revised third edition.
- [14] Yuri Matiyasevich. Enumerable sets are Diophantine. Doklady Akademii Nauk SSSR, 191:279–282, 1970.
- [15] Marcus Schaefer and Daniel Štefankovič. Fixed points, Nash equilibria, and the existential theory of the reals. Theory of Computing Systems, pages 1–22, 2015.
- [16] Alexander Schrijver. Theory of Linear and Integer Programming. Wiley - Interscience Series in Discrete Mathematics and Optimization, 1998.
- [17] Volker Weispfenning. The complexity of linear problems in fields. Journal of Symbolic Computation, 5(1):3–27, 1988. doi:10.1016/S0747-7171(88)80003-8.
