• Keine Ergebnisse gefunden

We fix for this whole appendix part a split(Σ12)ofΣfulfilling the condition of Item 2 of Lemma 18, andΣ010203built fromΣ12as described in the body of the paper.

Proof of Proposition 19

Definition 6(World Structure). LetI be an interpretation ofΣ01. The world structure ofI is the graph (V, E)where:

• V ={w|Done(w)∈ I}

• E={(w, w0) | w6=w0∧ ∃p∃~xInsp(~x, w, w0)∈ I}

Lemma 31. For everyDoverSin(Σ), the world structure of a modelI ofDandΣ01generated by a chase sequence is a finite tree, such that:

• its root is the unique elementwsuch thatEmpty(w)∈ I;

• if(w, w0)∈E, thenworld(w0) =world(w)∪ {p(~x)}for some atomp(~x), andp(~x)6∈world(w);

• ifInit(w)∈ Iandp(~a)∈ D \world(w), there existsw0such thatInsp(~a, w, w0)∈ I.

Proof. Let us first notice that Rule (58) is applicable exactly once, as its frontier is empty. The null it creates, sayw, is then the only one such thatEmpty(w)∈ I. Moreover, there is no edge incoming in win the world structure, as the only rules Rules (59), (60) and (61) that introduce an atom of the shape Insp(~x, w, w0)withw6=w0 are such thatw0 is existentially quantified. For the same reason, note that there is at most one edge incoming in any vertex in the world structure.

Next notice that no new null is created unless Rules (59), (60) or (61) are applied, and they all must be applied by mappingwto an element of the world structure, asDone(w)is in the body of each of these rules. Hence the world structure is connected, and is thus a tree of rootw.

Now let us notice that in any interpretation I generated by a sequence of rule applications, if Done(w) ∈ I, thenworldI(w) = worldI0(w)for anyI0 obtained by extending the sequence of rule applications that generatedI. Indeed, the only way to deriveDone(w)is to apply Rule (63), which re-quires the atomsEmpty(w)andSubs(w, w), aswis the only element for whichEmptyholds. The only way to create an atom of the shapeSubs(w0, w2)withw0 6= w2is by applying an instantiation of Rule (62), which can be applied ifw0is a parent ofw1in the world structure, and w1 is such that Subs(w1, w2)holds. HenceDone(w)is entailed only when Rule (62) as been applied by mappingw0

to every ancestor ofwandw2tow, which has a effect to ensure thatworldI(w)contains all the atoms possibly present inworldI0(w).

If(w, w0) ∈ E, thenw0 has been created by the application of Rule (59), (60) or (61). In all cases, Done(w)must hold at the time of the rule application. If it is by Rule (59) and substitution σ, then p(σ(~x))cannot belong toworld(w), as this would make Rule (59) not applicable withσ. By the sequence of rule applications described before,world(w0) =world(w)∪{p(σ(~x))}. Rules (60) and (61) are treated in a similar way.

Both the depth and the arity of the world structure is thus upper bounded by the number of atoms using a predicate appearing inΣ1∪Σ2and nulls fromD.

For the last item, let us notice that if Init(w) ∈ I, and p(~a) ∈ D \ world(w), then Rule (59) instantiated forpis applicable by mapping~xto~a. Applying that rule will create a fresh nullw0 which will fulfill the conditions stated in the lemma.

Lemma 32. LetDbe a database overSin(Σ), and letIbe a model ofDandΣ01generated by a chase sequence. Letv∈Nulls(I)such thatDone(v)∈ I. If a disjunctive ruleρis applicable toworld(v)byσ, then there exist inItwo elementsw1andw2such thatInsp1(~u1, v, w1)andInsp2(~u2, v, w2)such that p1(~u1)andp2(~u2)are the two atoms created by the application ofhρ, σi.

Proof. Let us first notice thatσ, extended by mappingwtov, is a substitution that maps the bodies of Rules (60) and (61) toI, by definition of world(v)and sinceDone(v) ∈ I. AsI is a model ofΣ01, the head of these two rules should be also mappable inI, hence there existsw1 andw2 fulfilling the conditions of the lemma.

Note that Proposition 19 is a direct consequence of Lemmas 31 and 32.

Proof of Lemma 18

Definition 7(Saturated World of a Null in an Interpretation). Letwbe a null in an interpretationIsuch thatSubs(w, w)∈ I. The saturated world ofwis defined bysaturatedWorldI(w) ={p(~x)|p0(~x, w)∈ I}.

Lemma 33. If there is a chase tree w.r.t.(Σ01∪Σ02)andDwhose unique leafIis such that there exists w∈Nulls(I)s.t.Goal∈saturatedWorldI(w)andDone(w)∈ I, then there exists a chase tree w.r.t Σ2andworld(w)whose unique leaf containsGoal.

Proof. Let us consider a chase tree T0 w.r.t. (Σ01 ∪Σ02)and D, and let w be such that Done(w) is in the result I of T0. We show that there exists a chase tree T w.r.t Σ2 andworld(w) such that saturatedWorldI(w)is mapped to the label of the (unique) leaf ofT by a homomorphismψ.

For every labelJ of a node inT0 such thatDone(w)∈ J, we show that there exists a prefix of a chase tree w.r.t.Σ2 andworld(w)such thatsaturatedWorldJ(w)is mapped to the label of the leaf of that prefix by a homomorphismψ. We do this by induction on the number of rule applicationshρ,hi withρof the form Rule (64) andh(w) =wthat are done inT0before the node labelled byJ.

• If no rule application of the shape hρ,hi with h(w) = w is performed in T0 before J, then saturatedWorldJ(w) =world(w). We thus defineψas the identity, and the chase tree prefix con-sisting of the root labelled byworld(w)fulfills the property.

• Assume that the property is true for everyJ obtained inT0after at mosti−1applications of the shape hρ0,hiwithρ0of the form Rule (64) andh(w) =w. LetJibe obtained inT0afterisuch applications and lethρ0,hibe the last one, withρ0being the instantiation of Rule (64) forρ∈Σ2. LetJi−1be the label of the node inT0on whichhρ0,hiis applied. By induction assumption, there existψand a prefix of a chase tree forΣ2andD, resulting inSi−1, such thatψ(saturatedWorldJi−1(w))⊆Si−1. Hence hρ, ψ◦h|Terms(Bρ)i, whereBρis the body ofρ, is applicable onSi−1, creating a new leaf, labeled by Si, and we extendψby mapping every null created by the instantiation ofzi∈~zin the application of hρ0,hito the null created by the instantiation ofzi ∈~zin the application ofhρ, ψ◦h|Terms(Bρ)i. We obtainψ(saturatedWorldJi(w))⊆Si.

Lemma 34. Any restricted chase w.r.tΣ01∪Σ02∪Σ03can be transformed into an equivalent restricted chase in which rules fromΣ01are applied before rules fromΣ02, which are applied before rules fromΣ03.

Proof. Notice that head predicates ofΣ03do not appear in do not appear inΣ0jwithj <3. Hence rules of Σ03can be applied last. Note that head predicates ofΣ02do not appear as body predicates ofΣ01. Moroever, a rule ofΣ02is applicable by mappingwtowonly ifDone(w)as been derived. Further applications of rules ofΣ01cannot add an atom of the shapep0(~x, w), and thus applying them before do not prevent the application of a rule ofΣ02.

Proposition 35. For every databaseDoverSin(Σ), ifΣ1∪Σ2,D |=Goal, thenΣ01∪Σ02∪Σ03,D |=Goal.

Proof. Let us consider a finite a chase treeT proving thatΣ1∪Σ2,D |=Goaland such that rules of Σ1are applied before rules ofΣ2(this is possible by definition ofΣ1 andΣ2that form a split ofΣ).

We build a chase tree proving thatΣ01∪Σ02∪Σ03,D |=Goal(we actually describe a sequence of rule applications, asΣ01∪Σ02∪Σ03contains only deterministic rules).

• Apply Rule (58), creating a fresh nullwand factsInit(w),Done(w)andEmpty(w).

• Until creation ofwD, perform the following:

– letwD0 be the last introduced null;

– letp(~a)∈ D \D0:

* apply Rule (59), instantiated for p, by mapping ~x to~a and w to wD0, creating a fresh null wD0∪{p(~a)};

* apply Rule (62) as many times as necessary untilSubs(w, wD0∪{p(~a)})is created, which makes Rule (63) become applicable by mapping w0 to wD0∪{p(~a)}. Then apply Rule (63) and add Done(wD0∪{p(~a)}).

• At the end of the above loop, note that we have created nullwDand added in particularDone(wD)as well asInsp(~a, wD, wD)and for everyp(~a)∈ D.

• Letrbe the root node ofT. Note thatris labelled byD. In what follows, we will introduce some nullswN such thatN is the label of some nodeninT and it will remain true thatDone(wN)as well asInsp(~a, wN, wN)for everyp(~a)∈ N are introduced between the creation ofwN and the creation of the nextwN0.

• Defineψ(r) =wDand letN ={r}andL=∅. UntilN =∅, perform the following.

– Consider the case where n is a node ofT labelled by N such that ψ(n) = wN andn has 2 childrenc1 and c2 labelled by N1 andN2 respectively, which correspond to the application of hρ, σiwithρ∈Σ1of the formV

p(~x)∈βp(~x)→p1(x~1)∨p2(x~2). We haveN1 =N ∪ {p1(~a1)}

andN2=N ∪ {p2(~a2)}where~a1=σ(~x1)and~a2 =σ(~x2). The instantiations of (60) and (61) corresponding toρare applicable throughσ0, which mapswtowN and~xtoσ(~x).

* Apply Rule (60), introducing a fresh null that we call wN1 and adding in particular Insp1(~a1, wN1, wN1). Then apply Rule (62) as many times as necessary, then Rule (63) so that Done(wN1)is created. Defineψ(c1) =wN1.

* If Rule (61) is not applicable, it implies that p1 = p2 and~a1 = ~a2, so that N1 = N2. Set N = (N∪ {c1})\ {n}, and setψ(c2) =wN1.

* Otherwise apply Rule (61), introducing a fresh null that we call wN2 and adding in particular Insp2(~a2, wN2, wN2).Then apply Rule (62) as many times as necessary, then Rule (63) so that Done(wN2)is created. Defineψ(c2) =wN2 and setN = (N∪ {c1, c2})\ {n}.

– Ifnis a node ofT having only one child, setL=L∪ {n}andN =N\ {n}.

At this point, for everyn∈L,ψ(n) =wNand ifIdenotes the current set of facts built by our derivation, saturatedWorldI(ψ(n)) =N by construction.

For alln∈L, the next rule applied onnis a rule fromΣ2, hence no more rule ofΣ1are applied on a descendant ofninT (by assumption onT). All rule applications belownare thus deterministic, and we

“copy” that derivation. Letψnbe the identity mapping from the labelN ofntosaturatedWorldI(ψ(n)).

By construction,ψn is a homomorphism. While we extendIby applying new rules, we will extendψn

into a homomorphism from the label of any descendantn0ofninTtosaturatedWorldI(ψ(n)).

• Forn0=n, this is already done.

• Assume that we have built a derivation such thatψnis a homomorphism from the labelN0 of some descendantn0 ofninT tosaturatedWorldI(ψ(n)). Letn00be the child ofn0 inT, labelled byN00, and lethρ, σibe the rule application creatingn00, whereρ∈Σ2. Thenhρ, ψn◦σican be applied to saturatedWorldI(ψ(n)), and thus Rule (64), instantiated forρis applicable inIby extendingψn◦σ by mappingwtoψ(n). We then defineψ(n00) =ψ(n), and extendψnby mapping each null created in the label ofn00by a variablezito the null created by variableziin the application of Rule (64).

LetT0be the tree structure havingψ(r) =wD as root and wherewpis parent ofwc ifwc has been created by an application of Rule (60) or Rule (61), that mappedwtowp. Note that all thewnin this tree structure are exactly the nulls ofI such that there exists a nodeninT withψ(n) =wn,c1, c2are children ofninTiffψ(c1), ψ(c2)are children ofψ(n)inT0.

Let`be a leaf ofT. By assumption,Goalbelongs to the label of`. Letnbe the unique node inLsuch that`is a descendant ofn. Sinceψnis a homomorphism from the label of`tosaturatedWorldI(ψ(n)), it holds thatsaturatedWorldI(ψ(n))containsGoal. By definition ofsaturatedWorldI, it follows that Goal0(ψ(n))∈ I. Since any leafwnofT0has an antecedentnbyψwhich has a descendant leaf`inT, thenGoal0(w)holds for each leafwofT0. Extend the derivation as follows:

• Apply Rule (65) to eachwleaf ofT0.

• IfAcc(w)has already been derived for the childrenwof a nodeψ(n)inT0, letρbe the rule that has been applied byσonnto create its children. Apply Rule (66) instantiated forρby mappingw1and w2 toψ(c1)andψ(c2), wherec1andc2are the children ofncorresponding to the application ofρ.

Acc(ψ(n))is thus derived.

• By induction on the depth, one derivesAcc(wD). AsInit(wD)holds, one can apply Rule (67) and obtainGoal.

We did not apply every possible rule: hence, to build a chase tree, we must ensure fairness (point 3. of the definition of chase tree), by applying all possible remaining rule applications, which concludes the proof.

To ease that proof, we will actually replace Rule (66) by the following rule:

Insp1(~x1, w, w1)∧Acc(w1)∧ Insp2(~x2, w, w2)∧Acc(w2)∧

V

p(~x)∈βInsp(~x, w, w)

→Accρ(w, w1, w2)∧Acc(w)

(68)

which has an additional ternary fresh predicate describing the ruleρ∈Σ1(and the worlds generated by the corresponding rule application) allowing to deriveAcc(w). Note that sinceAccρnot being appearing anywhere else, all the properties shown so far are still valid.

Proposition 36. For every databaseDoverSin(Σ), ifΣ01∪Σ02∪Σ03,D |=GoalthenΣ1∪Σ2,D |=Goal.

Proof. LetIbe a model ofDandΣ01∪Σ02∪Σ03obtained through a restricted chase sequence such that Goal∈ I. We build a chase treeT forΣ1∪Σ2andD0for someD0⊆ Dsuch thatGoalis in the label of every leaf ofT.

LetwD0 ∈Nulls(I)be such that Rule (67) is applied on it, withworld(wD0) =D0. SetW ={wD0}, and perform the following untilW =∅.

• Letw∈W. IfGoal0(w)∈ I, setW =W\ {w}.

• Otherwise, there must be someAccρ(w, w1, w2)∈ I, as the only way to deriveAcc(w)ifGoal0(w) does not hold is to apply some instantiation for someρof Rule (68) by some mappingσ. Moreover, there must be such an atom for whichw1andw2are different fromw. Considerhρ, σTerms(ρ)i: it is applicable, asσmaps the body ofρtoworld(w), and none of the two atoms in the head are present inworld(w)(otherwise,wwould be equal tow1or tow2). Performing this rule application adds two children to the node ofT labelled by world(w), of respective labelsworld(w1)andworld(w2). Set W = (W\w)∪ {w1, w2}.

As the tree structure ofIis finite, and that at each step, either the size ofW is decreasing, or the nullw considered is replaced by two nullsw1andw2such thatworld(w1)andworld(w2)are labels of nodes of strictly greater depth thanworld(w)in that tree, the above process terminates. Moreover, for each leaf of the considered prefix ofT, it holds that its label andΣ2entailGoal, by Lemma 33 and the fact that each leaf is labelled by someworld(w)such thatGoal0(w)∈ I(so thatGoal∈saturatedWorldI(w)).

Hence, one can expandT in such a way that all its leaves are labeled by sets containingGoal, which concludes the proof.

Lemma 37. For every databaseDoverSin(Σ),hΣ01∪Σ02∪Σ03,Diis chase-terminating.

Proof. By Lemma 34, chase sequences can be reordered without changing the number of rule applica-tions such that rules fromΣ01are applied first, then rules fromΣ02, then rules fromΣ03. Lemma 31 implies that rules fromΣ01cannot be triggered indefinitely. As the tree structure is finite, if there are infinitely many rule applications performed with a rule fromΣ02, there must be one world nullwsuch that there are infinitely many rules ofΣ02 that are performed mappingwtow. By the construction of Proposi-tion 36, it implies that there exists a database overSin2)for whichΣ2does not terminate, which is against our assumptions onΣ2. Finally,Σ03does not contain any existentially quantified variable, hence only finitely many rules can be triggered.

Lemma 18 is a direct consequence of Propositions 35, 36 and Lemma 37.

ÄHNLICHE DOKUMENTE