/************************************************************************/
/** E. LAENENS AND D. VERMEIR, U. of Antwerp -- format: plain text     **/
/************************************************************************/
 
             OBJECT ORIENTED LOGIC PROGRAMMING

                    USING ORDERED LOGIC


                         E. Laenens
                         D. Vermeir

            Dept. of Math. and Computer Science
                 University of Antwerp, UIA
                    Universiteitsplein 1
                   B2610 Wilrijk, Belgium

                   vermeir@ccu.uia.ac.be



(Note: ~ stands for "not")
We describe a logic formalism, called ordered logic, which aims to combine
some important advantages of object-oriented databases with those of deductive
databases.  Advantages of object-oriented systems [Atk89a] include, among
others, object identity and inheritance while relational and deductive
database models enjoy simpler declarative semantics and are closed under
query.

Objects.  We start by considering the notion of object (without inheritance).
Intuitively, objects have, besides an immutable identity, i.e. a name, a
number of properties.  In traditional object oriented systems, these
properties are defined either explicitly, e.g. through instance variables, or
implicitly, using methods. The latter may cause the properties of one object
to depend on those of another object (message passing).  In logic terms, a set
of properties, be they explicit or implicit, can conveniently be described as
a logical theory.  If we restrict ourselves to clauses, we could then identify
an object with a logic program (LP).  Explicit properties are modeled using
facts (ground clauses with an empty body) while methods correspond to general
clauses.  If we name each object by a constant from the language, we get that
an object can be represented by a pair Po where P is a logic program and o is
a constant naming the object.  The properties of o are then described by the
model(s) of Po, where one can pick ones favorite approach to LP semantics, at
least for the time being. In order to allow object properties to depend on the
properties of other objects, we can introduce "extended" literals of the form
X.q where q is an ordinary literal and X is a (bound or free) object
reference.  Intuitively, a.q holds if q holds in (the model of) a while X.q,
where X is a variable, holds if q holds in some other object X.  (Note the
resemblance with modal logic). Literals in the head of a clause are res-
tricted to refer to the self object, which can be dropped from the notation.

As an example, consider a two-object program where Pa={p<-b.~p} and
Pb={p<-a.~p}.  Clearly, a (stable) model Ma of a will contain p iff ~p is in
the model Mb of b and the other way around (we consider models as sets of
arbitrary, not just positive, literals).

Of course, the above can easily be simulated by adding an extra "object"
argument to each predicate symbol which, in the above example, would yield
P={p(a)<-p(b). , p(b)<-~p(a).}.

Inheritance.  Things get more interesting when extending the formalism to
support inheritance. Intuitively, objects, i.e.  theories, can be structured
in an inheritance partial order relation <. The idea is that more general
objects (classes) describe general properties while an object which is lower
in the hierarchy (subclasses, instances) contains more specific information
that is to be combined with the general "methods" in its superobjects in order
to define its full meaning.

In our framework, this implies that we need to specify the semantics of an
object o, based not only on Po but also on all the Pc which are such that o<c.

One obvious way to do this is to augment a's program by the programs of its
superobjects, leading to a "completion" program
                         P*= U   Pc
                              o<c

This will do nicely if we only want "monotonic" inheritance, where the models
of more specific objects always extend those of their superobjects.  However,
it precludes modeling exceptions (or "method redefinition" in object-oriented
languages).  Modeling exceptions naturally leads to the introduction of
negative rules, i.e. rules where the head literal may be negative. As an
example, consider the objects bird, kiwi and tweety where tweety<kiwi<bird,
i.e. tweety is a kiwi and kiwis are birds and Pbird={fly<-}, Pkiwi={~fly<-}
and Ptweety=/.  Here, we intuitively want Mbird={fly} but
Mpenguin=Mtweety={~fly}. This can only be achieved by taking the relative
position of objects in the hierarchy into account.

Our approach is then to introduce the notion of defeat of a rule.  A rule p<-C
is said to be applicable with respect to an interpretation I, if its body is
true, i.e. C(=I.  A rule r1:p<-C1 is a competitor of a rule r2:~p<-C2 if (the
object of) r2 is not more specific than (the object of) r1.  We then say that
a rule is defeated if it has an applicable competitor.

In our example, fly<- is defeated by ~fly<- (but not the other way around) in
any interpretation. In a first apprach, one can then say that an
interpretation I of an object o is a model[Lae90a,Lae90b] if each applicable
rule p<-C in every "visible" object c>o is either applied, i.e. pCI (this
corresponds to the classical definition of model) or defeated.

In our example, we get the desired model {~fly} for tweety, since the rule
fly<- for birds is defeated by the more specific applied rule ~fly<- for
penguins.

We note that the above definition can easily be extended to take inter-object
references into account.  However, the current semantics are not universal as
can be seen from the following example: consider two objects a<b where
Pa={~p<-} and Pb={p<-~p}. Here b has no model as can easily be verified.  In
[Lae90c] and[Lae91a] the above approach have been refined to a universal
semantics which has the pleasing property that the maximal (with respect to
set-inclusion) models are the "stable" ones while there is a unique "well-
founded" minimal model. A credulous approach which extends both maximal to
credulous and minimal to skeptical models has also been investigated [Gab91a].

Another interesting fact is that an ordinary logic program P can easily be
mapped into an ordered logic program: it suffices to define two objects o<o~
where Po=P is the original logic program and Po~ contains ~p for every
predicate p.  In fact, this "ordered version" can be regarded as explicitely
modeling the closed world assumption by inheritance from o~.  Moreover, the
projection of the semantics on this special case yields a unifying definition
[Lae91b] that covers stable as well as deterministic and well-founded models.

Query.  One of the disadvantages of most object-oriented database models is
that they are not closed under query, although some approaches have attempted
to remedy this by rather drastic means, such as making tables into objects. In
our framework, we will address this problem by introducing so-called "virtual"
objects. Essentially, we extend the set of names for objects to include
arbitrary terms instead of just constants. In addition, we attach an
"existence" condition to objects.  The approach is best illustrated by an
example that models the natural join of two relations R1(a,b) and R2(b,c).

We assume that both R1 and R2 have been defined as (class) objects r1 and r2,
and that each tuple is an instance of its corresponding class.  We can then
define a "virtual" object

        join(X,Y) =
                {
                a(U) <- X.a(U).
                b(U) <- X.b(U).
                c(U) <- Y.c(U).
                } <- X.b(Z) , Y.b(Z).


where X.a(Z),Y.b(Z) is the existence condition.  The above defines the meaning
of all objects with names join(o1,o2) where o1 and o2 are objects satisfying
the existence condition, i.e.  they agree on the b attribute.  Hence virtual
objects provide as a way to define "views" or queries on other objects. Again,
the semantics can be extended to cover also virtual objects (note the link
with free logic[Ben86a] ).  Of course, virtual objects can be put anywhere
into the inheritance order, so that it is possible to define e.g.
join(X,Y)<query in order to e.g. define common rules for the instantiations of
the virtual object.

Conclusion.  An ordered logic program consists of a partially ordered
collection of sets of (possibly negative) rules, each of which is associated
with an object term.  The semantics of an object is defined through a suitable
notion of rule satisfaction that resolves possible conflicts by taking into
account the relative position in the partial (inheritance) order.

Ordered logic has been used to implement the concrete language LOCO[Lae90d]
within the framework of the Esprit project KIWIS [Ver90a,The89a].  Efficient
top-down (proof-theory) and bottom-up evaluation strategies are described in
[Lae91c].

Finally it should be noted that the same approach has proven useful in the
construction of a simple theory [Sac91a] of update: versions of objects are
kept in a partial order where more recent versions are more specific. The same
semantics can then be used to solve the frame problem since information is
persistent unless it is contradicted by more recent events.

References

Atk89a.
     M. Atkinson, F. Bancilhon, D. DeWitt, K.  Dittrich,  D.
     Maier,  and  S.  Zdonik,  "The object-oriented database
     system manifesto," in Proceedings  DOOD89,  Kyoto,  pp.
     40-57, 1989.

Ben86a.
     E. Bencivenga, "Free logics," in Handbook of Philosoph-
     ical  Logic,  Vol  III,  ed.  F. Guenther, pp. 373-426,
     1986.

Gab91a.
     D. Gabbay, E. Laenens, and D. Vermeir,  "Credulous  vs.
     Sceptical  Semantics  for  Ordered  Logic Programs," in
     Proceedings of the Second International  Conference  on
     Principles  of  Knowledge Representation and Reasoning,
     pp. 208-217, Morgan Kaufmann, 1991.

Lae90a.
     E. Laenens and D. Vermeir,  "A  Fixpoint  Semantics  of
     Ordered  Logic," Journal of Logic and Computation, vol.
     1, no. 2, pp. 159-185, 1990.

Lae90b.
     E. Laenens, D. Sacca, and D. Vermeir, "Extending  logic
     programming,"  in Proceedings of the SIGMOD conference,
     pp. 184-193, 1990.

Lae90c.
     E. Laenens, Foundations of Ordered  Logic,  1990.   PhD
     Thesis, University of Antwerp UIA

Lae90d.
     E. Laenens, B. Verdonk, D. Vermeir, and D. Sacca,  "The
     LOCO  language:  towards  an  integration  of logic and
     object  oriented  progra  mming,"  Proceedings  of  the
     Workshop on Logic Programming and Non-Monotonic Reason-
     ing, Austin, Texas, 1990.

Lae91c.
     E. Laenens, N. Leone, P. Rullo, and D.  Vermeir,  Effi-
     cient  query evaluation in a language combining object-
     oriented and logic programming,  1991.   Submitted  for
     publication

Lae91a.
     E. Laenens and D. Vermeir, "On the Relationship between
     Well-Founded  and  Stable  Partial Models," in Proc. of
     the Mathematical Fundamentals of Database and Knowledge
     Base Systems, pp. 59-73, 1991.

Lae91b.
     E. Laenens, D. Vermeir, and C. Zaniolo, Pure models for
     Logic  Programs:  a  simplification  and unification of
     logic programming semantics, 1991.  Submitted for  pub-
     lication

Sac91a.
     D. Sacca, B. Verdonk,  and  D.  Vermeir,  Evolution  of
     Knowledge Bases, 1991.  Submitted for publication

The89a.
     The KIWIs Team,  "The  KIWI(s)   projects:   past   and
     future,"  in  Proc.  of 6th Esprit Conference, pp. 594-
     603, 1989.

Ver90a.
     D. Vermeir and  E.  Laenens,  "Advanced  Knowledge-Base
     Environments  for  Large  Database Systems," Knowledge-
     Based Systems, vol. 3, no. 4, pp. 215-220, 1990.
