Dynamic Complexity of Parity Exists Queries

Given a graph whose nodes may be coloured red, the parity of the number of red nodes can easily be maintained with first-order update rules in the dynamic complexity framework DynFO of Patnaik and Immerman. Can this be generalised to other or even all queries that are definable in first-order logic extended by parity quantifiers? We consider the query that asks whether the number of nodes that have an edge to a red node is odd. Already this simple query of quantifier structure parity-exists is a major roadblock for dynamically capturing extensions of first-order logic. We show that this query cannot be maintained with quantifier-free first-order update rules, and that variants induce a hierarchy for such update rules with respect to the arity of the maintained auxiliary relations. Towards maintaining the query with full first-order update rules, it is shown that degree-restricted variants can be maintained.


Introduction
The query Parity -given a unary relation U , does U contain an odd number of elements? -cannot be expressed in first-order logic, even with arbitrary numerical built-in relations [Ajt83,FSS84]. However, it can easily be maintained in a dynamic scenario where single elements can be inserted into and removed from U , and helpful information for answering the query is stored and updated by first-order definable update rules upon changes. Whenever a new element is inserted into or an existing element is removed from U , then a stored bit P is flipped 1 . In the dynamic complexity framework by Patnaik and Immerman [PI97] this can be expressed by the following first-order update rules: on insert a into U update P as (¬U (a) ∧ ¬P ) ∨ (U (a) ∧ P ) on delete a from U update P as (U (a) ∧ ¬P ) ∨ (¬U (a) ∧ P ) This simple program proves that Parity is in the dynamic complexity class DynFO which contains all queries that can be maintained via first-order formulas that use (and update) some additional stored auxiliary relations.
ParityExists deg≤log n be the query that asks for the parity of the number of nodes that are connected to a red node and have degree at most log n, where n is the number of nodes of the graph. The binary BIT predicate essentially gives the bit encoding of natural numbers.
Theorem 1.4. ParityExists deg≤log n can be maintained in DynFO with binary auxiliary relations in the presence of a linear order and BIT.
In particular, the queries ParityExists deg≤k , for k ∈ N, do not induce an arity hierarchy for DynFO. For fixed k, essentially already unary auxiliary relations suffice.
Theorem 1.5. ParityExists deg≤k can be maintained in DynFO with unary auxiliary relations in the presence of a linear order, for every k ∈ N.
In both results, Theorem 1.4 and 1.5, the assumption on the presence of a built-in linear order and the BIT predicate can be lifted, when, for Theorem 1.4, the degree bound of ParityExists deg≤log n refers to the active domain instead of the whole domain, and, for Theorem 1.5, when binary auxiliary relations are allowed. See Section 4 for a more detailed discussion.
Finally, we complement our results by a discussion of how queries expressible in FO extended by arbitrary modulo quantifiers can be maintained in an extension of DynFO. This observation is based on discussions with Samir Datta, Raghav Kulkarni, and Anish Mukherjee.
Outline. After recalling the dynamic descriptive complexity scenario in Section 2, we prove Theorem 1.2 in Section 3, followed by Theorem 1.4 and Theorem 1.5 in Section 4. Section 5 contains the discussion regarding maintaining ParityExists and similar queries in extensions of DynFO. We conclude in Section 6.

Preliminaries and a short introduction to dynamic complexity
In this article, we write [n] for the set {1, . . . , n} of natural numbers.
We now shortly recapitulate the dynamic complexity framework as introduced by Patnaik and Immerman [PI97], and refer to Reference [SZ16] for details.
In this framework, a (relational, finite) structure I over some schema σ in can be changed by inserting a tuple into or removing a tuple from a relation of I. A change α = δ(ā) consists of an (abstract) change operation δ, which is either ins R or del R for a relation symbol R ∈ σ in , and a tupleā over the domain of I. The change ins R (ā) insertsā into the relation R of I, and del R (ā) deletesā from that relation. We denote by α(I) the structure that results from applying a change α to the structure I.
A dynamic program P stores an input structure I over σ in as well as an auxiliary structure A over some auxiliary schema σ aux . For each change operation δ and each auxiliary relation S ∈ σ aux , the dynamic program has a first-order update rule that specifies how S is updated after a change. Each such rule is of the form on change δ(p) update S(x) as ϕ S δ (p;x) where the update formula ϕ S δ is over the combined schema σ in ∪ σ aux of I and A. Now, for instance, if a tupleā is inserted into an input relation R, the auxiliary relation S is updated to {b | (I, A) |= ϕ S ins R (ā;b)}. In the standard scenario, all relations in both I and A are empty initially.
An m-ary query q on σ-structures, for some schema σ, maps each σ-structure with some domain D to a subset of D m , and commutes with isomorphism. A query q is maintained by P if A has one distinguished relation Ans which, after each sequence of changes, contains the result of q for the current input structure I. The class DynFO contains all queries that can be maintained by first-order update rules. The class DynProp likewise contains the queries that can be maintained by quantifier-free update rules. We say that a query q is in k-ary DynFO, for some number k ∈ N, if it is in DynFO via a dynamic program that uses at most k-ary auxiliary relations; and likewise for DynProp.
Sometimes we allow the update formulas to access built-in relations, as for example a predefined linear order ≤ and the BIT predicate. We then assume that the input provides a binary relation that stores a linear order ≤ on the domain, which allows to identify the domain with a prefix of the natural numbers, and a binary relation BIT that contains a tuple (i, j) if the j-th bit in the binary representation of i is 1. Built-in relations are not changed by update rules.
For expressibility results we will use the standard scenario of Patnaik and Immerman [PI97] that uses initial input and auxiliary structures with empty relations. Our inexpressibility results are stated for the more powerful scenario where the auxiliary structure may be initialised arbitrarily. See also Reference [ZS15] for a discussion of these different scenarios.
Already quantifier-free programs are surprisingly expressive, as they can maintain, for instance, all regular languages [GMS12] and the transitive closure of deterministic graphs [Hes03]. As we have seen in the introduction, also the query Parity can be maintained by quantifier-free update rules. The following example illustrates a standard technique for maintaining queries with quantifier-free update rules which will also be exploited later.
Example 2.1. For fixed k ∈ N, let size-k be the Boolean query that asks whether the size of a unary relation U is equal to k, so, whether |U| = k holds. This query is easily definable in FO for each k. We show here that size-k can be maintained by a DynProp-program P with binary auxiliary relations.
The dynamic program we construct uses k-lists, a slight extension of the list technique introduced by Gelade, Marquardt and Schwentick [GMS12]. The list technique was also used to maintain emptiness of a unary relation U under insertions and deletions of single elements with quantifier-free formulas [ZS15]. To this end, a binary relation List is maintained which encodes a linked list of the elements in U in the order of their insertion. Additionally, two unary relations mark the first and the last element of the list. The key insight is that a quantifier-free formula can figure out whether the relation U becomes empty when an element a is deleted by checking whether a is both the first and the last element of the list.
Let us implement this highlevel idea for a fixed k ∈ N. Let def = k + 1. To maintain size-k, the quantifier-free dynamic program P stores a list of all elements u ∈ U, using a binary relation List 1 . More precisely, if u 1 , . . . , u m are the elements in U, then List 1 contains the tuples (u i j , u i j+1 ), for 1 ≤ j ≤ m − 1, where i 1 , . . . , i m is some permutation of {1, . . . , m}. Additionally, the program uses binary relations List 2 , . . . , List such that List i describes paths of length i in the linked list List 1 . For example, if (u 1 , u 2 ), (u 2 , u 3 ) and (u 3 , u 4 ) are tuples in List 1 , then (u 1 , u 4 ) ∈ List 3 . The list List 1 comes with 2 unary relations First 1 , . . . , First , Last 1 , . . . , Last that mark the first and the last elements of the list, as well as with k + 2 nullary relations Is 0 , . . . , Is k , Is >k that indicate the number of elements in U up to k. We call nodes u with u ∈ First i or u ∈ Last i the i-first or the i-last element, respectively.
Using these relations, the query can be answered easily: the result is given by Is k . We show how to maintain the auxiliary relations under insertions and deletions of single 9:6 N. Vortmeier and T. Zeume Vol. 17:4 elements, and assume for ease of presentation of the update formulas that if a change ins U (u) occurs then u / ∈ U before the change, and a change del U (u) only happens if u ∈ U before the change.
Insertions of elements. When an element u is inserted, it needs to be inserted into the list. This element u also becomes the last element of the list (encoded by a tuple u ∈ Last 1 ), and the i-last element u becomes the (i + 1)-last one, for i < . If only i elements are in the list before the change, u becomes the (i + 1)-first element. The update formulas are as follows: Deletions of elements. When an element u is deleted, the hardest task for quantifier-free update formulas is to determine whether, if the size of U was at least k + 1 before the change, its size is now exactly k. We use that if an element u is the j-first and at the same time the j -last element, then the list contains exactly j + j − 1 elements. If u is removed from the list, j + j − 2 elements remain. So, using the relations First j and Last j , the exact number m of elements after the change can be determined, if m ≤ 2 − 2 = 2k, and in particular, it can be determined whether this number is k. The relations First i (and, symmetrically the relations Last i ) can be maintained using the relations List j : if the i -first element u is removed from the list, then u becomes the i-first element for i ≤ i ≤ if (u, u ) ∈ List i−i +1 . The update formulas exploit these insights: As all auxiliary relations can be maintained under insertions and deletions of elements, the presented dynamic program witnesses that size-k is in binary DynProp.
Later on we will use that the dynamic program from Example 2.1 can straightforwardly be extended to maintain the set of nodes in a graph with degree k, for each fixed k ∈ N: for each node v of the graph, the dynamic program maintains whether the set of nodes adjacent to v has size k. Towards this end, the program maintains one instance of the auxiliary relations from Example 2.1 for each node v. This is realised by increasing the arity of every auxiliary relation by one, and the additional dimension is used to indicate the node to which a tuple belongs. Accordingly, this dynamic program uses at most ternary auxiliary relations.

ParityExists and quantifier-free updates
In this section we start our examination of the ParityExists query in the context of quantifier-free update rules. Let us first formalise the query. It is evaluated over coloured graphs, that is, directed graphs (V, E) with an additional unary relation R that encodes a set of (red-)coloured nodes. 3 A node w of such a graph is said to be covered if there is a coloured node v ∈ R with (v, w) ∈ E. The query ParityExists asks, given a coloured graph, whether the number of covered nodes is odd.
As stated in the introduction, ParityExists cannot be maintained with quantifierfree update rules. A closer examination reveals a close connection between a variant of this query and the arity structure of DynProp. Let k be a natural number. The variant ParityExists deg≤k of ParityExists asks whether the number of covered nodes that additionally have in-degree at most k is odd. Note that ParityExists deg≤k is a query on general coloured graphs, not only on graphs with bounded degree.
Theorem 1.2. ParityExists deg≤k can be maintained in DynProp with auxiliary relations of arity k, for any k ≥ 3, but not with auxiliary relations of arity k − 1, even on graphs with in-degree at most k.
We repeat two immediate consequences which have already been stated in the introduction.  Proof. For every k ≥ 1 we give a Boolean graph query that can be maintained using k-ary auxiliary relations, but not with (k − 1)-ary relations.
For k ≥ 3, we choose the query ParityExists deg≤k which satisfies the conditions by Theorem 1.2. 3 We note that the additional relation R is for convenience of exposition. All our results are also valid for pure graphs: instead of using the relation R one could consider a node v coloured if it has a self-loop (v, v) ∈ E. For k = 2, already [ZS15, Proposition 4.10] shows that the query s-t-TwoPath which asks whether there exists a path of length 2 between two distinguished vertices s and t separates unary DynProp from binary DynProp.
For k = 1, we consider the Boolean graph query ParityDegreeDiv3 that asks whether the number of nodes whose degree is divisible by 3 is odd. This query can easily be maintained in DynProp using only unary auxiliary relations. In a nutshell, a dynamic program can maintain for each node v the degree of v modulo 3. So, it maintains three unary relations These relations can easily be updated under edge insertions and deletions. Similar as for Parity, a bit P that gives the parity of |M 0 | can easily be maintained.
On the other hand, ParityDegreeDiv3 cannot be maintained in DynProp using nullary auxiliary relations. Suppose towards a contradiction that it can be maintained by a dynamic program P that only uses nullary auxiliary relations and consider an input instance that contains the nodes V = {u 1 , u 2 , v 1 , v 2 , v 3 } and the edges E = {(u 1 , v 1 ), (u 1 , v 2 ), (u 2 , v 1 )}. No matter the auxiliary database, P needs to give the same answer after the changes α 1 def = ins E (u 1 , v 3 ) and α 2 def = ins E (u 2 , v 3 ), as it cannot distinguish these tuples using quantifier-free first-order formulas. But α 1 leads to a yes-instance for ParityDegreeDiv3, and α 2 does not. See Figure 1 for an illustration. So, P does not maintain ParityDegreeDiv3.
The rest of this section is devoted to the proof of Theorem 1.2. First, in Subsection 3.1, we show that ParityExists deg≤k can be maintained with k-ary auxiliary relations, for k ≥ 3. For this, we employ the list technique introduced in Example 2.1. Afterwards, in Subsection 3.2, we prove that auxiliary relations of arity k − 1 do not suffice. This proof relies on a known tool for proving lower bounds for DynProp that exploits upper and lower bounds for Ramsey numbers [Zeu17].
3.1. Maintaining ParityExists deg≤k . We start by proving that ParityExists deg≤k can be maintained in DynProp using k-ary auxiliary relations. In Subsection 3.2 we show that this arity is optimal.
Proof. Let k ≥ 3 be some fixed natural number. We show how a DynProp-program P can maintain ParityExists deg≤k using at most k-ary auxiliary relations.
The idea is as follows. Whenever a formerly uncoloured node v gets coloured, a certain number c(v) of nodes become covered: v has edges to all these nodes, but no other coloured node has. Because the number c(v) can be arbitrary, the program P necessarily has to store for each uncoloured node v the parity of c(v) to update the query result. But this is not  Figure 2. An illustration of the notation used in the proof of Proposition 3.1. The set N •• (A, B) does not include w 1 , as there is no edge (v 5 , w 1 ), and it does not include w 5 , as there is an edge (v 7 , w 5 ) for a coloured node v 7 ∈ A.
sufficient. Suppose that another node v is coloured by a change and that, as a result, a number c(v ) of nodes become covered, because they have an edge from v and so far no incoming edge from another coloured neighbour. Some of these nodes, say, c(v, v ) many, also have an incoming edge from v. Of course these nodes do not become covered any more when afterwards v is coloured, because they are already covered. So, whenever a node v gets coloured, the program P needs to update the (parity of the) number c(v), based on the (parity of the) number c(v, v ). In turn, the (parity of the) latter number needs to be updated whenever another node v is coloured, using the (parity of the) analogously defined number c(v, v , v ), and so on. It seems that this reasoning does not lead to a construction idea for a dynamic program, as information for more and more nodes needs to be stored, but observe that only those covered nodes are relevant for the query that have in-degree at most k. So, a number c(v 1 , . . . , v k ) does not need to be updated when some other node v k+1 gets coloured, because no relevant node has edges from all nodes v 1 , . . . , v k+1 .
We now present the construction in more detail. A node w is called active if its indegree in-deg(w) is at most k. Let A = {a 1 , . . . , a } be a set of coloured nodes and let B = {b 1 , . . . , b m } be a set of uncoloured nodes, with + m ≤ k. By N •• G (A, B) we denote the set of active nodes w of the coloured graph G whose coloured (in-)neighbours are exactly the nodes in A and that have (possibly amongst others) the nodes in B as uncoloured We omit the subscript G and just write N •• (A, B) if the graph G is clear from the context. See Figure 2 for an example. The dynamic program P maintains the parity of Whenever a change α = ins R (v) colours a node v of G, the update is as follows. We distinguish the three cases In case (1), the set B∪{v}), and the existing auxiliary information can be copied. In case (2), actually N •• α(G) (A, B) = ∅, as B contains a coloured node. The parity of the cardinality 0 of ∅ is even. For case (3) we distinguish two further cases. If |A ∪ B| = k, no active node w can have incoming edges from every node in A ∪ B ∪ {v} as w has in-degree at most k, so ) and the existing auxiliary information is taken over.
and P can combine the existing auxiliary information.
When a change α = del R (v) uncolours a node v of G, the necessary updates are symmetrical. The case v ∈ A is similar to case (2) above: . Edge insertions and deletions are conceptionally easy to handle, as they change the sets N •• (A, B) by at most one element. Given all nodes of A and B and the endpoints of the changed edge as parameters, quantifier-free formulas can easily determine whether this is the case for specific sets A, B.
We now present P formally. For every ≤ k + 1 the program maintains unary relations N and N • with the intended meaning that for a node w it holds w ∈ N if in-deg(w) = and w ∈ N • if w has exactly coloured in-neighbours. These relations can be maintained as explained in Example 2.1 and the subsequent remark, requiring some additional, ternary auxiliary relations. We also use a relation Active def = N 1 ∪ · · · ∪ N k that contains all active nodes with at least one edge.
For every , m ≥ 0 with 1 ≤ + m ≤ k the programs maintains ( + m)-ary auxiliary relations P ,m with the intended meaning that a tuple (a 1 , . . . The following formula θ ,m checks the first two conditions: Of course, P also maintains the Boolean query relation Ans. We now describe the update formulas of P for the relations P ,m and Ans, assuming that each change actually alters the input graph, so, for example, no changes ins E (v, w) occur such that the edge (v, w) already exists.
Colouring a node v. A change ins R (v) increases the total number of active, covered nodes by the number of active nodes that have so far no coloured in-neighbour, but an edge from v. That is, this number is increased by |N •• (∅, {v})|. The update formula for Ans is therefore We only spell out the more interesting update formulas for the relations P ,m , for different values of , m. These formulas list the conditions for tuplesā = a 1 , . . . , a andb = b 1 , . . . , b m that N •• ({a 1 , . . . , a }, {b 1 , . . . , b m }) is of odd size after a change. The other update formulas are simple variants.
Uncolouring a node v. The update formulas for a change del R (v) are analogous to the update formulas for a change ins R (v) as seen above. Again we only present a subset of the update formulas, the others are again easy variants.
Inserting an edge (v, w). When an edge (v, w) is inserted, the number of active, covered nodes can change at most by one. At first, a covered node w might become inactive. This happens when w had in-degree k before the insertion. Or, an active node w becomes covered. This happens if v is coloured and w had no coloured in-neighbour and in-degree at most k − 1 before the change. The update formula for Ans is accordingly The necessary updates for relations P ,m are conceptionally very similar. We list the conditions that characterise whether the membership of w in N •• (A, B) changes, for a set A = {x 1 , . . . , x } of coloured nodes and a set B = {y 1 , . . . , y m } of uncoloured nodes.
• Before the change, w ∈ N •• (A, B) holds, but not afterwards. This is either because w becomes inactive or because the new edge (v, w) connects w with another coloured node v. This case is expressed by the formula • Before the change, w ∈ N •• (A, B) does not hold, but it does afterwards. Then w needs to be active and to have an incoming edge from all but one node from A ∪ B, and v is that one node. Additionally, w has no other coloured in-neighbours. The following formulas ψ 2 , ψ 3 express these conditions for the cases v ∈ A and v ∈ B, respectively.
The update formula for P ,m is then Deleting an edge (v, w). The ideas to construct the update formulas for changes del E (v, w) are symmetrical to the constructions for changes ins E (v, w). When an edge (v, w) is deleted, the node w becomes active if its in-degree before the change was k + 1. It is (still) covered, and then is a new active and covered node, if it has coloured in-neighbours other than v. This is the case if w has at least two coloured in-neighbours before the change, or if it has at least one coloured in-neighbour and v is not coloured.
On the other hand, if v was the only coloured in-neighbour of an active node w, this node is not covered any more. The update formula for the query relation Ans is therefore Regarding the update of relations P ,m , we distinguish the same cases as for insertions ins E (v, w) for a set A = {x 1 , . . . , x } of coloured nodes and a set B = {y 1 , . . . , y m } of uncoloured nodes. • Before the change, w ∈ N •• (A, B) holds, but not afterwards. That means the active node w has incoming edges from all nodes from A ∪ B, has no coloured in-neighbours apart from the nodes in A, and v ∈ A ∪ B. This is expressed by the formula • Before the change, w ∈ N •• (A, B) does not hold, but it does afterwards. Then w already is and stays connected to all nodes from A ∪ B, and either have degree k + 1 and become active and/or loose an additional coloured in-neighbour v. The following formula ψ 2 lists the possible combinations.
Finally, the update formula for P ,m is Our proof does not go through for k < 3, as we use ternary auxiliary relations to maintain whether a node has degree at most k, see Example 2.1 and the subsequent remark. In fact, this cannot be circumvented, as formalised by the next proposition. The proof relies on a lower bound result by Zeume and Schwentick [ZS15]. They show that one cannot maintain in binary DynProp, not even with arbitrary initialisation, whether there is a directed path from some distinguished node s to some distinguished node t in a 2-layered graph G [ZS15, Theorem 4.7]. A graph G = (V, E, s, t) with distinguished nodes s, t ∈ V is 2-layered, if its set V of nodes can be partitioned into sets V = {s, t} ∪ A ∪ B, such that edges go either from s to some node in A, from some node in A to some node in B, or from some node in B to t. So, the edge set E is a subset of ({s} We prove Proposition 3.2 using a reduction from (a special case of) this query.
Proof. We first show the result for k = 1. The proof of [ZS15, Theorem 4.7] shows that there is no dynamic program with quantifier-free update rules and binary auxiliary relations that can maintain s-t-reachability in 2-layered graphs, not even if the auxiliary relations may be initialised arbitrarily. The proof actually shows that such dynamic programs cannot even maintain the query if • the initial graph may be any 2-layered graph G = (V, E, s, t) with some node set V = {s, t} ∪ A ∪ B that satisfies the following conditions: there is no edge from s to any other node, and  all nodes from B have an edge to t, • the auxiliary relations are initialised arbitrarily, • the changes consist of a sequence of deletions of edges from A × B followed by the insertion of a single edge from s to some node in A.
We now assume, towards a contradiction, that there is a dynamic program P that witnesses that ParityExists deg≤1 is in binary DynProp. We show that from P we can construct a dynamic program P with quantifier-free update rules and binary auxiliary relations that can maintain s-t-reachability for 2-layered graphs with the restrictions noted above, contradicting [ZS15, Theorem 4.7].
Let G = (V, E, s, t) be some 2-layered graph with node set V = {s, t} ∪ A ∪ B, such that (b, t) ∈ E for every b ∈ B and (s, v) ∈ E for every v ∈ V . Let G = (V, E , R) be the coloured graph with the same node set V as G, edge set E def = {(v, u) | (u, v) ∈ E}, and R = ∅. Let A be the auxiliary relations that P assigns to G starting from an initially empty graph and arbitrarily initialised auxiliary relations when the edges E are inserted in some arbitrary order.
We now explain how a dynamic program P can maintain s-t-reachability for G under deletions of edges from A × B followed by the insertion of a single edge from s to some node in A, starting from the initial auxiliary relations A . The basic idea is that changes to G are translated to changes to G such that • if the graph obtained from G has an s-t-path then the graph obtained from G has no covered node with in-degree at most 1, and • if the graph obtained from G has no s-t-path then the graph obtained from G has exactly one covered node with in-degree at most 1.
The dynamic program P proceeds as follows. If an edge (u, v) ∈ E with u ∈ A and v ∈ B is deleted, then P simulates P for the deletion of the edge (v, u) ∈ E . If an edge (s, a) is inserted into E, then P simulates P for the insertion of (s, a) into E followed by the insertion of s into R. Then P gives the query answer "true" if and only if the answer of P is "false". All this is clearly expressible by quantifier-free update formulas.
Let G u be the 2-layered graph that results from G by applying the changes, and let G u be the coloured graph that results from G by applying the corresponding changes. An example is depicted in Figure 3. It remains to show that there is an s-t-path in G u if and only if the number of covered nodes in G u that have in-degree at most 1 is not odd. Suppose that there is an s-t-path in G u using edges (s, a), (a, b), (b, t), for some nodes a ∈ A and b ∈ B. It follows that the edges (s, a) and (b, a) are present in G u , so, a has in-degree at least 2. As a is the only neighbour of the only red node s, there are 0 covered nodes in G u with in-degree at most 1, an even number. Suppose on the other hand that there is no s-t-path in G u . That means that the only node a ∈ A such that an edge (s, a) exists in G u has no edge to any node in B, because every node from B has an edge to t. Consequently, the only incoming edge of a in G u is from s, which is a red node. So, there is exactly one covered node in G u with in-degree at most 1, an odd number. This concludes the case k = 1.
The case of k = 2 can be proven along the same lines, with the only adjustment that in the graph G we add edges from t to every node in A ∪ B, increasing the in-degree of every node from this set by 1.

3.2.
Inexpressibility results for ParityExists deg≤k . In this subsection we prove that kary auxiliary relations are not sufficient to maintain ParityExists deg≤k+1 , for every k ∈ N. The proof technique we use, and formalise as Lemma 3.3, is a reformulation of the proof technique of Zeume [Zeu17], which combines proof techniques from dynamic complexity [GMS12,ZS15] with insights regarding upper and lower bounds for Ramsey numbers. We actually use a special case of the formalisation from [SVZ18, Lemma 7.4], which is sufficient for our application.
The technique consists of a sufficient condition under which a Boolean query q cannot be maintained in DynProp with at most k-ary auxiliary relations. The condition basically requires that for each collection B of subsets of size k + 1 of a set {1, . . . , n} of elements that may be changed, for an arbitrary n, there is a structure I whose domain includes the elements {1, . . . , n} and a sequence δ 1 (x 1 ), . . . , δ k+1 (x k+1 ) of changes such that (1) the elements 1, . . . , n cannot be distinguished by quantifier-free formulas evaluated on I, and (2) the structure that results from I by applying the changes δ 1 (i 1 ), . . . , δ k+1 (i k+1 ) in that order, for each choice of k + 1 elements {i 1 , . . . i k+1 } ⊆ {1, . . . , n}, is a positive instance for q exactly if {i 1 , . . . , i k+1 } ∈ B.
In the following, we write (I,ā) ≡ 0 (I,b) ifā andb have the same length and agree on their quantifier-free type in I, that is, I |= ψ(ā) if and only if I |= ψ(b) for all quantifier-free formulas ψ. We denote the set of all subsets of size k of a set A by A k . Lemma 3.3 [SVZ18]. Let q be a Boolean query of σ-structures. Then q is not in k-ary DynProp, even with arbitrary initialisation, if for each n ∈ N and all subsets B ⊆ [n] k+1 there exist • a σ-structure I and a set P = {p 1 , . . . , p n } of distinct elements such that -P is a subset of the domain of I, -(I, p i 1 , . . . , p i k+1 ) ≡ 0 (I, p j 1 , . . . , p j k+1 ) for all strictly increasing sequences i 1 , . . . , i k+1 and j 1 , . . . , j k+1 over [n], and • a sequence δ 1 (x 1 ), . . . , δ k+1 (x k+1 ) of changes such that for all strictly increasing sequences i 1 , . . . , i k+1 over [n]: With the help of Lemma 3.3 we can show the desired inexpressibility result.
Proposition 3.4. For every k ≥ 0, ParityExists deg≤k+1 is not in k-ary DynProp, even with arbitrary initialisation. This even holds if the input graph may only have in-degree at most k + 1.
In the following, for a graph G = (V, E) and some set X ⊆ V of nodes we write N → ∃ (X) for the set {v | ∃u ∈ X : E(u, v)} of out-neighbours of the nodes in X. For singleton sets of nodes that are out-neighbours of every node in X.
Proof. Let k ∈ N be fixed. We apply Lemma 3.3 to show that ParityExists deg≤k+1 is not in k-ary DynProp.
The basic proof idea is simple. Given a collection B ⊆ [n] k+1 , we construct a graph G = (V, E) with distinguished nodes P = {p 1 , . . . , p n } ⊆ V such that (1) each node has in-degree at most k + 1 and It remains to construct the graph G. Let S be the set of all non-empty subsets of [n] of size at most k + 1. We choose the node set V of G as the union of P and S. Only nodes in P will be coloured, and only nodes from S will be covered. A first attempt to realise the idea mentioned above might be to consider an edge set {(p i , B) | B ∈ B, i ∈ B}: then, having fixed some set B ∈ B, the node B becomes covered whenever the nodes p i with i ∈ B are coloured. However, also some nodes B = B will be covered, namely if B ∩ B = ∅, and the number of these nodes influences the query result. We ensure that the set of nodes B = B that are covered by {p i | i ∈ B} is of even size, so that the parity of |N → ∃ ({p i | i ∈ B})| is determined by whether B ∈ B holds. This will be achieved by introducing edges to nodes [n] i ∈ S for i ≤ k such that for every subset P of P of size at most k the number of nodes from S that have an incoming edge from all nodes from P is even. By an inclusion-exclusion argument we conclude that for any setP ∈ P k+1 the number of nodes from S that have an incoming edge from some node ofP , but not from all of them, is even. It follows that whenever k + 1 nodes p i 1 , . . . , p i k+1 are marked, the number of covered nodes is odd precisely if there is one node in S that has an edge from all nodes p i 1 , . . . , p i k+1 , which is the case exactly if {i 1 , . . . , i k+1 } ∈ B.
We now make this precise. Let n be arbitrary and let P = {p 1 , . . . , p n }. For a set X ⊆ [n] we write P X for the set {p i | i ∈ X}.
The structure I we construct consists of a coloured graph G = (V, E, R) with nodes V 1 ∪ · · · ∪ [n] k+1 , and initially empty set R def = ∅ of coloured nodes. The edge set E contains all edges (p i , Y ) such that i ∈ Y and the set {B ∈ B | Y ⊆ B} has odd size. See Figure 4 for an example of this construction. Note that for each Y ∈ [n] i , for i ∈ {1, . . . , k + 1}, the degree of Y in G is at most i, and therefore also at most k + 1.  k+1 the set N → ∃ (P B ) contains all nodes with an incoming edge from a node in P B . It is therefore equal to the union i∈B N → ∃ (p i ). When we sum up the cardinalities of these sets N → ∃ (p i ), any node in N → ∃ (P B ) with edges to both p i and p j , for numbers i, j ∈ B, is accounted for twice. Continuing this argument, the cardinality of N → ∃ (P B ) can be computed as follows: For the parity of |N → ∃ (P B )| it therefore holds Our claim follows from the observation that |N → ∀ (P X )| is odd if and only if X ∈ B, which we will prove next.
Recall that for each i ≤ n and Y ∈ S an edge (p i , Y ) exists precisely if i ∈ Y and Y is included in an odd number of sets B ∈ B. This means that Y ∈ N → ∀ (P X ) if and only if X ⊆ Y and Y is included in an odd number of sets B ∈ B. The parity of |N → ∀ (P X )| is therefore congruent modulo 2 to the number of pairs (Y, B ) such that X ⊆ Y ⊆ B and B ∈ B hold: if Y is included in an even number of sets B ∈ B then Y ∈ N → ∀ (P X ), but the parity is not affected by also counting the even number of pairs (Y, B ) for this set Y .
For a fixed set B , the number of sets Y with X ⊆ Y ⊆ B is 2 |B \X| . We conclude that where the right-hand side is odd if and only if there is a B ∈ B with X ⊆ B and B \ X = ∅, so if X ∈ B. This proves the claim. Let δ 1 (x 1 ), . . . , δ k+1 (x k+1 ) be the change sequence ins R (x 1 ), . . . , ins R (x k+1 ) that colours the nodes x 1 , . . . , x k+1 . Let B ∈ [n] k+1 be of the form {i 1 , . . . , i k+1 } with i 1 < · · · < i k+1 . The change sequence α B def = δ 1 (p i 1 ) · · · δ k+1 (p i k+1 ) = ins R (p i 1 ), . . . , ins R (p i k+1 ) results in a graph where the set of coloured nodes is exactly P B . As all nodes in N → ∃ (P B ) have degree at most k + 1 and the set N → ∃ (P B ) is of odd size exactly if B ∈ B, we have that α B (I) is a positive instance of ParityExists deg≤k+1 if and only if B ∈ B.

ParityExists and first-order updates
As discussed in the introduction, the Parity query can be easily maintained with firstorder update rules. So far we have seen that its generalisation ParityExists can only be maintained with quantifier-free update rules if the in-degree of covered nodes is bounded by a constant. Now we show that with full first-order update rules, this query can be maintained if the in-degree is bounded by log n, where n is the number of nodes in the graph. We emphasise that only the in-degree of covered nodes is bounded, while a coloured node v can cover arbitrarily many nodes. If also the out-degree of coloured node is restricted, maintenance in DynFO becomes trivial 4 .
We start by providing a dynamic program with first-order update rules that maintains ParityExists deg≤k , for a constant k, and only uses unary relations apart from a linear order. Thus, in contrast to quantifier-free update rules, this query cannot be used to obtain an arity hierarchy for graph queries for first-order update rules. Afterwards we will exploit the technique used here to maintain ParityExists deg≤log n with binary auxiliary relations.
Theorem 1.5. ParityExists deg≤k can be maintained in DynFO with unary auxiliary relations in the presence of a linear order, for every k ∈ N.
An intuitive reason why quantifier-free dynamic programs for ParityExists deg≤k need auxiliary relations of growing arity is that for checking whether some change, for instance the colouring of a node v, is "relevant" for some node w, it needs to have access to all of w's "important" neighbours. Without quantification, the only way to do this is to explicitly list them as elements of the tuple for which the update formula decides whether to include it in the auxiliary relation.
With quantification and a linear order, sets of neighbours can be defined more easily, if the total number of neighbours is bounded by a constant. Let us fix a node w with at most k (in-)neighbours, for some constant k. Thanks to the linear order, the neighbours can be distinguished as first, second, . . . , k-th neighbour of w, and any subset of these nodes is uniquely determined and can be defined in FO by the node w and a set I ⊆ {1, . . . , k} that indexes the neighbours. With this idea, the proof of Proposition 3.1 can be adjusted appropriately for Theorem 1.5.
Proof (of Theorem 1.5). Let k ∈ N be some constant. Again, we call a node active if its in-degree is at most k. We sketch a dynamic program that uses a linear order on the nodes and otherwise at most unary auxiliary relations.
w 1 w 2 w 3 w 4 w 5 Figure 5. An illustration of the notation used in the proof of Theorem 1.5. The set N •• G (N ← {1,2,3} (w 3 )) does not include w 1 , as there is no edge (v 5 , w 1 ), and it does not include w 5 , as there is an edge (v 7 , w 5 ) for a coloured node v 7 ∈ N ← {1,2,3} (w 3 ). Compare with Figure 2.
Let I be a non-empty subset of {1, . . . , k}, and let w be an active node with at least max(I) in-neighbours. The set N ← I (w) of I-indexed in-neighbours of w includes a node v if and only if (v, w) is an edge in the input graph and v is the i-th in-neighbour of w with respect to the linear order, for some i ∈ I. The following notation is similar as in the proof of Proposition 3.1. For a graph G and an arbitrary set C of (coloured and uncoloured) nodes, we denote by N •• G (C) the set of active nodes that have an incoming edge from every node in C and no coloured in-neighbour that is not in C. An example for these notions is depicted in Figure 5.
For every I ⊆ {1, . . . , k} with I = ∅ we introduce an auxiliary relation P I with the following intended meaning. An active node w with at least max(I) neighbours is in P I if and only if (1) w has no coloured in-neighbours that are not contained in N ← I (w), and (2) the set N •• G (N ← I (w)) has odd size. Note that (1) implies that w ∈ N •• G (N ← I (w)). An auxiliary relation P I basically replaces the relations P ,m with + m = |I| from the proof of Proposition 3.1, and the updates are mostly analogous.
We now explain how the query relation Ans and the relations P I are updated when a modification to the input graph occurs. For maintaining P I , observe that first-order formulas can easily express that a node w is active, has at least max(I) neighbours and satisfies condition (1). The main task of the dynamic program we construct is to check condition (2).
Colouring a node v. When a change ins R (v) occurs, so, when a node v is coloured, the query relation Ans is only changed if v becomes the only coloured neighbour of an odd number of active nodes. This is the case if and only if there is an active and previously uncovered node w that v has an edge to and, furthermore, if w ∈ P I for the set I def = {i}, where i is the number such that v is the i-th in-neighbour of w with respect to the linear order.
For an arbitrary index set I, the update of a relation P I after the colouring of a node v is as follows. Let G be the graph before the change is applied, and let G be the changed graph. Let w be any active node. If v is an I-indexed in-neighbour of w, so if v ∈ N ← I (w), no change regarding w ∈ P I is necessary. Otherwise if v ∈ N ← I (w), we need to check whether The proof of Theorem 1.5 constructs a dynamic program that maintains unary relations P I , for each non-empty set I ⊆ {1, . . . , k}. We replace these relations by a single binary relation P , with the intended meaning that (v, w) ∈ P if and only if w ∈ P I(v) . First-order update rules can easily translate between these two representations in the presence of a linear order and BIT, and otherwise the update works exactly as described in the proof of Theorem 1.5.
In addition to a linear order, Etessami [Ete98] also shows how corresponding relations addition and multiplication can be maintained for the active domain of a structure. As BIT is first-order definable in the presence of addition and multiplication, and vice versa (see e.g. [ still using only binary auxiliary relations. So, the variant of ParityExists deg≤log n that considers n to be the number of non-isolated nodes, instead of the number of all nodes, can be maintained in binary DynFO without assuming built-in relations.

Maintenance using auxiliary relations of quasi-polynomial size
Orthogonally to the perspectives taken in this work so far, which focussed on the expressive power of the update formalism, one can ask how many auxiliary bits are necessary to maintain the query ParityExists, or, more generally, all queries expressible in first-order logic extended by modulo quantifiers. The class DynFO allows for polynomially many auxiliary bits: the auxiliary relations of a DynFO program can be encoded by a bit string of polynomial size. It is not hard to see that if one allows quasi-polynomially many auxiliary bits -so, the number of auxiliary bits is bounded by 2 log O(1) n -then all queries expressible in first-order logic extended by modulo quantifiers can be maintained. This was observed in discussions with Samir Datta, Raghav Kulkarni and Anish Mukherjee. Here, we provide a proof sketch for this observation.
For discussing the amount of auxiliary bits, it is convenient to switch the view point from first-order updates to updates computed by AC 0 circuits. A classical result linking circuit complexity and finite model theory states that a query can be computed by a uniform family of AC 0 -circuits (that is, by constant depth and polynomial size circuits with ¬-, ∧and ∨-gates with unbounded fan-in) if and only if it can be expressed by a first-order formula with access to a built-in linear order and BIT [BIS90]. So, if we assume the presence of a built-in linear order and BIT then the classes DynFO and (uniform) DynAC 0 coincide.
The class ACC 0 is defined similarly as AC 0 , but the circuits are additionally allowed to use modulo-gates. A query can be computed by a uniform family of ACC 0 -circuits if and only if it can be expressed by a first-order formula that may use modulo quantifiers, in addition to a linear order and BIT.
For simplifying the discussion, in the following we take a solely circuit-based perspective. We also, from now on, disregard uniformity conditions and only consider non-uniform circuit classes.
The classes q-AC 0 and q-ACC 0 are defined as the classes AC 0 and ACC 0 except that circuits can be of quasi-polynomial size, that is, of size 2 log O(1) n . The class DynAC 0 is the class of queries that can be maintained with AC 0 -circuits and polynomially many auxiliary bits. The class q-DynAC 0 is defined as the class DynAC 0 except that dynamic programs may use quasi-polynomially many auxiliary bits and update circuits from q-AC 0 .
It turns out that with quasi-polynomial update circuits all q-ACC 0 -queries can be maintained, and in particular the query ParityExists.
Theorem 5.1. Every query in q-ACC 0 can be maintained in q-DynAC 0 .
Instead of proving this theorem directly, we use that q-ACC 0 can be characterised by very simple circuits with one gate with quasi-polynomial in-degree [BT94].
A boolean function f : {0, 1} m → {0, 1} is symmetric if f (x) = f (ȳ) whenever the number of ones inx andȳ is equal. The class Sym + contains all queries computable by depthtwo size-2 log O(1) n circuits where the output gate computes a symmetric boolean function, and it has incoming wires from a layer of and-gates, which each have fan-in log O(1) n (see Reference [BT94]). As q-ACC 0 is contained in Sym + [BT94, Proposition 1.2], the following result implies Theorem 5.1.
Theorem 5.2. Every query in Sym + can be maintained in q-DynAC 0 .
Proof. The proof extends the ideas from the proofs of Theorem 1.4 and Theorem 1.5 to nodes with in-degree log O(1) n.
Let C be a family of Sym + -circuits, where for each n ∈ N the circuit C n is a depth-two size-2 log O(1) n circuit whose output gate computes some symmetric boolean function h, and that otherwise consists of a layer of and-gates g 1 , g 2 , . . . with fan-in at most k, for some k ∈ log O(1) n.
We construct a q-DynAC 0 -program P. The idea is to maintain, for each domain size n, the number m of and-gates of C n that are currently activated, i.e., that are only connected to inputs that are currently set to 1. The output of the symmetric function h for inputs with m ones can then be looked up in a table.
For maintaining the number of activated and-gates, the program P maintains, for every subset A of the input gates of size at most k, the value #(A) def = |{g i | g i is connected to all inputs in A, and is activated when the inputs from A are ignored}|, that is, the number of and-gates that are connected to all inputs in A and whose only inputs that are not set to 1 (if any) are contained in A.
Rephrased in the setting of the previous sections, we can think of the circuit as a coloured graph G, and an input gate is considered to be coloured if the input bit is set to 0. Then, #(A) is the number of and-gates that are connected to all inputs in A and are not covered by some node that is not in A, so, the cardinality of the set N •• G (A) as defined in Section 4.
As the number of sets of input gates of size at most k is quasi-polynomial in n, and for each such set A the number #(A) is bounded by the size of the circuit, which is again quasi-polynomial in n, this auxiliary information can be encoded by quasi-polynomially many auxiliary bits.
We need to show that the number of activated gates as well as the auxiliary information #(A) can be updated after changes that flip an input bit. Note that the circuit itself is fixed, so the dynamic program does not need to support changes that delete or insert wires.
When an input bit x is changed, the values #(A) are updated to # (A) as follows. For all sets A that include x, the count #(A) does not change, as all inputs in A are ignored in the definition of #(A). Also, the count #(A) does not change for sets A with x ∈ A and |A| = k, as all and-gates have fan-it at most k and can therefore not be connected to all inputs in A and the additional input x. The only case left is for a set A with |A| < k that does not include x. Suppose that x is flipped from 0 to 1. All and-gates counted for #(A) are not connected to x by the definition of #(A). After the change, also those gates are counted for #(A) that have a connection to all gates in A and to x, but to no other input gate that is set to 0. The number of these gates is given by # (A ∪ {x}).
In summary, the updated auxiliary information # (A) after x is set from 0 to 1 is as follows: If x is set from 1 to 0, the update is symmetric: The total number of activated gates changes by the number #({x}), which is either added in case x is flipped from 0 to 1, or subtracted if x is flipped from 1 to 0. These updates can easily be expressed by q-AC 0 circuits.
In Reference [Muk19] it is discussed how Theorem 5.1 can be extended to show that all queries in q-AC can be maintained in q-DynAC 0 , using different techniques. Here, q-AC denotes the class of all queries that can computed by families of circuits with quasi-polynomial size and poly-logarithmic depth.

Conclusion
We studied the dynamic complexity of the query ParityExists as well as its bounded degree variants. While it remains open whether ParityExists is in DynFO, we showed that ParityExists deg≤log n is in DynFO and that ParityExists deg≤k is in DynProp, for fixed k ∈ N. The latter result is the basis for an arity hierarchy for DynProp for Boolean graph queries. Several open questions remain.
Open question. Can ParityExists be maintained with first-order updates rules? If so, are all (domain-independent) queries from FO+Parity also in DynFO?
Open question. Is there an arity hierarchy for DynFO for Boolean graph queries?