<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>FO Queries Strongly Distributing over Components in Arbitrary Cardinality</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Francesco Di Cosmo</string-name>
          <email>dicosmo.francesco@gmail.com</email>
        </contrib>
      </contrib-group>
      <abstract>
        <p>In previous works a coordination-free strategy to compute Datalog with negation queries over databases distributed over many computational nodes has been studied, providing a syntactic characterization and proving the undecidability of the problem of deciding whether a query distributes. In view of a recast for FO queries, we report about a work in progress, namely the study of FO queries strongly distributing over components. We prove that the decision problem of establishing whether a FO query strongly distributes over components is undecidable and highlight how some syntactic bonds typical of Datalog with negation, namely safeness, play a crucial role in specifying strongly distributive FO queries.</p>
      </abstract>
      <kwd-group>
        <kwd>Strong distribution</kwd>
        <kwd>Undecidability</kwd>
        <kwd>Safeness</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        In [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] the problem of establishing which Datalog: queries distribute over
components has been studied, i.e. to determine those queries q such that, for any
database D, the following holds:
q(D) =
C2cc(D)
q(C)
Here by cc (D) we denote the set of connected components of D (formally
introduced in sec. 2.1). Informally, for example, if the database is a set of family
trees, then each tree is a component, where its memebers are connected by family
relationships.
      </p>
      <p>
        The aforementioned problem arises in the context of looking for a parallelized
coordination-free query computation strategy over databases distributed across
many computational nodes [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Indeed, we can interpret the right-hand term as
the result of the following strategy:
1. Facts of the whole database are stored in a scattered fashion over many
computational nodes. Hence, for each node there is a local database.
2. During a preliminary phase, nodes can communcate with each other to
update local databases asking and getting all and only facts about individuals
from the local database. In the end, each node will host some connected
components of the global database, say one.
3. Each node computes the query over its local database, neglecting
coordination with other nodes, getting a set of local answers.
4. All the sets of local answers are merged through the union set operator. This
is the result of the computation.
      </p>
      <p>
        By Datalog: we refer to a variant of standard Datalog: [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] whose queries
are expressible through a program P and a goal g, such that:
{ P is a set of rules like:
where H, the head, is an asserted literal, over an intentional vocabulary,
satisfying safeness, in the sense that its variables occurs also in B, the body,
and B is a conjunction of literals, over the same vocabulary extended with
an extensional one, also satisfying safeness, in the sense that every variable
occurring in a negated literal in a rule occurs also in an asserted literal in
the body of the same rule.
{ g is a rule without head, like:
      </p>
      <p>H</p>
      <p>B
?</p>
      <p>B
In both program and goal, neither constants nor equality are allowed. We say
that a speci cation (P; g) is connected if, for each body B in (P; g), the graph
(V; E) is connected, where V is the set of variables occurring in B and fx; yg 2 E
i x and y occurs in the same asserted literal. For example the rule:
is not connected, but the following one is it:</p>
      <p>E0(x; w)</p>
      <p>E(x; y) ^ E(z; w)
E0(x; w)</p>
      <p>E(x; y) ^ E(y; w)</p>
      <p>Two results have been established, namely that:
1. A Datalog: query distributes over components i it is speci able by a
connected speci cation;
2. The problem of deciding whether, given a Datalog: query q, q distributes
over components is undecidable.</p>
      <p>These results are proved exploiting recursive speci cations. With a view to
recasting these results in absence of recursion, in this paper we report on a work
in progress, namely the study of rst order (FO) queries distributing over
components.1 Moreover, in this preliminary discussion, we abstract databases with
purely relational structures of arbitrary cardinality and consider a stronger
version of distribution over components, named strong distribution over
components, i.e. those queries such that, for any structure S:
q(S) = [ q(S0) =</p>
      <p>S0 S</p>
      <p>
        [
C2cc(S)
q(C)
The questions we want to answer are:
1 We consider FO queries because, except for some details, they have the same
expressive power as Datalog: without recursion (see Codd's theorems [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]).
1. Is it possible to characterize FO queries strongly distributing over
components by syntactics means as in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]?
2. Is the problem of deciding whether a FO query strongly distributes over
components decidable?
2
2.1
      </p>
    </sec>
    <sec id="sec-2">
      <title>Preliminaries</title>
      <sec id="sec-2-1">
        <title>Structures and connected components</title>
        <p>Let L be a relational vocabulary, i.e. a nite non empty set of relation symbols
R=n, with positive arity n &gt; 0, and constant symbols c.2 A structure S over L
is a not empty set Dom(S), called the domain of S, enriched by interpretations
RS Dom(S)n, for each relation symbol R=n 2 L, and cS 2 Dom(S), for each
constant symbol c 2 L.</p>
        <p>We say that a structure S0 is a substructure of S (S is a superstructure of
S0), S0 S, i :
1. Dom(S0)</p>
        <p>Dom(S);</p>
        <p>, RS0 = RS \ Dom(S0)n;
32.. ffoorr eeaacchh rceolnasttioanntssyymmbboollRc=2n L2, LcS0 = cS.3
Given a subset A Dom(S) such that, for each constant symbol c 2 L, cS 2 A ,
A generates a substructure A of S, the only one such that Dom(A) = A .</p>
        <p>The underlying graph of a structure S over L is the graph (V; E), where
V = Dom(S) and fa; bg 2 E i there is a relation symbol R=n 2 L and a
n-tuple such that a; b 2 2 RS. A connected component of S is a
substructure generated by a connected component of its underlying graph. The set of
connected components of S is denoted cc (S). If S admits only one connected
component, then we say that S is connected.</p>
        <p>Directed graphs are simple examples of relational structures. For instance
the graph with vertex set V = fv1; v2; v3g and edge set E = f(v1; v2); (v3; v3)g
can be considered as a structure S over the purely relational language L =
fF=2g, where Dom(S) = V and F S = E. A substructure of S could be S0 with
Dom(S0) = fv1; v3g and F S0 = f(v3; v3)g, while the connected components of S
are the structures (fv1; v2g; f(v1; v2)g) and (fv3; v3g; f(v3; v3)g).
2.2</p>
      </sec>
      <sec id="sec-2-2">
        <title>Preservation theorems</title>
        <p>A FO formula ' (x1; : : : ; xn) over a vocabulary L is preserved under
superstructures i , for any two structures S0 S over L:</p>
        <p>8a1; : : : ; an 2 Dom(S0) S0 j= ' (a1; : : : ; an) ) S j= ' (a1; : : : ; an)
2 Note that no function symbols are allowed.
3 Therefore, cS 2 Dom(S0) holds.
whereas, ' is preserved under substructures i the vice versa is valid, i.e.:
8a1; : : : ; an 2 Dom(S0)</p>
        <p>
          S j= ' (a1; : : : ; an) ) S0 j= ' (a1; : : : ; an)
The following theorems [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] hold also for vocabularies involving function symbols.
        </p>
      </sec>
      <sec id="sec-2-3">
        <title>Theorem 1 (Preservation theorems).</title>
        <p>1. A formula ' is preserved under superstructures i it is equivalent to a
formula in 1, the set of prenex existential formulas.
2. A formula ' is preserved under substructures i it is equivalent to a formula
in 1, the set of prenex universal formulas.</p>
        <p>For example, 9x x = x is a valid 1 sentence.4 Since it is valid, it is preserved
under substructures and, by preservation theorem, it must be equivalent to a
(valid) 1 sentence, like 8x x = x. Finally, note that a quanti er-free formula is
both 1 and 1.
2.3</p>
      </sec>
      <sec id="sec-2-4">
        <title>FO queries</title>
        <p>Let L be a purely relational vocabulary, i.e. a relational vocabulary also without
constant symbols. A FO speci cation over L is a couple ('; ), where ' is a
FO formula over L and is a sequence of all elements in Var('),5 the set of
free variables in '. A FO speci cation (' (x1; : : : ; xn) ; ) over L specify the FO
query q('; ) such that, for any structure S over L:</p>
        <p>q(S) = f(h(x))x2 jS j= ' (h(x1); : : : ; h(xn))g</p>
        <sec id="sec-2-4-1">
          <title>Given a FO query q we say that:</title>
        </sec>
        <sec id="sec-2-4-2">
          <title>1. q is monotonic i , for any two structures S0</title>
          <p>S:
2. q is local i , for any structure S and a 2 q(S):
q(S0)</p>
          <p>q(S)
9C 2 cc (S)
a 2 q(C)
It is straightforward to prove that a FO query strongly distributes (as de ned
in sec. 1) i it is both monotonic and local. Hence, we will split the study of
strongly distributive queries in the study of monotonicity and locality. Lastly, it
will be useful the notion of closure by constants:
De nition 1. Given a FO formula ' (x1; : : : ; xn) over a vocabulary L, let L0 be
the extension of L with n new constant symbols c1; : : : ; cn. The closure by
constants 'c of ' is the sentence over L0 obtained replacing in ' each free variables
xi with the constant ci, for any i 2 f1; : : : ; ng.
4 It is valid because the domain of a structure cannot be empty.
5 Eventually with repetitions.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Monotonicity</title>
      <p>We now characterize monotonic FO queries as those queries speci able by a
formula.
1
Proposition 1. Let ' (x1; : : : ; xn) be a FO formula over a purely relational
vocabulary L. A FO query q('; ) is monotonic i ' is preserved under
superstructures.</p>
      <p>Proof.
): Let S0 S and a1; : : : ; an 2 Dom(S0) such that S0 j= ' (a1; : : : ; an). Hence,
there is at least a valuation h such that h(xi) = ai for any i 2 f1; : : : ; ng,
(h(x))x2 2 q(S0) and, by hypothesis, (h(x))x2 2 q(S). So S j= ' (a1; : : : ; an).
(: Similar to previous.</p>
      <p>Applying the preservation theorem 1, we obtain the following theorem.
Theorem 2. A FO query q('; ) is monotonic i
formula (sentence).
' ('c) is equivalent to a
1
Therefore, to check whether a FO formula q('; ) is monotonic amounts to check
if the closure by constants 'c is equivalent to a 1 sentence. We now prove that
this last check is not algorithmically possible.</p>
      <p>De nition 2. Let F1; F2 be two fragments of FO sentences over a vocabulary L.
With Eq(F1; F2) we denote the decision problem of establishing whether, given
a sentence '1 2 F1,
9'2 2 F2
'1 $ '2
Lemma 1. Let F1; F2 be two fragments of FO over a vocabulary L such that:
1. SAT (F1), the decision problem of satis ability of a sentence in F1, is
undecidable;
2. SAT (F2) is decidable;
3. F1 contains all contradictory sentences.</p>
      <p>Then, Eq(F1; F2) is undecidable.</p>
      <p>Proof. If Eq(F1; F2) were decidable through an algorithm A, then, given a
sentence ' 2 F1 as input to A,
{ If the output is negative, then ' is not contradictory, namely satis able;
{ If the output is positive, then there is at least one '0 2 F2 such that ' $ '0
is valid and, by completeness of FO, also derivable. Since the set of derivable
sentences is recursively enumerable, it is possible to algorithmically build up
at least one such '0. Recalling that SAT (F2) is decidable, it is possible to
decide if '0, so ', is satis able.</p>
      <p>In both cases it would be possible to decide whether ' is satis able and SAT (F1)
would be decidable, which contradicts the hypothesis 1.</p>
      <p>Theorem 3. Let L be a relational vocabulary su ciently expressive, i.e. with at
least one relational symbol R=n with n 2. Let also 1 and 1 be, respectively,
the set of existential sentences and universal sentences over L. Denoting with
F O the set of all FO sentences over L, Eq(F O; 1) and Eq(F O; 1) are both
undecidable.</p>
      <p>
        Proof. It is well-known that the Bernays-Schon nkel-Ramsey fragment (BSR),
i.e. the set of FO prenex sentences (without function symbols)6 and with a pre x
like 9 8 , is such that SAT (BSR) is decidable [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Clearly, BSR contains both 1
and 1 and they both contain all contradictory sentences.7 Since L is su ciently
expressive, SAT (F O) is undecidable [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Thereby, we can apply the previous
lemma and obtain the thesis.
      </p>
      <p>We can summarize previous results in the following corollary:
Corollary 1. The decision problem of establishing whether, given a FO query
q('; ) over a su ciently expressive vocabulary, q('; ) is monotonic is
undecidable.</p>
      <p>Since any contradictory formula speci es a local FO query,8 the same argument
used in lemma 1 can be reused for the decision problem of establishing whether
a FO formula ' speci es a strongly distributive query, i.e. if ' is such that:</p>
      <sec id="sec-3-1">
        <title>1. ' speci es a local FO query;</title>
        <p>2. 'c is equivalent to a 1 sentence.</p>
      </sec>
      <sec id="sec-3-2">
        <title>So, we can conclude also the following corollary:</title>
        <p>Corollary 2. The decision problem of establishing wheter, given a FO query
q('; ) over a su ciently expressive vocabulary, q('; ) strongly distributes is
undecidable.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Locality</title>
      <p>
        Due to the previous section, we focus only on 1 formulas. Moreover, here we
consider only quanti er-free disjunctive normal form (DNF) formulas without
=.9 However, we report only about two syntactic bonds over conjunctions and
6 Recall that L is a purely relational vocabulary, hence function simbols would not
occour anyway.
7 All contradictions are equivalent and 9x x 6= x and 8x x 6= x are two of them,
the rst in 1 and the second in 1.
8 Because, for any structures S, q(S) = ; holds.
9 Anyway, we are con dent that adding equality would not change the core ideas
of what follows, but would only require some more technicality, like an equality
propagation procedure as the union- nd algorithm in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Yet, we do not prove it
here.
disjunctions necessary to admit locality, referable to safeness of Datalog: rules
through the process of recti cation and unfolding [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].10
      </p>
      <p>We say that a formula ' (x1; : : : ; xn) is local i it speci es only local queries,
i.e. i , for any structure S and any a1; : : : ; an 2 Dom(S):11</p>
      <p>S j= ' (a1; : : : ; an) ) 9C 2 cc (S)</p>
      <p>C j= ' (a1; : : : ; an)
4.1</p>
      <sec id="sec-4-1">
        <title>Conjunctions</title>
        <p>Since a contradictory conjunction of literals is local, we will consider only
satis able formulas. First, we focus on negative conjunctions, i.e. where all literals
are negated, then, we take into account the remaining.</p>
        <p>Theorem 4. Let L be a purely relational vocabulary and ' (x1; : : : ; xn) be a
satis able negative conjunction of literals over L. Then ' is local i n = 1.
Proof. Since ' is satis able, it is not possible that in ' occur both an asserted
literal and its negation.
): Let S be a structure such that:</p>
        <p>Dom(S) = fa1; : : : ; ang, where ai 6= aj if i 6= j;
for any relation symbol R=m 2 L, SR = ;.12
Therefore, each a 2 Dom(S) forms a connected component and, since ' is
negative:</p>
        <p>S j= '(a1; : : : ; an)
Since ' is local, (a1; : : : ; an) must lay on a single connected component. This
is possible only if n = 1.
(: By hypothesis, ' is of the form '(x). Then, let S be a structure and a 2
Dom(S) such that:
Clearly, 9C 2 cc (S) such that a 2 Dom(C) and, by preservation theorem 2,
also:13</p>
        <p>S j= '(a)</p>
        <p>C j= '(a)</p>
        <sec id="sec-4-1-1">
          <title>By arbitrariness of S and a, ' is local.</title>
          <p>Theorem 5. Let L be a purely relational vocabulary and ' (x1; : : : ; xn) a not
negative satis able conjunction of literals over L. If ' is local, then ' is safe,
i.e. any variable occurring in a negated literal ocours also in an asserted literal.
10 Recti cation and unfolding are those processes that allow to translate Datalog:
without recursion in FO.
11 Clearly, it follows also that a1; : : : ; an 2 C.
12 I.e. S can be considered a plain set.
13 Each quanti er-free formula is also a 1 formula.</p>
          <p>Proof. Let ' (x1; : : : ; xn) be a not negative satis able conjunction of literals
Vi2I Li, where x 2 Var(') occurs only in negated literals. Say that x is x1. Since
' is not contradictory, then there is a structure S and a1; : : : ; an 2 Dom(S) such
that: S j= ' (a1; : : : ; an). Now consider the structure S0, obtained from S adding
a new element a to Dom(S). Therefore, a does not take part in the interpretative
part of S0 and, clearly:</p>
          <p>S0 j= ' (a; a2; : : : ; an)
Since fag is the domain of a connected component of S0, the sequence
(a; a2; : : : ; an) does not lay on a single connected component and so ' is not
local.
4.2</p>
        </sec>
      </sec>
      <sec id="sec-4-2">
        <title>Disjunctions</title>
        <p>Theorem 6. Let L be a purely relational vocabulary and ' (x1; : : : ; xn) a
disjunction Wi2I 'i, where 'i is a satis able 1 formula over L for each i 2 I. If '
is local, then ' is regular, i.e. all disjuncts share the same set of free variables.
Proof. Let ' (x1; : : : ; xn) be a satis able disjunction Wi2I 'i, where 'i 2 1 for
each i 2 I. Suppose there are indices i; j 2 I such that Var('i) 6= Var('j ),
say x 2 Var('i) n Var('j ) and suppose that x is x1. Since 'j (y1; : : : ; ym) is
satis able, there is a structure S and a1; : : : ; am 2 Dom(S) such that:</p>
        <p>S j= 'j (a1; : : : ; am)
Let h be a valuation such that h(yi) = ai for each i 2 f1; : : : ; mg. Now, as in the
previous proof, consider a structure S0, obtained from S adding an element a to
Dom(S). Then, the valuation k, obtained from h putting k(x) = a, still satis es
'j in S0 (because x 62 Var('j )). So, by semantic of disjunction:</p>
        <p>S0 j= ' (k(x1); : : : ; k(xn))
Since fk(x1)g = fag is the domain of a connected component of S0,
(k(x1); : : : ; k(xn)) does not lay on a single connected component and so ' is
not local.
5</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Conclusions and further work</title>
      <p>We have proved that, for su ciently expressive vocabularies, the decision
problem of establishing if a FO query strongly distributes over components is
undecidable. This has been possible through a contrast with the
Entscheidungsproblem of satis ability of F O formulas. However, we remark that we considered
FO in its full expressive power, ignoring those syntactical bonds stemming from
recti cation and unfolding, i.e. re ecting Datalog: safeness. Would something
change if those bonds were considered? In fact, tackling the problem of
locality, we showed that those bonds, in the form of safe conjunctions and regular
disjunctions, are necessary conditions to allow locality of DNF quanti er-free
formulas. This preliminary result should be extended to a full classi cation of
FO formulas specifying local FO queries.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Ameloot</surname>
            ,
            <given-names>T.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ketsman</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Neven</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zinn</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Datalog queries distributing over components</article-title>
          .
          <source>ACM TOCL 18(1)</source>
          ,
          <volume>1</volume>
          {
          <fpage>35</fpage>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Ameloot</surname>
            ,
            <given-names>T.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ketsman</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Neven</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zinn</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Weaker forms on monotonicity for declarative networking: a more ne-grained answer to the CALM-conjecture</article-title>
          .
          <source>ACM TODS 40(4)</source>
          ,
          <volume>1</volume>
          {
          <fpage>45</fpage>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Ullman</surname>
            ,
            <given-names>J.D.</given-names>
          </string-name>
          :
          <article-title>Principles of Database and Knowledge-Base Systems</article-title>
          , Volume I. Computer Science Press, Rockville, Maryland (
          <year>1989</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <issue>4</issue>
          .
          <string-name>
            <surname>Chang</surname>
            ,
            <given-names>C.C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Keisler</surname>
          </string-name>
          , H.:
          <article-title>Model theory</article-title>
          .
          <source>Elsevier</source>
          (
          <year>1990</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Ramsey</surname>
            ,
            <given-names>F.P..:</given-names>
          </string-name>
          <article-title>On a problem of formal logic</article-title>
          . In: Gessel,
          <string-name>
            <given-names>I.</given-names>
            ,
            <surname>Rota</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          ,
          <source>CLASSIC PAPERS IN COMBINATORICS 2009</source>
          , pp.
          <volume>1</volume>
          {
          <fpage>24</fpage>
          . Birkhauser Boston (Springer) (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6. Borger, E., Gradel,
          <string-name>
            <given-names>E.</given-names>
            ,
            <surname>Gurevich</surname>
          </string-name>
          ,
          <string-name>
            <surname>Y.</surname>
          </string-name>
          :
          <article-title>The classical decision problem</article-title>
          .
          <source>2nd edn. Springer Verlag (Springer Science &amp; Business Media)</source>
          (
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Aho</surname>
            ,
            <given-names>A.V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hopcroft</surname>
            ,
            <given-names>J. E.</given-names>
          </string-name>
          :
          <article-title>The design and analysis of computer algorithms</article-title>
          . Addison-Wesley Longman Publishing Company, Inc., Boston, MA, USA (
          <year>1974</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>