On the quantifier-free dynamic complexity of Reachability
aa r X i v : . [ c s . L O ] J a n On the quantifier-free dynamic complexity ofReachability ∗ , † Thomas Zeume and Thomas SchwentickJuly 23, 2018
Abstract
The dynamic complexity of the reachability query is studied in thedynamic complexity framework of Patnaik and Immerman, restricted toquantifier-free update formulas.It is shown that, with this restriction, the reachability query cannot bedynamically maintained, neither with binary auxiliary relations nor withunary auxiliary functions, and that ternary auxiliary relations are morepowerful with respect to graph queries than binary auxiliary relations.Further inexpressibility results are given for the reachability query ina different setting as well as for a syntactical restriction of quantifier-freeupdate formulas. Moreover inexpressibility results for some other queriesare presented.
In modern data management scenarios data is subject to frequent changes. Inorder to avoid costly re-computations of queries from scratch after each smallmodification of the data, one can try to (re-)use auxiliary data structures thathave been already computed before. However, these auxiliary data structuresneed to be updated dynamically whenever the data changes.The descriptive dynamic complexity framework (short: dynamic complexity)introduced by Patnaik and Immerman [10] models this setting. It was mainlyinspired by updates in relational databases. Within this framework, for a rela-tional database subject to change, auxiliary relations are maintained with theintention to help answering a query Q . When a modification to the database,an insertion or deletion of a tuple, occurs, every auxiliary relation is updatedthrough a first-order query (or, equivalently, through a core SQL query) thatcan refer to the database as well as to the auxiliary relations. A particular aux-iliary relation shall always represent the answer to Q . The class of all queries ∗ An extended abstract of this article appeared in Proceedings of the conference Mathe-matical Foundations of Computer Science 2013 (MFCS 2013). † Both authors acknowledge the financial support by the German DFG under grant SCHW678/6-1.
DynFO . Beyond query or view maintenancein databases we consider it an important goal to understand the dynamic com-plexity of fundamental algorithmic problems. Reachability in directed graphs isthe most intensely investigated problem in dynamic complexity (and also muchstudied in dynamic algorithms and other dynamic contexts) and the main querystudied in this paper. It is one of the simplest inherently recursive queries andthus serves as a kind of drosophila in the study of the dynamic maintainability ofrecursive queries by non-recursive means. It can be maintained with first-orderupdate formulas supplemented by counting quantifiers on general graphs [8] andwith plain first-order update formulas on both acyclic graphs and undirectedgraphs [10]. However, it is not known whether Reachability on general graphs ismaintainable with first-order updates. This is one of the major open questionsin dynamic complexity.All attempts to show that Reachability cannot be maintained in
DynFO have failed so far. In fact, there are no general inexpressibility results for
DynFO at all. This seems to be due to a lack of understanding of the un-derlying mechanisms of
DynFO . To improve the understanding of dynamiccomplexity, mainly two kinds of restrictions of
DynFO have been studied: (1)limiting the information content of the auxiliary data by restricting the arity ofauxiliary relations and functions and (2) reducing the amount of quantificationin update formulas.The study of bounded arity auxiliary relations was started in [2] and it wasshown that unary auxiliary relations are not sufficient to maintain the reacha-bility query with first-order updates. Further inexpressibility results for unaryauxiliary relations were shown and an arity hierarchy for auxiliary relations wasestablished. However, to separate level k from higher levels, database relationsof arity larger than k were used. Thus, a strict hierarchy has not yet been estab-lished for queries on graphs. In [1] it was shown that unary auxiliary relationsare not sufficient to maintain Reachability for update formulas of any logic withcertain locality properties. The proofs strongly use the “static” weakness oflocal logics and do not fully exploit the dynamic setting, as they only requiremodification sequences of constant length.The second line of research was initiated by Hesse [9]. He invented andstudied the class DynProp of queries maintainable with quantifier-free updateformulas. He proved that Reachability on deterministic graphs (i.e. graphsof unary functions) can be maintained with quantifier-free first-order updateformulas.There is still no proof that Reachability on general graphs cannot be main-tained in
DynProp . However, some inexpressibility results for
DynProp havebeen shown in [5]: the alternating reachability query (on graphs with ∧ - and ∨ -nodes) is not maintainable in DynProp . Furthermore, on strings,
DynProp exactly captures the regular languages (as Boolean queries on strings). Of course, a query maintainable in
DynFO can be evaluated in polynomial time and thusqueries that cannot be evaluated in polynomial time cannot be maintained in
DynFO either. ontributions The high-level goal of this paper is to achieve a better un-derstanding of the dynamic maintainability of Reachability and dynamic com-plexity in general. Our main result is that the reachability query cannot bedynamically maintained by quantifier-free updates with binary auxiliary rela-tions. This result is weaker than that of [2] in terms of the logic (quantifier-freevs. general first-order) but it is stronger with respect to the information contentof the auxiliary data (binary relations vs. unary relations). We establish a stricthierarchy within
DynProp for unary, binary and ternary auxiliary relations(this is still open for
DynFO ).We further show that Reachability is not maintainable with unary auxiliary functions (plus unary auxiliary relations). Although unary functions provideless information content than binary relations, they offer a very weak form ofquantification in the sense that more elements of the domain can be taken intoaccount by update formulas.All these results hold in the setting of Patnaik and Immerman where mod-ification sequences start from an empty database as well as in the setting thatstarts from an arbitrary database, where the auxiliary data is initialized by anarbitrary function. We show that if, in the latter setting, the initialization map-ping is permutation-invariant, quantifier-free updates cannot maintain Reacha-bility even with auxiliary functions and relations of arbitrary arity. Intuitivelya permutation-invariant initialization mapping maps isomorphic databases toisomorphic auxiliary data. A particular case of permutation-invariant initial-ization mappings, studied in [6], is when the initialization is specified by logicalformulas. In this case, lower bounds for first-order update formulas have beenobtained for several problems [6].We transfer many of our inexpressibility results to the k -Clique query, forfixed k ≥
3, and the colorability query k -Col , for fixed k ≥ DynProp can be maintained by aprogram with negation-free quantifier-free formulas only as well as by a programwith disjunction-free quantifier-free formulas only. Thus lower bounds for thosesyntactic fragments immediately yield lower bounds for
DynProp itself. Here,we show that Reachability cannot be maintained by
DynProp programs withupdate formulas that are disjunction- and negation-free.A preliminary version of this work appeared in [15]. It was without most ofthe proofs and did not contain the lower bound for disjunction- and negation-free
DynProp programs. The proofs of the normal form results obtained in [15]will be included in the long version of [17]. The latter work establishes normalforms for variants of dynamic conjunctive queries, complementing the normalforms for
DynProp . Related Work
We already described the most closely related work. As men-tioned before, the reachability query has been studied in various dynamic frame-works, one of which is the Cell Probe model. In the Cell Probe model, one aimsfor lower bounds for the number of memory accesses of a RAM machine forstatic and dynamic problems. For dynamic Reachability, lower bounds of order3og n have been proved [12]. Outline
In Section 2 we fix our notation and in Section 3 we define our dy-namic setting more precisely. The lower bound results for Reachability arepresented in Section 4 (for auxiliary relations) and in Section 5 (for auxiliaryfunctions). In Section 6 we transfer the lower bounds to other queries. Finally,we establish a lower bound for a syntactical fragment of
DynProp in Section 7.
Acknowledgement
We thank Ahmet Kara and Martin Schuster for carefulproofreading.
In this section, we repeat some basic notions and fix some of our notation.A domain is a finite set. For k -tuples, ~a = ( a , . . . , a k ) and ~b = ( b , . . . , b k )over some domain D , the 2 k -tuple obtained by concatenating ~a and ~b is denotedby ( ~a,~b ). The tuple ~a is ≺ -ordered with respect to an order ≺ of D , if a ≺ . . . ≺ a k . If π is a function on D , we denote ( π ( a ) , . . . , π ( a k )) by π ( ~a ). Weslightly abuse set theoretic notations and write c ∈ ~a if c = a i for some c ∈ D and some i , and ~a ∪ ~b for the set { a , . . . , a k , b . . . , b k } . A (relational) schema(or signature) τ consists of a set τ rel of relation symbols and a set τ const ofconstant symbols together with an arity function Ar : τ rel → N . A database D of schema τ with domain D is a mapping that assigns to every relation symbol R ∈ τ rel a relation of arity Ar( R ) over D and to every constant symbol c ∈ τ const a single element (called constant ) from D . The size of a database is the size ofits domain. Unless otherwise stated (as, e.g., in Section 5), we always considerrelational schemas.A τ - structure S is a pair ( D, D ) where D is a database with schema τ anddomain D . Sometimes we omit the schema when it is clear from the context.If S is a structure over domain D and D ′ is a subset of D that contains allconstants of S , then the substructure of S induced by D ′ is denoted by S ↾ D ′ .Let S and T be two structures of schema τ and over domains S and T ,respectively. A mapping π : S T preserves a relation symbol R ∈ τ of arity m ,when ~a ∈ R S if and only if π ( ~a ) ∈ R T , for all m -tuples ~a . It preserves a constantsymbol c ∈ τ , if c T = π ( c S ). The mapping is τ -preserving, if it preserves allrelation symbols and all constant symbols from τ . Two τ -structures S and T are isomorphic via π , denoted by S ≃ π T , if π is a bijection from S to T whichis τ -preserving. We define id [ ~a,~b ] : S → S to be the bijection that maps, forevery i , a i to b i and b i to a i , and maps all other elements to themselves.An atomic formula is a formula of the form R ( z , . . . , z l ) where R is a relationsymbol and each z i is either a variable or a constant symbol. The k -ary atomictype hS , ~a i of a tuple ~a = ( a , . . . , a k ) over D with respect to a τ -structure S isthe set of all atomic formulas ϕ ( ~x ) with ~x = ( x , . . . , x k ) for which ϕ ( ~a ) holds Throughout this work all functions are total. S , where ϕ ( ~a ) is short for the substitution of ~x by ~a in ϕ . We note that theatomic formulas can use constant symbols. As we only consider atomic typesin this paper, we will often simply say type instead of atomic type. The σ -type hS , ~a i σ is the set of atomic formulas of hS , ~a i with relation symbols from σ . If ≺ is a linear order on D we call a subset D ′ ⊆ D ≺ -homogeneous (or homogeneous ,if ≺ is clear from the context) if, for every l , the type of all ≺ -ordered l -tuplesover D ′ is the same, that is if hS , ~a i = hS ,~b i for all ordered l -tuples ~a and ~b .It is easy to observe, that a set D ′ is already ≺ -homogeneous if the conditionholds for every l up to the maximal arity of τ .An s - t -graph is a graph G = ( V, E ) with two distinguished nodes s and t . A k -layered s - t -graph G is a directed graph ( V, E ) in which V −{ s, t } is partitionedinto k layers A , . . . , A k such that every edge is from s to A , from A k to t orfrom A i to A i +1 , for some i ∈ { , . . . , k − } . The reachability query Reach on graphs is defined as usual, that is ( a, b ) is in
Reach ( G ) if b can be reachedfrom a in G . The s - t -reachability query s - t -Reach is a Boolean query that istrue for an s - t -graph G , if and only if ( s, t ) ∈ Reach ( G ).Formally, an s - t -graph is a structure over a schema with one binary relationsymbol (interpreted by the set of edges E ) and two constant symbols (inter-preted by the two distinguished nodes s and t ). The following presentation follows [14] and [5].Informally a dynamic instance of a static query Q is a pair ( D , α ), where D is a database and α is a sequence of modifications, i.e. a sequence of tupleinsertions and deletions into D . The dynamic query Dyn( Q ) yields as resultthe relation that is obtained by first applying the modifications from α to D and evaluating query Q on the resulting database. We formalize this as follows. Definition 1. (Abstract and concrete modifications) The set ∆ of abstractmodifications of a schema τ contains the terms ins R and del R , for every relationsymbol R ∈ τ . For a database D over schema τ with domain D , a concretemodification is a term of the form ins R ( ~a ) or del R ( ~a ) where R ∈ τ is a k -aryrelation symbol and ~a is a k -tuple of elements from D . Applying a modification ins R ( ~a ) to a database D replaces relation R D by R D ∪ { ~a } . Analogously, applying a modification del R ( ~a ) replaces R D by R D \ { ~a } .All other relations remain unchanged. The database resulting from applying amodification δ to a database D is denoted by δ ( D ). The result α ( D ) of ap-plying a sequence of modifications α = δ . . . δ m to a database D is defined by α ( D ) def = δ m ( . . . ( δ ( D )) . . . ). Definition 2. (Dynamic Query) A dynamic instance is a pair ( D , α ) consistingof an input database D and a modification sequence α . For a static query Q with In this work we do not allow modification of constants, for simplicity. τ , the dynamic query Dyn( Q ) is the mapping that yields Q ( α ( D )), forevery dynamic instance ( D , α ).Our main interest in this work is the dynamic version Dyn( s - t -Reach) ofthe s - t -reachability query.Dynamic programs, to be defined next, consist of an initialization mechanismand an update program. The former yields, for every database D an initial statewith initial auxiliary data (and possibly with further built-in data). The latterdefines the new state, for each possible modification δ . The following formaldefinitions are illustrated in Example 1 at the end of this section.An dynamic schema is a triple ( τ in , τ aux , τ bi ) of schemas of the input database,the auxiliary database, and the built-in database and respectively. We alwayslet τ def = τ in ∪ τ aux ∪ τ bi . Throughout the paper, τ in has to be relational. Inour basic setting we also require τ aux to be relational (this will be relaxed inSection 5).A note on the role of the built-in database is in order: as opposed to the auxil-iary database, the built-in database never changes throughout a “computation”.Our standard classes are defined over schemas without built-in databases (thatis, with empty built-in schema). Built-in databases are only used to strengthensome results in one of two possible ways, (1) by showing upper bounds in which(some) auxiliary relations or functions need not be updated or (2) by showinginexpressibility results that hold for auxiliary schemas of bounded arity but withbuilt-in relations of unbounded arity. In general, built-in data can be “simu-lated” by auxiliary data. However, this need not hold, e.g., if the auxiliaryschema is more restricted than the built-in schema. Definition 3. (Update program) An update program P over dynamic schema( τ in , τ aux , τ bi ) is a set of first-order formulas (called update formulas in the fol-lowing) that contains, for every R ∈ τ aux and every abstract modification δ ofsome S ∈ τ in , an update formula φ Rδ ( ~x ; ~y ) over the schema τ where ~x and ~y havethe same arity as S and R , respectively.A program state S over dynamic schema ( τ in , τ aux , τ bi ) is a structure ( D, I , A , B )where D is the domain, I is a database over the input schema (the currentdatabase ), A is a database over the auxiliary schema (the auxiliary database )and B is a database over the built-in schema (the built-in database ).The semantics of update programs is as follows. For a modification δ ( ~a ) andprogram state S = ( D, I , A , B ) we denote by P δ ( S ) the state ( D, δ ( I ) , A ′ , B ),where A ′ consists of relations R ′ def = { ~b | S | = φ Rδ ( ~a ; ~b ) } . The effect P α ( S ) of amodification sequence α = δ . . . δ m to a state S is the state P δ m ( . . . ( P δ ( S )) . . . ). In previous work (by us as well as by others) there was usually no terminological distinctionbetween the changes that are applied to the structure at hand (e.g., database or graph) andare considered as input to an update program and the changes that are applied by an updateprogram to the auxiliary data after such a change. Both types of changes usually have beentermed updates . In this article, we use the term modification for changes of the database orstructure and reserve the term update for the respective change applied to the auxiliary databy the actual update program. efinition 4. (Dynamic program) A dynamic program is a triple ( P, Init , Q ),where • P is an update program over some dynamic schema ( τ in , τ bi , τ aux ), • the tuple Init = (
Init aux , Init bi ) consists of a function Init aux that maps τ in -databases to τ aux -databases and a function Init bi that maps domainsto τ bi -databases, and • Q ∈ τ aux is a designated query symbol .A dynamic program P = ( P, Init , Q ) maintains a dynamic query Dyn( Q ) if, for every dynamic instance ( D , α ), the relation Q ( α ( D )) coincides with thequery relation Q S in the state S def = P α ( S Init ( D )), where S Init ( D ) is the initialstate, i.e. S Init ( D ) def = ( D, D , Init aux ( D ) , Init bi ( D )).Several dynamic settings and restrictions of dynamic programs have beenstudied in the literature [10, 4, 6, 5]. Possible parameters are, for instance: • the logic in which update formulas are expressed; • whether in dynamic instances ( D , α ), the initial database D is alwaysempty; • whether the initialization mapping Init is permutation-invariant (short: invariant ) in the sense that π ( Init aux ( D )) = Init aux ( π ( D )) and π ( Init bi ( D )) = Init bi ( π ( D )) hold, for every database D , domain D andpermutation π of the domain; and • whether there are any built-in relations at all.In [11], Dyn-FO is defined as the class of (Boolean) queries that can bemaintained for empty initial databases with first-order update formulas, first-order definable initialization mapping and without built-in data. Furthermore,a larger class with polynomial-time computable initialization mapping was con-sidered. Also [4] considers empty initial databases without built-in data. In[6], general instances (with non-empty initial databases) are allowed, but theinitialization mapping has to be defined by logical formulas and is thus alwaysinvariant; and there is no built-in data. In [5] update formulas are restricted tobe quantifier-free, the initial database is empty and a built-in order is available.In this article, the main dynamic classes do not allow built-in data. We calla dynamic schema normal if it has an empty built-in schema τ bi .We consider the following basic dynamic complexity classes. Definition 5. ( DynFO , DynProp ) DynFO is the class of all dynamic queriesmaintainable by dynamic programs with first-order update formulas over normaldynamic schemas.
DynProp is the subclass of
DynFO , where update formulasdo not use quantifiers. A dynamic program is k -ary if the arity of its auxiliaryrelation symbols is at most k . By k -ary DynProp (resp.
DynFO ) we refer todynamic queries that can be maintained with k -ary dynamic programs.7 mpty initial databasewith arbitrary initializationempty initial databasewith empty initializationnon-empty initial databasewith arbitrary initializationnon-empty initial databasewith invariant initialization = ⊆ ⊆⊆ Theorem 4.12 Theorem 4.7
Figure 1: Relationship between different dynamic settings considered in theliterature. Inclusion is with respect to the class of queries that can be maintainedfor a fixed (arbitrary) update language. Theorem 4.7 holds for all settings,Theorem 4.12 only for the lower left setting.At times we also consider dynamic programs with non-empty relational built-in schemas. We denote the extension of a dynamic class by programs with non-empty built-in schemas by a superscript ∗ , as in DynProp ∗ . We note that thearity restrictions in the above definition do not apply to the built-in relations.In our basic setting the initialization mappings can be arbitrary. We will ex-plicitly state when we relax this most general setting. Now we sketch importantrelaxations. Figure 1 illustrates the relationships between the various settings.First we note that for arbitrary initialization mappings, the same queriescan be maintained regardless whether one starts from an empty or from a non-empty initial database. Restricting the setting for non-empty initial databasesto invariant auxiliary data initialization leads to the initialization used in [6](called invariant initialization in the following). For empty initial databases,allowing empty initial auxiliary data only leads to the initialization model of[11, 4] (called empty initialization in the following).It is easy to see that applying an invariant initialization mapping to an emptydatabase is pretty much useless, as, all tuples with the same constants at thesame positions are treated in the same way. Therefore, queries maintainable in
DynFO or DynProp with empty initial database and invariant initializationcan also be maintained with empty initialization . This statement also holds inthe presence of arbitrary built-in relations.From now on we restrict our attention to quantifier-free update programs.Next, we give an example of such a program. Example 1.
We provide a
DynProp -program P for the dynamic variant ofthe Boolean query NonEmptySet , where, for a unary relation U subject toinsertions and deletions of elements, one asks whether U is empty. Of course, thisquery is trivially expressible in first-order logic, but not without quantifiers. Theprogram P illustrates a technique to maintain lists with quantifier-free dynamicprograms, introduced in [5, Proposition 4.5], which is used in some of our upperbounds. The initialization for a non-empty database can be obtained as the auxiliary relationsobtained after inserting all tuples of the database into the empty one. We do not formally prove this here. P is over auxiliary schema τ aux = { Q, First , Last , List } ,where Q is the query bit (i.e. a 0-ary relation symbol), First and
Last areunary relation symbols, and
List is a binary relation symbol. The idea is tostore in a program state S a list of all elements currently in U . The list structureis stored in the binary relation List S such that List S ( a, b ) holds for all elements a and b that are adjacent in the list. The first and last element of the list arestored in First S and Last S , respectively. We note that the order in whichthe elements of U are stored in the list depends on the order in which they areinserted into the set. For a given instance of NonEmptySet the initializationmapping initializes the auxiliary relations accordingly.
Insertion of a into U . A newly inserted element is attached to the end ofthe list . Therefore the First -relation does not change except when the firstelement is inserted into an empty set U . Furthermore, the inserted element isthe new last element of the list and has a connection to the former last element.Finally, after inserting an element into U , the query result is ’true’: φ Firstins ( a ; x ) def = ( ¬ Q ∧ a = x ) ∨ ( Q ∧ First ( x )) φ Lastins ( a ; x ) def = a = xφ Listins ( a ; x, y ) def = List ( x, y ) ∨ ( Last ( x ) ∧ a = y ) φ Q ins ( a ) def = ⊤ . Deletion of a from U . How a deleted element a is removed from the list,depends on whether a is the first element of the list, the last element of the listor some other element of the list. The query bit remains ’true’, if a was not thefirst and last element of the list. φ Firstdel ( a ; x ) def = ( First ( x ) ∧ a = x ) ∨ ( First ( a ) ∧ List ( a, x )) φ Lastdel ( a ; x ) def = ( Last ( x ) ∧ a = x ) ∨ ( Last ( a ) ∧ List ( x, a )) φ Listdel ( a ; x, y ) def = x = a ∧ y = a ∧ (cid:0) List ( x, y ) ∨ ( List ( x, a ) ∧ List ( a, y )) (cid:1) φ Q del ( a ) def = ¬ ( First ( a ) ∧ Last ( a )) In this section we prove lower bounds for the maintainability of the dynamic s - t -reachability query Dyn( s - t -Reach) with quantifier-free update formulas.First we introduce a tool for proving lower bounds for quantifier-free formu-las. Afterwards we prove that • Dyn( s - t -Reach) is not in binary DynProp ∗ ; and For simplicity we assume that only elements that are not already in U are inserted, theformulas given can be extended easily to the general case. Similar assumptions are madewhenever necessary. S A~a T T Bπ ( ~a ) ∼ = πα = δ ( ~a ) β = δ ( π ( ~a )) S P α ( S ) A T P β ( T ) B ∼ = π Figure 2: The statement of the substructure lemma. • Dyn( s - t -Reach) is not in DynProp ∗ with invariant initialization map-pings.The first result is used to obtain an arity hierarchy up to arity three forquantifier-free updates and binary queries.The proofs use the following tool which is a slight variation of Lemma 1from [5]. The intuition is as follows. When updating an auxiliary tuple ~c afteran insertion or deletion of a tuple ~d , a quantifier-free update formula has accessto ~c , ~d , and the constants only. Thus, if a sequence of modifications changesonly tuples from a substructure A of S , the auxiliary data of A is not affectedby information outside A . In particular, two isomorphic substructures A and B should remain isomorphic, when corresponding modifications are applied tothem.We formalize the notion of corresponding modifications as follows. Let π bean isomorphism from a structure A to a structure B . Two modifications δ ( ~a )on A and δ ( ~b ) on B are said to be π -respecting if ~b = π ( ~a ). Two sequences α = δ · · · δ m and β = δ ′ · · · δ ′ m of modifications respect π if, for every i ≤ m , δ i and δ ′ i are π -respecting. Lemma 4.1 (Substructure lemma for
DynProp ∗ ) . Let P be a DynProp ∗ program and S and T states of P with domains S and T , respectively. Further,let A ⊆ S and B ⊆ T such that S ↾ A and T ↾ B are isomorphic via π . Then P α ( S ) ↾ A and P β ( T ) ↾ B are isomorphic via π for all π -respecting modificationsequences α , β on A and B . The substructure lemma is illustrated in Figure 2.10 roof.
The lemma can be shown by induction on the length of the modificationsequences. To this end, it is sufficient to prove the claim for a pair of π -respectingmodifications δ ( ~a ) and δ ( ~b ) on A and B . We abbreviate S ↾ A and T ↾ B by A and B , respectively.Since π is an isomorphism from A to B , we know that R A ( ~d ) holds if andonly if R B ( π ( ~d )) holds, for every m -tuple ~d over A and every relation symbol R ∈ τ . Therefore, ϕ ( ~x ) evaluates to true in A under ~d if and only if it does soin B under π ( ~d ′ ), for every quantifier-free formula ϕ ( ~x ) over schema τ . Thusall update formulas from P yield the same result for corresponding tuples ~d and π ( ~d ) from A and B , respectively. Hence P δ ( ~a ) ( S ) ↾ A is isomorphic to P δ ( π ( ~a )) ( S ) ↾ B . This proves the claim.The following corollary is implied by Lemma 4.1, since the 0-ary auxiliaryrelations of two isomorphic structures coincide. Corollary 4.2.
Let P be a DynProp ∗ -program with designated Boolean querysymbol Q , and let S and T be states of P with domains S and T . Further let A ⊆ S and B ⊆ T such that S ↾ A and T ↾ B are isomorphic via π . Then Q has the same value in P α ( S ) and P β ( T ) for all π -respecting sequences α , β ofmodifications on A and B . The Substructure Lemma can be applied along the following lines to provethat
Dyn( s - t -Reach) cannot be maintained in some settings with quantifier-free updates. Towards a contradiction, assume that there is a quantifier-freeprogram P = ( P, Init , Q ) that maintains
Dyn( s - t -Reach) . Then, find • two states S and T occurring as states of P with current graphs G S and G T ; • substructures S ↾ S ′ and T ′ ↾ T ′ of S and T isomorphic via π ; and • two π -respecting modification sequences α and β on S ′ and T ′ such that α ( G S ) is in s - t -Reach and β ( G T ) is not in s - t -Reach .This yields the desired contradiction, since Q has the same value in P α ( S ) and P β ( T ) by the substructure lemma.How such states S and T can be obtained depends on the particular setting.Yet, Ramsey’s theorem and Higman’s lemma often prove to be useful for thistask. Next, we present the variants of these theorems used in our proofs. Theorem 4.3 (Ramsey’s Theorem for Structures) . For every schema τ andall natural numbers k and n there exists a number R τ,k ( n ) such that, for every τ -structure S with domain A of size R τ,k ( n ) , every ~d ∈ A k and every order ≺ on A , there is a subset B of A of size n with B ∩ ~d = ∅ , such that, for every l ,the type of ( ~a, ~d ) in S is the same, for all ≺ -ordered l -tuples ~a over B . I.e. S = P α ( S Init ( G )) for some s - t -graph G and modification sequence α , and likewisefor T . k -hypergraph G is a pair ( V, E ) where V is a set and E is a set of k -element subsets of V . If E contains all k -element subsets of V , then G is called complete . A k -hypergraph G ′ = ( V ′ , E ′ ) is a sub- k -hypergraph of a k -hypergraph G = ( V, E ), if V ′ ⊆ V and E ′ contains all edges e ∈ E with e ⊆ V ′ . A C -coloring col of G , where C is a finite set of colors, is a mapping that assigns to everyedge in E a color from C , that is, col : E → C . A C -colored k -hypergraph isa pair ( G, col ) where G is a k -hypergraph and col is a C -coloring of G . If thename of the C -coloring is not important we also say G is C -colored . Theorem 4.4. (Ramsey’s Theorem for Hypergraphs) For every set C of colorsand natural numbers n and k there exists a number R C ( n ) such that, if the edgesof a complete k -hypergraph of size R C ( n ) are C -colored, then the hypergraphcontains a complete sub- k -hypergraph with n nodes whose edges are all coloredwith the same color. Proof (of Theorem 4.3).
Given a schema τ and natural numbers k , n . Let R τ,k ( n ) be chosen sufficiently large with respect to k , n , and τ such that thefollowing argument works. Further let S be a τ -structure with domain A of sizegreater than R τ,k ( n ) and ≺ an arbitrary order on A . Denote by m the maximalarity in τ and by ~c the constants of S in some order. Further denote by C theset of all constants and all elements occurring in ~d .Observe that proving the claim for l ≤ m is sufficient.We first prove the claim for | C | = 0, by constructing inductively sets B l that satisfy the condition for l with l ≤ m . Let B = A . The set B l , l ≤ m ,is obtained from B l − as follows. From B l − a coloring col of the complete l -hypergraph G with node set B l − is constructed. The coloring col uses l -ary τ -types as colors. An edge e = { e , . . . , e l } with e ≺ . . . ≺ e l is colored bythe type hS , e , . . . , e l i . Because B l − is large, it has, by Ramsey’s theorem, asubset B l such that all edges e ⊆ B l of size l are colored with the same color by col . But then, by the definition of col , all ≺ -ordered l -tuples over B l have thesame type in S . By this construction we obtain a set B m such that for every l ≤ m the type of all ≺ -ordered l -tuples over B m is the same. Setting B := B m proves the claim for | C | = 0.The idea for the case | C | 6 = 0 is to construct from S a new structure S ′ of anextended schema over domain A ′ = A \ C such that S ′ encodes all informationabout C contained in S and then use the case | C | = 0 for S ′ .The structure S ′ is of schema τ ∪ τ ′ , where τ ′ contains for every l ≤ m andevery ( l + | C | )-ary τ -type t , an l -ary relation symbol R t . An l -tuple ~a is in R S ′ t ifand only if t is the τ -type of ( ~a, ~C ). Application of the case | C | = 0 to S ′ yieldsa huge homogeneous subset B ′ with respect to ≺ and schema τ ∪ τ ′ . Then, forevery l ≤ m , the type of ( ~a, ~C ) in S is the same, for all ≺ -ordered l -tuples ~a over B ′ . This proves the claim.Now we state the variant of Higman’s Lemma that will be used later. A12ord u is a subsequence of a word v , in symbols u ⊑ v , if u = u . . . u k and v = v u v . . . v k − u k v k for some words u , . . . , u k and v , . . . , v k . Theorem 4.5 (Higman’s Lemma) . For every infinite sequence ( w i ) i ∈ N of wordsover an alphabet Σ there are l and k such that l < k and w l ⊑ w k . We will actually make use of the following stronger result. See e.g. [13,Proposition 2.5, page 3] for a proof.
Theorem 4.6.
For every alphabet of size c and function g : N → N there isa natural number H ( c ) such that in every sequence ( w i ) ≤ i ≤ H ( c ) of H ( c ) manywords with | w i | ≤ g ( i ) there are l and k with l < k and w l ⊑ w k . In the following we will refer to both results as Higman’s Lemma.
As already mentioned in the introduction, the proof that
Dyn( s - t -Reach) isnot in unary DynFO in [2] uses constant-length modification sequences, and ismainly an application of a locality-based static lower bound for monadic secondorder logic. This technique does not seem to generalize to binary
DynFO . Weprove the first unmaintainability result for
Dyn( s - t -Reach) with respect tobinary auxiliary relations. We recall that binary DynProp ∗ can have built-inrelations of arbitrary arity. Theorem 4.7.
Dyn( s - t -Reach) is not in binary DynProp ∗ . The proof of Theorem 4.7 will actually show that binary
DynProp ∗ can-not even maintain Dyn( s - t -Reach) on 2-layered s - t -graphs. These restrictedgraphs will then help us to show that binary DynProp ∗ does not captureternary DynProp . This separation shows that the lower bound technique for bi-nary
DynProp does not immediately transfer to ternary
DynProp (or ternary
DynProp ∗ ). At the moment we do not know whether it is possible to adaptthe technique to full DynProp .Before proving Theorem 4.7, we show the following corresponding result forunary
DynProp ∗ whose proof uses the same techniques in a simpler setting. Proposition 4.8.
The dynamic s - t -reachability query is not in unary DynProp ∗ ,not even for -layered s - t -graphs.Proof. Towards a contradiction, assume that P = ( P, Init , Q ) is a dynamicprogram over schema τ = ( τ in , τ aux , τ bi ) with unary schema τ aux that maintainsthe s - t -reachability query for 1-layered s - t -graphs. Let n ′ be sufficiently large with respect to τ and n be sufficiently large with respect to n ′ . Further let m be the highest arity of a relation symbol from τ bi .Let G = ( V, E ) be a 1-layered s - t -graph such that V = { s, t } ∪ A with n = | A | and E = ∅ . Further let S = ( V, E, A , B ) be the state obtained by applying Init to G . Explicit numbers are given at the end of the proof. s and t in S , as they never change during the application of a modification sequence(but, of course, tuples containing constants might change in the graph and inthe auxiliary relations).First, we identify a subset of A on which the built-in relations are homoge-neous. By Ramsey’s Theorem for structures (choosing ~d = ( s, t )) and because n = | A | is sufficiently large with respect to n ′ there is a set A ′ ⊆ A of size n ′ and an order ≺ on A ′ such that all ≺ -ordered m -tuples ~a and ~a over A ′ areof equal τ bi -type.Let S ′ def = ( V, E ′ , A ′ , B ) be the state of P that is reached from S after appli-cation of the following modifications to G (in some arbitrary order):( α ) For every node a ∈ A ′ , insert edges ( s, a ) and ( a, t ).We observe that the built-in data has not changed, but the auxiliary data mighthave changed.Let a ≺ . . . ≺ a n ′ be an enumeration of the elements of A ′ . For every i ∈ { , . . . , n ′ } , we define α i to be the modification sequence that deletes theedges ( s, a n ′ ), ( s, a n ′ − ) , . . . , ( s, a i +1 ), in this order. Let S ′ i be the state reachedby applying α i to S ′ . Thus, in state S ′ i only nodes a , . . . , a i have edges to node s . For every i , we construct a word w i of length i , that has a letter for everynode a , . . . , a i and captures all relevant information about those nodes in S ′ i .The words w i are over the set of all unary types of τ aux . More precisely, the j thletter σ ji of w i is the unary τ aux -type of a j in S ′ i . We recall that the unary typeof a j captures all information about the tuple ( s, a j , t ).Since n ′ = | A ′ | was chosen sufficiently large with respect to τ , it follows byHigman’s Lemma, that there are k and l such that k < l and w k ⊑ w l , that is, w k = σ k σ k . . . σ kk = σ i l σ i l . . . σ i k l for suitable numbers i < . . . < i k .We argue that the structures S ′ k ↾ { s, t, a , . . . , a k } and S ′ l ↾ { s, t, a i , . . . , a i k } are isomorphic via the mapping π with π ( a j ) = a i j for all j , π ( s ) = s and π ( t ) = t . By definition of A ′ and because built-in relations do not change,the mapping π preserves τ bi . The schema τ aux is preserved since a j and a i j are of equal unary type, by the definition of w k and w l . Thus π is indeed anisomorphism. We refer to Figure 3 for an illustration.Therefore, by Corollary 4.2, the program P computes the same query resultfor the following π -respecting modification sequences β and β :( β ) Delete edges ( s, a ) , . . . , ( s, a k ) from S ′ k .( β ) Delete edges ( s, a i ) , . . . , ( s, a i k ) from S ′ l .However, applying the modification sequence β yields a graph where t is notreachable from s , whereas by β a graph is obtained where t is reachable from s since k < l , the desired contradiction.We now specify the numbers n and n ′ that were chosen in the beginning ofthe proof. In order to apply Higman’s Lemma, the set A ′ needs to be of size atleast n ′ def = H ( | n ′′ | ) where n ′′ is the number of unary types of τ . Therefore, theset A has to be of size n def = R τ ( n ′ ). 14 ′ k : sa a i − a i a i +1 a i − a i a i +1 a k a k +1 a i k − a i k a i k +1 a l a l +1 a m t S ′ l : sa a i − a i a i +1 a i − a i a i +1 a k a k +1 a i k − a i k a i k +1 a l a l +1 a m t Figure 3: The structures S ′ k and S ′ l from the proof of Proposition 4.8. Deletededges are dotted. The isomorphic substructures are highlighted in blue.Now we prove Theorem 4.7, i.e. that Dyn( s - t -Reach) is not in binary DynProp ∗ . In the proof, we will again first choose a homogeneous subsetwith respect to the built-in relations. The notation introduced next and thefollowing lemma prepare this step.We refine the notion of homogeneous sets. Let S be a structure of someschema τ and A , B disjoint subsets of the domain of S . We say that B is A - ≺ -homogeneous up to arity m , if for every l ≤ m , all tuples ( a,~b ), where a ∈ A and ~b is an ≺ -ordered l -tuple over B , have the same type. We may drop theorder ≺ from the notation if it is clear from the context, and we may drop A if A = ∅ . We observe that if the maximal arity of τ is m and B is A -homogeneousup to arity m , then B is A -homogeneous up to arity m ′ for every m ′ . In thiscase we simply say B is A -homogeneous . Lemma 4.9.
For every schema τ and natural number n , there is a naturalnumber R hom τ ( n ) such that for any two disjoint subsets A , B of the domain ofa τ -structure S with | A | , | B | ≥ R hom τ ( n ) , there are subsets A ′ ⊆ A and B ′ ⊆ B such that | A ′ | , | B ′ | = n and B ′ is A ′ -homogeneous in S .Proof. Let τ be a schema with maximal arity m . Choose k ′ to be a largenumber with respect to τ and n ; and let k be a large number with respect to Again, explicit numbers can be found at the end of the proof. ′ . In particular k is large with respect to the number of constant symbols in τ . Further let A , B be disjoint subsets of the domain of a τ -structure S with | A | , | B | > k . Since k is large with respect to the number of constants in S , weassume, without loss of generality, that neither A nor B contains a constant.Fix a k ′ -tuple ~a = ( a , . . . , a k ′ ) of A . Further let ≺ be an arbitrary order on B . Because | B | is large with respect to k ′ , n and τ , and by Ramsey’s theoremon structures (choose ~d = ~a ), there is a subset B ′ of B of size n such that forevery l ≤ m the type of ( ~a,~b ) in S is the same, for all ≺ -ordered l -tuples ~b over B ′ .Since k ′ is large with respect to τ and because there is only a boundednumber of ( m + 1)-ary τ -types, there is an increasing sequence i , . . . , i n suchthat for all l ≤ m the τ -types of tuples ( a i j ,~b ) are equal, for all ≺ -ordered l -tuples ~b over B ′ and j ∈ { , . . . , n } . We choose A ′ := { a i , . . . , a i n } . Then B ′ is A ′ -homogeneous up to arity m and therefore A ′ -homogeneous.It remains to give explicit numbers. For the sequence i , . . . , i n to exist in1 , . . . , k ′ , the number k ′ has to be at least nM + 1 where M is the number of( m + 1)-ary τ -types. Thus k has to be at least R τ,k ′ ( k ′ ) + c where c is thenumber of constants in τ . Define R hom τ ( n ) def = k . Proof (of Theorem 4.7).
Let us assume, towards a contradiction, thatthe dynamic program ( P, Init , Q ) over schema τ = ( τ in , τ aux , τ bi ) with binary τ aux maintains the dynamic s - t -reachability query for 2-layered s - t -graphs. Wechoose numbers n , n , n and n such that n is sufficiently large with respect to τ , n is sufficiently large with respect to n , n is sufficiently large with respectto n and n is sufficiently large with respect to n .Let G = ( V, E ) be a 2-layered s - t -graph with layers A , B , where A and B are both of size n and E = { ( b, t ) | b ∈ B } . Further, let S = ( V, E, A , B ) be thestate obtained by applying Init to G .We will first choose homogeneous subsets. By Lemma 4.9 and because n issufficiently large, there are subsets A and B such that | A | = | B | = n and B is A - ≺ -homogeneous in S , for some order ≺ . Next, let A and B be arbitrarilychosen subsets of A and B , respectively, of size | B | = n and | A | = 2 | B | ,respectively. We note that B is still A -homogeneous. In particular, B is still A -homogeneous with respect to schema τ bi . We associate with every subset X ⊆ B a unique vertex a X from A in an arbitrary fashion.Now,we define the modification sequence α as follows.( α ) For every subset X of B and every b ∈ X insert an edge ( a X , b ), in somearbitrarily chosen order.Let S ′ def = ( V, E ′ , A ′ , B ) be the state of P after applying α to S , i.e. S ′ = P α ( S ).We observe that the built-in data has not changed, but the auxiliary data mighthave changed. In particular, B is not necessarily A -homogeneous with respectto schema τ aux in state S ′ .Our plan is to exhibit two sets X, X ′ such that X ( X ′ ⊆ B such that therestriction of S ′ to { s, t, a X ′ }∪ X ′ contains an isomorphic copy of S ′ restricted to { s, t, a X } ∪ X . Then the substructure lemma will easily give us a contradiction.16y Ramsey’s theorem and because | B | is sufficiently large with respectto n , there is a subset B ⊆ B of size n such that B is ≺ -homogeneousin S ′ . Let b ≺ . . . ≺ b n be an enumeration of the elements of B and let X i def = { b , . . . , b i } , for every i ∈ { , . . . , n } .Let S ′ i denote the restriction of S ′ to X i ∪{ s, t, a X i } . For every i , we constructa word w i of length i , that has a letter for every node in X i and captures allrelevant information about those nodes in S ′ i . More precisely, w i def = σ i · · · σ ii ,where for every i and j , σ ji is the binary type of ( a X i , b j ).Since B is sufficiently large with respect to τ aux , it follows, by Higman’slemma, that there are k and l such that k < l and w k ⊑ w l , that is w k = σ k σ k . . . σ kk = σ i l σ i l . . . σ i k l for suitable numbers i < . . . < i k . Let ~b def = ( b , . . . , b k ) and ~b ′ def = ( b i , . . . , b i k ). Further, let T k def = S ′ k ↾ T k where T k = { s, t, a X k } ∪ ~b , and T l def = S ′ l ↾ T l where T l def = { s, t, a X l } ∪ ~b ′ . We referto Figure 4 for an illustration of the substructures T k and T l of S ′ .We show that T k ≃ π T l , where π is the isomorphism that maps s and t tothemselves, a X k to a X l and b j to b i j for every j ∈ { , . . . , k } . We argue that π fulfills the requirements of an isomorphism, for every relation symbol R from τ in ∪ τ bi ∪ τ aux : • For the input relation E this is obvious. In S ′ there are no edges from s to nodes in A and all nodes from B have an edge to t . Further X l isconnected to all nodes in ~b and X k is connected to all nodes in ~b ′ . • For R ∈ τ bi , the requirement follows because B is A -homogeneous forschema τ bi . • For R ∈ τ aux of arity 2 and two 2-tuples ~c and π ( ~c ) we distinguish twocases. First, if ~c and π ( ~c ) contain elements from B only, then ~c ∈ R T k if and only if π ( ~c ) ∈ R T l because B is homogeneous in S ′ . Second, if ~c contains s , t or A X l , then ~c ∈ R T k if and only if π ( ~c ) ∈ R T l because of theconstruction of w k and w l .Thus, by the substructure lemma, application of the following two modifi-cation sequences to S ′ results in the same query result:( β ) Deleting edges ( a X k , b ) , . . . , ( a X k , b k ) and adding an edge ( s, a X k ).( β ) Deleting edges ( a X l , b i ) , . . . , ( a X l , b i k ) and adding an edge ( s, a X l ).However, applying β yields a graph in which t is not reachable from s , whereasby applying β a graph is obtained in which t is reachable from s . This is thedesired contradiction.It remains to specify the sizes of the sets. To apply Higman’s lemma, | B | hasto be of size at least n def = H ( m ) where m is the number of binary types over τ aux .Hence, for applying Ramsey’s theorem, | B | has to be of size n def = R τ ( n ).Thus it is sufficient if | B | and | A | contain n def = 2 n elements. Therefore, byLemma 4.9, the sets A and B can be chosen of size n def = R hom τ ( n ).17 k : sta X a X k a X l b b i − b i b i +1 b i − b i b i +1 b k b k +1 b i k − b i k b i k +1 b l T l : sta X a X k a X l b b i − b i b i +1 b i − b i b i +1 b k b k +1 b i k − b i k b i k +1 b l Figure 4: The structure S ′ from the proof of Theorem 4.7. The isomorphicsubstructures T k and T l are highlighted in blue. An arity hierarchy for
DynFO was established in [2]. The dynamic queries Q k +1 used to separate k -ary and ( k + 1)-ary DynFO can already be maintainedin ( k +1)-ary DynProp , thus the hierarchy transfers to
DynProp immediately.However, Q k +1 is a k -ary query and has an input schema of arity 6 k + 1 (im-proved to 3 k +1 in [3]). Here we establish a strict arity hierarchy between unary,binary and ternary DynProp for Boolean queries and binary input schemas.We use the following problems s - t -TwoPath and s -TwoPath Query: s - t -TwoPath Input: An s - t -graph G = ( V, E ). Question:
Is there a path of length two from s to t ?18 uery: s -TwoPath Input:
A graph G = ( V, E ) with one distinguished node s ∈ V . Question:
Is there a path of length two starting from s ? Proposition 4.10.
The dynamic query
Dyn( s - t -TwoPath) is in binary DynProp ,but not in unary
DynProp ∗ .Proof sketch. That
Dyn( s - t -TwoPath) is not in unary DynProp ∗ followsimmediately from Proposition 4.8 as such a program would also maintain thedynamic s - t -reachability query for 1-layered graphs.In order to prove that Dyn( s - t -TwoPath) is in binary DynProp , we sketcha
DynProp -program ( P, Init , Q ) whose auxiliary schema contains unary rela-tion symbols In , Out , First , and
Last and a binary relation symbol
List .The idea is to store, in a program state S , a list of all nodes a such that ( s, a, t )is a path in E S . The relation In S contains all nodes with an incoming edgefrom s , and Out S contains all nodes with an outgoing edge to t . The relations First S , Last S , List S maintain the actual list, similarly to Example 1. Thecurrent query bit is maintained in Q S .For a given instance of s - t -TwoPath the initialization mapping initializesthe auxiliary relations accordingly. Insertion of ( a, b ) into E . We note that edges ( a, b ) where a = s and b = t can be ignored, as they cannot contribute to any path of length 2 from s to t . Furthermore, paths of length 2 involving only nodes s and t can be easilyhandled by DynProp formulas, and therefore will be ignored as well.If a = s and b = t , then b is inserted into In , otherwise if a = s and b = t then a is inserted into Out .Afterwards a or b is inserted into List , if it is now contained in both In and Out . In that case the query bit is set true.Formally: φ Inins ( a, b ; x ) = In ( x ) ∨ ( x = b ∧ a = s ∧ b = s ∧ b = t ) φ Outins ( a, b ; x ) = Out ( x ) ∨ ( x = a ∧ a = s ∧ a = t ∧ b = t ) φ Firstins ( a, b ; x ) = First ( x ) ∨ ( ¬ Q ∧ ϕ n ( x )) φ Lastins ( a, b ; x ) = ( Last ( x ) ∧ ¬ ϕ n ( a ) ∧ ¬ ϕ n ( b )) ∨ ϕ n ( x ) φ Listins ( a, b ; x, y ) = ( List ( x, y ) ∧ ¬ ϕ n ( a ) ∧ ¬ ϕ n ( b )) ∨ ( Last ( x ) ∧ ϕ n ( y )) φ Q ins ( a, b ) = Q ∨ ϕ n ( a ) ∨ ϕ n ( b )Here, ϕ n ( x ) is an abbreviation for φ Inins ( a, b ; x ) ∧ φ Outins ( a, b ; x ) ∧ ( ¬ In ( x ) ∨ ¬ Out ( x ))expressing that x is becoming newly inserted into List . Deletion of ( a, b ) from E . First, if a = s , then b is removed from In .Further if b = t then a is removed from Out .19fterwards a or b is removed from List , if it has been removed from In or Out . If
List is empty now, then the query bit is set to false. The preciseformulas are along the lines of the formulas of Example 1.
Proposition 4.11.
The dynamic query
Dyn( s -TwoPath) is in ternary DynProp ,but not in binary
DynProp ∗ .Proof sketch. For proving that
Dyn( s -TwoPath) is not in binary DynProp ∗ ,assume to the contrary that there is a binary DynProp ∗ -program P = ( P, Init , Q )for
Dyn( s -TwoPath) . With the help of P one can, for the graphs from theproof of Proposition 4.8, maintain whether there is a path from s to some nodeof B . However, this yields a correct answer for s - t -Reach for those graphs,since in the proof all nodes of B have an edge to t .In order to prove that Dyn( s -TwoPath) is in ternary DynProp , we sketcha
DynProp -program ( P, Init , Q ) whose auxiliary schema contains unary rela-tion symbols In , Out , First , Last and Empty , binary relation symbols List , First , Last and Empty , and a ternary relation symbol List . Theidea is that in a state S , the binary relation List S contains a list of all nodes a on a path ( s, a, b ) in E S , for some node b . The relation In S contains all nodeswith an incoming edge from s , and Out S contains all nodes with an outgoingedge. In order to update Out S , the projection List S ( a, · , · ) of the ternary re-lation List S stores a list of nodes b with ( a, b ) ∈ E S , for every node a . Thelists List S and List S ( a, · , · ) are maintained by using the technique from Exam-ple 1 and by using the auxiliary relations stored in First S , Last S , Empty S , First S , Last S and Empty S . The current query bit is maintained in Q S .For a given instance of s -TwoPath the initialization mapping initializes theauxiliary relations accordingly. Insertion of ( a, b ) into E . First, if a = s then b is inserted into In .Otherwise, a is inserted into Out and b is inserted into List ( a, · , · ).Afterwards a or b is inserted into List , if it is now contained in both In and Out . If one of them is inserted, then the query bit is set true.
Deletion of ( a, b ) from E . First, if a = s then b is removed from In . Oth-erwise, b is removed from List ( a, · , · ) and if List ( a, · , · ) is empty afterwards,then a is removed from Out .Afterwards a or b is removed from List , if it has been removed from In or Out . The query bit is set to false, if the list
List is empty now. We now turn to the setting with invariant initialization. Recall that an initial-ization mapping
Init with
Init = (
Init aux , Init bi ) is invariant if π ( Init aux ( D )) = Init aux ( π ( D )) and π ( Init bi ( D )) = Init bi ( π ( D ))for every database D , domain D and permutation π of the domain. The condi-tion π ( Init bi ( D )) = Init bi ( π ( D )) implies that a built-in relation contains either20ll tuples or no tuple at all. Therefore DynProp and
DynProp ∗ with invariantinitialization mapping coincide.First-order logic, second-order logic and other logics considered in computerscience can only define queries, i.e. mappings that are invariant under permuta-tions. Therefore the following result applies, in particular, for all initializationmappings defined in those logics. Theorem 4.12.
Dyn( s - t -Reach) cannot be maintained in DynProp withinvariant initialization mapping. This holds even for 1-layered s - t -graphs.Proof. Towards a contradiction, assume that the dynamic program ( P, Init , Q )with schema τ = τ in ∪ τ aux and invariant initialization mapping Init maintainsthe s - t -reachability query for 1-layered s - t -graphs. Let n be the number of typesof tuples of arity up to m for τ aux ∪ { E } where m is the highest arity of relationsymbols in τ aux ∪ { E } .We consider the 1-layered s - t -graphs G i = ( V i , E i ), for every i from 1 , . . . , n + 1,with V i = { s, t } ∪ A i where A i = { a , . . . , a i } and E = { s } × A i ∪ A i × { t } .Further, we let S i = ( V i , E i , A i ) be the state obtained by applying Init to G i .Our goal is to find S k and S l with k < l such that S k is isomorphic to S l ↾ V k (see Figure 5 for an illustration). Then, by the substructure lemma, the program P computes the same query result for the following modification sequences:( β ) Delete edges ( s, a ) , . . . , ( s, a k ) from S k .( β ) Delete edges ( s, a ) , . . . , ( s, a k ) from S l .However, applying the modification sequence β yields a graph where t is reach-able from s , whereas by β a graph is obtained where t is not reachable from s ,a contradiction.Thus it remains to find such states S k and S l . A tuple is diverse , if all com-ponents are pairwise different. For arbitrary m ′ ≤ m , diverse tuples ~a,~b ∈ A m ′ and i ≤ n , we observe that G i ≃ id [ ~a,~b ] G i where id [ ~a,~b ] is the bijection thatmaps a i to b i , b i to a i and every other element from S to itself. Therefore S i ≃ id [ ~a,~b ] S i by the invariance of Init . Thus hS i , ~a i = hS i ,~b i , and therefore alldiverse m ′ tuples are of the same type in S i .Since n is the number of types up to arity m , there are two states S k and S l such that, for every m ′ ≤ m , all diverse m ′ -tuples are of the same type in S k and S l . But then S k ≃ S l ↾ V k .The proof of the previous result does not extend to DynFO , since reachabil-ity in graphs of depth three is expressible even in (static) predicate logic. Theproof fails, because the substructure lemma does not hold for
DynFO -programs.At first glance, layered graphs with many layers look like a good candidate forproving that
DynFO cannot maintain s - t -Reach in this setting. However, in[6] it is shown that DynFO with FO+TC-definable initialization mappings canexpress s - t -Reach for arbitrary acyclic graphs.21 k : sa a k t S l : sa a k a k +1 a l t Figure 5: The structures S k and S l from the proof of Theorem 4.12. Theisomorphic substructures are highlighted in blue. In this section we consider the extension of the quantifier-free update formal-ism by auxiliary functions. Recall that
DynProp -update formulas can onlyaccess the inserted or deleted tuple ~a and the currently updated tuple ~b of anauxiliary relation. With auxiliary functions further elements might be accessedvia function terms over ~a and ~b . Thus, in a sense, auxiliary functions can beseen as adding weak quantification to quantifier-free formulas. The class of dy-namic queries that can be maintained with quantifier-free update formulas andauxiliary functions is denoted DynQF .After the formal definition of
DynQF and adapting the substructure lemmato it, we prove that • Dyn( s - t -Reach) is not in unary DynQF ; and • Dyn( s - t -Reach) is not in DynQF with invariant initialization.When full first-order updates are available, auxiliary functions can be simu-lated in a straight forward way by auxiliary relations. However, without quan-tifiers this is not possible. Auxiliary functions are quite powerful. While onlyregular languages can be maintained in
DynProp , all Dyck languages, amongother non-regular languages, can be maintained in
DynQF [5]. Furthermore,undirected reachability can be maintained in
DynQF with built-in relations [9].We extend our definition of schemata to allow also function symbols. Withinthis section, a schema (or signature) τ consists of a set τ rel of relation symbols, aset τ fun of function symbols and a set τ const of constant symbols together with anarity function Ar : τ rel ∪ τ fun N . A schema is relational if τ fun = ∅ . A database D of schema τ with domain D is a mapping that assigns to every relation symbol R ∈ τ rel a relation of arity Ar( R ) over D , to every k -ary function symbol f ∈ τ fun a k -ary function, and to every constant symbol c ∈ τ const a single element (called constant ) from D .In the following, we extend our definition of update programs for the case22f auxiliary schemas with functions . It is straightforward to extend the defi-nition of update formulas for auxiliary relations: they simply can make use offunction terms. However, following the spirit of DynProp , we allow a morepowerful update mechanism for auxiliary functions that allows case distinctionsin addition to composition of function terms.The following definitions are adapted from [5].
Definition 6. (Update term)
Update terms are inductively defined by the fol-lowing.(1) Every variable and every constant is an update term.(2) If f is a k -ary function symbol and t , . . . , t k are update terms, then f ( t , . . . , t k ) is an update term.(3) If φ is a quantifier-free update formula (possibly using update terms) and t and t are update terms, then ite ( φ, t , t ) is an update term.The semantics of update terms associates with every update term t and inter-pretation I = ( S , β ), where S is a state and β a variable assignment, a value J t K I from S . The semantics of (1) and (2) is straightforward. If S | = φ holds,then J ite ( φ, t , t ) K I is J t K I , otherwise J t K I .The extension of the notion of update programs for auxiliary schemas withfunction symbols is now straightforward. An update program still has an updateformula φ Rδ (possibly using terms built from function symbols) for every relationsymbol R ∈ τ aux and every abstract modification δ . Furthermore, it has, forevery abstract modification δ and every function symbol f ∈ τ aux , an updateterm t fδ ( ~x ; ~y ). For a concrete modification δ ( ~a ) it redefines f for each tuple ~b byevaluating t fδ ( ~a ; ~b ) in the current state. Definition 7. ( DynQF ) DynQF is the class of queries maintainable by quantifier-free update programs with (possibly) auxiliary functions. The class k -ary DynQF is defined via update programs that use auxiliary functions and relations of arityat most k .We define DynQF ∗ as the extension of DynQF with built-in functions andrelations of arbitrary arity.Lists can be represented by unary functions in a straightforward way. There-fore, it is not surprising that the upper bound of Proposition 4.10 already holdsfor unary
DynProp with unary built-in functions.
Proposition 5.1.
Dyn( s - t -Reach) on 1-layered s - t -graphs can be maintainedin unary DynQF ∗ with relational auxiliary schema and only unary built-in func-tions. In particular, Dyn( s - t -Reach) on 1-layered s - t -graphs can be maintainedin unary DynQF . We also allow functions in built-in schemas. As they are not updated they do not needany further particular definitions. roof sketch. We construct a
DynQF ∗ -program P over relational auxiliaryschema { Q, ConS , ConT , C } and functional built-in schema { Pred , Succ } , where Q is the query bit (i.e. a 0-ary relation symbol), ConS, ConT and C are unaryrelation symbols and Pred and
Succ are unary function symbols.The basic idea is to interpret elements of D as numbers according to theirposition in the graph of Succ . For simplicity, but without loss of generality,we therefore assume that the domain is of the form D = { , . . . , n − } with s = 0 and t = n −
1. For every state S , the built-in function Succ S is then thestandard successor function on D (with Succ S ( n −
1) = n −
1) and
Pred S isits corresponding predecessor function (with Pred S (0) = 0).The second idea is to store the current number i of vertices connected toboth s and t by letting C S = { i } . If an edge-insertion connects an element to s and t then i is replaced by i + 1 in C S with the help of Pred S and Succ S .Analogously i is replaced by i − s or t . The relations ConS S and ConT S store the elements currentlyconnected to s and t , respectively.For a given instance of the s - t -reachability query on 1-layered s - t -graphs theinitialization mapping initializes the auxiliary relations accordingly. Insertion of ( a, b ) into E . If a = s then node b is inserted into ConS; if b = t then node a is inserted into ConT. Further, if a or b is now in both S and T then the counter is incremented by 1: φ ConS ins ( a, b ; x ) def = ( a = s ∧ x = b ) ∨ ConS( x ) φ ConT ins ( a, b ; x ) def = ( b = t ∧ x = a ) ∨ ConT( x ) φ C ins ( a, b ; x ) def = (cid:0) a = s ∧ ConT( b ) ∧ C ( Pred ( x )) (cid:1) ∨ (cid:0) b = t ∧ ConS( a ) ∧ C ( Pred ( x )) (cid:1) ∨ (cid:0) a = s ∧ ¬ ConT( b ) ∧ C ( x ) (cid:1) ∨ (cid:0) b = t ∧ ¬ ConS( a ) ∧ C ( x ) (cid:1) φ Q ins ( a, b ) def = ¬ φ C ins ( a, b ; s )Deletions can be maintained in a similar way.We refer to [9, Section 4.3] and [5, Sections 4 and 6] for more examples of DynQF -programs.In the following we work towards lower bounds for
DynQF . We first extendthe substructure lemma to non-relational structures. If a modification changesa tuple from a substructure A of a structure S , then the update of the auxiliarydata of A can depend on elements obtained from applying functions to elementsin A . We formally capture these elements by the notion of neighborhood, definednext.The nesting depth d ( t ) of an update term t is its nesting depth with respect tofunction symbols: If t is a variable, then d ( t ) = 0; if t is of the form f ( t , . . . , t k )then d ( t ) = max { d ( t ) , . . . , d ( t k ) } + 1; and if t is of the form ite ( φ, t , t ) then d ( t ) = max { d ( φ ) , d ( t ) , d ( t ) } . The nesting depth d ( φ ) of φ is the maximal24esting depth of all update terms occurring in φ . The nesting depth of P is themaximal nesting depth of an update term occurring in P .For a schema τ , let Terms kτ be the set of terms of nesting depth at most k with function symbols from τ . Informally, the k -neighborhood of a set A isthe set of all elements of S that can be obtained by applying a term of nestingdepth at most k to a vector of elements from A . Definition 8. (Neighborhoods) Let S be a state with domain S over schema τ and k ≥
0. The k -neighborhood N k S ( A ) of a set A ⊆ S is the set { J t K ( S ,β ) | t ∈ Terms kτ and β ( x ) ∈ A, for every variable x in t } . A subset A of S is closed if N S ( A ) = A .The k -neighborhood of a tuple ~a or a single element a is defined accordingly.We note that for a closed set A it also holds N k S ( A ) = A , for every k .A bijection π between (the domains S and T of) two structures S and T over τ = τ rel ∪ τ fun is an isomorphism , if it preserves τ rel and π ( f S ( ~a )) = f T ( π ( ~a )) forall k -ary function symbols f ∈ τ fun and k -tuples ~a over S . Two subsets A ⊆ S , B ⊆ T are k -similar , if there is a bijection π : N k S ( A ) → N k T ( B ) such that • the restriction of π to A is a bijection of A and B , • π satisfies π ( t S ( ~a )) := t T ( π ( ~a )) for all t ∈ Terms kτ fun and ~a over A , and • π preserves τ rel on N k S ( A ).We write A ≈ π, S , T k B to indicate that A and B are k -similar via π in S and T .We drop S and T from this notation if they are clear from the context, and wedrop π if the name is not important. We also write ( a , . . . , a p ) ≈ S , T k ( b , . . . , b p )to indicate that { a , . . . , a p } ≈ π, S , T k { b , . . . , b p } via the isomorphism π thatmaps a i to b i , for every i ∈ { , . . . , p } . Note that if A ≈ B , then S ↾ A and T ↾ B are τ rel -isomorphic by the first and third property.The following lemma is a slight generalization of Lemma 4 from [5] and a gen-eralization of the substructure lemma for DynProp (Lemma 4.1) to
DynQF ∗ .Intuitively, the substructure lemma for DynQF ∗ requires not only similarity ofthe substructures but of their neighborhoods as well. Lemma 5.2 (Substructure lemma for
DynQF ) . Let P be a DynQF ∗ programwith nesting depth k and let l be some number. Furthermore let S and T be statesof P with domains S and T and let A and B be subsets of S and T , respectively.There is a number m ∈ N such that if A ≈ π, S , T m B , then A ≈ π,P α ( S ) ,P β ( T )0 B , forall π -respecting modification sequences α and β on A and B of length at most l .Proof. The proof is an extension of the proof of Lemma 4.1. The lemma followsby an induction over the length l of the modification sequence. For l = 0 thereis nothing to prove. The induction step follows easily using Claim (C) below.Let δ ( ~a ) and δ ( ~b ) be two π -respecting modifications on A and B , respectively,i.e. ~b = π ( ~a ). Let S ′ def = P δ ( ~a ) ( S ) and T ′ def = P δ ( ~b ) ( T ). We prove the followingclaims for arbitrary r ∈ N : 25A) If A ≈ π, S , T r + k B , then for all ~c over N r S ( A ):(i) ~c ∈ R S ′ if and only if π ( ~c ) ∈ R T ′ for all relation symbols R ∈ τ aux .(ii) f S ′ ( ~c ) ∈ N r + k S ( A ) and π ( f S ′ ( ~c )) = f T ′ ( π ( ~c )) for all function symbols f ∈ τ aux .(B) If A ≈ π, S , T r · k B , then t S ′ ( ~c ) ∈ N r · k S ( A ) and π ( t S ′ ( ~c )) = t T ′ ( π ( ~c )) for allterms t ∈ Terms rτ aux ∪ τ bi and ~c over S .(C) If A ≈ π, S , T r · k + k B , then A ≈ π, S ′ , T ′ r B .We prove Claim (A) first. We recall that ~c ∈ R S ′ if and only if S | = φ Rδ ( ~a ; ~c ),and that f S ′ ( ~c ) is J t fδ ( ~x ; ~y ) K ( S ,γ ) , where γ maps ( ~x, ~y ) to ( ~a, ~c ). Since ~a and ~c aretuples over N r S ( A ) it is sufficient to prove, for every tuple ~d over N r S ( A ), that(i) ϕ ( ~d ) holds in S if and only if ϕ ( π ( ~d )) holds in T , for every quantifier-freeformula ϕ with nesting depth at most k , and that (ii) π ( J t K ( S ,~d ) ) = J t K ( T ,π ( ~d )) ,for every update term t with nesting depth at most k .The proof is by induction on k . We start with the base case. If k = 0, termsand update terms do not use any function symbols and therefore, (i) and (ii) holdtrivially, because π witnesses the ( r + k )-similarity of A and B in S and T . Forthe induction step, we consider update terms and update formulas with nestingdepth k ′ ∈ { , . . . , k } . If an update term t with d ( t ) = k ′ is of the form f ( ~s )with ~s = ( s , . . . , s n ), then, by induction hypothesis, π ( J s i K ( S ,~e i ) ) = J s i K ( T ,π ( ~e i )) and s S i ( ~e i ) ∈ N r + k ′ − S ( A ) for every i and vector ~e i consisting of elements from ~d . Thus, π ( J f ( ~s ) K ( S ,~d ) ) = J f ( ~s ) K ( T ,π ( ~d )) because A and B are ( r + k )-similar and k ′ ≤ k . The other cases are analogous. This concludes the proof of Claim (A).Claim (B) can be proved by an induction over the nesting depth of t . Theinduction step uses Claim (A ii).For Claim (C) we have to prove that π is witnessing the r -similarity of A and B in S ′ and T ′ . The first property of similarity is trivial and the second followsfrom Claim (B). For the third property let ~c be an arbitrary m -tuple over N rA ( S ′ )and R some m -ary relation symbol. Then ~c = ( J t K ( S ′ ,~c ) , . . . , J t n K ( S ′ ,~c n ) ) with ~c i over A and t i ∈ Terms rτ aux . Thus ~c is a tuple over N r · kA ( S ), by Claim (B),and therefore R S ′ ( ~c ) if and only if R T ′ ( π ( ~c )), by Claim (A).We now prove that unary DynQF cannot maintain s - t -reachability. Intu-itively, unary functions cannot store the transitive closure relation of a directedpath in such a way, that the information can be extracted by a quantifier-freeformula. The proof is simplified by the following observation. Of course, the following two statements also hold for relation and function symbolsfrom τ bi . Here, we use ~d to denote the variable assignment mapping the free variables of t to thecomponents of ~d . emma 5.3. If an l -ary query Q can be maintained by a DynQF -program,then Q can be maintained by a k -ary DynQF -program with only one l -ary aux-iliary relation (used for storing the query result) on databases with at least twoelements. The restriction to structures with at least two elements is harmless, as weonly use this lemma in a context where structures indeed have at least twoelements.
Proof sketch.
In order to encode relations by functions, two constants (i.e., 0-ary functions) c ⊥ and c ⊤ are used. Those constants are initialized by two distinctelements of the domain. Then a k -ary relation R can be easily encoded by a k -ary function f R via ( a , . . . , a k ) ∈ R if and only if f R ( a , . . . , a k ) = c ⊤ . Theorem 5.4.
Dyn( s - t -Reach) is not in unary DynQF .Proof.
Towards a contradiction, we assume that P = ( P, Init , Q ) is a unary
DynQF -program that maintains s - t -reachability over schema τ = τ in ∪ τ aux with unary τ aux . By Lemma 5.3 we can assume that τ aux contains only 0-aryand unary function symbols and one 0-ary relation symbol Q for storing thequery result. The graphs used in this proof do not have self-loops and everynode has at most one outgoing edge. Therefore we can assume, in order tosimplify the presentation, that τ aux contains a unary function symbol e , suchthat in every state S the function e S encodes the edge relation E as follows. Ifthe single outgoing edge from u is ( u, v ) then e ( u ) = v and if u has no outgoingedge then e ( u ) = u .Let k be the nesting depth of P and let n be chosen sufficiently large withrespect to τ and k . Let G = ( V, E ) be a graph where V = { s, t } ∪ A with A = { a , . . . , a n } and E = { ( a i , a i +1 ) | i ∈ { , . . . , n − }} , i.e., G ↾ A is a pathof length n − a to a n . Further, let S = ( V, E, A ) be the state obtainedby applying Init to G .Our goal is to find i and j with i < j such that for the two nodes a def = a i and b def = a j it holds ( a, b, s, t ) ≈ m ( b, a, s, t ), where m is the number fromthe substructure lemma for auxiliary functions (Lemma 5.2), for modificationsequences of length 2 and nesting depth k .Then, by Lemma 5.2, the program P computes the same query result forthe following two modification sequences:( β ) Insert edges ( s, a ) and ( b, t ).( β ) Insert edges ( s, b ) and ( a, t ).However, applying the modification sequence β yields a graph in which t isreachable from s , whereas β yields a graph in which t is not reachable from s (see Figure 6 for an illustration). This is the desired contradiction.Thus it remains to show the existence of such i and j . To this end, let t , . . . , t l be the lexicographic enumeration of Terms kτ with respect to somefixed order of the function symbols. Let the k -neighborhood vector ~ N k S ( c ) of an27 β ( S ): sa . . . a i − a i a i +1 . . . a j − a j a j +1 . . . a n t P β ( S ): sa . . . a i − a i a i +1 . . . a j − a j a j +1 . . . a n t Figure 6: The structure S from the proof of Theorem 5.4. Edges inserted bymodification sequence β and modification sequence β , respectively, are dotted.element c in S be the tuple ( c, t ( c ) , . . . , t l ( c )). For a tuple ~c = ( c , . . . , c m ),the k -neighborhood vector ~ N k S ( ~c ) of ~c is the tuple ( ~ N k S ( c ) , . . . , ~ N k S ( c m )). Thenumber of equality types of such neighborhood vectors is finite and bounded bya number that only depends on m , k and τ aux .By applying Ramsey’s theorem on the graph over { , . . . , n } , where eachpair ( i, j ) with i < j is colored by the equality type of ~ N m +1 S ( a i , a j , s, t ), weobtain numbers i < i < i such that the equality types of ~ N m +1 S ( a i , a i , s, t ), ~ N m +1 S ( a i , a i , s, t ), and ~ N m +1 S ( a i , a i , s, t ) are equal. In particular, as all func-tion symbols are unary, the equality types of ~ N m +1 S ( a i , s, t ), and ~ N m +1 S ( a i , s, t )and finally those of ~ N m +1 S ( a i , a i , s, t ) and ~ N m +1 S ( a i , a i , s, t ) are equal.For the latter conclusion, we show the following claim: if for two terms t and t of depth at most m + 1 it holds t ( a i ) = t ( a i ) then also t ( a i ) = t ( a i ).We observe that if t ( a i ) = t ( a i ) then also t ( a i ) = t ( a i ) and t ( a i ) = t ( a i ) (since ~ N m +1 S ( a i , a i , s, t ), ~ N m +1 S ( a i , a i , s, t ), and ~ N m +1 S ( a i , a i , s, t )have the same equality type). Hence, t ( a i ) = t ( a i ) and therefore t ( a i ) = t ( a i ) = t ( a i ) = t ( a i ). The latter equality follows as the equality types of ~ N m +1 S ( a i , s, t ), and ~ N m +1 S ( a i , s, t ) are equal. This concludes the proof of theclaim.To prove ( a, b, s, t ) ≈ m ( b, a, s, t ) it only remains to show that ( u, v ) ∈ E if and only if ( u ′ , v ′ ) ∈ E , for two components u and v from ~ N m S ( a, b, s, t )and their corresponding components u ′ and v ′ from ~ N m S ( b, a, s, t ). However,28 u, v ) ∈ E if and only if e ( u ) = v , and analogously ( u ′ , v ′ ) ∈ E if and only if e ( u ′ ) = v ′ . Thus this claim follows already from the fact that ~ N m +1 S ( a i , a i , s, t )and ~ N m +1 S ( a i , a i , s, t ) have the same equality type.We now extend the lower bound for invariant initialization obtained in The-orem 4.12 to quantifier-free programs with auxiliary functions. Invariant ini-tialization is still weak in the presence of auxiliary functions in the sense, thatfunctions initialized by invariant initialization can only point to ’distinguished’nodes, as formalized by the following lemma. Lemma 5.5.
Let P = ( P, Init , Q ) be a DynQF -program with invariant ini-tialization mapping
Init and auxiliary schema τ aux . Further let I be an inputstructure for P whose domain contains b and b ′ with b = b ′ . If id [ b, b ′ ] is anisomorphism of I , then f Init ( I ) ( ~a ) = b for all k -ary function symbols f ∈ τ aux and all k -tuples ~a .Proof. The claim follows immediately from the invariance of the initializationmapping.The following lemma will be useful for the proof of the next theorem.
Lemma 5.6.
Let P be a DynQF program and S and T be states of P withdomains S and T . Further let A ⊆ S and B ⊆ T be closed. If S ↾ A and T ↾ B are isomorphic via π then P α ( S ) ↾ A and P β ( T ) ↾ B are isomorphic via π for all π -respecting modification sequences α , β on A and B .Proof. Observe that when A and B are closed and S ↾ A and T ↾ B are isomorphicvia π then A and B are k -similar via π for arbitrary k . Thus the claim followsfrom Lemma 5.2. Theorem 5.7.
Dyn( s - t -Reach) cannot be maintained in DynQF with invari-ant initialization mapping. This holds even for 1-layered s - t -graphs.Proof. We follow the argumentation of the proof of Theorem 4.12.Towards a contradiction, assume that P is a DynQF -program with auxiliaryschema τ aux and invariant initialization mapping Init which maintains the s - t -reachability query for 1-layered s - t -graphs. Let m be the maximum arity ofrelation or function symbols in τ aux ∪ { E } . Further let n be the number ofisomorphism types of structures with at most m + 2 elements.We consider the complete 1-layered s - t -graphs G i = ( V i , E i ), 2 ≤ i ≤ n + 2,with V i = { s, t } ∪ A i and A i = { a , . . . , a i } . Further let S i = ( V i , E i , A i ) be thestate obtained by applying Init to G i .We observe that id [ a, a ′ ] is an automorphism of G i for all pairs ( a, a ′ ) ofnodes in A i with a = a ′ . Thus, by Lemma 5.5, s and t are the only values thatthe auxiliary functions in S i can assume, and therefore S i ↾ A ∪ { s, t } is closedfor any subset A of A i . Hence, by Lemma 5.6, it is sufficient to find S k and S l with k < l such that S k is isomorphic to S l ↾ V k . Then, we can apply the samesequences of modifications as in Theorem 4.12 to reach a contradiction.29ecall that a tuple is diverse, if all components differ pairwise. Since G i ≃ id [ ~a,~b ] G i , for two diverse m ′ -tuples ~a and ~b over A i with m ′ ≤ m , also S i ≃ id [ ~a,~b ] S i by the invariance of Init . In particular ( s, t, ~a ) and ( s, t,~b ) are ofthe same isomorphism type.Since n is the number of isomorphism types of structures of at most m + 2elements, there are two states S k and S l such that, all diverse m -tuples over A k and A l extended by s and t are of the same isomorphism type in S k and S l ,respectively. But then S k ≃ S l ↾ V k . In this section we use the lower bounds obtained for the dynamic s - t -reachabilityquery for shallow graphs to establish lower bounds for the dynamic variants ofthe following Boolean queries Query: k -Clique Input:
A graph G Question:
Does G contain a k -clique? Query: k -Col Input:
A graph G Question: Is G k -colorable?where k is a fixed natural number. Cliques are usually defined for undirectedgraphs only. We define a clique in a directed graph to be a set of nodes suchthat each pair of nodes from the set is connected by an edge. Similarly forcolorability.Lower bounds for the dynamic variants of the k -Clique and k -Col prob-lems (where k is fixed) can be established via reductions to the dynamic s - t -reachability query for shallow graphs. Proposition 6.1.
The dynamic query
Dyn( k -Clique) , for k ≥ , and thedynamic query Dyn( k -Col) , for k ≥ , are not in binary DynProp ∗ .Proof. We prove that
Dyn( -Clique) cannot be maintained in binary DynProp .Afterwards we sketch the proof for
Dyn( k -Clique) , for arbitrary k ≥
3. Thegraphs used in the proof have a k -Clique if and only if they are not ( k − Dyn( k -Col) cannot be maintained in binary DynProp .More precisely, we show that from a binary
DynProp -program P ′ for thequery Dyn( -Clique) one can construct a dynamic program P that maintainsthe s - t -reachability query for 2-layered s - t -graphs. As the latter does not existthanks to Theorem 4.7, we can conclude that the former does not exist either.Let us thus assume that P ′ = ( P ′ , Init ′ , Q ′ ) is a dynamic program for Dyn( -Clique) with binary auxiliary schema τ ′ aux and built-in schema τ ′ bi .30 : sta a a a b b b b G ′ : s = ta a a a b b b b Figure 7: The construction from Proposition 6.1. The s - t -paths ( s, a , b , t ) and( s, a , b , t ) in G correspond to the cliques { s, a , b } and { s, a , b } in G ′ .The reduction is very simple. For a 2-layered graph G = ( { s, t } ∪ A ∪ B, E ),let G ′ be the graph obtained from G by identifying s and t . Clearly, G has apath from s to t if and only if G ′ has a 3-clique. See Figure 7 for an illustration.The dynamic program P uses the same auxiliary schema as P ′ , the sameinitialization mapping and the same built-in schema relations. However, edges( u, t ) in E are interpreted as if they were edges ( u, s ) in E ′ . More precisely, theupdate formulas of P are obtained from those in P ′ by replacing every atomicformula E ′ ( x, y ) with ( y = s ∧ E ( x, t )) ∨ ( y = s ∧ E ( x, y )). Obviously, P is adynamic program for s - t -reachability for 2-layered s - t -graphs if P ′ is a dynamicprogram for Dyn( -Clique) , as desired.For arbitrary k , the construction is similar. The idea is that P simulates ona graph G the behavior of P ′ on G ⊗ K k − , that is, the graph that results from G by adding a ( k − G .Interestingly, the update formulas of P are exactly as in the previous reductionto Dyn( -Clique) , as the “virtual” additional k − Init is not the same as
Init ′ ( G ) but ratherthe projection of Init ′ ( G ⊗ K k − ) to the nodes of G . Proposition 6.2.
The dynamic query
Dyn( k -Clique) , for k ≥ , and thedynamic query Dyn( k -Col) , for k ≥ , cannot be maintained in DynQF withinvariant initialization mapping.Proof.
The proof approach is the same as for the previous proposition. Weprove that
Dyn( -Clique) cannot be maintained in DynQF with invariantinitialization. Afterwards we sketch the proof for
Dyn( k -Clique) , for arbitrary k ≥
3. The graphs used in the proof have a k -Clique if and only if they are not( k − Dyn( k -Col) cannot be maintainedin DynQF with invariant initialization mapping.31ore precisely, we show that from
DynQF dynamic program P ′ with invari-ant initialization that maintains Dyn( -Clique) one can construct a dynamicprogram P ′ that maintains the s - t -reachability query for 1-layered s - t -graphs.As the latter does not exist thanks to Theorem 5.7, we can conclude that theformer does not exist either.Let us thus assume that P ′ = ( P ′ , Init ′ , Q ′ ) is a dynamic program for Dyn( -Clique) with invariant initialization mapping Init ’ and auxiliaryschema τ ′ aux .We use the following simple reduction. For a 1-layered graph G = ( { s, t } ∪ A, E ), let G ′ be the graph obtained from G by adding an edge ( s, t ). Clearly, G has a path from s to t if and only if G ′ has a 3-clique.The dynamic program P uses the same auxiliary schema as P ′ and the sameinitialization mapping. The update formulas of P are obtained from those in P ′ by replacing every atomic formula E ′ ( x, y ) with ( E ( x, y ) ∨ ( x = s ∧ y = t )).Obviously, P is a dynamic program for s - t -reachability for 2-layered s - t -graphsif P ′ is a dynamic program for Dyn( -Clique) , as desired.For arbitrary k , the construction is similar. The idea is that P simulates on agraph G the behavior of P ′ on G ⊗ ( K k − , K k − ), that is, the graph that resultsfrom G by adding two ( k − G . The update formulas of P are exactly as in the previous reductionto Dyn( -Clique) . However, Init is not the same as
Init ′ ( G ) but ratherthe projection of Init ′ ( G ⊗ ( K k − , K k − )) to the nodes of G . By Lemma 5.5,auxiliary functions in Init ( G ) do not take values from ( K k − , K k − ). Thus P is a dynamic program for s - t -reachability for 2-layered s - t -graphs if P ′ is adynamic program for Dyn( k -Clique) . Proving that Reachability cannot be maintained in
DynProp appears to benon-trivial. A natural question is, whether lower bounds for syntactic frag-ments of
DynProp can be proved, without restrictions on the arity of auxiliaryrelations. Normal form results from [15] (see below) imply that lower boundsfor some large fragments cannot be obtained easier than for
DynProp . In thissection we prove that Reachability cannot be maintained in the (very) weakfragment of
DynProp where update formulas are restricted to be conjunctionsof atoms.Throughout this section we allow arbitrary initialization and no auxiliaryfunctions.A formula is negation-free if it does not use negation at all. A formula is conjunctive if it is a conjunction of (positive or negated) literals. A dynamicprogram is negation-free (conjunctive, respectively) if all its update formulasare negation-free (conjunctive, respectively). We follow the naming schemafrom [17] and refer to the conjunctive, the negation-free and the conjunctive,negation-free fragment of
DynProp as DynPropCQ ¬ , DynPropUCQ and
DynPropCQ , respectively. 32he following theorem implies that lower bounds for
DynPropCQ ¬ and DynPropUCQ immediately yield lower bounds for
DynProp . In other words,proving lower bounds for those fragments is not easier than proving lower boundsfor
DynProp itself.
Theorem 7.1 ([15, 16]) . Let Q be a query. Then the following statements areequivalent:(a) Q can be maintained in DynProp .(b) Q can be maintained in DynPropCQ ¬ .(c) Q can be maintained in DynPropUCQ . The rest of this section is devoted to the proof of the following theorem.
Theorem 7.2.
Dyn( s - t -Reach) is not in DynPropCQ . To this end, we first prove that the query
NonEmptySet from Example 1cannot be maintained in this fragment. Afterwards we sketch how to adapt thisproof for the reachability query.For technical reasons, the proof assumes a
DynPropCQ -program in whichno atom contains any variable more than once. We first illustrate by an examplehow this restriction can be achieved.
Example 2.
We consider the following
DynPropCQ -program, where, for sim-plicity, only update formulas for insertions are specified. φ R ins ( u ; x, y ) = S ( x, y ) ∧ R ( x, x ) φ S ins ( u ; x, y ) = S ( x, y )An equivalent DynPropCQ -program in which all update formulas only containatoms with distinct variables can be obtained by replacing R ( x, x ) by R ′ ( x )where R ′ is a fresh unary relation symbol. It then has to be ensured, that R ′ ( x ) ≡ R ( x, x ). This can be achieved by updating R ′ with the update formulafor R , in which x and y are unified. φ R ins ( u ; x, y ) = S ( x, y ) ∧ R ′ ( x ) φ S ins ( u ; x, y ) = S ( x, y ) φ R ′ ins ( u ; x ) = S ( x, x ) ∧ R ′ ( x )Finally we apply the same construction to the atom S ( x, x ) in φ R ′ ins : φ R ins ( u ; x, y ) = S ( x, y ) ∧ R ′ ( x ) φ S ins ( u ; x, y ) = S ( x, y ) φ R ′ ins ( u ; x ) = S ′ ( x ) ∧ R ′ ( x ) φ S ′ ins ( u ; x ) = S ′ ( x )33he process of Example 2 necessarily terminates since there is only a finitenumber of equality types for the variables of each of the atoms occurring in anupdate formula. An equality type ρ of a set of variables X = { x , . . . , x n } issimply an equivalence relation on X . Lemma 7.3.
For every
DynPropCQ -program there is an equivalent
DynPropCQ -program in which no atom in any update formula contains a variable more thanonce.Proof sketch.
For a given
DynPropCQ -program P schema τ , construct anequivalent DynPropCQ -program P ′ over schema τ ′ where τ ′ contains, for every k -ary relation symbol R ∈ τ and every equality type ρ on k variables x , . . . , x k ,a relation symbol R ρ of arity k ′ where k ′ is the number of equivalence classesof ρ .The intention is that ( S , β ) | = R ( ~x ), for a state R and variable assignment β respecting ρ if and only if ( S , β ρ ) | = R ρ ( ~y ), where β ρ maps every variable y i tothe value of the i -th equivalence class of ρ under β . This can be ensured alongthe lines of Example 7.3.We prove Theorem 7.4 in a slightly more general setting. A modification α is honest with respect to a given state if it does not insert a tuple already presentin the input database and does not delete a tuple which is not present in thedatabase. A query is in h- Dyn C if it can be maintained with C update programs,for all sequences of honest modifications. It is easy to see that for a class C closedunder boolean operations, the classes Dyn C and h- Dyn C coincide. However forweak classes such as DynPropCQ the restriction to honest modifications mightmake a difference, since update formulas cannot explicitly test (at least not ina straight forward way) whether a modification is honest. Nevertheless, all ourproofs work for both kinds of types of modifications.We prove that h-
DynPropCQ (and therefore also
DynPropCQ ) cannotmaintain the query ∃ xU ( x ) from Example 1. Lemma 7.4.
Dyn(NonEmptySet) is neither in
DynPropCQ nor in h-
DynPropCQ .Proof.
Towards a contradiction, we assume that there is a h-
DynPropCQ -program P = ( P, Init , Q ) over schema τ that maintains query Q defined by ∃ xU ( x ) and, by Lemma 7.3, that no variable occurs more than once in anyatom of an update formula of P .The following notions will be convenient for the proof. The dependency graph of a dynamic program P with auxiliary schema τ has vertex set V = τ and anedge ( R, R ′ ) if the relation symbol R ′ occurs in one of the update formulas for R . The deletion dependency graph of P is defined like the dependency graphexcept that only update formulas for deletions are used. The deletion depth ofa relation R is defined as the length of the shortest path from Q to R in thedeletion dependency graph. 34e start with a simple observation. Let R ( u ) be a relation atom in theformula φ Q del ( u ) for the 0-ary query relation Q , that is: φ Q del ( u ) def = . . . ∧ R ( u ) ∧ . . . Further let S be a state in which the relation U contains two elements a = b .Then, necessarily, R S contains a and b , as otherwise deletion of a or b wouldmake Q empty without U becoming empty. This observation can be generalized:if a relation R has “distance k ” from Q in the subgraph of the dependency graphinduced by del -formulas and U contains at least k + 1 elements, then R mustcontain all diverse tuples over U , that is, tuples that consist of pairwise distinctelements from U .We prove this observation next, afterwards we look at how the statement ofthe lemma follows. Using our assumption on non-repeating variables, it is easyto show that the arity of relations of deletion depth k is at most k (at most oneplus the arity of the updated relation).We prove by induction on k that, for each relation R of deletion depth k ,and every state S in which U contains at least k + 1 elements, R has to containall diverse tuples over U .For k = 0 this is obvious as Q needs to contain the empty tuple if U isnon-empty.For k >
0, let S be a state such that U S contains at least k + 1 elements.Further let R be some arbitrary relation symbol of deletion distance k . Then R ( ~x ) occurs in the update formula φ R ′ del ( u ; ~y ) of some relation symbol R ′ ofdeletion depth k − ~x = ( x , . . . , x l ), with ~x ⊆ { u } ∪ ~y . By the above, l ≤ k and ~y contains at most k − k -tuple ~a =( a , . . . , a k ) over U S that is not in R S . Let Θ : { x , . . . , x l } → U S be theassignment with Θ( x i ) = a i and let ˆΘ be some extension of Θ to an injectiveassignment of { u } ∪ ~y to elements from U S (such an assignment exists because |{ u } ∪ ~y | ≤ k < | U | ). Then φ R ′ del ( u ; ~y ) evaluates to false in state S under ˆΘ(since ~a / ∈ R S by assumption). Thus, deleting ˆΘ( u ) from U S yields a state S ′ with ˆΘ( ~y ) / ∈ R ′S ′ . However, U S ′ still contains at least k elements and therefore,by induction hypothesis, the relation R ′S ′ contains every diverse tuple over U S ′ and thus, in particular, ˆΘ( ~y ), the desired contradiction from the assumptionthat ~a R S .Now we can complete the proof of Lemma 7.4. Let S be a state in which theset U contains m + 1 elements, where m is the maximum (finite) deletion depthof any relation symbol in P . By the claim above, all relations whose symbolsare reachable from Q in the deletion dependency graph of P contain all diversetuples over U S . Thus, all relation atoms over tuples from U S evaluate to true.It is easy to show by induction on the length of modification sequences thatthis property (applied to U S ′ ) holds for all states S ′ that can be obtained from S by deleting elements from U S . In particular, it holds for any such state inwhich U S ′ contains only one element a . But then, φ Q del ( a ) evaluates to true in S ′ and thus Q remains true after deletion of a , the desired contradiction to theassumed correctness of P . 35 roof sketch (of Theorem 7.2). Towards a contradiction assume thatthere is a
DynPropCQ -program P for Dyn( s - t -Reach) over schema τ . Weshow that a DynPropCQ -program P ′ can be constructed from P such that P ′ maintains Dyn(NonEmptySet) under deletions. As the proof of the precedinglemma shows that
Dyn(NonEmptySet) cannot be maintained in
DynPropCQ even if elements are deleted from U only, this is the desired contradiction.The intuition behind the construction of P ′ is as follows. For sets U ⊆ A ,the 1-layered graph G with nodes { s, t } ∪ A and edges { ( s, a ) | a ∈ U } ∪ { ( a, t ) | a ∈ A } naturally corresponds to the instance I of Dyn(NonEmptySet) overdomain A with set U . The deletion of an element a from U in I corresponds tothe deletion of the edge ( s, a ) from G . Using this correspondence, the program P ′ essentially maintains the same auxiliary relations as P . When a is deletedfrom U then P ′ simulates P after the deletion of ( s, a ).A complication arises from the fact that Dyn(NonEmptySet) does nothave constants s and t . Therefore the program P ′ encodes the relationshipof s and t to elements from A by using additional auxiliary relations. Moreprecisely, for every k -ary relation symbol R ∈ τ and every tuple ρ = ( ρ , . . . , ρ k )over {• , s, t } , the program P ′ has a fresh l -ary relation symbol R ρ where l isthe number of ρ i ’s with ρ i = • . The intention is as follows. Let i < . . . < i l such that ρ i j = • . With every l -tuple ~u = ( y , . . . , y l ) of variables we associatethe tuple ~u ρ = ( u ρ , . . . , u ρk ) of terms from { s, t, y , . . . , y l } , where (1) u ρi = s if ρ i = s , (2) u ρi = t if ρ i = t , and (3) u ρi j = y j , for j ∈ { , . . . , l } . Analogously,we define ~a ρ for tuples ~a = ( a , . . . , a l ) over A . Then P ′ ensures that ~a ∈ R ρ insome state if and only if ~a ρ ∈ R in the corresponding state of P .Update formulas φ R ρ del U ( v ; x , . . . , x l ) of P ′ are obtained from update formu-las φ R del E ( u, v ; x , . . . , x k ) of P in two steps. First, from φ R del E a formula φ ′ is constructed by replacing every occurrence of x i by x ρi and replacing everyoccurrence of u by s . Then φ R ρ del U is obtained from φ ′ by replacing every atom T ( ~w ) in φ R del E by T ρ ( ~y ), for the unique tuple ~y of variables and the unique tuple ρ , for which ~y ρ = ~w .Now, P ′ yields the same query result after deletion of elements a , . . . , a m as P after deletion of edges ( s, a ) , . . . , ( s, a m ). Hence the program P ′ maintains Dyn(NonEmptySet) under deletions. This is a contradiction.
The question whether Reachability is maintainable with first-order updates re-mains one of the major open questions in dynamic complexity. Proving thatReachability cannot be maintained with quantifier-free updates with arbitraryauxiliary data seems to be a worthwhile intermediate goal, but it appears non-trivial as well.We contributed to the intermediate goal by giving a first lower bound forbinary auxiliary relations. Whether the strictness of the arity hierarchy for
DynProp extends beyond arity three is another open question.For (full) first-order updates a major challenge is the development of lower36ound tools. Current techniques are in some sense not fully dynamic: eitherresults from static descriptive complexity are applied to constant-length modi-fication sequences; or non-constant but very regular modification sequences areused. In the latter case, the modifications do not depend on previous changesto the auxiliary data (as, e.g., in [6] and in this paper). Finding techniques thatadapt to changes could be a good starting point.
References [1] Guozhu Dong, Leonid Libkin, and Limsoon Wong. Incremental recompu-tation in local languages.
Inf. Comput. , 181(2):88–98, 2003.[2] Guozhu Dong and Jianwen Su. Arity bounds in first-order incrementalevaluation and definition of polynomial time database queries.
J. Comput.Syst. Sci. , 57(3):289–308, 1998.[3] Guozhu Dong and Louxin Zhang. Separating auxiliary arity hierarchy offirst-order incremental evaluation systems using (3k+1)-ary input relations.
Int. J. Found. Comput. Sci. , 11(4):573–578, 2000.[4] Kousha Etessami. Dynamic tree isomorphism via first-order updates. InAlberto O. Mendelzon and Jan Paredaens, editors,
Proceedings of the Sev-enteenth ACM SIGACT-SIGMOD-SIGART Symposium on Principles ofDatabase Systems, June 1-3, 1998, Seattle, Washington, USA , pages 235–243. ACM Press, 1998.[5] Wouter Gelade, Marcel Marquardt, and Thomas Schwentick. The dynamiccomplexity of formal languages.
ACM Trans. Comput. Log. , 13(3):19, 2012.[6] Erich Gr¨adel and Sebastian Siebertz. Dynamic definability. In AlinDeutsch, editor, , pages 236–248. ACM, 2012.[7] R.L. Graham, B.L. Rothschild, and J.H. Spencer.
Ramsey Theory . WileySeries in Discrete Mathematics and Optimization. Wiley, 1990.[8] William Hesse. The dynamic complexity of transitive closure is in DynTC0.In
Database Theory - ICDT 2001, 8th International Conference, London,UK, January 4-6, 2001, Proceedings , pages 234–247, 2001.[9] William Hesse.
Dynamic Computational Complexity . PhD thesis, Univer-sity of Massachusetts Amherst, 2003.[10] Sushant Patnaik and Neil Immerman. Dyn-FO: A parallel, dynamic com-plexity class. In
Proceedings of the Thirteenth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, May 24-26, 1994,Minneapolis, Minnesota , pages 210–221. ACM Press, 1994.3711] Sushant Patnaik and Neil Immerman. Dyn-FO: A parallel, dynamic com-plexity class.
J. Comput. Syst. Sci. , 55(2):199–209, 1997.[12] Mihai Patrascu and Erik D. Demaine. Lower bounds for dynamic con-nectivity. In L´aszl´o Babai, editor,
Proceedings of the 36th Annual ACMSymposium on Theory of Computing, Chicago, IL, USA, June 13-16, 2004 ,pages 546–553. ACM, 2004.[13] Sylvain Schmitz and Ph. Schnoebelen. Multiply-recursive upper boundswith Higman’s lemma. In
Automata, Languages and Programming - 38thInternational Colloquium, ICALP 2011, Zurich, Switzerland, July 4-8,2011, Proceedings, Part II , pages 441–452, 2011.[14] Volker Weber and Thomas Schwentick. Dynamic complexity theory revis-ited.
Theory Comput. Syst. , 40(4):355–377, 2007.[15] Thomas Zeume and Thomas Schwentick. On the quantifier-free dynamiccomplexity of reachability. In Krishnendu Chatterjee and Jiri Sgall, editors,
MFCS , volume 8087 of
Lecture Notes in Computer Science , pages 837–848.Springer, 2013.[16] Thomas Zeume and Thomas Schwentick. On the quantifier-free dynamiccomplexity of reachability.
CoRR , abs/1306.3056, 2013.[17] Thomas Zeume and Thomas Schwentick. Dynamic conjunctive queries.In Nicole Schweikardt, Vassilis Christophides, and Vincent Leroy, editors,