RANK LOGIC IS DEAD, LONG LIVE RANK LOGIC!

Abstract Motivated by the search for a logic for polynomial time, we study rank logic (FPR) which extends fixed-point logic with counting (FPC) by operators that determine the rank of matrices over finite fields. While FPR can express most of the known queries that separate FPC from Ptime, almost nothing was known about the limitations of its expressive power. In our first main result we show that the extensions of FPC by rank operators over different prime fields are incomparable. This solves an open question posed by Dawar and Holm and also implies that rank logic, in its original definition with a distinct rank operator for every field, fails to capture polynomial time. In particular we show that the variant of rank logic ${\text{FPR}}^{\text{*}}$ with an operator that uniformly expresses the matrix rank over finite fields is more expressive than FPR. One important step in our proof is to consider solvability logic FPS which is the analogous extension of FPC by quantifiers which express the solvability problem for linear equation systems over finite fields. Solvability logic can easily be embedded into rank logic, but it is open whether it is a strict fragment. In our second main result we give a partial answer to this question: in the absence of counting, rank operators are strictly more expressive than solvability quantifiers.


Introduction
"Le roi est mort, vive le roi!" has been the traditional proclamation, in France and other countries, to announce not only the death of the monarch, but also the immediate installment of his successor on the throne. The purpose of this paper is to kill the rank logic FPR, in the form in which it has been proposed in [7], as a candidate for a logic for Ptime. The logic FPR extends fixed-point logic by operators rk p (for every prime p) which compute the rank of definable matrices over the prime field F p with p elements. Although rank logic is well-motivated, as a logic that strictly extends fixed-point logic with counting by the ability to express important properties of linear algebra, most notably the solvability of linear equation systems over finite fields, our results show that the choice of having a separate rank operator for every prime p leads to a significant deficiency of the logic. Indeed, it follows from our main theorem that even the uniform rank problem, of computing the rank of a given matrix over an arbitrary prime, cannot be expressed in FPR and thus separates FPR from Ptime. This also reveals that a more general variant of rank logic, which has already been proposed in [15,16,18] and which is based on a rank operator that takes not only the matrix but also the prime p as part of the input, is indeed strictly more powerful than FPR.
Our result thus installs this new rank logic, denoted FPR * , as the rightful and distinctly more powerful successor of FPR as a potential candidate for a logic for Ptime.
A logic for polynomial time The question whether there is a logic that expresses precisely the polynomial-time properties of finite structures is an important challenge in the field of finite model theory [10,11]. The logic of reference for this quest is fixed-point logic with counting (FPC) which captures polynomial time on many interesting classes of structures and is strong enough to express most of the algorithmic techniques leading to polynomialtime procedures [5]. Although it has been known for more than twenty years that FPC fails to capture Ptime in general, by the fundamental CFI-construction due to Cai, Fürer, and Immerman [4], we still do not know many properties of finite structures that provably separate FPC from Ptime. The two main sources of such problems are tractable cases of the graph isomorphism problem and queries from the field of linear algebra. First of all, the CFI-construction shows that FPC cannot define the isomorphism problem on graphs with bounded degree and bounded colour class size whereas the isomorphism problem is known to be tractable on all classes of graphs with bounded degree or bounded colour class size. Secondly, Atserias, Bulatov and Dawar [2] proved that FPC cannot express the solvability of linear equation systems over any finite Abelian group. It follows, that also other problems from the field of linear algebra are not definable in FPC. Interestingly, also the CFI-query can be formulated as linear equation system over F 2 [7].
Rank logic This latter observation motivated Dawar, Grohe, Holm and Laubner [7] to introduce rank logic (FPR) which is the extension of FPC by operators for the rank of definable matrices over prime fields F p . To illustrate the idea of rank logic, let ϕ(x, y) be a formula (of FPC, say) which defines a binary relation ϕ A ⊆ A × A in an input structure A. We identify the relation ϕ A with the associated adjacency matrix In this sense, the formula ϕ defines in every structure A a matrix M A ϕ with entries in {0, 1} ⊆ F p . Now, rank logic FPR contains for every prime p ∈ P a rank operator rk p which can be used to form a rank term [rk p ϕ(x, y)] whose value in an input structure A is the matrix rank of M ϕ over F p (we remark that rank logic also allows to express the rank of matrices which are indexed by tuples of elements; the precise definition is given in Section 2).
It turns out that rank operators have quite surprising expressive power. For example, they can define the transitive closure of symmetric relations, they can count the number of paths in DAGs modulo p and they can express the solvability of linear equation systems over finite fields (recall that a linear equation system M ⋅ ⃗ x = ⃗ b is solvable if, and only if, rk(M ) = rk(M ⃗ b)) [7]. Furthermore, rank operators can be used to define the isomorphism problem on various classes of structures on which the Weisfeiler-Lehman method (and thus fixed-point logic with counting) fails, e.g. classes of C(ai)-F(ürer)-I(mmerman) graphs [4,7] and multipedes [12,15]. The common idea of these isomorphism procedures is to reduce the isomorphism problem of structures to a suitable linear equation system over a finite field. More generally, by a recent result (which is mainly concerned with another candidate of a logic for polynomial time [1]), it follows that FPR captures polynomial time on certain classes of structures of bounded colour class size. In particular, this holds for the class of all structures of colour class size two (to which CFI-graphs and multipedes belong).
While these results clearly show the high potential of rank logic, almost nothing has been known about its limitations. For instance, it has remained open whether rank logic suffices to capture polynomial time, whether rank operators can simulate fixed-point inductions [7] and also whether rank logic can define closely related problems from linear algebra (such as the solvability of linear equations over finite rings rather than fields [6]). One particular intriguing question is whether rank operators over different prime fields can simulate each other. In other words: is it possible to reduce the problem of determining the rank of a matrix over F p (within fixed-point logic with counting) to the problem of determining the rank of a matrix over F q (where p, q are distinct primes)? To attack this problem, Dawar and Holm [8,15] developed a powerful toolkit of so called partition games of which one variant (so called matrix-equivalence games) precisely characterises the expressive power of infinitary logic extended by rank quantifiers. By using these games, Holm [15] was able to give a negative answer to the above question for the restricted case of rank operators of dimension one.
In this paper we propose a different method, based on exploiting symmetries rather than game theoretic arguments, to prove new lower bounds for logics with rank operators. In our main result (Theorem 3) we prove that for every prime q there exists a class of structures K q on which FPC fails to capture polynomial time and on which rank operators over every prime field F p , p ≠ q can be simulated in FPC. On the other hand, rank operators over F q can be used to canonise structures in K q which means that the extension of fixed-point logic by rk q -operators captures polynomial time on K q . From this result we can easily extract the following answers to the open questions outlined above.
We obtain these classes of structures K q by generalising the well-known construction of Cai, Fürer and Immerman [4]. It has been observed that their construction actually is a clever way of encoding a linear equation system over F 2 into an appropriate graph structure (see e.g. [2,7,15,16]). Intuitively, each gadget in the CFI-construction can be seen as an equation (or, equivalently, as a circuit gate) which counts the number of transpositions of adjacent edges modulo two, and the CFI-query is to decide whether the total number of such transpositions is even or odd. Knowing this, it is very natural to ask whether this idea can be generalised to encode linear equation systems over arbitrary finite fields or, more generally, equation systems over arbitrary (Abelian) groups.
In [20], in order to obtain hardness results for the graph isomorphism problem, Torán followed this idea and established a graph construction which simulates mod k-counting gates for all k ≥ 2. Moreover, in order to separate the fragments of rank logic by operators over different prime fields, Holm presented in [15] an even more general kind of construction which allows the representation of equations over every Abelian group G. In fact, we obtain the classes K q essentially by using his construction for the special case where G = F q . Solvability logic One important step in our proof is to consider solvability logic FPS which is the extension of FPC by quantifiers which can express the solvability of linear equation systems over finite fields (so called solvability quantifiers, see [6,18]). Obviously the logic FPS can easily be embedded into rank logic (as rank operators can be used to solve linear equation systems), but it remains open whether the inclusion FPS ≤ FPR is strict. To prove our main result outlined above we show that over certain classes of structures the logics FPS and FPR have precisely the same expressive power. In a more general context this might give some evidence that in the framework of fixed-point logic with counting rank operators can be simulated by solvability quantifiers. On the other hand we show in Section 4 that the extension of first-order logic (without counting) by solvability quantifiers is strictly weaker than the respective extension by rank operators. This last result thus separates solvability quantifiers and rank operators in the absence of counting.
Let us briefly sketch the main idea of our proofs which is to exploit the symmetries of definable linear equation systems. To this end, let M ⋅ ⃗ x = 1 be a linear equation system over some prime field F p where M is an I × I-matrix over F p and where 1 is the I-identity vector over F p , i.e. 1(i) = 1 for all i ∈ I. Moreover, let Γ be a group which acts on I and which stabilises M , i.e. for all i, j ∈ I and π ∈ Γ we have M (i, j) = M (π(i), π(j)). In other words, if we identify the elements π ∈ Γ with I × I-permutation matrices Π then we have Π ⋅ M = M ⋅ Π. Now let ⃗ b ∈ F I p be a solution of the linear equation system M ⋅ ⃗ x = 1. Then we observe that In other words: the solution space of the linear equation system M ⋅ ⃗ x = 1 is closed under the action of Γ. Such and similar observations will enable us to transform a given linear equation system into a considerably simpler linear system which still is equivalent to the original one.

Logics with linear-algebraic operators
By S(τ ) we denote the class of all finite, relational structures of signature τ . We assume that the reader is familiar with first-order logic (FO) and inflationary fixed-point logic (FP).
For details see [9,10]. We write P for the set of primes and denote the prime field with p elements by F p . We consider matrices and vectors over unordered index sets. Formally, if I and J are non-empty sets, then an is a reflexive, transitive and total binary relation. A preorder ⪯ induces a linear order on the classes of the associated equivalence relation We briefly recall the definitions of first-order logic with counting FOC and (inflationary) fixed-point logic with counting FPC which are the extensions of FO and FP by counting terms. Formulas of FOC and FPC are evaluated over the two-sorted extension of an input structure by a copy of the arithmetic. Following [7] we let A # denote the two-sorted extension of a τ -structure A = (A, R 1 , . . . , R k ) by the arithmetic N = (N, +, ⋅, 0, 1), i.e. the two-sorted structure A # = (A, R 1 , . . . , R k , N, +, ⋅, 0, 1) where the universe of the first sort (also referred to as vertex sort) is A and the universe of the second sort (also referred to as number sort or counting sort) is N.
As usual for the two-sorted setting we have, for both, the vertex and the number sort, a collection of typed first-order variables. We agree to use Latin letters x, y, z, . . . for variables which range over the vertices and Greek letters ν, µ, . . . for variables ranging over the numbers. Similarly, for second-order variables R we allow mixed types, i.e. a relation symbol R of type (k, ) ∈ N × N stands for a relation R ⊆ A k × N . Of course, already first-order logic over such two-sorted extensions is undecidable. To obtain logics whose data complexity is in polynomial time we restrict the quantification over the number sort by a numeric term t, i.e. Qν ≤ t.ϕ where Q ∈ {∃, ∀} and where t is a closed numeric term. Similarly, for fixed-point logic FP we bound the numeric components of fixed-point variables R of type (k, ) in all fixed-point definitions by a tuple of closed numeric termst = (t 1 , . . . , t ) where each t i bounds the range of the variable ν i in the tupleν. For the logics which we consider here the value of such numeric terms (and thus the range of all quantifiers over the number sort) is polynomially bounded in the size of the input structure. Together with the standard argument that inflationary fixedpoints can be evaluated in polynomial time and the fact that the matrix rank over any field can be determined in polynomial time (for example by the method of Gaussian elimination), this ensures that all the logics which we introduce in the following have polynomial-time data complexity.
Letxν be a mixed tuple of variables and lett be a tuple of closed numeric terms which bounds the range of the numeric variables inν. For a formula ϕ we define a counting term s = [#xν ≤t . ϕ] whose value s A ∈ N in a structure A corresponds to the number of tuples (ā,n) ∈ A k × N such that A ⊧ ϕ(ā,n) and n i ≤ t A i where k = x and = ν . We define first-order logic with counting FOC as the extension of (the above described two-sorted variant of) FO by counting terms. Similarly, by adding counting terms to the logic FP we obtain (inflationary) fixed-point logic with counting FPC.

Extensions by rank operators
Next, we recall the notion of rank operators as introduced in [7]. Let Θ(xν ≤t,ȳμ ≤s) be a numeric term wheret ands are tuples of closed numeric terms which bound the range of the numeric variables in the tuplesν andμ, respectively. Given a structure A we define The matrix rank operators compute the rank of the matrix M Θ over a prime field F p for p ∈ P. Firstly, as in [7], we define for every prime p a matrix rank operator rk p which allows us to construct a new numeric rank term [rk p (xν ≤t,ȳμ ≤s) . Θ] whose value in the structure A is the rank of the matrix (M Θ mod p) over F p . Secondly, we propose a more flexible rank operator rk * which gets the prime p as an additional input. Formally, with this rank operator rk * we can construct a rank term [rk * (xν ≤t,ȳμ ≤s, π ≤ r) . Θ] where π is an additional free numeric variable whose range is bounded by some closed numeric term r. Given a structure A and an assignment π ↦ p for some prime p ≤ r A , the value of this rank term is the matrix rank of (M Θ mod p) considered as a matrix over F p . The rank operator rk * can be seen as a unification for the the family of rank operators (rk p ) p∈P and has been introduced in [15,16,18].
We define, for every set of primes Ω ⊆ P, the extension FOR Ω of FOC and the extension FPR Ω of FPC by matrix rank operators rk p with p ∈ Ω. For convenience, we let FOR = FOR P and FPR = FPR P . Similarly, we denote by FPR * the extension of FPC by the uniform rank operator rk * . We remark, that rank operators can directly simulate counting terms. For example we have that Hence, we could equivalently define the rank logics FOR Ω , FPR Ω and FPR * as the extensions of (the two-sorted variants of) FO and FP, respectively.

Extensions by solvability quantifiers
It is well-known that the extensions of FOC and FPC by matrix rank operators have surprising expressive power which, in particular, goes beyond that of fixed-point logic with counting. For example, it is known that rank operators can easily define the symmetric transitive closure of binary relations and that they can be used to express the structure isomorphism problem on various classes on which the Weisfeiler-Lehman test fails like, for example, classes of Cai, Fürer and Immerman graphs [4,7]. Interestingly, such results for rank logic were obtained by reducing the respective queries to a solvability problem for linear equation system over finite fields. Although the solvability problem (for linear equation systems) can be defined in rank logic, we propose to study extensions by quantifiers which directly express this solvability problem. One advantage of this approach is that one can naturally define such quantifiers for linear systems over more general classes of algebraic domains, like rings, for which no appropriate notion of matrix rank exists, cf. [6].
Let Ω ⊆ P be a set of primes. Then the solvability logic FPS Ω extends the syntax of FPC for every p ∈ Ω by the following formula creation rule for solvability quantifiers slv p .
The semantics of the formula ψ(z) is defined similarly as for rank logic. More precisely, let k = x and = ȳ . To a pair (A,z ↦c) ∈ S(σ,z) we associate the I × J-matrix M ϕ over At first glance, the solvability quantifier seem to pose serious restrictions on the syntactic form of definable linear equation systems. Specifically, the coefficient matrix has to be a matrix over {0, 1} and the vector of constants is fixed from outside. However, it is not hard to show that general linear equation systems can be brought into this kind of normal form by using quantifier-free first-order transformations (see Lemma 4.1 in [6]).
We write FPS to denote the logic FPS P and FPS p to denote the logic FPS {p} for p ∈ P. Analogously to the definition of FPR * we also consider a solvability quantifier slv which gets the prime p as an additional input and which can uniformly simulate all solvability quantifiers slv p for p ∈ P. Let FPS * denote the extension of FPC by this uniform version of a solvability quantifier. Then the following inclusions easily follow from the definitions and the fact that rank operators can be used to define the solvability problem for linear equation systems.
Finally we remark that, analogously to [7], we defined rank operators and solvability quantifiers for prime fields only. Of course, the definition can easily be generalised to cover all finite fields, i.e. also finite fields of prime power order. However, for the case of solvability quantifiers, Holm was able to prove in [15] that this does not alter the expressive power of the resulting logics since solvability quantifiers over a finite field F q of prime power order q = p k can be simulated by solvability quantifiers over F p . Moreover, a similar reduction can be achieved for rank operators which altogether shows that it suffices to focus on rank operators and solvability quantifiers over prime fields.

Separation results over different classes of fields
In this section we separate the extensions of fixed-point logic with counting by solvability quantifiers and rank operators over different prime fields. Specifically, we show that the expressive power of the logics FPS Ω is different for all sets of primes Ω. Moreover, we transfer these results to the extensions FPR Ω by rank operators. In this way we can answer the following open question about rank logic: It holds that FPR p ≠ FPR q for pairs of different primes p, q. [8,15,16] Another important consequence of our result is that rank logic (in the way it was defined in [7]) does not suffice to capture polynomial time. Let us state these results formally.
In fact, both theorems are simple consequences of our following main result. Proof of Theorem 1. Let Ω and Ω ′ be two sets of primes as above. Without loss of generality let us assume that there exists a prime q ∈ Ω ∖ Ω ′ . Then by Theorem 3 there exists a class K q on which FPS Ω = FPR Ω = Ptime and on which FPS Ω ′ = FPR Ω ′ = FPC < Ptime. ◂

Proof of Theorem 2.
Otherwise assume that FPR = Ptime. Then, in particular, FPR = FPR * and there exists a formula ϕ ∈ FPR which can uniformly determine the rank of matrices over prime fields, i.e. which can express the uniform rank operator rk * . As a matter of fact we have ϕ ∈ FPR Ω for some finite set of primes Ω. By using ϕ we can uniformly express the matrix rank over each prime field F p in FPR Ω . In other words, we have FPS ≤ FPR ≤ FPR * ≤ FPR Ω . Now let q ∈ P ∖ Ω. By Theorem 3 there exists a class of structures K q on which FPR Ω = FPC < Ptime. However, the class K q can be chosen such that Ptime = FPS q ≤ FPR Ω on K q by Theorem 3 (d) and we obtain the desired contradiction. ◂ The proof of Theorem 2 reveals a deficiency of the logic FPR: each formula can only access rk p -operators for a finite set Ω of distinct primes p. In fact, the query which we constructed to separate FPR from Ptime can be defined in FPR * . Altogether this suggests to generalise the notion of rank operators and to specify the prime p as a part of the input, as we did for FPR * , and as it was proposed in [15,16,18].
The remainder of this section is devoted to the proof of Theorem 3. We fix a prime q and proceed as follows. In a first step, we identify properties of classes of structures K q which guarantee that the relations claimed in (a), (b), (c) and (d) hold. In a second step, we proceed to show that we can obtain a class of structures K q that satisfies all of these sufficient criteria. This together then proves our theorem.

Establishing sufficient criteria
We start by establishing sufficient criteria for the most relevant part of Theorem 3 which is the relation claimed in (a). Assume that we have a class of structures K q = K with the following properties.
(I) The automorphism groups ∆ A ∶= Aut(A) of structures A ∈ K are Abelian q-groups. (II) The orbits of -tuples in structures A ∈ K can be ordered in FPC.
Formally, for each ≥ 1 there is a formula ϕ ⪯ (x 1 , . . . , x , y 1 , . . . , y ) ∈ FPC such that for every structure A ∈ K, the formula ϕ ⪯ (x,ȳ) defines in A a linear preorder ⪯ on A with the property that two -tuplesā,b ∈ A are ⪯-equivalent if, and only if, they are in the same ∆ A -orbit.

▸ Lemma 4. If K satisfies (I) and (II), then FPS
The proof of this lemma is by induction on the structure of FPS Ω -formulas. Obviously, the only interesting step is the translation of a solvability formula ψ(z) = (slv pxν ≤s,ȳμ ≤t)ϕ(xν,ȳμ,z) into an FPC-formula ϑ(z) which is equivalent to ψ(z) on the class K. Let x = ȳ = , ν = μ = λ and z = k. To explain our main argument, we fix a structure A ∈ K and a k-tuple of parametersc ∈ (A ⊎ N) k which is compatible with the type of the variable tuplez. According to the semantics of the solvability quantifier, the formula ϕ defines in (A,z ↦c) The key idea is to use the symmetries of the structure A to translate the linear equation system M ⋅ ⃗ x = 1 into an equivalent linear system which is simpler in the sense that its solvability can be defined in the logic FPC. The reader should observe that each automorphism π ∈ ∆ A = Aut(A) naturally induces an automorphism of the twosorted extension A # which point-wise fixes every number n ∈ N. In particular we have Aut(A) = Aut(A # ).
. The group Γ acts on I and J in the natural way. We identify each automorphism π ∈ Γ with the corresponding I × I-permutation matrix Π I and the corresponding J × J-permutation matrix Π J in the usual way. More precisely, to π ∈ Γ we associate the I × I-permutation matrix Π I which is defined as Then Γ acts on the set of I × J-matrices by left multiplication with I × I-permutation matrices. Similarly, we let Π J denote the J × J-permutation matrix defined as Then Γ also acts on the set of I × J-matrices by right multiplication with J × J-permutation matrices. Specifically, for π ∈ Γ we have ( This identity leads to the following important observation. shows that Γ acts on the solution space of the linear equation system. Since K satisfies property (I) we know that Γ is a q-group for a prime q ≠ p. Thus each Γ-orbit has size q r for some r ≥ 0. On the other hand, the number of solutions is a power of p. We conclude that there is at least one Γ-orbit of size one which proves our claim. ◂ Then the entries of the solution ⃗ b on Γ-orbits are constant: for j ∈ J and π ∈ Γ we have . We proceed to use the property (II) and show that there exists an FPC-formula ϕ ⪯ (x,ȳ) which defines for all A ∈ K andc ∈ (A ⊎ N) k as above a linear preorder ⪯ on A which identifies Γ-orbits. Note that, in general, Γ = Aut(A,c) is a strict subgroup of ∆ = Aut(A). Thus we can not directly apply (II). However, the Γ-orbits on A correspond to the ∆-orbits on A k ′ + where the first k ′ entries are fixed to the elements {c 1 , . . . , c k } ∩ A.
The linear preorder ⪯ naturally extends to a preorder on the sets I and J with the same properties. Let us write J = J 0 ⪯ J 1 ⪯ ⋯ ⪯ J v−1 to denote the decomposition of J into the Γ-orbits J j which are ordered by ⪯ as indicated. Moreover, for j ∈ [v] we let e j denote the identity vector on the j-th orbit J j , i.e. the J-vector which defined for i ∈ J as Together with Lemma 5 this shows the following. . It is a simple observation that such linear equation systems can be solved in FPC: the linear order on the column set induces (together with some fixed order on F p ) a lexicographical ordering on the set of rows which is, up to duplicates of rows, a linear order on this set. Thus, in general, if we have a linear order on one of the index sets of the coefficient matrix this suffices to obtain an equivalent matrix where both index sets are ordered, see also [18]. This finishes our proof of Lemma 4.
We proceed to show that the conditions (I) and (II) also guarantee that rank operators can be reduced to solvability operators over the class K. In fact, for this translation we only require the somewhat weaker assumption that we can define in FPC on -tuples in structures A ∈ K a linear preorder in which every class can be linearised in FPC by fixing a constant number of parameters. The precise technical requirements will become clear from the proof of the following lemma. Let x = ȳ = , ν = μ = λ and z = k. Let A ∈ K and letc be a k-tuple of parameters c ∈ (A ⊎ N) k which is compatible with the type of the variable tuplez. The term Θ defines in (A,z ↦c) for According to the semantics of matrix rank operators, the value Υ A (c) ∈ N is the rank of the matrix M . We proceed to show that we can determine the matrix rank of M by a recursive application of solvability queries. To this end we make the following key observation.
Proof of claim: First of all, we let ϕ ⪯ be an FPC-formula which defines in every structure A ∈ K a linear preorder ⪯ on J A such that ⪯-classes correspond to ∆ A -orbits. Such a formula exists by our assumption that K satisfies property (II). Analogously, we choose an FPC-formula ϑ ⪯ which defines in every structure A ∈ K a linear preorder ⪯ * on J A × J A that induces a linear order on the ∆ A -orbits. Now let [j] ⊆ J A be a ⪯-class for some A ∈ K. By property (I) we know that ∆ A is an Abelian group. Thus, each automorphism π ∈ ∆ A which fixes one element in the ∆ A -orbit [j] point-wise fixes every element in the class [j]. We conclude that the restriction of ⪯ * to elements in {j} × [j] corresponds to a linear order on [j] for each j ∈ [j]. In this way we obtain an FPC-formula ψ ≤ with the desired properties. ⊣ We are now prepared to describe the recursive procedure which allows us to determine the rank of the matrix M in FPS Ω . To this end we fix formulas ϕ ⪯ and ψ ≤ with the above properties. Moreover, let ⪯ denote the linear preorder defined by ϕ ⪯ on J and let We use the formula ψ ≤ to obtain on each class J i a family of definable linear orderings (which depend on the choice of different parameters). For j ∈ J we denote by ⃗ m j ∈ F I p the j-th column of the matrix M . Then the rank of M coincides with the dimension of the F p -vector space which is generated by the set of columns First, we use ψ ≤ to fix a linear order on J i (the following steps are independent of the specific linear order and can thus be performed in parallel for each such order). Using this linear order on Moreover, W consists of linearly independent columns and is a basis for ⟨W ⟩.
Since the above described recursion can easily be implemented in FPS Ω , we conclude that the rank d r−1 of the matrix M can be determined in FPS Ω which completes our proof. ◂ We now focus on the parts (c) and (d) of Theorem 3 and establish sufficient criteria which guarantee that FPC fails to capture Ptime on K while FPS q can express every polynomial-time decidable property of K-structures.
(III) There exists an FPS q -definable canonisation procedure on K.
(IV ) For every k ≥ 1 there exists a pair of structures A ∈ K and B ∈ K such that A ≅ B and A ≡ C k B.
Proof. It is clear that by property (III) we have FPS q = Ptime on K. Moreover, if we had FPC = Ptime on K then, by the embedding of FPC into C ω ∞ω and the fact that K-structures can be canonised in polynomial time, there exists a fixed k ≥ 1 such that C k ∞ω can identify each structure in K which, in turn, contradicts property (IV). ◂

Constructing an appropriate class of structures
We proceed to construct a class of structures K which satisfies properties (I) -(IV). Our approach is a generalisation of the well-known construction of Cai, Fürer and Immerman [4] for cyclic groups other than F 2 . To illustrate the main differences, let us briefly recall the idea of the original construction. Starting from an undirected and connected graph G = (V, E), we take two copies e 0 , e 1 of every edge e ∈ E. Moreover, for every vertex v ∈ V we consider the set vE ⊆ E of edges which are adjacent to v and we add one of the following two constraints to restrict the symmetries of the resulting CFI-graph: either the set of all sets {e ρ(e) ∶ e ∈ vE} with ρ ∶ vE → F 2 and ∑ e∈vE ρ(e) = 0 is stabilised (an even node) or the dual set of all sets {e ρ(e) ∶ e ∈ vE} with ρ ∶ vE → F 2 and ∑ e∈vE ρ(e) = 1 is stabilised (an odd node). These constraints are encoded by a simple graph gadget. Although it seems that for each of these exponentially many choices we obtain a different CFI-graph, there really are, up to isomorphism, only two such graphs which in turn are determined by the parity of the number of odd nodes. Very roughly, the reason is that we can transpose, or twist, two copies e 0 , e 1 of each an edge e and move this twist along a path (in the connected graph G) to iteratively resolve pairs of odd nodes. In order to generalise this construction to F q we take for every edge e ∈ E a directed cycle of length q over q copies e 0 , e 1 , . . . , e q−1 of the edge e. We then add similar constraints for sets of incident edges as above, but naturally, instead of having only two different kinds of such constraints, we have one for each value 0, 1, . . . , q − 1 ∈ F q . Now, instead of twisting pairs of edges, we consider cyclic shifts of length ≤ q on the edge classes e 0 , e 1 , . . . , e q−1 which respect the cycle relation. Again, these shifts can be propagated along paths in the original graph G and, with a reasoning analogous to the original approach, it turns out that there are, up to isomorphism, only q different types of generalised CFI-graphs over F q . We remark that the same kind of generalisations has been studied, for example, in [15,20].
Let us formalise the above described intuitions. We start with an (undirected), connected and ordered graph G = (V, ≤, E). Let C, I and R be binary relation symbols. We set τ ∶= {⪯ , C, I, R}. We define for every prime q and every sequence of we call a CFI-structure over G. For the following construction we agree that arithmetic is modulo q so that we can drop the operator "mod q" in statements of the form x = ymod q and x + y mod q for the sake of better readability. For what follows, let E(v) ⊆ E denote the set of directed edges starting in v. Since G is an undirected graph, this means that for each undirected edge {v, w} of G we have (v, w) ∈ E(v) and (w, v) ∈ E(w). The construction is illustrated in Figure 1.
The universe of CFI q (G, ⃗ d) consists of edge nodes and equation nodes. The set of edge nodesÊ is defined asÊ ∶= ⋃ e∈Eê where for every directed edge e ∈ E we let the edge classê = {e 0 , e 1 , . . . , e q−1 } consist of q distinct copys of e. In particular, for every edge e = (v, w) ∈ E and its reversed edge e −1 ∶= f = (w, v) ∈ E the setsê and f are disjoint. We say that two such edges (or edge classes) are related. The gadget relation R is defined as At first glance our construction associates to every graph G (with the above properties) and to each sequence of gadget values ⃗ d ∈ [q] V a different structure CFI q (G, ⃗ d). However, for each graph G with the above properties there really are, up to isomorphism, only q different CFI-structures CFI q (G, ⃗ d). In fact, the value ∑ ⃗ d ∶= ∑ v∈V ⃗ d(v) completely determines the isomorphism class of a CFI-structure over G.
To obtain this characterisation, we analyse the automorphism group of CFI-structures and, more generally, the set of isomorphisms between two structures A = CFI q (G, ⃗ d 1 ) and . For such structures we know that the setÊ of edge nodes, the linear preorder ⪯ onÊ, the cycle relation C and the inverse relation I do not depend on the sequence of gadget values. This means that each possible isomorphism π which maps A to B induces an automorphism of the common substructure C ∶= (Ê, (⪯ ↿Ê), C, I) which only depends on G but not on ⃗ d ∈ [q] V . Thus Let π ∈ Γ. The linear preorder ⪯ onÊ and the cycle relation C enforce that π is the composition of cyclic shifts on the individual edge classesê, i.e. π ∈ ∏ e∈E ⟨( e 0 e 1 ⋯e q−1 )⟩ ≤ Sym(Ê). It is convenient to identify the group ∏ e∈E ⟨( e 0 e 1 ⋯e q−1 )⟩ with the vector space F E q in the obvious way.
In addition, the inverse relation I enforces that cyclic shifts for pairs of related edge classes are inverse to each other in the following sense: let e = (v, w) ∈ E and f = (w, v) ∈ E be a pair of related edges. Assume that we have a permutation π ∈ F E q such that π(e) = x and π(f ) = y. We have (e 0 , f 0 ) ∈ I. Hence, if π is supposed to be an automorphism of C then we have π(I) = I and thus (e x , e y ) ∈ I which means that x + y = 0.
In conclusion, it follows that Γ ≤ F E q is the subgroup of F E q which contains all E-vectors π ∈ F E q with the property that π(e) + π(f ) = 0 for pairs of related edges e, f ∈ E. Again we remind the reader that Γ only depends on G but not on ⃗ d ∈ [q] V . If we want to stress this dependence, then we sometimes write Γ(G) but usually we omit G if the graph is clear from the context. Now, given a CFI-structure A = CFI q (G, ⃗ d), we define for each vertex v ∈ V the v-gadget as the set gadget(v) ∶=v d(v) ⊎ ⋃ e∈E(v)ê .
▸ Lemma 9. Let A = CFI q (G, ⃗ d) and let π ∈ Γ. Then there is precisely one extensionπ of π toÊ ⊎V such thatπ(A) is a CFI-structure over G.
We show that under the assumption thatπ(A) is a CFI-structure over G the action of π onÊ determinesπ(ρ).
We have that (ρ, e ρ(e) ) ∈ R for all e ∈ E(v). Hence for a potential isomorphismπ we must have that (π(ρ), π(e ρ(e) )) ∈ R ′ (for a gadget relation R ′ of a CFI-structure over G). Since we have π(e ρ(e) ) = e ρ(e)+π(e) , it follows by the definition of CFI-structures that the function π(ρ) ∶ E(v) → [q] is determined as (π(ρ))(e) = ρ(e) + π(e) which in turn only depends on the action of π on the edge classesê for e ∈ E(v). ◂ The preceding lemma shows that Iso(A, B) can be identified with a subset of Γ. In fact, the set Aut(A) turns out to be a subgroup of Γ of which Iso (A, B) is a coset in Γ. Specifically, we saw that every π ∈ Γ can uniquely be identified with an isomorphism of CFI-structures over G by setting π(ρ) = ρ + π for ρ ∈v d . As a consequence, this means that π(v d ) =v d * where d * = d + ∑ e∈E(v) π(e) and that In particular, π stabilises the relation R d v if, and only if, ∑ e∈E(v) π(e) = 0. π(e)).
For the other direction we proceed by induction on the number i of vertices . If no such vertex exists, then the claim is trivial. Otherwise, because of our assumption, there exist at least two such vertices v, w ∈ V , v ≠ w. Since G is connected we find a simple path By the definition of π it follows that π ∈ Γ. Let π(CFI q (G, Thus the claim follows from the induction hypothesis. ◂ The kind of isomorphism that we constructed in the proof of Lemma 11 plays an important role later on. Thus, for a simple pathp from v 0 to v m (m ≥ 1) as above and a constant z ∈ F q we denote this isomorphism by π[p, z] ∈ Γ. In other words, if we let σ z [e] ∈ Γ for e ∈ E and z ∈ F q denote the E-vector which is defined as Intuitively, the isomorphism π[p, z] allows us to simultaneously increase the gadget value at v 0 by z and to decrease the gadget value at v m by z while the induced twists are moved along the pathp through the gadget relations of the vertices v j , 1 ≤ j < m, whose gadget value does not change. A very important special case arises whenp is a simple cycle of length m ≥ 3 Then for all values z ∈ F q the isomorphism π[p, z] ∈ Γ is an automorphism of CFI-structures over G. We are going to use these automorphisms to show that it is possible to define in FPC an ordering on the orbits of -tuples as required by property (II). It turns out that it therefore suffices to ensure that the graph G is sufficiently connected.
Recall that a graph G is k-connected, for k ≥ 1, if G contains more than k vertices and if G stays connected when we remove any set of at most k vertices. The connectivity con(G) of a graph G is the maximal k ≥ 1 such that G is k-connected. Moreover, the connectivity con(G) of a class G of graphs is the function con(G) ∶ N → N defined by n ↦ min G∈G, G =n con(G).
We are prepared to define the class K: let G be a class of undirected, ordered graphs such that con(G) ∈ ω(1). Then we set

Verifying the required properties
We proceed to show that K satisfies the required properties (I) -(IV). First of all, we saw that the automorphism group of each CFI-structure CFI q (G, ⃗ d) is a F q -vector space, so property (I) clearly holds for the class K.
The proof that K satisfies property (II) is more involved. Let us fix the length ≥ 1 of tuples on which we want to define a linear preorder which identifies ∆ A -orbits. By the choice of K it suffices to consider CFI-structures A = CFI q (G, ⃗ d) over graphs G = (V, ≤, E) with con(G) > ( + 2) since almost all structures in K satisfy this condition. As above let Γ ≤ F E q denote the group that acts on the set of CFI-structures over G and let A ∶= (V ⊎Ê) denote the universe of the CFI-structure A.
(i) Let v ∈ V . We say that the vertex v is marked (given the parametersā) if for some (ii) Let e = (v, w) ∈ E. We say that the edge e is marked (given the parametersā) if one of the vertices v or w is marked or if for some x ∈ {a 1 , . . . , a λ } we have that x ∈ê ∪f where f = (w, v) ∈ E is the edge related with e.
(a) If v ∈ V is marked, then the v-gadget can be identified in C +2 ∞ω (using the parametersā), i.e. for every c ∈gadget(v) there exists a formula ϑ(x, y) ∈ C +2 ∞ω such that ϑ A (ā) = {c}. Proof. First of all, it is straightforward (even without using the parameters) to fix the ⪯-class of any element c ∈ A in C +2 ∞ω . Secondly, observe that if an element ρ ∈v is fixed, then we can fix an element in each of the edge classesê for e ∈ E(v) since ρ is R-connected to precisely one vertex in each of these classes. Moreover, if we have fixed an element x ∈ê in some edge classê, then we can simply use the cycle relation C to identify each element c ∈ê via its C-distance to a in C +2 ∞ω . Finally, the inverse relation I yields a definable bijection between related edge classes. ◂ ▸ Lemma 14. Let λ ≤ ,ā ∈ A λ and let v ∈ V be a vertex that is not marked. Then for all edges e, e ′ ∈ E(v), e ≠ e ′ which are not marked there exists π ∈ Aut(A,ā) such that π(e) = −π(e ′ ) ≠ 0 and such that π Proof. Let e = (v, w) and e ′ = (v, w ′ ) as above. Then the vertices w and w ′ are not marked. Consider the graph G ′ that results from G by removing the vertex v and each marked vertex y ∈ V . Let V ′ ⊆ V denote the vertex set and E ′ ⊆ E the edge relation of the graph G ′ .
For every x ∈ M there is an edge f ∈ E such that x ∈f . For each such edge f that is also contained in the subgraph G ′ we delete one of its endpoints but neither the vertex w nor the vertex w ′ and denote the resulting subgraph by G ′′ with vertex set V ′′ ⊆ V ′ and edge relation E ′′ ⊆ E ′ . It still might happen that there is a parameter x ∈ M such that x ∈f for f ∈ E ′′ . However, this can only occur if f connects w ′ and w. Since we removed at most ( V − V ′ ) + M ≤ λ + 1 ≤ ( + 1) vertices from the graph G to obtain G ′′ and since con(G) > ( + 2) we know that there is a simple path of length m ≥ 2 (i.e. the path does not consist of a single edge between w and w ′ ) which connects w and w ′ in G ′′ : We extendp to a simple cyclep c in G from v to v by using the edges (v, w), (v, w ′ ) ∈ E: Let 0 ≠ z ∈ [q]. We claim that π ∶= π[p c , z] satisfies the desired properties. By the definition of π it holds that π(e) = z = −π(e ′ ). Let x ∈ {a 1 , . . . , a λ }. Then we have x ∉ ⋃ m−1 i=1vi ∪ŵ ∪ŵ ′ ∪v, since none of the vertices v, w and w ′ is marked and since we removed any other marked vertex y ∈ V from G.
Moreover, for f ∈ {(v, w), (w, v), (v, w ′ ), (w ′ , v)} we have that x ∉f by our assumption that e, e ′ are not marked. Also for f ∈ {(w, v 1 ), (w ′ , v m−1 )} we have x ∉f since otherwise we had removed the vertices v 1 (A,b) if, and only if, there exists π ∈ Aut(A) such that π(ā) =b.

Proof.
We proceed by induction on the maximal position 1 ≤ i ≤ λ up to which the tuplesā andb agree, i.e. such that for 1 ≤ j < i we have a j = b j and such that a i ≠ b i . Let a ∶= a i and b ∶= b i . Then we have to show that there exists an automorphism π ∈ Aut(A, a 1 ⋯ a i−1 ) such that π(a) = b. Sinceā andb have the same C +2 ∞ω -type we know that a and b belong to the same ⪯-class. We choose v ∈ V such that a, b ∈ gadget(v).
In what follows, whenever we speak of marked vertices or marked edges then we implicitly refer to a marking with respect to the already fixed part of parameters {a 1 , . . . , a i−1 }.
Without loss of generality we may assume that the vertex v is not marked (by an element x ∈ {a 1 , . . . , a i−1 }), because otherwise, by Lemma 13, every element in gadget(v) can uniquely be identified in C +2 ∞ω . We distinguish between the two cases where a and b are equation nodes and where a and b are edge nodes.
For the first case let a, b ∈v. There exists a unique π ∈ F E(v) q such that π(a) = b and such that ∑ e∈E(v) π(e) = 0. Moreover, this vector π can easily be defined in C +2 ∞ω given the elements a and b. Now assume that one of the edges e = (v, w) ∈ E(v) is marked but that π(e) ≠ 0. Since the edge e is marked, every element inê can uniquely be identified in C +2 ∞ω by Lemma 13. However, since a and b are R-connected to different elements inê (as π(e) ≠ 0) this contradicts the fact thatā andb have the same C +2 ∞ω -type. Thus, for every edge e ∈ E(v) we either have that π(e) = 0 or that e is not marked. By induction on the number of edges e ∈ E(v) with π(e) ≠ 0 we show that π can be extended to an automorphism in Aut (A, a 1 , . . . , a i−1 ). Thus let us fix e ∈ E(v) such that π(e) ≠ 0. Since we have that ∑ f ∈E(v) π(f ) = 0 there has to be another edge e ′ ∈ E(v) with π(e ′ ) ≠ 0. We apply Lemma 14 to obtain an automorphism σ ∈ Aut(A, a 1 , . . . , a i−1 ) such that σ(e) = π(e), σ(e ′ ) = −π(e) and σ(f . By the induction hypothesis we can extend this vector to an automorphism π * ∈ Aut(A, a 1 , . . . , a i−1 ). But then (π * + σ) ∈ Aut(A, a 1 , . . . , a i−1 ) is an extension of π.
For the second case assume that a, b ∈ê for some edge e ∈ E(v). As above we conclude that the edge e is not marked. Since con(G) > ( + 2) the minimal degree of each vertex in G is at least ( + 4). Since the vertex v is not marked there has to be another edge e ′ ∈ E(v), e ≠ e ′ which is not marked. Thus we can apply Lemma 14 to obtain an automorphism π ∈ Aut (A, a 1 , . . . , a It is well-known that classes of C +2 ∞ω -equivalent tuples can be ordered in FPC, see e.g. [17]. Hence, it follows from our previous lemma that the class K satisfies property (II).

▸ Lemma 16. The class K satisfies the properties (I) and (II).
Let us now turn our attention to property (IV). In the next lemma we are going to show that for each k ≥ 1 and each sufficiently connected graph G ∈ G, the logic C k ∞ω cannot distinguish between any pair of CFI-structures over G (although there exist non-isomorphic CFI-structures over G).
▸ Lemma 17. Let k ≥ 1 and let G = (V, ≤, E) ∈ G such that con(G) > k. Then for all Thus, the class K satisfies property (IV).
. Without loss of generality we assume that A ≅ B. We show that Duplicator wins the k-pebble bijection game on A and B. Let and let z ∶= z b − z a . As above, for e = (v, w) ∈ E and y ∈ [q] we let σ y [e] ∈ Γ = Γ(G) denote the isomorphism which shifts the edge classê by y, the edge classf for f = (w, v) by −y and which stabilises all remaining classes, i.e.
Given a position (A, a 1 , . . . , a , B, b 1 , . . . , b ) in the k-pebble bijection game, we say that a pair (v, π) with v ∈ V and π ∈ Γ(G) is good if: the v-gadget is not marked (by the pebbled elements a 1 , . . . , a in A or, equivalently, by  the pebbled elements b 1 , . . . , b in B), Intuitively this means that π is nearly an isomorphism between A and B except for the gadget associated to vertex v. Of course π itself does not induce a bijection between the universes of the two CFI-structures (as otherwise A ≅ B). However, for each e ∈ E(v) we can associate a bijectionπ e ∶ A → B to π which is defined aŝ In what follows we show that Duplicator can play in such a way that after each round such a good pair (v, π) exists. Obviously, if Duplicator can maintain this invariant this suffices for her to win the game.
Indeed we can find such a good pair (v, π) by Lemma 11 for the initial position (A, B) of the game. Let us now consider one round of the game which starts from a position (A, a 1 , . . . , a , B, b 1 , . . . , b ) for which a good pair (v, π) exists. First, Spoiler chooses a pair i ≤ k of pebbles which he removes from the game board (if the corresponding pebbles are placed at all). Duplicator then answers Spoiler's challenge by providing a bijectionπ e for some edge e ∈ E(v) which is not marked. Note that such an edge e exists since con(G) > k and thus each vertex has degree at least k + 2. Spoiler picks a new pair (a,π e (a)) ∈ A × B of π e -related elements on which he places the i-th pair of pebbles. By the properties of π it immediately follows that the resulting mappingā[i ↦ a] ↦b[i ↦ b] is a partial isomorphism. However, it might happen that Spoiler placed the i-th pair of pebbles on equation nodeŝ v in the gadget associated to vertex v. In this case the pair (v, π) is not good any longer. So assume that Spoiler pebbled a new pair of elements (a, π e (a)) ∈v ×v. Since the edge e = (v, w) was not marked we know that w is not marked. Thus it is easy to see that the pair (w, σ z [e] + π) is good. ◂ To complete our proof we establish an FPS q -definable canonisation procedure on the class K. The idea is as follows: given a CFI-structure A = CFI q (G, ⃗ d) over a graph G and a value z ∈ [q] we construct a linear equation system over F q which is solvable if, and only if, ∑ ⃗ d = z. This linear equation system is FO-definable in the structure A which shows that FPS q can determine the isomorphism class of a CFI-structure over G. Since the graph G is ordered it is easy to construct an ordered representative from each isomorphism classes of CFI-structures over G which concludes our argument.
More specifically, let G = (V, ≤, E) ∈ G, let A = CFI q (G, ⃗ d) ∈ K and let z ∈ F q . For our linear equation system we identify each element e i ∈Ê and each vertex v ∈ V with a variable over F q , i.e. we let V ∶=Ê ⊎ V be the set of variables. The equations of the linear system are given as follows: for all e i ∈Ê (E 1) It is easy to see that this system is FO-definable in A. First of all, the equation (E 4) can be defined as a sum over the ordered set V . Moreover, we can express the equations of type (E 1) and (E 2) by using the cycle and inverse relation, respectively. Finally, the equations of type (E 3) can be expressed by using the gadget relation R. Proof. If ∑ ⃗ d = z then it is easy to verify that we obtain a solution ⃗ σ ∈ F V q of the linear system by setting ⃗ σ(e i ) = i and ⃗ σ(v) = ⃗ d (v). For the other direction, we show that a solution ⃗ σ ∈ F V q of this system defines an isomorphism π between A and B = CFI q (G, ⃗ As a preparation, we let δ(e) ∶= ⃗ σ(e i ) − i for e ∈ E and some e i ∈ê. Since ⃗ σ is a solution, δ ∈ F E q is well-defined. Now we obtain the isomorphism π for e i ∈Ê and ρ ∈V by setting Using the equations (E 1) and (E 2) one easily verifies that π respects the cycle relation C and the inverse relation I. Moreover, let (ρ, e ρ(e) ) ∈ R. Then π(e ρ(e) ) = e ⃗ σ(e ρ(e) ) and ⃗ σ(e ρ(e) ) = ρ(e) + δ(e).
Thus, π also respects R. Finally, by the equations of type (E 3), for all v ∈ V and ρ ∈v we have that This shows that ⃗ σ(v) = d + (v) and that ∑ ⃗ This finishes our proof of Theorem 3.

Solvability quantifiers vs. rank operators
In the previous section we obtained separation results for the extensions of FPC by solvability quantifiers (and rank operators) over different sets of primes. One important step of our proof was to construct a class of structures on which the expressive power of the logics FPR Ω and FPS Ω coincides. Moreover, as we already mentioned in Section 2, most of the queries which are known to separate fixed-point logic with counting and rank logic can also be expressed in FPS. This leads to the interesting question whether, in general, rank operators can be simulated by solvability quantifiers within fixed-point logic with counting. In this context, it is worthwhile to remark that many other problems from linear algebra are known to sit in between of "solving linear equation systems" and "computing the matrix rank", for example, deciding whether two matrices are similar or equivalent, see [18,15,16].
In this section we solve a simplified version of this question and show that in the absence of fixed-points and, more importantly, in the absence of counting, rank operators are strictly more expressive than solvability quantifiers. The reader should note that rank operators can easily simulate counting terms but this does not hold for solvability quantifiers.
In order to state our main result formally, we first define for every prime p the extension FOS p of first-order logic (without counting) by solvability quantifiers over F p . The crucial difference to the extension FOR p of first-order logic by rank operators rk p is that the logic FOS p is a one-sorted logic which does not have access to a counting sort.
Analogously to the definition of FPS in Section 2, the syntactic normal form of definable linear equation systems in the definition of slv p -quantifier does not lead to a severe restriction (again, see Lemma 4.1 in [6]).
Let us briefly summarise what is known about the logic FOS p (see also [6,18]). First of all, it follows from [7] that for every prime p, the logic FOS p can express the symmetric transitive closure of definable relations. Hence, FOS p subsumes the logic STC and can express every Logspace-computable property of ordered structures. Secondly, it also follows from [7] that FOS 2 can distinguish between the odd and even version of a CFI-graph, which means that FOS 2 cannot be a fragment of FPC. More generally, by adapting the CFI-construction for other fields one can show that FOS p ≤ FPC for all p ∈ P (see e.g. [15]).
On the domain of ordered structures, the expressive power of FOS p can be characterised in terms of a natural complexity class: in [3], Buntrock et. al. introduced the logarithmic space modulo counting classes MOD k L for integers k ≥ 2. Analogously to the case of modulo counting classes for polynomial time, the idea is to say that a problem is in MOD k L if there exists a non-deterministic logspace Turing machine which verifies its inputs by producing a number of accepting paths which is not congruent 0 mod k. For the formal definition we refer the reader to [3]. It turns out that, at least for primes p, the class MOD p L is closed under many natural operations, including all Boolean operations and even logspace Turing reductions [3,14]. Furthermore, many problems from linear algebra over F p are complete for MOD p L. In particular this is true for the solvability problem of linear equation systems over F p and for computing the matrix rank over F p [3].
Building on these insights, Dawar et. al. were able to show that for all primes p, the logic FOR p captures MOD p L on the class of ordered structures. It has been noted in [18] that their proof shows that the same correspondence holds for the logic FOS p .
Despite this characterisation over the class of ordered structures, the situation over general structures remained unclear. It easily follows that FOS p ≤ FOR p ≤ FPR, but, so far, it has been open whether one, or even both, of these inclusions are strict. In this section we are going to settle one of these questions: ▸ Theorem 22. For all primes p we have FOS p < FOR p (over the class of sets S(∅)).
In some sense, this result is not very surprising. Over the class of sets, the logic FOR p captures the complexity class MOD p L since the size of a set is a complete invariant. In contrast, the logic FOS p cannot access the counting sort and thus had to express properties over pure unordered sets which have the maximal amount of symmetries. However, it is not obvious how one can turn this intuition into a formal argument. Strikingly, FOS p has non-trivial expressive power over sets. For instance, FOS p can determine the size of sets modulo p [18], and consequently, modulo p k for every fixed k (since n ≡ 0 mod p k if, and only if, n ≡ 0 mod p and n p ≡ 0 mod p k−1 ). Note that fixed-point logic FP, for example, collapses to first-order logic over sets.
In order to prove Theorem 22 we make use of the following strong normal form for FOS p which has been established in Corollary 4.8 of [6].
▸ Theorem 23. Every formula ϑ(z) ∈ FOS p is equivalent to an FOS p -formula of the form Similar to our approach in Section 3, the main idea for separating FOS p and FOR p is to exploit the symmetries of definable linear equation systems. More precisely, we are aiming at considerably reducing the size of an input linear equation system via an FOR pdefinable transformation. For the remainder of this proof, let us fix a quantifier-free formula α(x 1 , . . . , x k , y 1 , . . . , y ) ∈ FO(∅) and a prime p. According to the semantics of FOS p , the formula α defines in an input structure A = ([n]) of size n the [n] k × [n] -coefficient matrix M n which is given forā ∈ [n] k ,b ∈ [n] as For convenience we set I n = [n] k and J n = [n] . Let Γ = Γ n = Sym([n]). Then the group Γ acts on I n and J n in the natural way. As in Section 3 we identify the action of π ∈ Γ with the multiplication by the associated I n × I npermutation matrix Π I and the J n × J n -permutation matrix Π J , respectively. Hence, for π ∈ Γ we have For what follows, we fix a prime q which is distinct from p and a subgroup ∆ ≤ Γ which is a q-group, i.e. ∆ = q m for some m ≥ 0. The overall strategy is to use the ∆-symmetries of the matrix M n to strongly reduce the size of the linear equation system M n ⋅ ⃗ To verify our original claim assume that M * n ⋅ ⃗ b = 1. Then we have Note that for this direction we require that q and p are co-prime as we have to divide by ∆ .
for allā ∈ I n ,b ∈ J n and π ∈ ∆. In other words, the entries of the I n × J n -matrix M * n are constant on the ∆-orbits of the index sets I n and J n . More specifically, if we let I ∆ n and J ∆ n denote the sets of ∆-orbits on I n and J n , respectively, then M * n can be identified with the matrix (M * n ∆) which is defined as Note that, depending on the size of the group ∆, the sets I ∆ n and J ∆ n can be noticeably smaller than the index sets I n and J n . Hence our obvious strategy is to choose ∆ as large as possible to obtain a much more compact linear equation system M * n ⋅ ⃗ x = 1 which is equivalent to the given one.
Recall that the maximal q-subgroups ∆ ≤ Γ are the q-Sylow groups of Γ. It is wellknown that for the case where Γ = Sym([n]) these groups can be obtained via an inductive construction which we want to explain here for the special case of n being a power of q (the general case can be handled similarly, see e.g. [13]). Hence from now on, let us assume that n = q r for some r ≥ 1.
First of all, we determine the size of q-Sylow groups of Γ. A simple induction shows that the maximal t ≥ 1 such that q t divides n! = (q r )! is given as In fact, we can write (q r )! as (q r )! = 1⋯(1 ⋅ q)⋯(2 ⋅ q)⋯(q r−1 ⋅ q). Hence t = t * + q r−1 where t * is the maximal such that q t * divides (q r−1 )!.
In particular, if we denote for n = q r a q-Sylow of Sym([n]) by ∆ r , then our argument from above shows that ∆ 1 = q and that ∆ r+1 = ∆ r q ⋅ q.
As it turns out, this equation already gives a hint about the algebraic structure of ∆ r . Indeed, ∆ r+1 can be obtained as the wreath product of ∆ r and the cyclic group F q . Since ∆ 1 = F q it follows that ∆ r is the r-fold wreath product of the cyclic group F q . We decided to skip the formal definition of the notion of wreath products and rather to directly illustrate this concept for the particular case of the q-Sylow groups of Γ = Sym([n]) = Sym([q r ]).
To obtain an algebraic description of these groups, we inductively construct for r ≥ 1 a q-Sylow subgroup ∆ r ≤ Sym([q r ]) together with a family of trees T x i for i = 0, . . . , r and x ∈ [q r−i ] such that the following properties hold.
(I) T x i is a complete q-ary tree of height i whose leaves are labelled with elements from [n].
More precisely, the labels of the leaves of T x i form the set P x i = {x ⋅ q i , . . . , (x + 1) ⋅ q i − 1} (note that P x i is the x-th block of the natural partition of [n] into parts of size q i ).
(II) For all i ≤ r the group ∆ r transitively acts on the set {T x i ∶ x ∈ [q r−i ]} by applying permutations δ ∈ ∆ r to the labels of the leaves of the tress T x i . Moreover, for each i ≤ r, the subgroup of ∆ r which point-wise stabilises the trees T x i is a normal subgroup of ∆ r . (III) We have ∆ 1 ≤ ∆ 2 ≤ ⋯ ≤ ∆ r where ∆ i acts on the set of labels P 0 i of the tree T 0 i . More generally, for every block P x i , the group ∆ r contains a subgroup ∆ i,x r ≤ ∆ r which point-wise fixes the elements of all blocks P y i for y ≠ x and whose action on P x i corresponds to the action of ∆ i on P 0 i .
The inductive construction of the trees T x i is depicted in Figure 2. To understand this construction better, it is quite useful to think of elements y ∈ [n] as being represented in their q-adic encoding, i.e. y = y 0 + y 1 ⋅ q + ⋯ + y r−1 ⋅ q r−1 . Then we have that y ∈ P 0 r = [n] and y ∈ P yr−1 Hence, the q-adic encoding of y describes the unique path in the tree T 0 r from the root to the leaf T y 0 . The trees T x i clearly satisfy the properties stated in (I). For the inductive construction of the q-Sylow groups ∆ r we first fix ∆ 1 as the cyclic group generated by the natural cyclic shift γ = (0 1 ⋯ q − 1) on the set P 0 We proceed with the inductive step r ↦ r + 1. The set [q] r+1 splits into q blocks P 0 r , . . . , P q−1 r each of size q r . The group ∆ r acts on P 0 r and point-wise fixes the elements from the blocks P x r with x ≠ 0. Let γ ∈ Sym([n]) for n = q r+1 be the following permutation which shifts the segments P 0 r , . . . , P q−1 r in a cycle of length q by composing the natural shifts on the sets of residues modulo q r : Hence for all a ∈ [n] we have γ(a) = (a + q r ) mod q r+1 . We set ∆ 0 r = ∆ r and, more generally, ∆ x r = (γ x )∆ r (γ x ) −1 for x = 0, . . . , q − 1 to obtain q copys of ∆ r which independently act on the segments P x r for 0 ≤ x ≤ q − 1. Finally, we define ∆ r+1 as the semi-direct product of (∆ 0 r × ⋯ × ∆ q−1 r ) and the cyclic group ⟨γ⟩ of size q. This means that the group elements of ∆ r+1 are elements in the set (∆ 0 r × ⋯ × ∆ q−1 r × ⟨γ⟩) and that the group operation is given by Since ∆ r+1 = ∆ r q ⋅ q we conclude that ∆ r+1 indeed is a q-Sylow subgroup.
can use the notion of signatures to describe M * n as an (S k n × S n )-matrix. This fits with our proof plan as the index sets S k n and S n of the matrix M * n are much smaller than the index sets I n and J n of the coefficient matrix M n of the original linear equation system. However, it still might be the case that the succinctness of the matrix M * n does not help, because it is not possible to obtain its entries within FOR p .
We show that this is not the case. More precisely we show that we can define the matrix M * n in FOC in a structure of size r (where we assume that r ≥ q). Therefore, the main technical step is to show that FOC can count (modulo p) the number of realisations of a potential signature σ ∈ S k n .
First of all, we need some further notation. A complete equality type in k + variables is a consistent set τ (x 1 , . . . , x k , x k+1 , . . . , x k+ ) of literals x i = x j , x i ≠ x j which contains for every pair i < j either the atom x i = x j or the literal x i ≠ x j . Note that each quantifier-free formula α ∈ FO(∅) can be expressed as a Boolean combination of complete equality types.
In the following main technical lemma we show that in the structure A = ([r]) we can count (modulo p) the number of realisations of a (potential) signature σ ∈ S n in a subtree T x i in FOC. More generally, this is possible if we additionally fix some entries of the tuples which should realise σ in T x i . Here we need another prerequisite: as we want to work with elements from the set [n] = [q r ] in a structure of size r we have to agree on some sort of succinct representation. Of course the natural choice here is to represent numbers x ∈ [n] in the structure A via their q-adic encoding: a binary relation R ⊆ [r] 2 which corresponds to a function R ∶ [r] → [q] represents the number x(R) ∈ [n] = ∑ r−1 i=0 R(i) ⋅ q i . Note that this encoding requires a linear order on the set [r] (which is not the case for the structure A). However, as we are working with FOC we can just use the number sort on which a linear order is available. Hence in the following, whenever we specify FOC-formulas or FOC-terms with free variables or with free relation symbols which should represent numbers, then we implicitly assume that these variables are numeric variables and that the relation symbols are evaluated over the number sort. The same holds for signatures σ ∈ S n which we specify in FOC-formulas by a list of pairs (h i , d i ) of numeric variables of length 2 .
Before we state our main technical lemma it is helpful to recall that our inductive construction of the trees T x i fits very well with the q-adic encoding of numbers x ∈ [n]. Again, let x ∈ [n] be given by its q-adic encoding as x = (x 0 , . . . , Then the i-th node on the unique path from the root in the tree T = T 0 r to the leave T x 0 is the root of the tree T y r−i where y = x r−i + x r−i+1 q + ⋯ + x r−1 q i−1 . In other words, the q-adic encoding of x precisely describes the path in the tree T from the root to the leave labelled with x where at level (r − i) the i last entries x r−i , . . . , x r−1 in the q-adic encoding of x are determined (i.e. x is a member of the block P y r−i ).  (a 1 , . . . , a s , a s+1 , . . . , a ) = σ}.
(ii) if Z ≠ ∅, then the formulas (ϕ e ) s<e≤ define the q-adic representation of witnessing elements a s+1 , . . . , a ∈ P x i , i.e. such that (a s+1 , . . . , a ) ∈ Z. Proof. First of all, by our previous observations it is easy to see that the condition a j ∈ P x i for j = 1, . . . , s can be defined in FOC. More generally, we can use the q-adic encoding of the elements a j to determine sgn(a 1 , . . . , a s ) in FOC. Hence, for the remainder of the proof we assume that sgn(a 1 , . . . , a s ) is consistent with σ and that a j ∈ P x i for j = 1, . . . , s. We proceed by induction on . For = 1 it suffices to show that FOC can compute (n mod p) where n = q r in the structure A. To see this, recall that p and q are co-prime and thus we can use Lagrange's theorem to conclude that q r ≡ q r ′ mod p if r ′ ≡ r mod (p − 1). Since p is a constant, the claim follows.
Let ≥ 2. We distinguish between the following two cases. If s = 0, then we can partition the set of realisationsā of σ according to first entry a 1 into P x i parts of equal size. It suffices to determine the size of each of these blocks, since we can determine P x i mod p in FOC similarly as above.
Without loss of generality let us assume that a 1 = x ⋅ q i . Since we have given the q-adic encoding of x it is easy to see that we can define the q-adic encoding of xq i in FOC. This gives us the formula ϕ 1 . Next, we partition the set of indices {2, . . . , } into classes according to the equivalence relation j 1 ≈ j 2 if σ(1, j 1 ) = σ(1, j 2 ). Let the resulting classes be Y 1 , . . . , Y v and let σ(1, y) = (h w , d w ) for all y ∈ Y w and w = 1, . . . , v.
We observe that there exists a tupleā with , and for all pairs y 1 ∈ Y w1 and y 2 ∈ Y w2 with w 1 ≠ w 2 we have that Since is a constant, the number of possible partitions of {2, . . . , } is bounded by a constant as well. It is easy to see that for every possible such partition we can check the first and third condition in FOC. To verify the second condition in FOC we use the induction hypothesis. There are two aspects which have to be discussed with more precision. First of all, we have to handle one particular case separately: indeed, if h w = 1 for all w = 1, . . . , v, then we cannot use the induction hypothesis since all elements (including a 1 ) have to be chosen in the same subtree of height one. However, in this case there is only one realisation (if the third condition is satisfied) so this does not cause any problems. The other difficulty is that we have to define the q-adic encoding of the value z w = xq i−hw+1 + d w in FOC. We already noted before that the q-adic representation of xq i−hw+1 can be defined in FOC and since 0 ≤ d w < q we can also define the q-adic encoding of z in FOC.
In fact, the induction hypothesis also provides us with a term which counts modulo p the number of possible realisations of σ in the subtrees T zw hw−1 restricted to the indices in Y w together with formulas ϕ e which define witnessing elements. Finally, since the overall number of possible realisations of σ in T x i is the product of the realisations restricted to the components Y w , the claim follows for the case where s = 0.
For the general case let ≥ s > 0 and let a 1 , . . . , a s ∈ P x i be the components of the tupleā that are already fixed. Recall that we can assume without loss of generality that sgn(a 1 , . . . , a s ) is consistent with σ and that all elements a 1 , . . . , a s are located in the subtree T x i . Since we have fixed the element a 1 , we can proceed as above except for two small changes. First of all, when applying the induction hypothesis we have to respect the remaining fixed elements a 2 , . . . , a s . Moreover, when we form the partitions of {2, . . . , } into parts Y 1 , . . . , Y v as above then we have to adapt the position of elements corresponding to the index set Y w since the element a 1 is not necessarily contained in the tree T xq i−hw +1 hw+1 . However, since we have given the q-adic representation of a 1 we can define in FOC the element 0 ≤ d a < q such that a 1 is located in the subtree T xq i−hw +1 +da hw+1 . The remaining steps can be performed as above. This finishes our proof. ◂ ▸ Lemma 27. Let τ (x 1 , . . . , x k , y 1 , . . . , y ) ∈ FO(∅) be a complete equality type (in k + variables). Then there is an FOC-term Θ τ (z x ,z y ) such that for all r ≥ q, all σā ∈ S k n and σb ∈ S n , where n = q r , the value Θ A (σā, σb) of Θ in A = ([r]) is Θ A (q, σā, σb) = {b ∈ J n ∶ sgn(b) = σb, ([n]) ⊧ τ (ā,b)} mod p for some (or, equivalently, all)ā ∈ I n with sgn(ā) = σā.
Proof. By Lemma 26 we can first check in FOC that σā and σb can be realised (otherwise the answer is trivial). Moreover, if τ (restricted to x 1 , . . . , x k ) is not consistent with σā or if τ (restricted to y 1 , . . . , y ) contradicts σb, then the answer is trivial as well.
In all other cases, Lemma 26 provides FOC-formulas which define in the structure A the q-adic encoding of elements a 1 , . . . , a k ∈ [n] such that sgn(ā) = σā. Moreover, if τ contains a literal x i = y j , then we can fix the entry b j as well. Hence, let us assume without loss of generality that τ contains the literals x i ≠ y j for all 1 ≤ i ≤ k and 1 ≤ j ≤ .
With this notation our overall aim is to determine ( B ∅ Y mod p) for Y = [ ] in FOC. The first observation is that by Lemma 26 we can determine ( B ∅ mod p) for all partial assignments in FOC. The second observation is that we can construct the values ( B Y mod p) by induction on Y as follows. For Y ⊆ {1, . . . , } and a partial assignment (with dom( ) ∩ Y = ∅) we have for all j ∈ Y that In this way we recursively obtain the value ( B ∅ Y mod p) for Y = [ ]. Since is a constant the recursion depth is bounded by a constant as well and the procedure can be formalised in FOC. ◂ ▸ Lemma 28. There exists an FOC-term Θ(μ,ν) which defines for all r ≥ q in the structure A = ([r]) the matrix M * n where n = q r .
Proof. Recall that we can view M * n as an (S k n × S n )-matrix over F p . To represent the index sets S k n and S n we letμ andν be tuples of numeric variables of lengths μ = k 2 and ν = 2 , respectively.
Note that the entry M * n (σā, σb) of M * n for σā ∈ S k n and σb ∈ S n is given as M * n (σā, σb) = {b ∈ J n ∶ sgn(b) = σb, M n (ā,b) = 1 mod p, for some (or, equivalently, all)ā ∈ I n with sgn(ā) = σā. The entry M n (ā,b), in turn, is determined by the quantifier-free formula α(x 1 ,x 2 ) ∈ FO(∅). With this preparation, Lemma 27 already shows that we can determine the value M * n (σā, σb) for the case where α is a complete equality type. For the general case we just write α as the union of complete equality types and combine the constant number of intermediate results. ▸ Theorem 30. Let K ⊆ S(∅) be a class of sets. If K q is definable in FOS p , then K is definable in FOR p .
Proof. If K q is definable in FOS p , then by Theorem 23 we can also find a formula ϕ = (slv px1 ,x 2 )α(x 1 ,x 2 ) ∈ FOS p that defines K q such that α is quantifier-free. By using the above construction and Lemma 28, we conclude that the linear equation system M n ⋅ ⃗ Proof. Otherwise we had FOS p = FOR p . As above we fix some prime q ≠ p. Let K ⊆ S(∅) be a class of sets such that K ∉ FOR p , but such that (K q ) q ∈ FOR p . Such a class K is wellknown to exist (just combine the fact that, over sets, we have Logspace ≤ FOR p ≤ Ptime and the space-hierarchy theorem, see e.g. [19]). Since FOS p = FOR p we had (K q ) q ∈ FOS p and by Theorem 30 this means that K q ∈ FOR p . Again, since FOR p = FOS p , we had K q ∈ FOS p . A second application of Theorem 30 yields K ∈ FOR p which contradicts our assumptions. ◂ Finally we remark that the proof also works for the extension of fixed-point logic by solvability quantifiers but in the absence of counting. The simple reason is that fixed-point operators do not increase the expressive power of first-order logic over the empty signature since all definable relations are composed from a constant-sized set of basic building blocks.

Discussion
We showed that the expressive power of rank operators over different prime fields is incomparable and we inferred that the version of rank logic FPR with a distinct rank operator rk p for every prime p ∈ P fails to capture polynomial time. In particular our proof shows that FPR cannot express the uniform version of the matrix rank problem where the prime p is part of the input. Moreover, we separated rank operators and solvability quantifiers in the absence of counting. Of course, an immediate question is whether the extension FPR * of FPC by the uniform rank operator rk * suffices to capture polynomial time. We do not believe that this is the case. A natural candidate to separate FPR * from Ptime is the solvability problem for linear equation systems over finite rings rather than fields [6]. While linear equations systems can be efficiently solved also over rings, there is no notion of matrix rank that seems to be helpful for this purpose. In particular, it is open, whether FPR * can define the isomorphism problem for CFI-structures generalised to Z 4 . A negative answer to this last question would provide a class of structures on which FPR * is strictly weaker than Choiceless Polynomial Time (which captures Ptime on this class [1]).
Another question concerns the relationship between solvability logic FPS and rank logic FPR * . Our proof of Lemma 7 shows that on every class of structures of bounded colour class size the two logics have the same expressive power. However, over general structures this reduction fails. We only know, by our results from Section 4, that a simulation of rank operators by solvability quantifiers would require counting.
Finally, we think it is worth to explore the connections between our approach and the game-theoretic approach proposed by Dawar and Holm in [8] to see to what extent our methods can be combined. For example, what kind of properties does a variant of their partition games have for infinitary logics with solvability quantifiers?