(20 Years of)
Dynamic Complexity: From Regular Languages to Regular Path Queries
Thomas Schwentick AutoMathA 2015
Leipzig, May 2015 Lehrstuhl Logik in der Informatik
Dynamic Complexity: From Regular Languages to Regular Path Queries - - PowerPoint PPT Presentation
(20 Years of) Dynamic Complexity: From Regular Languages to Regular Path Queries Thomas Schwentick AutoMathA 2015 Leipzig, May 2015 Lehrstuhl Logik in der Informatik The general setting (1/2) s s s Input t t t Aux. data Reach(s,t)?
(20 Years of)
Leipzig, May 2015 Lehrstuhl Logik in der Informatik
Input
yes Reach(s,t)? Reach(s,t)? no
Reach(s,t)? yes
!(TZ) !
– we consider graph queries and regular lan- guages – Graphs can be changed by insertions and deletions of edges — one at a time – The auxiliary data usually consists of relations
“query relation”) yielding the current query result – The auxiliary relations are updated after each change – These updates are specified by first-order formulas
query:
Input: Directed Graph G, vertices s, t Question: Is there a path from s to t in G?
!
1 2 3 4 5
1 2 3 4 5
INS(2,4)
1 2 3 4 5
1 2 3 4 5
closure of the edge relation
T pa, b; x, yq:
– determines the pairs px, yq in T after insertion of
–
def
[Dong, Libkin, Wong 95]
– updates the auxiliary relations via first-order update formulas from Φ,
possible change, and – initializes the auxiliary relations via initialization mapping INIT
iliary relations always stores the query result
def
class of maintainable queries – under insertion and deletion of tu- ples, – with empty initialization, – starting from empty structures
!
1 2 3 4 5 6 7 8 9
x y
a b u v
[Dong, Su 93/95; Patnaik, Immerman 94/97]
still exists a path p from x to y?
(1.) (a not reachable from x) or (y not reachable from b); or (2.) p must have a last edge pu, vq for which a can be reached from u
T pa, b; x, yq:
– Database theory view:
tained without recursion?
which SQL fragments? – Complexity theoretic view:
[Barrington, Immerman, Straubing 90]
– Logical view:
tion systems (FOIES) – FOIES can add elements – set updates – queries
– FOIES: Dong, Su 1993 – DynFO: Patnaik, Immerman 1994
– Which queries are in DynFO?
– Which queries are not in DynFO?
– Which queries are in DynL? – Which DynL1 capture which logics L2 for
!
Introduction
Dynamic Complexity of Formal Languages Dynamic Complexity of Reachability Dynamic Complexity of Regular Path Queries Conclusion
there are many options to choose from: – Universe:
– Initialization:
– Change operations:
parameters – Logics:
throughout the talk – Auxiliary data:
– Query types:
– Semantics of update formulas:
!
Input
Reach(s,t)? no
Reach(s,t)? no
Reach(s,t)? yes
empty auxiliary data
[Patnaik, Immerman 94/97]
– E.g.: a linear order can be de- fined incrementally
def
can be maintained with first-order logic in the main setting
– Reachability on acyclic graphs – Reachability on undirected graphs
[Patnaik, Immerman 94/97]
– Reachability on embedded pla- nar graphs
[Datta, Hesse, Kulkarni 14]
– Bipartiteness
[Patnaik, Immerman 94/97]
– Tree isomorphism [Etessami 98]
!
Input
Reach(s,t)? no
Reach(s,t)? no
Reach(s,t)? yes
computed auxiliary relations – (depending on the size of the universe)
classes
Non-uniform DynFO
DynFOp`, ˆq
ing on the power of the precompu- tation
!
Input
Reach(s,t)? yes
Reach(s,t)? no
Reach(s,t)? yes
precomputed aux data (depend- ing on the actual input)
input and empty-aux is not meaningful
“non-empty aux” and “non-empty input” settings coincide
setting is weaker: – First-order logic can
the aux data (in general)
phism, but ...
ability on undirected graphs and Bipartiteness
[Grädel, Siebertz 12] !
Aux-Initalization Empty initial structure Arbitrary initial structure Arbitrary Non-uniform DynFO
DynFOp`, ˆq FOp`, ˆq Empty DynFO [Patnaik/Immerman 94/97] FO PTime DynFO` [Patnaik/Immerman 94/97] Logical
[Grädel/Siebertz 12] !
– How to maintain membership in regular languages? – How to maintain Reachability? – How to combine the two?
!
Introduction Settings
Dynamic Complexity of Reachability Dynamic Complexity of Regular Path Queries Conclusion
consists of – a set of positions t1, ..., nu, – with an ordering ă, – and one unary relation Sσ for each alpha- bet symbol σ.
– In that case: Wi
def
– Otherwise: Wi
def
–
and –
both represent the same string bbcc
– operation insσpiq, inserts i in Sσpiq and deletes it from all Sσ1piq, for σ1 ‰ σ, – operation delpiq, setting all Sσpiq to false.
(MM)
DynFO
– Queries that can be maintained in DynFO with quantifier-free formulas and aux rela- tions
– Queries that can be maintained in DynFO with quantifier-free formulas and aux functions (and relations)
!
– we mainly use binary auxiliary relations Rp,q, for every pair p, q P Q – Intention: Rp,qpi, jq ” δ˚pp, wi`1 ¨ ¨ ¨ wj´1q “ q
w1
wi wi`1 ¨ ¨ ¨
wj´1 wj
wn
wk´1 wk`1
insσ pk; i, jq
def
δpp1,σq“q1
del
def
p1
(MM)
from left to right
w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 insw11p11q w11
type”), for every k
!
Introduction Settings Dynamic Complexity of Formal Languages
Dynamic Complexity of Regular Path Queries Conclusion
DynFOC (with counting quantifiers)
non-uniform DynFOr‘s (with modulo-2 counting quantifiers)
DynFO
[Patnaik, Immerman 94/97]
DynQF
DynProp
– for DynFO
[Dong, Su ’98]
– for DynQF
– for DynProp
[Gelade, Marquardt, TS 09]
[Zeume, TS 13]
– with a reduction type under which DynFO is closed – and matrix entries ď n (number of nodes)
– if entries are ď n – Thus: REACH P DynFOp`, ˆq
in DynFO – And: REACH is domain independent
(similarly: Laubner 11):
nAG is invertible and
8
i“1
def
erwise 0
has a solution with xs “ 0 if and only if
t
has a solution at all
t
t
t has a solution
t P ColumnSpacepB1q
tq
rankpB1q “ rankpBq “ n
tq “ n ` 1
t has full rank
– One edge change in G only yields one entry change in B1|e1
t
– All entries in B1|e1
t are of value ď n
it suffices to maintain rankpA mod pq for at most n2 primes ď n3 – Clearly: rankpAq ě k ð
– Let us assume detpA1q “ 0, for some such submatrix
for some of the first n2 primes p – Therefore: rankpAq ě k
for some of the first n2 primes p
– This is done for n2 primes p in parallel (and: p ď n3)
rankpA mod pq for pn ˆ nq-matrices with entries ď n and p ď n3
an ICALP reviewer pointed us to an algorithm in [Frandsen&Frandsen 09] which can be adapted for our purposes – and is actually simpler than ours
nation
– an invertible matrix U and – a matrix E in reduced row-echelon form such that UA “ E
– The leading entry in every row is 1 – The column of such a leading entry is all- zero otherwise – Rows are sorted in a “diagonal” fashion
– rankpEq “ rankpUAq “ rankpAq and – the structure of E rankpAq “ number of non-zero rows of E
(1) If new leading entries occur in column j: – keep the one with the maximum number of successive zeros in its row, and – set all other entries of column j to 0 by appropriate row operations (2) If a former leading entry of a row k is lost in column j (by the change in A or by (1)) – Take the next non-zero-entry on row k – Clean its column by appropriate row operations (3) If needed: move the (ď 2) rows whose leading entry has changed during (1) or (2) to their correct positions (and adapt them so that their leading entries are 1) (4) Update U accordingly
– uniform AC0 “ FOp`, ˆq
[Barrington, Immerman, Straubing 90]
– ... thus DynAC0 “ DynFOp`, ˆq... – ... and therefore: REACH P DynFOp`, ˆq
inp 1 2 3 4 5 6 aux
` p1, 1, 2q p1, 2, 3q p2, 1, 3q
. . . . . .
ˆ p1, 1, 1q p1, 2, 2q p2, 1, 2q
. . . . . .
R1 R2
. . .
(from the very beginning)
inp 1 2 3 aux
` p1, 1, 2q p1, 2, 3q p2, 1, 3q ˆ p1, 1, 1q p1, 2, 2q p2, 1, 2q p3, 1, 3q p1, 3, 3q R1 R2
. . .
– “Domain is even” R DynFO
built on the fly
– For domain-independent queries this can be organized so that DynFO captures DynFOp`, ˆq – And thus: REACH P DynFO
gram P by a DynFO program P1?
can give correct answers as soon as
activated – This can be done for every m in parallel – For non-square m some more care is needed
def
– Establish arithmetic on these elements
are 1, . . . , m
– Start simulating P on vertex set t1, . . . , ℓu2 instead
m of Gm
can be instantly lifted to t1, . . . , ℓu2
changes have to be dealt with when m is activated – For each change operation δ:
m and do the re-
spective update operations and
can just give P’s answer on G1
m
!
Introduction Settings Dynamic Complexity of Formal Languages Dynamic Complexity of Reachability
Conclusion
– Let G “ pV, Eq with edge labels from alphabet Σ – Let q be a regular expression and A an equivalent NFA with unique initial and final states s and t – There is a q-path from i to j in G ð
there is a path from pi, sq to pj, tq in the product graph G ˆ A, where
def
– Since a single change in G only induces ď |Q| changes in G ˆ A, and A is fixed, this yields a DynFO upper bound
(UCRPQs)
!
Introduction Settings Dynamic Complexity of Formal Languages Dynamic Complexity of Reachability Dynamic Complexity of Regular Path Queries
FO UCQ “ D˚FO
UCQ CQ CQ FO UCQ “ D˚FO
UCQ CQ CQ Prop PropUCQ PropCQ PropCQ
DynFO DynD˚FO Dyn@˚FO DynCQ DynUCQ
DynCQ DynUCQ
DynQF DynProp DynPropUCQ DynPropCQ DynPropUCQ
DynPropCQ (non-empty input, PTIME aux) [Zeume, TS 14]
well understood
– Which other problems can be placed in DynFO
– Develop dynamic lower bound methods – Show that some (concrete, domain-independent) PTIME problem is not in DynFO – Show that some (concrete, domain-independent) PTIME problem is not in DynQF – Show that DynQF Ĺ DynFO – Show that REACH R DynProp – Can distance be maintained in DynFO?
mental evaluation of datalog queries. In DBPL 1993, pages 295–308, 1993
decremental evaluation of transitive closure by first-order queries. Inf. Comput., 120(1):101–106, 1995
A parallel, dynamic complexity class. In PODS 1994, pages 210–221, 1994
A parallel, dynamic complexity class. J. Comput.
1990
putation of recursive queries in relational calculus and sql. In DBPL 1995, page 7, 1995
first-order incremental evaluation and definition
first-order updates. In PODS, pages 235–243. ACM Press, 1998
sitive closure is in DynTC0. In ICDT 2001, pages 234–247, 2001
Amherst, 2003
complexity theory revisited. Theory Comput. Syst., 40(4):355–377, 2007
2012
new logics for the characterization of Polynomial
2011
Sci., 410(41):4085–4093, 2009
and other problems. In ICALP (1), pages 356– 367, 2014
jee, Thomas Schwentick, and Thomas Zeume. Reachability is in DynFO. To be presented at ICALP 15
236–248. ACM, 2012
the quantifier-free dynamic complexity of reacha-
Science 2013, pages 837–848, 2013
namic conjunctive queries. In ICDT 2014, pages 38–49, 2014
plexity of k-clique. In MFCS 2014, 2014