CS240A: Databases and Knowledge Bases Fixpoint Semantics of Datalog - PowerPoint PPT Presentation

About This Presentation
Title:

CS240A: Databases and Knowledge Bases Fixpoint Semantics of Datalog

Description:

Fixpoint Semantics of Datalog Carlo Zaniolo Department of Computer Science University of California, Los Angeles WINTER 2002 Three Equivalent Semantics Model ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 8
Provided by: Fushen6
Learn more at: http://web.cs.ucla.edu
Category:

less

Transcript and Presenter's Notes

Title: CS240A: Databases and Knowledge Bases Fixpoint Semantics of Datalog


1
CS240A Databases and Knowledge BasesFixpoint
Semantics 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 n1 ( I )   TP ( TP n (I) )
  • Moreover, with w denoting the first limit
    ordinal, we define
  • TPw (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)
    TPw (Æ)
  • NB the monotonicity of TP is critical for the
    existence of lfp(TP) and its efficient
    computation (next slide).

7
Computing TPw (Æ)
  • Theorem The successive powers of TP, form an
    ascendingchain I.e. TPn (Æ) Í TP n1 (Æ).
  • Proof by induction
  • Base Æ TP0 (Æ) Í TP1(Æ),
  • Induction If TPn-1 (Æ) Í TPn (Æ) then TPn
    (Æ) Í TPn1 (Æ)
  • Indeed, TPn(Æ) TP ( TPn-1(Æ)) and TPn1(Æ)
    TP ( TPn(Æ))
  • And the conclusion follows from the monotonicity
    of TP
  • Corollaries TPk(Æ)    Èn k TPn (Æ)
  • if TPk1(Æ) TPK (Æ) then TPK (Æ) TP
    (Æ)w
  • Computation start from the empty set, and repeat
    the application of TP until no new atoms are
    obtainedI.e., the n1-th power is identical to
    the n-th one (if such condition never occurs then
    we have an infinite computation).
Write a Comment
User Comments (0)
About PowerShow.com