Many important computational problems can be phrased as the question “is there a homomorphism from to ?”, where and are hypergraphs, or more generally, relational structures. Examples include evaluation and minimisation of conjunctive queries  and solving constraint satisfaction problems, see .
The problem Hom – is there a homomorphism from to ? – is NP-complete in its general form. In the static setting it is well understood which restrictions on or render the problem tractable [5, 14, 16]. A particular restriction of great importance in databases is to demand that is acyclic . This restriction of Hom, we call it the Acyclic Hypergraph Homomorphism problem AHH, can be solved in polynomial time by Yannakakis’ algorithm  and is complete for the complexity class LOGCFL , the class of problems that can be reduced in logarithmic space to a context-free language.
We are interested in a dynamic setting where the input of a problem is subject to changes. The complexity-theoretic framework DynFO for such a dynamic setting was introduced by Patnaik and Immerman  and it is closely related to a setting of Dong, Su and Topor . In this setting, a relational input structure is subject to a sequence of changes, which are usually insertions of single tuples into a relation, or deletions of single tuples from a relation. After each change, additionally stored auxiliary relations are updated as specified by first-order update formulas. The class DynFO contains all problems for which the update formulas can maintain the answer for the changing input.
With few exceptions, for example in parts of , research in the DynFO framework takes a data complexity viewpoint: all context-free languages  and all problems definable in monadic second-order logic MSO  are in DynFO if the context-free language or the MSO-definable problem is fixed and not part of the input. Every fixed conjunctive query is trivially in DynFO, as such a query can be expressed in first-order logic and updates defined by first-order formulas can just compute the result from scratch after every change; however, there are also non-trivial maintenance results for fixed conjunctive queries for subclasses of DynFO [11, 26]. The complexity results for Hom and AHH of [12, 25] are however from a combined complexity perspective: both and are part of the input.
In this paper we study the combined complexity of AHH in the dynamic setting. As inputs we allow hypergraphs and general relational structures over some fixed schema .
As our main positive result, we show that AHH is in DynFO for every schema , if is subject to insertions and deletions of hyperedges but stays acyclic, and may initially be arbitrary but is not changed afterwards. A main building block for this result is a proof that a join tree for can be maintained in DynFO in such a way that after a single change to the maintained join tree only changes by a constant number of edges. We show that given a join tree for we can maintain the answer to AHH under changes of single edges of the join tree. The main result follows by compositionality properties of DynFO.
We also give a hardness result for the case that also is subject to changes. If AHH is in DynFO for every schema under changes of and , then all LOGCFL-problems are in (a variant of) DynFO, which we believe not to be the case. So, this result is a strong indicator that maintenance under changes of is not possible in DynFO. Note that this result does not follow immediately from the fact that AHH is LOGCFL-complete: the NL-complete problem of reachability in directed graphs is in DynFO  as well as a PTIME-complete problem , and these results do not imply that all NL-problems and even all PTIME-problems are in DynFO, as this class is not known to be closed under the usual classes of reductions.
Further related work.
In databases, Incremental View Maintenance is concerned with updating the result of a database query after a change of the input, see  for an overview. Koch  shows that a set of queries that include conjunctive queries can be maintained incrementally by low-complexity updates. A system for maintaining the result of Datalog-like queries under changes of the data and the queries is described in .
2 Preliminaries and Setting
We introduce some concepts and notation that we need throughout the paper. See also  for an overview of Dynamic Complexity. We assume familiarity with first-order logic FO, and refer to  for basics of Finite Model Theory.
A (purely relational) schema consists of a finite set of relation symbols with a corresponding arity. A structure over schema with finite domain has, for every -ary relation symbol , a relation . We assume that all structures come with a linear order on their domain , which allows us to identify with , for . We also assume that first-order formulas have access to this linear order and to compatible relations and encoding addition and multiplication on .
The dynamic complexity framework.
In the dynamic complexity framework as introduced by Patnaik and Immerman , the goal of a dynamic program is to answer a standing query to an input structure under changes. To do so, the program stores and updates an auxiliary structure , which is over the same domain as . This structure consists of a set of auxiliary relations.
The set of admissible changes to the input structure is specified by a set of change operations. We mostly consider the change operations and for a relation of the input structure. A change consists of a change operation and a tuple over the domain of . The change inserts the tuple into the relation and the change deletes from .
For every change operation and every auxiliary relation , a dynamic program has a first-order update rule that specifies how is updated after a change over . Such a rule is of the form on change update as , where the update formula is a first-order formula over the combined schema of and . After a change is applied, the relation is updated to .
We say that a dynamic program maintains a query under changes from if a dedicated auxiliary relation Ans contains the answer to for the current input structure after each sequence of changes over . The class DynFO contains all queries that can be maintained by dynamic programs with first-order update rules, starting from initially empty input and auxiliary relations. We also say that can be maintained in DynFO under changes.
In this paper we are interested in scenarios where only parts of the input are subject to changes. To have a meaningful setting we then have to allow non-empty initial input relations. We then say that a query can be maintained in DynFO starting from non-empty inputs. Sometimes we then also allow the auxiliary relations to be initialised within some complexity bound. We say that a query is in DynFO with initialisation, for a complexity class , if there is a -algorithm such that can be maintained in DynFO if for an initial input the initial auxiliary relations are set to the result of applied to .
The reductions usually used in dynamic complexity are bounded first-order reductions . A reduction is bounded if there is a global constant such that if the structure is obtained from the structure by inserting or deleting one tuple, then can be obtained from by inserting and/or deleting at most tuples. We will not directly employ these reductions here, but we will use the simple proof idea to show that DynFO is closed under these reductions (see ): if a query can be maintained by a dynamic program under insertions and deletions of single tuples, then there is also a dynamic program that can maintain under insertions and deletions of up to tuples, for any constant . That dynamic program can be obtained by nesting copies of the update formulas of .
Hypergraphs and Homomorphisms.
We use the term hypergraph in a very broad sense. For this paper, a hypergraph is just a relational structure over a purely relational schema , that is, a structure , where the domain is a set of nodes and the relations are sets of (labelled) hyperedges. This definition implies that the maximal size of any hyperedge, that is, the maximal arity of a relation , is a constant that only depends on . Sometimes we ignore the labels and denote as a tuple , where is the set of all hyperedges.
A spanning forest of an undirected graph is defined in the usual way. We encode a spanning forest as a structure where is the set of spanning edges and is a ternary relation that describes paths in the spanning forest. A tuple indicates that (1) and are in the same connected component of the spanning forest and (2) the unique path from to in the spanning forest is via the node . Patnaik and Immerman  have shown that spanning forests with this encoding can be maintained in DynFO under insertions and deletions of single edges [20, Theorem 4.1].
A join forest of a hypergraph is a forest whose nodes are the hyperedges of , such that if two hyperedges have a node in common, then they are in the same connected component of and all nodes on the unique path from to in are hyperedges of that also include . We encode a join forest using relations and with the same intended meaning as for spanning forests, where . The arity of is the sum of the arities of and , a tuple indicates that has an edge between the hyperedges and . The use of is analogous.
We define that a hypergraph is acyclic if it has a join forest. This definition coincides with the notion of -acyclicity introduced by Fagin . See also [12, Section 2.2] for a detailed discussion of this notion.
A homomorphism from a hypergraph to a hypergraph is a map that preserves the hyperedge relations. So, for all relations and all tuples over , where is the arity of , if is a hyperedge of , then is a hyperedge of .
The main problem we study is the Acyclic Hypergraph Homomorphism problem AHH, where is a fixed schema. It asks, for two given hypergraphs and over schema (where is acyclic), also called query hypergraph and data hypergraph respectively, whether there is a homomorphism from to .
3 Maintenance under Changes of the Query Hypergraph
The goal of this section is to show that AHH can be maintained under changes of the query hypergraph , as long as it stays acyclic. We also show that a DynFO program can recognise that a change would make cyclic. So, we do not need to assume that only changes occur that preserve acyclicity, if we allow the program to “deny” all other changes.
We introduce some notation of . The weighted hyperedge graph of a hypergraph is the undirected weighted graph whose nodes are the hyperedges of and the set contains an undirected edge if are different hyperedges of that have at least one node in common. The weight of such an edge is the number of nodes that and have in common.
The weight of a hypergraph is the sum over the degrees of the non-isolated nodes of , where each degree is decremented by one. So, if for the set contains all nodes of that appear in at least one hyperedge, then .
Let be a hypergraph.
The hypergraph is acyclic if and only if the weight of is equal to the weight of a maximal-weight spanning forest of .
If is acyclic, then is a join forest of .
Using this lemma, we prove that a dynamic program can maintain acyclicity of hypergraphs, as well as a join forest that only changes moderately when the input hypergraph is changed.
Let be a fixed schema. The following can be maintained in DynFO under insertions and deletions of single hyperedges:
whether a hypergraph over is acyclic, and
a join forest for an acyclic hypergraph over , as long as stays acyclic. Moreover, there is a global constant such that if is the maintained join forest for and is the maintained join forest after a single hyperedge is inserted or deleted, then and differ by at most edges.
The proof follows the idea that is brought forth by Lemma 1: we show that a maximal-weight spanning forest of and its weight can be maintained. This weight is compared with the weight of , which is easy to maintain. If the weights are equal, then is acyclic and the spanning forest is a join forest.
Already Patnaik and Immerman  describe how a spanning forest of an undirected graph can be maintained under changes of single edges, and their procedure [20, Theorem 4.1] can easily be extended towards maximal-weight spanning forests. However, we face the problem that inserting and deleting hyperedges of implies insertions and deletions of nodes of . While a spanning forest can easily be maintained in DynFO under node insertions, it is an open problem to maintain a spanning forest under node deletions: if the spanning forest is a star and its center node is deleted, then it seems that a spanning forest of the remaining graph needs to be defined from scratch, which is not possible using FO formulas. We circumvent this problem and show that we can maintain a spanning forest where the degree of every node is bounded by a constant.
We show how a maximal-weight spanning forest of and the weight can be maintained; the result then follows using Lemma 1.
We start with the weight . If a hyperedge is inserted, then the weight of the hypergraph increases by the number of nodes it contains that were not isolated before the insertion. Similarly, if is deleted, then the weight decreases by the number of nodes it contains that do not become isolated. This update can easily be expressed by first-order formulas.
Now we consider maintaining a maximal-weight spanning forest of .
Let be the maximal arity of a relation in . Any hyperedge of can only include at most many nodes and there are at most many different non-empty sets of nodes that a fixed hyperedge can have in common with any other hyperedge. We show how to maintain a maximal-weight spanning forest of where each node has degree at most . More specifically, for any node of (which is a hyperedge of ) and each non-empty set of nodes appearing in , the maintained spanning forest contains at most two edges such that the set of nodes that has in common with and , respectively, is exactly . We call this property Invariant .
We assume that our auxiliary relations contain a maximal-weight spanning forest and its weight, and that satisfies Invariant . This is trivially satisfied by an empty spanning forest for an initially empty hypergraph. We show how the invariant can be satisfied again after a change.
In the following, we say that is an -neighbour of if these hyperedges have exactly the nodes in common. The number of -neighbours of (that has an edge to in ) is called its -degree (with respect to ).
Insertion of a hyperedge .
Suppose a hyperedge is inserted into the hypergraph , resulting in the hypergraph . Let be the set of nodes that occur in . For each non-empty , let be the edges of in to its -neighbours. We adapt in stages, one stage per subset , and in each stage the spanning forest is changed by at most two edges. As the number of stages is bounded by the constant , the maintained spanning forests before and after the update only differ by a constant number of edges.
Let be a sequence of all non-empty subsets of , partially ordered by their size, starting with the largest. So, . Stage for an arbitrary works as follows. Suppose that is a maximal spanning forest of the graph that results from by adding the node and the edge set and that satisfies Invariant (so is a maximum spanning forest for and therefore also for ). Let be the -neighbours of . The hyperedges in form a clique in , as they all have at least the nodes in common, so they are in the same connected component of . We consider two cases.
First, if is not in , then let be some hyperedge that has -degree at most with respect to . Such an needs to exist as is a forest. Then clearly is a spanning forest of . It is maximal, as replacing some spanning edge by another edge from to an -neighbour cannot increase the weight: if this would be the case for some edge , then cannot be maximal, because the edge has at least the same weight as the edge and replacing by would therefore create a spanning forest with larger weight than . Invariant is also satisfied by .
Second, if is in , then let be the minimal-weight edge in on the path from to any hyperedge in . If the weight of this edge is at least , then , as the weight of the spanning forest cannot be increased by incorporating an edge from . Otherwise, results from by removing the edge and adding an edge from to one of its -neighbours with -degree at most with respect to . With the same arguments as in the other case, is a maximal-weight spanning forest of , it also satisfies Invariant .
The updates of the spanning forest relation can be expressed by first-order formulas using the relations . These relations can be updated as in the proof of [20, Theorem 4.1], as the relations change only by a constant number of tuples. The weight of the spanning forest can also be updated easily.
Deletion of a hyperedge .
Suppose is deleted from , resulting in the hypergraph . As the maintained spanning forest satisfies Invariant , the degree of in is bounded by the constant . Therefore, the procedure of [20, Theorem 4.1] only needs to be applied for a constant number of edge deletions. If by a deletion of a spanning tree edge a connected component of decomposes into two components and , then we need to ensure that a potentially selected replacement edge results in a spanning forest that satisfies Invariant again. So, suppose that the components and are connected in , and let be a maximal-weight edge that connects them. Let be the set of nodes that and have in common. Without loss of generality, we suppose that and have -degree at most with respect to . If this is not the case for example for , then there needs to be a -neighbour in that has -degree at most with respect to , which then can be used instead of . Adding to the remaining spanning forest will therefore result in a maximal-weight spanning forest for the changed hypergraph which satisfies Invariant . Also, the maintained spanning forest differs only by at most edges from its previous version. The weight of the spanning forest can easily be updated as well. ∎
We now present the main maintenance result of this paper.
Let be a fixed schema. The problem AHH can be maintained in DynFO, starting from an arbitrary initial hypergraph and an initially empty hypergraph , under insertions and deletions of single hyperedges of , as long as this hypergraph stays acyclic.
The proof uses the idea of Yannakakis’ algorithm  for evaluating a conjunctive query. This algorithm processes a join tree for a query in a bottom-up fashion. In a first step, for each node of the join tree (which is a hyperedge of ) all assignments for its variables are stored such that exists in the data hypergraph . Then, bottom-up, each inner node removes all of its variable assignments that are not consistent with the assignments of its children. So, an assignment for a node is removed if there is a child of such that no stored assignment of that child agrees with on the common variables of and . All remaining stored assignments for can be extended to a homomorphism for the subhypergraph of that consists of the hyperedges that are in the subtree of the join tree rooted at . A homomorphism from to exists if after the join tree is processed the root has remaining assignments.
Let be an acyclic hypergraph over some schema and let be a hypergraph over the same schema. Also, let be a join forest of .
We adapt a technique that was used by Gelade, Marquardt and Schwentick  to show that regular tree languages can be maintained in a subclass of DynFO. For each triple of symbols from we maintain an auxiliary relation with the following intended meaning. A tuple is in if
the hyperedges , and are present in and in the same connected component of ,
when we consider to be the root of then is a descendant of and is a descendant of , and
if we assume that there is a homomorphism of the subtree of rooted at into such that , then it follows that there also is a homomorphism of the subtree of rooted at into such that .
Phrased differently, means that the hyperedges in which, considering to be the root, are in the subtree of but not in the subtree of , can be mapped into by a homomorphism that maps the elements to and the elements to .
If holds we say that is a valid partial assignment for down to .
Notice that from these relations one can first-order define relations with the intended meaning that if
the hyperedges and are in the same connected component of , and
when we consider to be the root of then there is a homomorphism of the subtree of rooted at into such that .
For this, a first-order formula existentially quantifies a hyperedge and a tuple of elements, and checks that is a leaf of the component with root , that the hyperedge exists in and that holds. Whether a node is a leaf in a join tree can be expressed using the join tree’s paths relations , all other conditions are clearly first-order expressible. We assume in the following that these relations are available. If holds we say that is a valid partial assignment for .
We argue next that if we can maintain these auxiliary relations under insertions and deletions of single edges of the join forest, then the statement of the theorem follows.
Notice that from the auxiliary relations a first-order formula can express whether a homomorphism from to exists. To check this, a formula needs to express that for every connected component of there is a homomorphism from this component to . This is the case if for each hyperedge of there is a tuple such that is in .
It remains to argue that it is sufficient to maintain the auxiliary relations under changes of single edges of the join forest. From Theorem 3.1 we know that a join forest for can be maintained in DynFO under insertions and deletions of single hyperedges, as long as it stays acyclic. Moreover, after each edge change, the maintained join forest only differs in a constant number of edges from its previous version. If we have a dynamic program that is able to process single edge changes of the join forest, then by nesting its update formulas times we can obtain a dynamic program that is able to process edge changes at once. In summary, a dynamic program for AHH maintains a join forest as described by Theorem 3.1 and after every change of a hyperedge it uses to update the auxiliary relations and to decide whether a homomorphism exists.
Now we explain how the relations can be maintained by first-order formulas under insertions and deletions of single edges of the join forest. For notational simplicity we assume that the schema of consists of a single relation . It follows that we only have one auxiliary relation that needs to be maintained.
When an edge is inserted into the join forest, the two connected components of and of get connected. The auxiliary relations for all other connected components remain unchanged. We explain under which conditions a tuple is contained in the updated version of , where we assume that is from . For hyperedges from the reasoning is symmetric. We assume that is a descendant of and is a descendant of in the combined connected component rooted at ; if this is not the case, is not in the updated version of .
We distinguish three cases. First, assume that and are in . If is not in the subtree of or is in the subtree of , then no change regarding is necessary.
Otherwise, let be the lowest common ancestor of and in the join tree with root and let be the children of , where is the ancestor of and is the ancestor of . With the help of the old version of first-order formulas can determine the valid partial assignments for all children for and the valid partial assignments for down to . This is immediate for all with , we now explain it for .
To check whether a tuple is a valid partial assignment for , a first-order formula can first determine the valid partial assignments for for the component with root , which are given by . With this information it can check which valid partial assignments for for the component with root are still valid for the union of and with root . To do so, it checks for a (formerly) valid assignment whether there is a valid assignment for such that they agree on the shared elements. The tuple is a valid partial assignment for if it is a valid partial assignment for down to , for some valid partial assignment for .
With the information on the children, a first-order formula can determine the valid partial assignments for down to . This only involves a check whether for a candidate assignment a corresponding hyperedge exists in and whether every child has a valid partial assignment that agrees with on the elements that are shared by and .
The tuple is in the updated version of if and only if is in the old version of , for some valid partial assignment of down to ,
As a second case, assume that is in and is in . This case is very similar to the case we just discussed and we do not spell out the details.
As a last case, assume that and are both in . This case is very simple, as holds after the update precisely if holds before the update.
In all cases, the stated conditions can be expressed by first-order formulas. This is because the schema is fixed and therefore the arity of is constant, it follows that formulas can quantify over hyperedges and assignments. Also, formulas can determine whether a node is in a subtree of another node and the lowest common ancestor of two nodes using the paths relation of the join forest.
When an edge is deleted from the join forest, one connected component is split into the two connected components of and of . Again, the auxiliary relations for all other connected components remain unchanged. As for the insertion case, we explain under which conditions a tuple is contained in the updated version of , for a root from . We assume that is a descendant of and is a descendant of in the component rooted at ; otherwise, is not in the updated version of .
If is not in the subtree of or is in the subtree of , then no change regarding is necessary. Otherwise the update is performed very similarly to the corresponding insertion case detailed above. The only difference is the way the valid partial assignments for are determined. Notice that a first-order formula can determine the valid partial assignments for all (remaining) children of , as they are given by the relation . A tuple is a valid partial assignment for if the hyperedge exists in and if all children have a valid partial assignment that agrees with on the shared elements. ∎
4 Hardness under Changes of the Data Hypergraph
We have seen in the previous section that one can maintain the existence of homomorphisms in DynFO if only the query hypergraph may change and the data hypergraph remains the same. The dynamic program we constructed for the proof of Theorem 3.2 can not directly cope with changes of . This is because might contain several hyperedges over a single relation : if a change of occurs, then the number of nodes in the join tree for which we have to take this change into account when updating partial valid assignments is a priori unbounded. If we disallow multiple hyperedges over the same relation in , then we can actually allow a change to replace an arbitrary number of -hyperedges, as long as each change only affects a single relation of . Such a restriction of translates to self-join free acyclic conjunctive queries.
Let be a fixed schema. As long as remains acyclic and contains at most one hyperedge for each relation , the problem AHH can be maintained in DynFO under insertions and deletions of single hyperedges of and under arbitrary changes of a single relation of .
Proof (Proof sketch)
To adapt the proof of Theorem 3.2, it suffices to show how after changing some relation of one can determine the valid partial assignments for the single node in the join forest . As the valid partial assignments for its children did not change, this only involves to check for each tuple such that the hyperedge exists in whether each child in has a valid partial assignment that agrees with on all elements it has in common with . ∎
In the remainder of this section, we will see that if might be an arbitrary acyclic hypergraph, then a maintenance result for AHH under changes of is unlikely, even if in turn is not allowed to change.
Gottlob et al.  show that it is LOGCFL-complete to decide whether from a given acyclic hypergraph there is a homomorphism into a hypergraph . The complexity class LOGCFL contains all problems that can be reduced in logarithmic space to a context-free language. This class is contained in AC, contains NL and is equivalent to logspace-uniform SAC , the class of problems decidable by logspace-uniform families of semi-unbounded Boolean circuits of polynomial size and logarithmic depth. A semi-unbounded Boolean circuit consists of or-gates with unbounded fan-in and and-gates with fan-in . There are no negation gates, but for each input gate there is an additional input gate that carries the negated value of .
In their article, Gottlob et al.  show that there is a schema such that every SAC problem can be reduced in logarithmic space to AHH. We slightly adapt their construction and show that the hardness result also holds for bounded logspace reductions. Furthermore, if a reduction maps an instance to an instance , then the change to induced by a change to is first-order definable.
Theorem 4.1 (adapted from [12, Theorem 4.8])
There is a schema that contains at most binary relations such that AHH is hard for LOGCFL under logspace reductions.
Let . There is a logspace reduction from to AHH that satisfies the following properties. Assume that are instances of with and let and . Then:
if and differ only in one bit, then differs from by at most hyperedges, for a global constant , and
is first-order definable from , and .
Let be a problem from LOGCFL. As , there is a logspace-uniform family of circuits that decides , where a circuit has size at most for some , logarithmic depth in , and the fan-in of every and-gate is bounded by . Without loss of generality, see [12, Lemma 4.6], we can assume that also has the following normal form:
the circuit consists of layers of gates, and the gates of layer receive all their inputs from gates at layer ,
all layers either only contain or-gates or only contain and-gates,
the first layer after the inputs consists of or-gates,
if layer is a layer of or-gates, then layer only consists of and-gates, and vice versa, and
the output gate is an and-gate.
A circuit of this form accepts its input if and only if a proof tree can be homomorphically mapped into it. A proof tree for a circuit in normal form has the same depth as and an and-gate as its root. Each and-gate of the proof tree has two or-gates as its children, and each or-gate has one child, which is a gate labelled with the constant for an or-gate at the lowest layer, and an and-gate for all other or-gates. Note that a proof tree is acyclic.
If there is a homomorphism that maps each constant of the proof tree to an input gate of the circuit that is set to , each and-gate of the proof tree to an and-gate of the circuit, and for each and-gate of the proof tree its two children to different or-gates in the circuit, then all gates of the circuit that are in the image of the homomorphism evaluate to for the current input. Therefore, the output gate also evaluates to , and the circuit accepts its input. It is also clear that if the circuit accepts its input, then there is a homomorphism from the proof tree into the circuit.
We encode circuits and proof trees over the schema . Each gate is encoded by a tuple of elements. If is an and-gate with children , then this is encoded by tuples and . If is an or-gate and is one of its children, then this is encoded by the tuple . The relations 0 and 1 are used to encode constants and assignments of input gates in the obvious way.
We use the two relations to ensure that a homomorphism from a proof tree to a circuit maps the two children of an and-gate to two different or-gates.
From the proof of [12, Theorem 4.8] it follows that from an input of with the corresponding circuit , which results from by assigning constants to its inputs gates as specified by , and the corresponding proof tree can be computed in logarithmic space. In conclusion, this proves that the function that maps to is a logspace reduction from to AHH, and therefore that AHH is hard for LOGCFL under logspace reductions.
We now proceed to prove part b of the theorem statement. Consider two input instances for with . Both and are inputs of the circuit , so the same proof tree is constructed for them by , yielding part bba. The only differences in the images of are the assignments of constants to the input gates of . If and only differ in one bit, say, the first bit that is represented by the input gate , then we have and for one input, and and for the other input. So, the encodings of the circuit only differ by tuples, which implies part bbb. Towards part bbc, we can ensure that these tuples are first-order definable by using an appropriate encoding enc of the gates, for example by encoding the -th input gate by the -th tuple in the lexicographic ordering of -tuples over the domain. ∎
Building on the hardness result of Theorem 4.1, we can show that if AHH can be maintained in DynFO under changes of , then all LOGCFL-problems are in DynFO if we allow a PTIME initialisation. This would be a breakthrough result, as there are already problems in uniform (problems decidable by uniform circuits with polynomial size, constant depth and not-, and-, or- and modulo 2-gates with arbitrary fan-in), a much smaller complexity class, that we do not know how to maintain in DynFO .
If for arbitrary schema the problem AHH can be maintained in DynFO under insertions and deletions of single hyperedges from and , as long as stays acyclic, then every problem can be maintained in DynFO with PTIME initialisation under insertions and deletions of single tuples.
The same even holds under the condition that AHH can only be maintained under changes of single hyperedges of , but starting from an arbitrary initial acyclic hypergraph , even if a PTIME initialisation of the auxiliary relations is allowed. So, we can take this theorem as a strong indicator that AHH might not be in DynFO under changes of .
Let be arbitrary. Let be the schema and the reduction guaranteed to exist by Theorem 4.1 such that is a reduction from to AHH. Let be a dynamic program that maintains AHH under insertions and deletions of single hyperedges. We construct a dynamic program with PTIME initialisation that maintains .
For an initially empty input structure over a domain of size , the initialisation first constructs the corresponding SAC-circuit , with the input bits set as given by , and the proof tree and stores them in auxiliary relations. This is possible in . Then, using polynomial time, it simulates for a sequence of insertions that lead to and from initially empty hypergraphs and stores the produced auxiliary relations.
When a change of occurs, identifies the constantly many changes of that are induced by the change, which is possible in first-order logic thanks to Theorem 4.1, and simulates for these changes. ∎
5 Conclusion and Further Work
In this paper we studied under which conditions the problem AHH can be maintained in DynFO. Our main result is that this problem is in DynFO under changes of single hyperedges of the query hypergraph , on the condition that it remains acyclic. This result directly implies that the result of acyclic Boolean conjunction queries can be maintained in DynFO. As the corresponding dynamic program, see proof of Theorem 3.2, also maintains partial assignments of existing homomorphisms, this can straightforwardly be extended also to non-Boolean acyclic conjunctive queries.
We have also seen that it is unlikely that AHH is in DynFO under changes of the data hypergraph .
In the static setting, the homomorphism problem is not only tractable for acyclic hypergraphs , but for a larger class of graphs  which includes the class of graphs with bounded treewidth, see . It is therefore interesting whether our DynFO maintenance result can also be extended to allow for cyclic hypergraphs , in particular to allow hypergraphs of treewidth at most , for some
. Results of this form would probably require an analogous result to Theorem3.1, so, that a tree decomposition of some width can be maintained for every hypergraph with treewidth at most , and that any change of the hypergraph leads to a maintained tree decomposition that can be obtained from its previous version by a constant number of changes.
Outside the DynFO framework, maintenance of tree decompositions for graphs with treewidth , that is, series-parallel graphs, is considered in , but a change of the graph may affect a logarithmic number of nodes of the tree decomposition. Preliminary unpublished results show (using different techniques than ) that for graphs with treewidth a tree decomposition can indeed be maintained in DynFO. It is so far unclear whether tree decompositions can also be maintained in a way that only a constant-size part changes after a change of the graph.
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 682588.
-  Beeri, C., Fagin, R., Maier, D., Yannakakis, M.: On the desirability of acyclic database schemes. Journal of the ACM (JACM) 30(3), 479–513 (1983). https://doi.org/10.1145/2402.322389
-  Bernstein, P.A., Goodman, N.: Power of natural semijoins. SIAM Journal on Computing 10(4), 751–771 (1981). https://doi.org/10.1137/0210059
-  Bodlaender, H.L.: Dynamic algorithms for graphs with treewidth 2. In: van Leeuwen, J. (ed.) Graph-Theoretic Concepts in Computer Science, 19th International Workshop, WG ’93, Utrecht, The Netherlands, June 16-18, 1993, Proceedings. Lecture Notes in Computer Science, vol. 790, pp. 112–124. Springer (1993). https://doi.org/10.1007/3-540-57899-4_45
Chandra, A.K., Merlin, P.M.: Optimal implementation of conjunctive queries in relational data bases. In: Hopcroft, J.E., Friedman, E.P., Harrison, M.A. (eds.) Proceedings of the 9th Annual ACM Symposium on Theory of Computing, May 4-6, 1977, Boulder, Colorado, USA. pp. 77–90. ACM (1977).https://doi.org/10.1145/800105.803397
-  Dalmau, V., Kolaitis, P.G., Vardi, M.Y.: Constraint satisfaction, bounded treewidth, and finite-variable logics. In: Hentenryck, P.V. (ed.) Principles and Practice of Constraint Programming - CP 2002, 8th International Conference, CP 2002, Ithaca, NY, USA, September 9-13, 2002, Proceedings. Lecture Notes in Computer Science, vol. 2470, pp. 310–326. Springer (2002). https://doi.org/10.1007/3-540-46135-3_21
-  Datta, S., Kulkarni, R., Mukherjee, A., Schwentick, T., Zeume, T.: Reachability is in DynFO. J. ACM 65(5), 33:1–33:24 (2018). https://doi.org/10.1145/3212685
-  Datta, S., Mukherjee, A., Schwentick, T., Vortmeier, N., Zeume, T.: A strategy for dynamic programs: Start over and muddle through. Log. Methods Comput. Sci. 15(2) (2019). https://doi.org/10.23638/LMCS-15(2:12)2019
-  Dong, G., Su, J., Topor, R.W.: Nonrecursive incremental evaluation of datalog queries. Ann. Math. Artif. Intell. 14(2-4), 187–223 (1995). https://doi.org/10.1007/BF01530820
-  Fagin, R.: Degrees of acyclicity for hypergraphs and relational database schemes. Journal of the ACM (JACM) 30(3), 514–550 (1983). https://doi.org/10.1145/2402.322390
-  Feder, T., Vardi, M.Y.: The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory. SIAM J. Comput. 28(1), 57–104 (1998). https://doi.org/10.1137/S0097539794266766
-  Gelade, W., Marquardt, M., Schwentick, T.: The dynamic complexity of formal languages. ACM Trans. Comput. Log. 13(3), 19:1–19:36 (2012). https://doi.org/10.1145/2287718.2287719
-  Gottlob, G., Leone, N., Scarcello, F.: The complexity of acyclic conjunctive queries. J. ACM 48(3), 431–498 (2001). https://doi.org/10.1145/382780.382783
-  Green, T.J., Olteanu, D., Washburn, G.: Live programming in the LogicBlox system: A MetaLogiQL approach. Proc. VLDB Endow. 8(12), 1782–1791 (2015). https://doi.org/10.14778/2824032.2824075
-  Grohe, M.: The complexity of homomorphism and constraint satisfaction problems seen from the other side. J. ACM 54(1), 1:1–1:24 (2007). https://doi.org/10.1145/1206035.1206036
-  Gupta, A., Mumick, I.S.: Maintenance of Materialized Views: Problems, Techniques, and Applications, p. 145–157. MIT Press, Cambridge, MA, USA (1999)
-  Hell, P., Nesetril, J.: On the complexity of H-coloring. J. Comb. Theory, Ser. B 48(1), 92–110 (1990). https://doi.org/10.1016/0095-8956(90)90132-J
-  Koch, C.: Incremental query evaluation in a ring of databases. In: Paredaens, J., Gucht, D.V. (eds.) Proceedings of the Twenty-Ninth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS 2010, June 6-11, 2010, Indianapolis, Indiana, USA. pp. 87–98. ACM (2010). https://doi.org/10.1145/1807085.1807100
-  Libkin, L.: Elements of Finite Model Theory. Springer (2004). https://doi.org/10.1007/978-3-662-07003-1
-  Muñoz, P., Vortmeier, N., Zeume, T.: Dynamic Graph Queries. In: Martens, W., Zeume, T. (eds.) 19th International Conference on Database Theory (ICDT 2016). Leibniz International Proceedings in Informatics (LIPIcs), vol. 48, pp. 14:1–14:18. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany (2016). https://doi.org/10.4230/LIPIcs.ICDT.2016.14
-  Patnaik, S., Immerman, N.: Dyn-FO: A parallel, dynamic complexity class. J. Comput. Syst. Sci. 55(2), 199–209 (1997). https://doi.org/10.1006/jcss.1997.1520
-  Schwentick, T., Vortmeier, N., Zeume, T.: Sketches of dynamic complexity. SIGMOD Rec. 49(2), 18–29 (2020). https://doi.org/10.1145/3442322.3442325
-  Venkateswaran, H.: Properties that characterize LOGCFL. J. Comput. Syst. Sci. 43(2), 380–404 (1991). https://doi.org/10.1016/0022-0000(91)90020-6
-  Vortmeier, N., Kokkinis, I.: The dynamic complexity of acyclic hypergraph homomorphisms, accepted for publication at the International Workshop on Graph-Theoretic Concepts in Computer Science, WG 2021.
-  Vortmeier, N., Zeume, T.: Dynamic complexity of parity exists queries. In: Fernández, M., Muscholl, A. (eds.) 28th EACSL Annual Conference on Computer Science Logic, CSL 2020, January 13-16, 2020, Barcelona, Spain. LIPIcs, vol. 152, pp. 37:1–37:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2020). https://doi.org/10.4230/LIPIcs.CSL.2020.37
-  Yannakakis, M.: Algorithms for acyclic database schemes. In: Very Large Data Bases, 7th International Conference, September 9-11, 1981, Cannes, France, Proceedings. pp. 82–94. IEEE Computer Society (1981), https://dl.acm.org/doi/10.5555/1286831.1286840
-  Zeume, T.: The dynamic descriptive complexity of k-clique. Inf. Comput. 256, 9–22 (2017). https://doi.org/10.1016/j.ic.2017.04.005