1 / 7

CS240A: Databases and Knowledge Bases Fixpoint Semantics of Datalog

CS240A: Databases and Knowledge Bases Fixpoint Semantics of Datalog. Carlo Zaniolo Department of Computer Science University of California, Los Angeles WINTER 2002. Three Equivalent Semantics. Model Theoretic : describing what facts hold true because of the given facts and rules.

maya
Download Presentation

CS240A: Databases and Knowledge Bases Fixpoint Semantics of Datalog

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS240A: Databases and Knowledge BasesFixpointSemantics of Datalog Carlo Zaniolo Department of Computer Science University of California, Los Angeles WINTER 2002

  2. Three Equivalent Semantics • Model Theoretic: describing what facts hold true because of the given facts and rules. • Proof Theoretic: using SLD-resolution • Fixpoint Semantics. Defined as the least fixpoint of the transformation defined by the rules. • For positive programs (I.e., programs without negated goals) all three semantics are-well defined and equivalent. Here we will cover only 3. • For programs with negated goals things are more complex, different semantics are possible and equivalence might not hold any longer. Here we will only consider stratified negation.

  3. Example anc(X, Y) ¬ parent(X, Y). anc(X, Z) ¬ anc(X,Y), parent(Y,Z). parent(X, Y) ¬ father(X, Y). parent(X, Y) ¬ mother(X, Y). mother(anne, silvia). mother(silvia, marc). A bottom-up derivation to derive facts that are true. Step1: mother(anne, silvia), mother(silvia, marc). Step2: mother(anne, silvia), mother(silvia, marc), parent(anne, silvia), parent(silvia, marc). Step3: those in step 2+ anc(anne, silvia), anc(silvia, marc). Step4: those in step 3+ anc(anne, marc). Step4: those in step 4 only---we have reached fixpoint.

  4. Herbrand Universe and Ground Instanceof program P • The Herbrand Universe for P, denoted UP, is defined as the set containing (1) the constants in P and (2) the terms recursively constructed by letting the arguments of functions be elements in UP. For the example program: UP = {anne, marc, silvia}. • Ground version a rule r:ground(r). This is the set of ground instances of r --i.e., all the rules obtained by assigning to the variables in r, values from the Herbrand universe UP. • E.g. from the previous program take: parent(X, Y) ¬ mother(X, Y). Since there are 2 variables in this rule and UP = 3, then ground(r) consists of 3 ×3 rules: parent(anne, anne) ¬ mother(anne, anne). parent(anne, marc) ¬ mother(anne, marc). ... parent(silvia, silvia) ¬ mother(silvia, silvia).

  5. Semantics of a positive program P as the least fixpoint of its Immediate Consequence Operator TP • The ground version of a program P, denoted ground(P), is the set of the ground instances of its rules: ground(P) = { ground( r)  |  r Î P} • The Immediate Consequence Operator TP: TP(I) = {A Î BP|$r A ¬ A1,...,A nÎ ground(P), { A1,...,An } ÍI } The TP operator can be implemented using the relational algebra equivalent of the relational rules. • The fixpoint equation: I= TP(I) • The solutions of this equations are called fixpoint for TP • When we have several solutions we can find the minimal ones and the least ones (according to Í ) • For a positive program P the least fixpoint of TP exists and is denoted lfp(TP) • lfp(TP)defines the meaning of P.

  6. Computation of TP • Powers of TP : TP­ 0 ( I )  = I ¼ TP­ n+1 ( I )  = TP ( TP­ n (I) ) • Moreover, with w denoting the first limit ordinal, we define: TP­w (I)   =  È{ T ­n (I)  |  n ³ 0 } • Powers of TP starting from the empty set; I.e. from I = Æ Theorem:If P is a positive program; then lfp(TP) = TP­w (Æ) NB: the monotonicity of TP is critical for the existence of lfp(TP) and its efficient computation (next slide).

  7. Computing TP­w (Æ) Theorem: The successive powers of TP, form an ascendingchain: I.e. TP­n (Æ) Í TP­n+1 (Æ). Proof by induction: Base:Æ = TP­0 (Æ) Í TP­1(Æ), Induction: IfTP­n-1 (Æ) Í TP­n (Æ) then TP­n (Æ) Í TP­n+1 (Æ) Indeed, TP­n(Æ) = TP (TP­n-1(Æ)) and TP­n+1(Æ) = TP (TP­n(Æ)) And the conclusion follows from the monotonicity of TP Corollaries: TP­k(Æ)   = Èn £ k TP­n (Æ) if TP­k+1(Æ)= TP­K (Æ) then TP­K (Æ)= TP (Æ)­w Computation: start from the empty set, and repeat the application of TP until no new atoms are obtained—I.e., the n+1-th power is identical to the n-th one (if such condition never occurs then we have an infinite computation).

More Related