Vous êtes sur la page 1sur 32

Topology and the Semantics of Logic Programs

Anthony Karel Seda


Department of Mathematics, University College, Cork, Ireland.
E-mail : STMT8002@IRUCCVAX.UCC.IE

Abstract

We introduce topologies on spaces of interpretations which extend and generalise the query and positive query topologies of Batarekh and Subrahmanian. We
study continuity in these topologies of the immediate consequence map associated
with any normal logic program and provide necessary and sucient conditions for
continuity to hold. We relate these ideas to (i) computational power of programs;
(ii) canonical programs; (iii) the declarative semantics of de nite programs; (iv)
Maher's down continuous programs; (v) the decency thesis of Ja ar, Lassez and
Maher, and (vi) compactness of sets of xed points and models.

1 Introduction
The classical approach to the study of xed point semantics of de nite logic programs P
utilises two main facts: (1) The set ILJ of all interpretations of the underlying language
L based on a given preinterpretation J forms a complete lattice under the partial
order of set inclusion. (2) The immediate consequence map TP de ned on ILJ is lattice
continuous. An application is then made of a theorem, usually attributed to Kleene,
to provide least xed points of TP , see [26] for a detailed account. The term classical
used here re ects the fact that the underlying logic is classical two-valued and also that
the resulting semantics is satisfactory in general so long as only atoms are present in
clause bodies: once one permits negation symbols to be present in clause bodies one
loses monotonicity (and hence lattice continuity) of TP . Nevertheless, this approach
has been extended [1] to the class of strati ed programs by adopting a di erent notion
from the usual one of ordinal powers in the case of nonmonotonic operators.
For various reasons, including the problems caused by extended syntax (i.e. the
presence of negation or other symbols in clause bodies), it has been proposed that one
should work over three-valued, four-valued or even many-valued logics and much work
has been done in this area, see [9, 10, 12, 13, 21, 22, 23, 24, 31]; in this context, even van
Emden's work [11] can be thought of as using quantitative truth values in the interval
[0; 1]. To take just one example, in pursuing this proposal Fitting in [12] considers
Kleene's so called strong three-valued logic. In this setting, the notion of \basic set"


Fundamenta Informaticae 24 (4) (1995), 359-386.

de ned in [12] plays the role of interpretation or valuation (also called truth function)
and the set of all such basic sets forms a complete semilattice but not a complete
lattice. Given a logic program P there is, moreover, an operator P de ned on this
set whose xed points coincide exactly with the models of a sort of completion of P .
It is interesting to note that in general P is monotone (even when P is not de nite)
but not continuous, a point to which we will return later. Similar remarks apply to
[13] except that the space of interpretations there forms a complete lattice and the
interpretations themselves take values in a bilattice. A uni ed treatment of much of the
work cited above and also some which is not (such as Quantitative Logic Programming
and Constraint Logic Programming) is to be found in [9]. What emerges is that from
an abstract point of view semantical questions are concerned with the following: (i)
A partially ordered set T of truth values which is perhaps a complete partial order, a
complete semilattice or a complete lattice. (ii) The set T D of all interpretations de ned
on the set D of all atoms in L with values in T , which itself inherits pointwise the
underlying structure present in T (more generally at this point the set of all structures
as de ned in [9]). (iii) A monotone, weakly continuous or continuous operator  on T D
whose pre- xed points or xed points are the models of the program P under discussion
or its completion in some sense; these latter, i.e. the xed points of , are found by
applying variants or generalisations of a theorem due to Tarski, see [12, 16, 25].
Now there is another way of viewing these issues, a way familiar in the domain
theory and denotational semantics of procedural languages but not much considered in
logic programming, and it is as follows. Given a T topological space X one may de ne
a partial order  on X , called the specialisation order, by x  y i x is in the closure
of fyg. Conversely, there is associated with any partially ordered set (X; ) a complete
lattice of T topologies whose associated specialisation orders coincide with , see [19,
Page 45] and [30, 37]. In fact, the collection of all sets of the form " x = fy 2 X ; x  yg,
where x 2 X , forms a subbasis for the maximal element in the complete lattice just
referred to (and sometimes called the Alexandro topology) in which, as is well known, a
function f : X ?! X is continuous i it is order preserving or monotonic. Moreover, in
the case when X is a cpo and we replace the Alexandro topology by the Scott topology
we have that f is partial order continuous i.e. continuous in the lattice theoretic sense
i it is Scott continuous, again this is well known.
It is apparent from the observations just made that the study of T D in various
topologies and the continuity of  therein subsumes the study of these from the latticetheoretic point of view. Indeed, as suggested in [30, Page 307] it is possible to make
ner arguments using the lattice of topologies related to a single partial order than it
is with that partial order. Moreover, as we shall see, there are interesting and informative topologies on T D not even related to the underlying partial order on T D , in
fact many such arise from well known function-space constructions. Such a study as
that just envisaged raises many questions, including: Is it possible to distinguish topologically between complete partial orders, complete semilattices and complete lattices ?
Are there syntactic criteria for determining continuity of  in various topologies ? Can
computational power of various classes of programs be related to, say, continuity of a
suitably chosen  in various topologies on T D ? Can problems of current interest in logic
programming be translated into topological terms and vice-versa ? Can such methods
0

be used to study xed points of  as indeed they are elsewhere in mathematics ?


Our present purpose, therefore, is to discuss in some detail the extent to which one
can apply the methods of general topology and analysis to the study of the declarative semantics of logic programs. We shall not be so ambitious here as to embrace the
programme outlined above in its full generality, but will in the main restrict ourselves
to relating these ideas to the case of two-valued logic and current notions of logic programming as it is described in [26]; extensions to the general case will be considered
elsewhere. Our aims are, consequently, very much akin to those of Batarekh and Subrahmanian in their papers [2, 3, 4, 5, 6]. They have already introduced topological
ideas into the study of logic programs; speci cally they have introduced two topologies
(the query topology and the positive query topology) both of which are naturally de ned
in terms of L. It is, hence, necessary to devote a certain amount of space to considering their results and relating our work to theirs; indeed we intend to both extend
and complement their work. In fact, most of their studies are conducted under a blanket assumption (variously called by them the matching condition, Henkin condition or
the reachability condition) concerning the nature of the sets D they permit to be the
domains of preinterpretations for L. This e ectively imposes the restriction that they
work only over the Herbrand preinterpretation of L which is a needless restriction and
one which we remove. In so doing, we relate their concepts to our more general ones and
place theirs in our context by showing that the matching condition provides necessary
and sucient conditions under which their topologies coincide with certain of those
which we introduce, see Propositions 3 and 6. Thus, the main topics we investigate are
as follows:
 In Section 2 we consider topologies on spaces of interpretations. When viewed as
function spaces it is very natural to consider these in various product topologies.
This we do relative to arbitrary domains D, and recover the query topology
and the positive query topology as special cases when D happens to satisfy the
matching condition. This has several consequences: First, all the general topology
established in [3, 4, 5, 6] follows quickly and simply from well known facts about
product spaces and moreover these facts become available in complete generality.
Similarly, it is immediate for the same reason that the positive query topology
coincides with the Scott topology and that the query topology coincides with the
Lawson topology, a topology well known in lattice theory, see [15]. Finally, we can
actually easily display metrics generating the query topology rather than simply
asserting that it is metrizable.
 In Section 3 we brie y consider the declarative semantics of de nite logic programs
and show how topological continuity of TP can be used as a substitute for lattice
continuity to recover the Kowalski - van Emden theorem. That it is possible
to derive such results in this way should be no surprise given the role of the
Scott topology in computing. Nevertheless, the approach we adopt has some
mathematical interest for two reasons. First, it motivates the introduction of the
greatest limit of a net of interpretations. Secondly, it brings out the topological
interpretation of the role of lattice continuity in nding xed points. In fact,
this turns out to be the following simple observation familiar in certain areas
3

of mathematics such as dynamical systems where convergent sequences or nets


are used to nd xed points: Suppose T : X ?! X is a continuous function
de ned on a topological space X and x 2 X is some distinguished element of
X . Consider the \orbit" x ; T (x ); T (x ); : : : of x and suppose that the sequence
T n(x ) converges to x, say, i.e. T n(x ) ! x. Then by continuity of T we have that
T (T n(x )) ! T (x), and therefore T n(x ) ! T (x). From this one can now deduce
that T (x) = x, i.e. that x is a xed point of T , whenever one has unique limits.
The existence of unique limits may obtain due to purely topological features of
X , for example if X is Hausdor , or it may result from some other feature of X .
Indeed, we encounter both situations at various points in our work. For example,
in x3 we use the lattice structure available to de ne the aforementioned notion of
greatest limit when dealing with convergence in the topology Q de ned there.
On the other hand, we use the fact that the topology Q we de ne in x2 is Hausdor
when dealing with convergence in Q. As we shall see, the uniqueness of greatest
limits in Q turns out to be a satisfactory substitute for the Hausdor separation
axiom, at least for the convergence questions we address in Q .
 In [3, 6] several interesting conclusions are drawn from the hypothesis that TP is
continuous in the query topology, where P is a (classical) normal logic program.
These include consistency of comp(P ), the completion of P , and criteria to ensure
that comp(P ) [ comp(P ) is consistent given that comp(P ) and comp(P ) are
consistent; both these issues are important general questions, of course, in logic
programming. It is desirable, therefore, to have necessary, sucient and necessary
and sucient conditions for the continuity of TP which are readily veri ed. These
we obtain in Section 4 where we consider the consequences of these results and
establish our main conclusions. In particular, we obtain Theorem 12 of [6] as a
corollary of our results namely that in the absence of local variables TP is continuous in the query topology. This condition is of interest and occurs in several places
in the literature in di erent guises, see for example [10, x6,x7], [11, Theorem 3:10],
[13, x5,x6] and [27] where it is shown that (over the Herbrand universe) absence
of local variables characterises down-continuity up to subsumption equivalence.
In fact, we show that in the case of the Herbrand universe down continuity is exactly the same thing as continuity relative to the query topology. Moreover, the
observations above together with those of Blair in [8] concerning Shepherdson's
transformation [36] of 2-register machines into logic programs mean that the class
of programs P for which TP is continuous in the query topology computes all
partial recursive functions.
The equivalence noted above between down continuity of TP and topological continuity of TP , for the Herbrand universe at least, permits two further topological interpretations of issues important in logic programming. The rst is that the programs which
Fitting [12] deemed \acceptable" and for which his map  is (partial order) continuous
is, for de nite clauses, precisely the class for which  is topologically continuous, see
[17]. The other is that the programs P for which TP is continuous in the query topology are canonical in the sense of [7, 18]. According to [17, 28] the continuous programs
should not be deemed acceptable in that they are incapable of expressing transitive
0

closure. We nish by observing that the result of McCarthy [29], which we discuss in
Section 4, to the e ect that programs P for which TP is continuous merely at the single
point TP # ! are canonical, provides a much larger class of canonical programs than
the down continuous programs. Whether or not this class is \acceptable" i.e. whether
or not those programs within it can express transitive closure we do not know.
Acknowledgement. The author thanks two anonymous referees for comments which
substantially improved the presentation of this paper at certain points. In particular,
he thanks one of them for bringing [14, 20] to his attention. These two papers use
metric space theory to establish interesting and signi cant results concerning logic programming which are close in spirit to ours, although there is no actual overlap between
our results and those of [14, 20].

2 Topologies on ILJ

2.1 Notation and terminology

It will be convenient rst to establish and collect together certain pieces of notation and
terminology which we will use throughout without further mention. We refer to [26]
for all terms and notation relating to logic programming which are not de ned here.
Let L denote a rst order language (not containing the equality symbol) and let
J denote a xed, but arbitrary, preinterpretation of L with domain, dom(J ), denoted
by D. Usually, in later sections, L will denote the underlying language of a normal
logic program but for the moment L is perfectly general. Suppose that v is a variable
assignment. Given a term t in L, let Jv (t) 2 D denote the term assignment or denotation
of t with respect to J and v, alternatively denoted t j v when J is understood. If
t = (t ; : : : ; tn) is a vector of terms in L, then Jv (t), or t j v, is by de nition the vector
(Jv (t ); : : : ; Jv (tn)). We let DL denote the set of all J -instances of predicate symbols in
L, thus DL is the set fp(d); p is a predicate symbol in L and d is a vector of elements
of D whose length equals the arity of pg. If I is an interpretation of L based on J , we
let I (p) denote the relation on Dn to which I assigns the n-ary predicate symbol p. In
the usual way, we can identify I with a subset of DL; thus p(d) 2 I i I (p)(d) = true.
Hence, the set X or ILJ of all interpretations of L based on the preinterpretation J can be
identi ed with the power set P (DL) of DL, that is to say X = ILJ = P (DL). Let 0 and 1
be distinct symbols not in L. By identifying each subset I of DL with its characteristic
function I we can identify P (DL) with the set 2D of all functions from DL into 2,
where 2 denotes the set f0; 1g. Therefore, if we let f0; 1gi = fQ0; 1g for each i 2 DL,
then we can further identify P (DL) and 2D with the product i2D f0; 1gi. Thus, in
terms of the framework described in the Introduction the set T here is simply f0; 1g
partially ordered in the usual way and, as already noted, we shall restrict ourselves to
this level of generality throughout.
An arbitrary literal, L(t) or just L, in L takes the form p(t) or :p(t), where p(t)
is an atomic formula. Since we are working in classical two valued logic, if I is an
interpretation of L and v is a variable assignment I j=v L(t) or I j= L(t), if v is
understood, means precisely the following. When L(t) is p(t), I j=v L(t) i p(Jv (t)) 2 I ,
and when L(t) is :p(t), I j=v L(t) i p(Jv (t)) 62 I . Suppose E = 9L(t) or E = 9(L)
1

denotes the existential closure of the literal L(t) and fx ; : : : ; xm g is the set of free
variables in L; such a formula E is called a query. Given a variable assignment v and
an interpretation I of L, we write I j= E if there are elements d ; : : : ; dm in D such that
I j=u L, where u = v(x ; : : : ; xm=d ; : : : ; dm) is the variable assignment v except that
xi is assigned to di for i = 1; 2; : : : ; m. More generally, if E = 9(L ^    ^ Ln ), where
each Li is a literal Li (ti), then E is the general form of a query and we write I j= E
to mean that I j=u Li for i = 1; 2; : : : ; n, where u is as before except that fx ; : : : ; xmg
denotes the union of the sets of free variables which occur in each of the Li . Of course,
the truth, or otherwise, of the statement \I j= E " is independent of v.
It will be convenient at times, for purely technical reasons, to slightly abuse the
notation just established in the previous paragraph and the usual understanding of the
symbols j=, ^ and : in the following way. If Jv (t) = d, we will sometimes write I j= p(d)
to mean exactly that p(d) 2 I or in other words that p(Jv (t)) 2 I . Similarly, we write
I j= :p(d) to mean exactly that p(d) 62 I . Thus it is meaningful to write I j= L(d)
or I j= L(Jv (t)) or I j= L(t j v) and by extension to write I j= L (d ) ^    ^ Ln (dn),
this latter meaning, of course, that I j= Li (di) for i = 1; 2; : : : ; n. Finally, if L(t) is a
literal, we will sometimes nd it convenient to write L j v for L(t j v), where v is a
variable assignment (once again, J being understood); we call L j v a v - instance of L.
It should be noted that :p(d) is simply a mixture of syntactic and semantical entities
in just the same way as p(d) is such, and is a convenient device to use in the details of
some of our later results.
1

2.2 The Query Topology

We begin by recalling the query topology of Batarekh and Subrahmanian [2, 3, 4, 5,


6] and discussing certain of its limitations; in the next subsection we show how the
diculties encountered here can be overcome. We refer to [39] as a general reference
to matters topological, and to [32, 37, 38] as general background for those readers
unfamiliar with the methods and use of topology in theoretical computer science. Other
examples of the use of such methods abound in the literature on domain theory.
Let J be a xed preinterpretation of the rst order language L and let X denote
the set ILJ of all interpretations of L based on J , as described above. Given a query E
in L we form the subset G (E ) of X de ned by G (E ) = fI 2 X ; I j= E g and then form
the class G of subsets of X , where G = fG (E ); E is a queryg. The query topology is,
by de nition, that topology on X generated by taking G as a subbasis. Thus, a typical
open set in the query topology is a union of sets of the type G (E ^    ^ En), where
E ; : : : ; En are queries and G (E ^    ^ En ) denotes the intersection of the sets G (Ei),
for i = 1; 2; : : : ; n; of course, the collection B of sets of this latter type G (E ^    ^ En)
forms a basis for the query toplogy.
As already noted in the Introduction, Batarekh and Subrahmanian have made quite
extensive studies of this toplogy with much the same aims in mind as we have here.
However, from a certain point of view the topology described above is not entirely
satisfactory. In order to explain this point of view we note rst that the set of all literals
in L is countable. Therefore the set of all queries in L is countable. In consequence
we see that the collection B is countable and that always the query topology is second
1

countable irrespective of the cardinality of the domain D of J . This is unsatisfactory


in that it leads to a paucity of open sets in ILJ , see Remark 2. This in turn leads to
a failure, in general, of such desirable properties as the Hausdor separation property
(see the next example) where there is no intrinsic reason for this to happen. Indeed,
we shall soon de ne a perfectly natural generalisation of the query topology which is
always Hausdor . By contrast, the other topologies of interest to us viz. the positive
query topology and our generalisation of it intrinsically lack all separation properties
other than that of being T , see x3.
0

Example 1.

Consider the program P as follows

p(o)
p(s(x)) p(x)
and consider the following preinterpretation J of the underlying language L of P . We
shall (i) take the domain of J to be the set R of all real numbers; (ii) assign the constant
symbol o to the zero element, 0, of R; (iii) assign the function symbol s to the function
s0 : R ?! R de ned by s0(r) = r + 1. Thus, the term assignment J (sn(o)) of sn(o) is
n, i.e. J (sn(o)) = n. Here DL = fp(d); d 2 Rg, and since L contains only the predicate
symbol p any interpretation I of L based on J corresponds to a subset of R. In other
words, the set X or ILJ is naturally in one-to-one correspondence with the set of all
subsets of R. If we let I = fp(1=2)g and I = fp(3=4)g for example, so that I ; I 2 X ,
it is straightforward to show that I and I cannot be separated, see [33], and therefore
that X is not Hausdor .2
In fact, Batarekh and Subrahmanian impose a condition at all times which they call
the matching condition. Under this condition D is forced to be countable and in that
case the query topology is Hausdor . We discuss this condition in more detail in the
next subsection.
1

2.3 The topology Q

In order to overcome some of the diculties identi ed in the previous subsection, we


propose now to introduce a generalisation of the query topology as follows.
Let p be an n-ary predicate symbol in L and let x ; x ; : : : ; xn be variable symbols in
L. If v denotes a variable assignment with v(xi) = di, say, then we write v(x) = d, where
of course x denotes the vector (x ; x ; : : : ; xn) and d denotes the vector (d ; d ; : : : ; dn).
Next, we de ne the set G (p(x); v), also denoted by G (p(x j v)) or G (p(d)), to be
fI 2 X ; I j= p(d)g. Likewise, we de ne the set G (:p(x); v), alternatively denoted by
G (:p(x j v)) or G (:p(d)), to be fI 2 X ; I j= :p(d)g. Thus, consistent with our earlier
notation we de ne G (L(d)) to be the set fI 2 X ; I j= L(d)g. Finally, let G denote
the collection of all sets of the form G (p(d)) together with those of the form G (:p(d))
where p(d) belongs to DL. We de ne the atomic topology Q on X = ILJ to be that
topology obtained by taking the collection G as a subbasis. Thus, a basic open set
in this topology is of the form G (L (d )) \V   \ G (Ln (dn)) which we may write on
occasions as G (L (d ) ^    ^ Ln(dn)) or G ( ni Li (di)) by our abuse of notation. So,
1

=1

if C denotes the collection of all sets of this latter type, then C forms a basis for the
atomic toplogy and in this topology an arbitrary open set is a union of elements of C .

Remark 1 1) In forming C from G , we take all nite intersections of elements of G .

As usual, we allow empty intersections i.e. the intersection


of the empty family, which

J
in this case is all of IL . It is useful notation to let denote the empty conjunction
L1 (d1) ^  ^ Ln (dn) ofliterals with n = 0. Thus, G () is the intersection of the empty
family and therefore G () = ILJ , and hence I j=  for all I 2 ILJ .
2) In general, I j= p1 (d1 ) ^    ^ pn(dn) ^ :q1 (e1 ) ^    ^ :qm (em ) i pi(di ) 2 I and
qj (ej ) 62 I for i = 1; 2; : : : ; n; j = 1; 2; : : : ; m. In particular, this is so when I =  i
n = 0, and when I = DL i m = 0.

We present next some of the basic separation properties of the atomic topology in
Proposition 1. These facts are the analogues for Q of similar results established by
Batarekh and Subrahmanian [3, 5] for the query topology. We omit the direct proofs
which are straightforward; in any case the results follow immediately from Theorem 1
below.
Proposition 1 Let J be an arbitrary preinterpretation of a rst order language L.
Then
a) The set G (L(d)) is both open and closed.
b) Every basic open set in Q is closed.
c) The topology Q is regular and Hausdor .
It is apparent from this result and Example 1 that the query and atomic topologies
are usually di erent, and we now proceed to demonstrate the true connection between
them. In the next subsection, we establish results that give us a very clear picture of
these topologies.

Proposition 2 The atomic topology is ner than the query topology.


Proof Let E = 9(L (t ) ^    ^ Ln(tn)) be an arbitrary query in L and suppose
fx ; : : : ; xm g is the union of the sets of free variables which occur in each of the literals
in E . Consider the basic open set G (E ) = fI 2 X ; I j= E g in the query topology and let v be a variable assignment. Then an interpretation I belongs to G (E )
i there are elements d ; : : : ; dm of D such that I Vj=u Li(ti) for i = 1; 2; : : : ; n, where
u = v(x ; : : : ; xm =d ; : : : ; dm). But then
I 2 G ( ni Li(di )), where di = Ju(ti) for
V
i = 1; 2; : : : ; n. Conversely, if I 2 G ( ni Li (di)), then I 2 G (E ). It is now evident
that G (E ) is a union of certain basic open sets in the atomic topology, this union being
taken over a collection of variable assignments u. Therefore, G (E ) is open in the atomic
1

=1

=1

topology as required. 2

Remark 2 It is apparent from this result, or rather its proof, that the root of the

problem with the query topology is the presence of the existential quanti er in a query.
This forces one to take unions as above with the result that there are not enough open
sets.

According to [3, 5] a preinterpretation J matches the language L i every element d


in the domain D of J is the denotation of some variable free term in L. For example, if J
is the Herbrand preinterpretation of L, then J matches L. Batarekh and Subrahmanian
impose the condition at all times that J matches L and refer also to this condition as
the Henkin condition or the reachability condition. However, this is a severe restriction
to make since it forces the domain D of J to be countable. We will have no need to
impose the matching condition at any time. Nevertheless, it is under this condition
that we obtain coincidence of the two topologies we have been discussing, as we show
in the next result, and for this reason it is of some interest to us.

Proposition 3 The query topology coincides with Q i J satis es the matching condition. In particular, these topologies coincide for the Herbrand preinterpretation.

Proof Suppose rst that J satis es the matching condition. By Proposition 2 it suces
to show that each of the sets G (p(d)) and G (:p(d)) is open in the query topology, for
then the two topologies coincide. So let p(d) be an arbitrary element of DL. Then d is
a vector of elements of D and, by the matching condition, there is a vector t of variable
free terms in L such that J (t) = d. Now consider the query E = 9(p(t)). Since t is
variable free, E is simply the ground atom p(t). Thus, G (E ) = G (p(t)) = G (p(d)) and
it follows that G (p(d)) is open in the query topology, as required. A similar argument
shows that G (:p(d)) is open in the query topology. This establishes suciency of the
condition.

Conversely, suppose that the matching condition is not satis ed and let DL be
de ned to be that subset of DL whose elements have arguments
each of which is the

denotation of a variable free term in L. Then
by hypothesis DL 6= DL and, since the

topology Q is Hausdor , it follows that DL and DL can be separated by basic
open

sets. Thus, there is a basic neighbourhood of DL in Q which does not contain DL. Now
suppose that G (E ) is a subbasic neighbourhood of DL in the query topology. Thus,
E = 9(L ^    ^ Ln) is a query and DL j= E . Therefore, by Remark 1, all the literals
Li which occur in E are positive. Now assign all the variables which occur in E , if
any, to elements of D which are the denotations of variable free terms
in L. Then for

this variable
assignment J (Li ) 2 DL for i = 1; 2; : : : ; n and so DL j= E or, in other

words, DL 2 G (E ). Thereforeevery subbasic, and hence basic, neighbourhood of DL in
the query topology contains DL and so these points of X cannot be separated therein.
Therefore, the query and atomic topologies do not coincide.2
1

Corollary 1 If J satis es the matching condition, then the class of all G (E ) such that
E is a ground query forms a countable subbasis (in fact, basis) for the query topology.

2.4 Convergence in the topology Q

Our next task is to establish basic net convergence results in X . These results will allow
us to display the topology Q as a product topology. This in turn permits us to obtain
all the point-set topology we have need of concerning X . Our approach avoids a long
detour into lattice theory which is the direction taken in [6].
9

Let fI;  2 g, or just I, denote a net of interpretations, I, in X = ILJ . The
following is a key result.

Proposition 4 A net I converges to I in Q i every element of I is eventually an

element of I and every element of the complement of I is eventually an element of the


complement of I .

Remark 3 1) The condition stated in the proposition \ A, say, is eventually an element


of I" means that there exists  such that A 2 I for all    .
0

2) The condition in the statement of Proposition 4 is to be interpreted in the obvious


way if either I =  or I = DL . Thus, if I = , only the second half of the condition
applies (and then the conclusion is valid), whereas if I = DL , only the rst half applies
(and again the conclusion is valid).

Proof of Proposition 4 Suppose I ! I and A = p(d) 2 I . Put U = G (p(d)), then U


is a neighbourhood of I and so I eventually belongs to U . Hence there exists  such
that    implies I 2 U i.e. I j= p(d) and so p(d) 2 I . Thus, A 2 I whenever
   , and so A is eventually an element of I. Now suppose that A 62 I , where again
A = p(d). Then I j= :p(d). Put U = G (:p(d), so that I 2 U . Hence I 2 U eventually
i.e. there exists  such that    implies I 2 G (:p(d)). Thus, I j= :p(d) or, in
other words, p(d) 62 I . Therefore, A 62 I whenever    as required.
Conversely, suppose that the \eventual" conditions hold relative to I and I . Let U
be a neighbourhood of I ; without loss Vof generality Vwe can suppose that U is a basic
neighbourhood of I of the form U = G ( ni pi(di ) ^ mj :qj (d0 j )). Then we have that
0

=1

=1

p (d ); : : : ; pn(dn) 2 I and q (d0 ); : : : ; qm (d0m ) 62 I:


1

By hypothesis and the directedness of (; ), we can choose  so large (after n + m
steps) that whenever    we have
0

p (d ); : : : ; pn(dn ) 2 I and q (d0 ); : : : ; qm (d0m ) 62 I:


1

Thus, I 2 U whenever    and so I ! I in Q as required. 2


Let us now use the identi cation described in x2:1 to carry the topology Q over to
D
2 ; thus a net I ! I i I ! I . Suppose in fact that I ! I and A 2 DL.
If A 2 I , then I (A) = 1. But since I ! I , we have, by Proposition 4, that A is
eventually in I i.e. eventually I (A) = 1 also. On the other hand, if A 62 I , then
I (A) = 0. But again using the fact that I ! I and Proposition 4, we see that
eventually I (A) = 0 also. Thus, for each A 2 DL, we see that I (A) ! I (A) in the
discrete topology on 2. So in fact, I converges pointwise to I . Clearly, the above
arguments reverse and so I ! I in the image of Q under the identi cations being
considered i I converges to I pointwise. Thus, the topology on 2D is the topology
of pointwise convergence. Therefore,
the atomic topology Q on X = P (DL) carries
over to the product topology on Qi2D f0; 1gi, where each set f0; 1gi is endowed with
the discrete topology. Many results follow from this central fact as we now see.
0

10

Theorem 1 Let J denote an arbitrary preinterpretation of L, let X = ILJ and let D

denote the domain of J as usual. Then


a) In the topology Q, X is a totally disconnected compact Hausdor space.
b) Q is metrizable i D is countable.
c) Q is second countable i D is countable.
d) In the topology Q, X is a Cantor space. In fact, when J is the Herbrand preinterpretation, and is in nite, the space X of all Herbrand interpretations is homeomorphic
to the usual Cantor set in the closed unit interval within the real line.

Proof All these results follow from results concerning product spaces, see Willard [39],
as indicated. For a) see Page 211 and other well known results such as Tychono 's
theorem. For b) see Page 161, Theorem 22.3. For c) see Page 108, Theorem 16.2.
Finally, for d) see Page 121 Art. 17.9 and Page 217, Cor. 30.5.2
It is well known, see [15, Chapter 111], that the Lawson topology of the complete
lattice 2D coincides with the product topology on 2D when 2 is endowed with the
discrete topology. We therefore immediately obtain, as another consequence of our
observations above, the following result rst established in [6] under the matching condition.
L

Theorem 2 For an arbitrary preinterpretation J the topology Q on ILJ coincides with


the Lawson topology.

We nish this section by describing metrics which generate Q in the case that the
domain D of J is countable.
Suppose that D is countable and, as usual, form the set DL = fp(d); p is a predicate
symbol and d is a vector of elements of Dg. In this case it is clear that the set DL is
countable, although there is no obvious way of listing the elements of DL in a sequence.
Let A = p(d) denote a typical element of DL and choose some xed listing fAig of the
elements of DL, where i = 1; 2; 3; : : :.
Now in general, if (Mi; i)i ; ; ;::: is a sequence
of metric spaces, where each i is
Q
1
bounded by 1, and we form the product M = i Mi , then the product topology on
M is generated by the metric , where
X i( i; i0 )
( ; 0) = 1
i
2i
in which expression = ( ; ; : : :) and 0 = ( 0 ; 0 ; : : :) are elements of M . These
facts are contained in the proof of [39, Theorem 22.3, Page 161].
As before, let 2 = f0; 1g endowed with the discrete topology and let 2Ai = 2i = 2
for i = 1; 2; 3; : : :. Now de ne the metric i on 2i for each i by
=1 2 3

=1

=1

i (0; 0) = 0 = i (1; 1) and i (1; 0) = 1 = i(0; 1):


Then i generates the discrete
topology on 2i and the metric  described above generates
Q
1
the product topology on i 2i, and hence the atomic topology on P (DL). This metric
has an intuitive description when applied to elements of P (DL ) as we now show.
=1

11

Consider the identi cations above of P (DL), 2D and Q1


i 2i . These equate I with
I which in turn is equated with the sequence I = ( ; ; : : :), where n = 1 i An 2 I
and n = 0 i An 62 I . Thus, if I and I 0 are two interpretations and I and I 0 the
corresponding sequences, then
X i( i; i0 ) :
(I; I 0) = (I ; I 0 ) = 1
i
2i
Consider now the symmetric di erence I 4 I 0 of I and I 0. An element Ai belongs to
this symmetric di erence i either Ai 2 I n I 0 or Ai 2 I 0 n I . In other words, i either
i = 1 and i0 = 0 or i = 0 and i0 = 1 which is the case i Pi ( i; i0 ) = 1. Thus, in
reality, the metric  can be expressed in the form (I; I 0) = Ai2I 4I i and we have
the following result.
Theorem 3 If the domain, D, of J is countable and fAig is a listing of the elements
of DL, where i = 1; 2; 3; : : :, then the topology Q is generated by the metric  de ned by
X
(I; I 0) = Ai2I 4I 21i :
An alternative approach to and proof of this theorem can be found in [33] where it
is shown that, with a slightly modi ed form of , the process above determines, up to
equivalence, all metrics which generate Q.
L

=1

=1

1
2

3 Further topologies on ILJ


In addition to the query topology, Batarekh and Subrahmanian [3, 5] have discussed a
topology which they call the positive query topology and have established equality between it and the well known Scott topology de ned on the lattice ILJ . Once again, their
treatment is subject to the \matching condition" and once again we regard this as an
unnecessary restriction to impose. In this section, we therefore propose to investigate
this topology from our viewpoint and to generalise the results obtained by Batarekh
and Subrahmanian. Later, we establish continuity of the immediate consequence map
of any de nite logic program and also some interesting convergence results in our generalisation, Q , of the positive query topology. As already noted in the Introduction,
these facts lead to the Kowalski - van Emden theorem and therefore show that Q can
be taken as a foundation for the declarative semantics of de nite logic programs.
+

3.1 The Positive Query Topology

With the notation established earlier and following [3, 5] we de ne a positive query
to be a query E = 9(L ^    ^ Ln) in which each literal Li is in fact positive or, in
other words, is an atom. Again, we let G (E ) denote the set fI 2 X ; I j= E g and
G = fG (E ); E is a positive query g. By de nition, the positive query topology on X is
that topology obtained by taking G as a subbasis. Thus, a typical basic open
set in
T
n
this topology is a set of the type G (E ^    ^ En) which is, by de nition, i G (Ei),
where E ; E ; : : : ; En are positive queries. Of course, the collection B of all sets of
1

=1

12

this latter type forms a countable basis for the positive query topology. Thus, as in
the case of the query topology, the positive query topology is always second countable,
and again the root cause of the problem is the existential quanti er in a positive query
which corresponds to taking a union. To overcome this diculty, we next introduce a
generalisation of the positive query topology which we call the positive atomic topology.

3.2 The topology Q+

With reference to x2, let G denote the set fG (p(d)); p(d) 2 DLg. By de nition, the
positive atomic topology is the topology Q de ned on X by taking G as a subbasis.
Thus, a basic open
set in this topology is of the form G (p (d ) ^   ^ pn(dn )) by which
T
n
we mean the set i G (p(di)).
The positive query topology bears the same sort of relationship to the positive
atomic topology as exists between the query topology and the atomic topology. In
both cases, removal of the existential quanti er frees up the creation of open sets which
become more plentiful as a result. For example, the positive atomic topology is not
second countable unless the domain of J is countable. However, it is not Hausdor
either and we discuss the exact separation properties enjoyed by these topologies in
a little detail later on. We shall see that these topologies are yet more examples of
topologies of interest in theoretical computer science which possess only the barest
separation properties viz. they are T but not even T .
+

=1

Remark 4 The same comment as was made in Remark 1 also


holds here in forming

the basis of Q from the class G . So, noting again that G () = ILJ , we have

a) I j=  for every I 2ILJ .
b) In particular,  j= . Indeed, if  j= p (d ) ^    ^ pn (dn), then n = 0 and the
+

conjunction involved is the empty one.

The analogue of Proposition 2 for the positive query and positive atomic topologies
is as follows.

Proposition 5 The positive atomic topology is ner than the positive query topology.
Proof The proof of Proposition 2 carries over mutatis mutandis to the case of the
positive query and positive atomic topologies.2
In fact, we have the following result.

Proposition 6 The positive query and positive atomic topologies coincide i J satis es
the matching condition. In particular, they coincide for the Herbrand preinterpretation
J.

Proof For suciency, if J satis es the matching condition, then the proof of the suciency part of Proposition 3 easily modi es to the present situation, and so the positive
query topology coincides with Q .
Conversely, suppose J does not satisfy the matching condition. The proof of necessity given in Proposition 3 does not carry over directly, as it made use of the Hausdor
+

13

separation property which is not satis ed by the topologies currently in question. We


therefore reason as follows.
Let p(d) be an element of DL in which d is not the denotation of any vector of
variable free terms in L, so that at least one component
of d is not the denotation of

any variable free term in L. Thus, p(d) 2 DLn DL, where DL has the meaning given
to it in proving Proposition 3. Let U = G (E ) be a subbasic open neighbourhood of
I = fp(d)g in the positive query topology. Then I j= E and E is a positive query of the
form 9(p(z ) ^    ^ p(zn)) in which p is the only predicate symbol and z ; : : : ; zn are
vectors of terms (not necessarily variables), and for each vector zi, i = 1; 2; : : : ; n, not all
its components can be variable free. Moreover, because fp(d)g j= E , for some variable
assignment v we have (p(z ) ^    ^ p(zn)) j v = p(d). Now suppose, more generally,
that G (E ) is a basic neighbourhood of I = fp(d)g in the positive query topology. Then,
by what we have already noted, E = E ^    ^ El for some nite number of positive
queries E ; E ; : : : ; El , where
(i) Ei = 9(p(zi ) ^    ^ p(zini )), for i = 1; 2; : : : ; l.
(ii) Each zij is a vector of terms, not necessarily variables, not all of whose components are variable free.
(iii) For some variable assignment vi , we have (p(zi ) ^    ^ p(zini )) j vi = p(d), for
i = 1; 2; : : : ; l.
Now let u be an assignment of all variables to elements of D each of which is the
denotation of a variable free term in L. Let p(zij ) j u be denoted by p(dij ). Then, for

i = 1; 2; : : : ; l and each j = 1; 2; : : : ; ni, we have p(dij ) 2 DL and therefore p(dij ) 6= p(d).


Letting I denote the set fp(dij ); i = 1; 2; : : : ; l and j = 1; 2; : : : ; nig, we see that I 2
G (E ), but p(d) 62 I, and so I 62 G (p(d)). Thus, we can never have G (E )  G (p(d)) for
any basic neighbourhood G (E ) of I = fp(d)g in the positive query topology. It follows
therefore that G (p(d)) is not open in the positive query topology and, hence, that the
positive query and positive atomic topologies are di erent.2
Corollary 2 If J satis es the matching condition, then the class of all sets G (E ) such
that E is a ground positive query forms a countable subbasis (in fact, basis) for the
positive query topology.
1

3.3 Convergence results in Q+

We consider next certain results concerning net convergence in ILJ when this set is
endowed with the topology Q . Since this latter topology is non-Hausdor , we lack
uniqueness of limits of convergent nets, or of lters for that matter. Such a lack is
often regarded in mathematics as to be sucient to render a non-Hausdor topology
unworkable. However, in this case ILJ is a lattice and this fact permits us to de ne the
notion of the greatest limit . Such a limit is unique, of course, and its use allows us to
overcome many of the problems posed by the failure of the Hausdor separation axiom.
The basic net convergence result for Q is as follows. It is proved in the same way
as Proposition 4 was proved and we omit the details.
Proposition 7 In the topology Q :
+

14

a) Every net I converges to .


b) If I 6= , a net I converges to I i every element of I is eventually an element
of I.

Let us again use the identi cation of each subset I with its characteristic function
I , as described in x2:1, this time to transport the topology Q to 2D . As a corollary of
Proposition 7, we easily obtain in complete generality the following result rst obtained
in [5] in the presence of the matching condition and using a considerable amount of
lattice theory.
+

Theorem 4 For an arbitrary preinterpretation J of L the topology Q on ILJ coincides


+

with the Scott topology.

Proof Suppose that I ! I in Q and A is any element of DL. Suppose rst that
A 2 I (thus we are supposing in particular that I 6= ), so that I (A) = 1. Since
I ! I , we see that A 2 I eventually by Proposition 7 and so I (A) = 1 eventually.
Thus, if U is given as either of the two possible Scott neighbourhoods f1g, f0; 1g of
I (A) in 2, eventually we have I (A) 2 U . Now suppose that A 62 I , including the
case that I = . Then I (A) = 0. The only Scott neighbourhood of 0 in 2 is f0; 1g
and obviously I (A) 2 f0; 1g eventually. Thus, we see that for each A 2 DL we have
I (A) ! I (A) in the Scott topology on 2.
Conversely, suppose for each A 2 DL that I (A) ! I (A) in the Scott topology
on 2; we will show then that I ! I in 2D i.e. that I ! I in ILJ . If I = , this
last conclusion is immediate from Proposition 7; otherwise suppose A is an arbitrary
element of I so that I (A) = 1. Let U = f1g be chosen as a Scott neigbourhood of
I (A). Since I (A) ! I (A), eventually I (A) 2 U i.e. eventually I (A) = 1 or, in
other words, eventually A 2 I as required.
We now see that convergence I ! I in Q is equivalent to pointwise convergence
in the Scott topology on 2. It follows, therefore that Q is coincident with the product
of the Scott topologies on 2 and in turn that it is coincident with the Scott topology
on 2D by [15, Page 122].2
From this theorem it follows that all the general facts about the Scott topology
apply to Q . For example, it must be the case that Q is T but not T , although it is
easy to see this directly.
Continuing with our main development, we have the following further consequences
of Proposition 7. First, if I ! I in Q and J  I , then we have I ! J . Next,
for any net I of interpretations in X = ILJ consider the set fJ 2 X ; I ! J g. This
set contains  and is hence never empty. We are led naturally,Stherefore, to de ne the
notion of the greatest limit, gl(I), of the net I by gl(I) = fJ 2 X ; I ! J g. It
follows immediately then that we have I ! gl(I), so that gl(I) is well named.
+

Proposition 8 Let I be a net of interpretations in ILJ .

a) If SI is monotonic increasing in the sense that I  I whenever   0 , then


gl(I) = I .
b) If IT is monotonic decreasing in the sense that I  I whenever   0 , then
gl(I) = I .
0

15

Proof a) Case 1. Suppose gl(I) =  and SI 6= .


In this case, some I is non-empty, say I0 is non-empty. Let A 2 I0 . Then A 2 I
whenever    by the monotonicity hypothesis. Hence, I ! I0 and so gl(I) 6= .
This contradiction means that S I =  and so we get gl(I) = S I in this case.
Case 2. Suppose that gl(I) = I 6= .
Let A 2 IS. Then A 2 I eventually, since
I ! gl(I), and so A 2 SI and
S
therefore I  I . Conversely, suppose A 2 I . ThenSA 2 I0 for some S and by
monotonicity
A 2 I whenever    . Therefore, I ! I and we have  I  I .
S
Thus, I =  I as required.
b) Case 1.T Suppose gl(I) =  and T I 6= .
Let A 2 I. Then A 2 I for all  and so A is eventually in I. It follows that
I ! TTI and hence gl(I) 6= . This contradiction gives TI =  and so we get
gl(I) = I in this case.
Case 2. Suppose gl(I) = I 6= .
Let A 2 I . Then A 2 I eventually i.e. there is  such that A 2 I whenever
  . Now let  be any element of the index set  of the given net. Since  is
directed by , there is  2  such that    and    . But then I0  I2 and
I1  I2 . By the fact that A 2 I whenever    we conclude that A 2 I2 , and
in
T
turn we deduce that A 2 I1 . In other words, A 2 I for every . Therefore, A 2  I
and so gl(I)  T I. TIn addition, we see that TI 6=  in this case.
Conversely, if A 2 I , then A 2 I for all  and so A is eventually in I. Therefore,
I ! T I and we have TI  I as required.2
In fact, we also have the following result.
0

Proposition 9 a) If I is monotonic increasing,T then I ! S I in Q.


b) If I is monotonic decreasing, then I !  I in Q.

SI = , then I =  for all  and the result is clear. So suppose that
Proof
a)
If
SI 6= . If A 2 SI, then A 2 I for some  =  . Thus, by monotonicity, A 2 I
0
whenever    and so A is eventually in I. If A 62 SI, if Ssuch A exists, then A 62 I
for any  and so A isT eventually not in I . Therefore, I !  I in Q as required.
b) Suppose A 2  I, if such A exists. Then A 2 I for all  and so A is eventually
in I. Suppose A 62 TI, if such A exists. Then A 62 I0 for some  =  . But then
by monotonicity,TA 62 I whenever    , and so A is eventually not in I as required.
Therefore, I !  I in Q.2
We now turn our attention to the immediate consequence map, TPJ or simply T ,
associated with any normal logic program, P , and we establish next the important fact
that TPJ is always continuous in the topology Q for any de nite logic program P . As
usual, our general reference for matters concerned with logic programming is [26], and
for convenience we recall that TPJ : IPJ ?! IPJ is de ned as follows, where IPJ denotes ILJ
and L is the underlying language of P :- TPJ (I ) is de ned to be the set of all p(d) 2 DL
such that there is a program clause p(t) L (t ); : : : ; Ln(tn) in P and a variable
assignment v satisfying Jv (t) = d i.e. p(t j v) = p(d) and I j=v L (t ) ^    ^ Ln (tn).
It is clear that TPJ (I ) 2 IPJ for each I 2 IPJ .
0

16

Theorem 5 The immediate consequence map TPJ is continuous in the topology Q for
+

any de nite logic program P .

Proof Let I 2 IPJ and let I ! I be a net converging to I in Q ; we must show


that T (I) ! T (I ) in Q , where T denotes TPJ . If T (I ) = , then it is immediate from
Proposition 7 a) that T (I) ! T (I ). So suppose that T (I ) 6=  and let A = p(d) belong
to T (I ). Thus, by the de nition of T , there is a program clause p(t) p (t ); : : : ; pn(tn)
and a variable assignment v such that p(t j v) = A and I j=v p (t ) ^    ^ pn(tn).
Case 1. The program clause is a unit clause i.e. n = 0.

In thiscase the body of the program clause is the empty conjunction  of atoms.
But I j=  for every  by Remark 4, and so A 2 T (I) for every . Hence, A 2 T (I)
eventually.
Case 2. The program clause is not a unit clause.
Since I j=v p (t )^  ^pn (tn) we have that p (t j v); : : : ; pn(tn j v) 2 I . But I ! I
and so eventually pi (ti j v) 2 I for i = 1; 2; : : : ; n. Thus, I j=v p (t ) ^    ^ pn(tn)
eventually and hence A 2 T (I) eventually.
Hence, in any case A is eventually in T (I) and so T (I) ! T (I ) as required.2
Remark. Since TPJ is actually lattice continuous, this last result can also be proved
by noting that Q coincides with the Scott topology, and then using a well known
theorem relating topological continuity and lattice continuity.
We now consider sequences of interpretations, iterates of the immediate consequence
map, T , and the connections that exist between xed points of T and the iterates of T .
The following result is elementary.
+

Proposition 10 Let I 2 IPJ and let T denote TPJ . Then in either Q or Q we have
+

T n(I ) convergent to an interpretation K i T n (I ) converges to K .


+1

Corollary 3 For any I 2 IPJ , we have that gl(T n(I )) = gl(T n (I )) = gl(T (T n(I ))).
+1

The form of Kleene's rst recursion theorem appropriate for the development of our
theory is contained in the next theorem and its corollary, Corollary 4, below.

Theorem 6 Let P be a de nite program and let T denote TPJ .


a) Suppose I 2 IPJ is such that fT n (I )g is monotone increasing. Then gl(T n(I )) is

a xed point of T . Conversely, every xed point of T arises as gl(T n(I )) for some such
I.
b) If T is continuous in Q and I 2 IPJ is such that fT n(I )g is monotone decreasing,
then gl(T n(I )) is a xed point of T .
n
Proof a) Here gl(T n(I )) = S1
n TS(I ). Hence, since every net converges to its greatn
n
n
estSlimit, we have that T (I ) ! 1
nS T (I ). Therefore, by Theorem 5, T (T (I )) !
n )) and so T n (I ) ! T ( 1 T n(I )). By Proposition 10 it now follows that
T( 1
n
n T (IS
n
T n(I ) ! T ( 1
n T (I )) and we obtain the inclusion
=1

=1

+1

=1

=1

T(

=1

[1 T n(I ))  gl(T n(I )) = [1 T n(I ):


n
n
=1

=1

17

n
m
In the other direction, if A 2 S1
n T (I ), then A 2 T (I ) for some m and we
n
canSassume m > 1 since fT (I )g is monotonic increasing. Hence, A 2 T (T m? (I )) 
n
T( 1
n T (I )) since TSis monotonic, PS being a de nite program. Therefore, we obtain
1 n
n
the reverse inclusion 1
n T (I )  T ( n T (I )) as required.
For the converse statement, suppose that I is a xed point of T . Then T n(I ) = I
for
so the sequence fT n(I )g is monotonic increasing. Therefore gl(T n(I )) =
S1 allT nn(Iand
) = I and this establishes
the claim.
n
T
1
n
n
gl(T (I )) = n T (I ) and so by Proposition 9 b) we have T n(I ) !
T1 b)T nHere
(I ) in Q. Therefore, by the hypothesisTthat T is continuous in this topology,
n
n
T (T n(I )) ! T (T1
T n(I )) i.e. T n (I ) ! T ( 1
n T
n T (I )). Hence, by Proposition 10
n
we have T n(I ) ! T ( 1
using the uniqueness
of limits in a Hausdor
n T (I )). Finally,
n (I ) = T (T1 T n (I )).2
space we obtain the required equality T1
T
n
n
=1

=1

=1

=1

=1

=1

=1

+1

=1

=1

=1

=1

=1

Corollary 4 Suppose P is a de nite logic program and T denotes TPJ . Then


a) lfp(T ), the least xed point of T , equals T " !.
b) If T is continuous in Q, then P is canonical (see [7, 18]).

Proof
any xed point, then   I . Hence T n()  I forS all n, and so
S1 T na)()IfI Iis. But
n
T n() is monotonic increasing and so gl(T n()) = 1
n
n T ()  I .
n
By Theorem 6, gl(T ()) is a xed point
and, by the last inclusion, is now seen to be
S
1
the least such. By de nition, T " ! = n T n() and so T " ! = lfpT(T ) as stated.
n
b) Let I be any xed point of T . Then I  DL and so I  1
n T (DL ). By
n
Proposition 8 b) this intersection is equal to gl(T (DL)) which is a xed point according
to the present hypothesis and Theorem 6 b). It is now clear
that gl(T n(DL)) is the
T
1
greatest xed point of T and, by de nition, T # ! = n T n(DL) = gl(T n(DL)).
Therefore, the greatest xed point of T is equal to T # ! and so P is canonical as
required.2
To nish this section we establish the Kowalski - van Emden theorem as a corollary
of the results above.
=1

=1

=1

=1

=1

Corollary 5 Let J be the Herbrand preinterpretation for a de nite logic program P , let

T denote TP and let MP denote the least Herbrand model of P . Then MP = lfp(T ) =
T " !.
Proof Now MP is a model of P and so we have T (MP )  MP , and hence T (T (MP )) 
T (MP ) using monotonicity of T . Therefore, T (MP ) is also a model of P . Hence,
MP  T (MP ) by de nition of MP and it follows that T (MP ) = MP and so MP is a
xed point of T . Clearly MP is equal to the least xed point of T since every xed
point is a model.2

4 Continuity in the topology

4.1 Sucient conditions for continuity in Q

In this section, we study in some considerable detail the map TPJ : IPJ ?! IPJ and its
continuity with respect to the topology Q; we also consider some of the consequences of
18

continuity. In general, TPJ is not continuous, as we shall see, relative to Q even when P
is a de nite program. Thus, one of the main tasks to be undertaken is the determination
of conditions which will ensure continuity and which, if possible, are simple to check in
terms of syntax, and this task we address rst.
Following [26] we recall that a normal program clause C is a clause of the form
p(t) L (t ); : : : ; Ln(tn), where n  0 and the Li are literals; this is sometimes
abbreviated to C
C ?. A normal program is a nite set of normal program clauses.
As shown in [26, Chapter 4], once one allows literals (i.e. negated atoms) to be present
in the bodies of program clauses, one can allow arbitrary rst order formulae to be
present. We shall not do that, however, and from now on the terms program clause
and program will mean normal program clause and normal program respectively.
Since we are not concerned here with resolution, we can always arrange the body of
C so that the positive literals are grouped at the left hand end and the negative ones
at the right hand end by relabelling the literals in the body if necessary, thus C takes
the form
p(t) p (t ); : : : ; pl(tl ); :pl (tl ); : : : ; :pn(tn);
where 0  l  n. We will often suppose this has been done for each program clause
in any normal logic program. Actually, on occasions it will be preferable to write C in
the form
p(t) p (t ); : : : ; pl(tl ); :q (s ); : : : ; :qm (sm );
where 0  l and 0  m, for purposes of notation and indexing.
For the rest of this section, P will denote an arbitrary normal logic program and
J will denote a preinterpretation of the underlying language L of P . The following
de nition is a natural companion to the notions DL and p(d) in that it is a combination
of both syntactic and semantical entities.
De nition 1. Let C be a clause p(t) L (t ); : : : ; Ln(tn) in P , where n  0. We
will call p(t j v) L (t j v); : : : ; Ln(tn j v), where v is a given variable assignment, the
J - instance of C determined by v and denote it by Jv (C ) or C j Jv . If J is understood,
we write simply C j v and refer to it as the v - instance of C . In general, we talk of J instances of C or just instances of C . If we have written C as C
C ?, then we may
?
write C j v C j v for C j v.
Given a v-instance p(t j v) L (t j v); : : : ; Ln(tn j v) of a clause C , we shall refer
to p(t j v) as the head of that instance and to L (t j v); : : : ; Ln(tn j v) as the body .
This terminology will not con ict with that usually applied to clauses, since the context
will always determine which is meant. Finally, two J - instances C j v and C j u of the
same clause C will be said to be di erent if either (i) C j v and C j u are di erent
elements of DL, or (ii) a J - instance of a literal present in C ? j v resp. present in
C ? j u is di erent from each J - instance of each literal present in C ? j u resp. present
in C ? j v. Two instances of a clause C which are not di erent will be said to be equal
or the same.
De nition 2. A program clause C : p(t) L (t ); : : : ; Ln(tn) in P , where n  0,
will be said to be of nite type relative to an element p(d) of DL and J if C has only
nitely many di erent J - instances with head p(d). The program P will be said to be
of nite type relative to p(d) and J if each clause in P is of nite type relative to p(d)
1

+1

+1

19

and J . Finally, P will be said to be of nite type relative to J if P is of nite type


relative to p(d) and J for each p(d) 2 DL.
We will allow this terminology to extend to the situation where there are no instances
of a clause C resp. of any clause in P with p(d) in the head. In this case, p(d) does
not occur as an instance of the head of C resp. does not occur as an instance of the
head of any clause in P .
Thus, if the clause C : p(t) L (t ); : : : ; Ln(tn) is of nite type relative to some
p(d) and J , then in general many di erent variable assignments give the same value
with respect to J to each literal Li (ti) in the body of C . In other words, we get
Li (Jv (ti)) = Li(Jv (ti)) for possibly many di erent variable assignments v; v0, where
i = 1; 2; : : : ; n.
1

Example 2.

Take C to be the clause p(x) :p(f (y)) and take J to be the preinterpretation in
which the domain of J is the set of integers and in which J assigns f to the function
f 0, where f 0(d) = d + 1. Then it is readily seen that C is not of nite type relative to
any p(d) 2 DL. On the other hand, if in J we assign f to a constant function f 0, then
C is of nite type relative to every p(d) 2 DL.
We turn now to the proof of one of our main results.

Theorem 7 Let P be a normal program and J be a preinterpretation of the language


L of P . Let I 2 IPJ and suppose that P has the property that whenever p(d) 2 DL and
TPJ (I ) j= :p(d), then P is of nite type relative to p(d) and J . Then TPJ is continuous
at I in the topology Q. In particular, if P is of nite type relative to J , then TPJ is
continuous in Q.

Proof Let I 2 IPJ be any interpretation satisfying the hypothesis of the theorem, and let
G = G (L(d)) be an arbitrary subbasic neighbourhood of T (I ) in Q, where T denotes
TPJ . We need to nd a neighbourhood G of I in Q such that T (G )  G .
Since G = G (L(d)) is a neighbourhood of T (I ), we have that T (I ) j= L(d). Suppose
rst that L is positive so that G is of the form G (p(d). Thus, T (I ) j= p(d) and so
p(d) 2 T (I ). Therefore, there is a program clause C in P of the form
2

p(t)

p (t ); : : : ; pl (tl ); :q (s ); : : : ; :qm (sm)


1

(in which l + m  0) and a variable assignment v with the


following properties.


a) If l + m = 0, then C j v is the unit clause p(d)  and, trivially, I j= .
b) If l + m > 0, then C j v is, say,

p(d)

p (d ); : : : ; pl(dl ); :q (e ); : : : ; :qm (em)


1

and I j= p (d ) ^  ^ pl (dl ) ^:q (e ) ^  ^:qm (em), where di = Jv (ti) for


i = 1; 2; : : : ; l

and ej = Jv (sj ) for j = 1; 2; : : : ; m. If a) is the case, put G = G () = IPJ . Then

G is a neighbourhood of I and if I 0 2 G , then I 0 j=  and so p(d) 2 T (I 0) i.e.
T (I 0) j= p(d). Thus, T (I 0) 2 G and we have T (G )  G as required. In case b), put
G = G (p (d ) ^    ^ pl (dl ) ^ :q (e ) ^    ^ :qm (em )) which is a neighbourhood of I .
1

20

If I 0 2 G , then I 0 j= p (d ) ^   ^ pl (dl ) ^ :q (e ) ^   ^ :qm (em ) and so p(d) 2 T (I 0)


i.e. T (I 0) j= p(d) and so T (I 0) 2 G . Thus, again we have T (G )  G as required.
This covers the case when L is positive.
Now suppose that L is negative, so that G = G (:p(d)). In this case we have
T (I ) j= :p(d) i.e. p(d) 62 T (I ).
Case 1. Suppose that p(d) is not the head of any instance of any program clause in
P.
In this case put G = IPJ itself so that G is a neighbourhood of I . Now let I 0 2 G .
Then by the hypothesis of this case, we have p(d) 62 T (I 0) and so T (I 0) j= :p(d). Thus,
T (I 0) 2 G and again we have T (G )  G , as required.
Case 2. Suppose that p(d) is the head of some instance of some clause in P .
If the clause C just referred to in the hypothesis of this case were a unit clause
p(t) , so that the instance in question were p(d) , then T (I ) would contain p(d)
which is not the case. Thus, any such clause C in this case is not a unit clause; let
1

p(t)

p (t ); : : : ; pl (tl ); :q (s ); : : : ; :qm (sm)


1

(with l + m  1) be a typical clause C in P with p(d) as an instance of its head. Since


p(d) 62 T (I ) we must have I 6j=v p (t ) ^    ^ pl (tl ) ^ :q (s ) ^    ^ :qm (sm ) for any
variable assignment v such that p(t j v) = p(d). In other words, if v is any variable
assignment such that p(t j v) = p(d), then
1

I 6j= p (d ) ^    ^ pl (dl ) ^ :q (e ) ^    ^ :qm (em)


1

(1)

where di = Jv (ti), for i = 1; 2; : : : ; l, and ej = Jv (sj ), for j = 1; 2; : : : ; m. It follows that


some of the pi(di) do not belong to I , for 0  i  l, and some of the qj (ej ) do belong to
I , for 0  j  m. Let p (d ); : : : ; pk (dk ), where 0  k  l, be the totality of the pi(di)
in (1) which do not belong to I , and let :q (e ); : : : ; :qk (ek ), where 0  k0  m, be
the totality of the :qj (ej ) in (1) for which qj (ej ) does belong to I , in some reordering of
the body if necessary. Then I j= :p (d ) ^    ^ :pk (dk ) ^ q (e ) ^    ^ qk (ek ). Carry
out this process for each instance of each program clause with p(d) in the head. By
our hypothesis concerning P being of nite type relative to p(d) and J , there are only
nitely many instances to consider. So let fp (d ); : : : ; p (d )g be the entire collection
of all instances of positive literals (i.e. atoms) which occur amongst the bodies of the
instances of the clauses referred to above and which do not belong to I . Similarly, let
f:q (e ); : : : ; :q (e )g be the entire collection of all instances of negative literals which
occur amongst the bodies of the instances of the clauses referred to above for which
q (e ); : : : ; q (e ) do belong to I . Then
1

I j= :p (d ) ^    ^ :p (d ) ^ q (e ) ^    ^ q (e ):
1

Put G = G (:p (d ) ^  ^:p (d ) ^ q (e ) ^  ^ q (e )) so that G is a neighbourhood


of I in Q. Now suppose that I 0 2 G . Then I 0 j= :pi (di), for i = 1; : : : ; , and
I 0 j= qj (ej ), for j = 1; : : : ; . Thus, if p(d) C ? j v is any instance of any program
clause with p(d) in its head, C ? j v will either contain at least one pi(di), where
i = 1; : : : ; , or at least one :qj (ej ), where j = 1; : : : ; . It follows that I 0 6j= C ? j v and
1

21

so p(d) 62 T (I 0) i.e. T (I 0) j= :p(d). Therefore, T (I 0) 2 G and we have T (G )  G as


required.
Since a basic neighbourhood of T (I ) is a nite intersection of subbasic neighbourhoods of T (I ), it suces to consider the two subbasic neighbourhoods G (p(d)) and
G (:p(d)) as above. Hence, T is continuous at I in Q.2
Recall that a variable symbol (or simply variable) in a program clause is called local
if it appears only in the body of that clause, see [27]. The following corollary generalises
[6, Theorem 12].
2

Corollary 6 Suppose that J is a preinterpretation of L in which each function symbol

f is assigned to an injective function f 0. If P is a normal program, with underlying


language L, and P has no local variables, then TPJ is continuous in Q. In particular, if
J is the Herbrand preinterpretation of the underlying language of a normal program P
and P has no local variables, then TPJ is continuous in Q.
Proof Let C be a program clause p(t) p (t ); : : : ; pn(tn) in P and suppose that
x ; : : : ; xk are all the variable symbols which appear in p(t). By the hypothesis that P
contains no local variable symbols, there are no other variable symbols in C . Let v and
v0 be two variable assignments and suppose that p(t j v) = p(t j v0). By the hypothesis
concerning injectivity, which holds in particular in any Herbrand preinterpretation, we
see that v(xi) = v0(xi ) for i = 1; : : : ; k. From this it follows that C ? j v = C ? j v0 and
in turn it follows that P is of nite type relative to J . The conclusion now follows from
Theorem 7.2
Example 3. Consider the program P as follows
p(o)
p(s(x)) p(x)
Take J to be the preinterpretation de ned in Example 1. It is clear that P is of nite
type relative to J and so TPJ is continuous in Q in this case. Similarly, the same
conclusion is drawn if we take J to be the Herbrand preinterpretation of P .2
We next give a useful result which is a partial converse to Theorem 7, stated in
contrapositive form.
Theorem 8 Let P be a normal program and J be a preinterpretation of the language
L of P . Suppose that P has a clause C of the form
p(t) p (t ); : : : ; pl (tl ); :q (s ); : : : ; :qm (sm)
which has in nitely many di erent J - instances with the same head p(d), say, but is
such that no instance of any literal occurs in nitely often in the bodies. Then TPJ is
discontinuous in Q at any I 2 IPJ such that TPJ (I ) j= :p(d).
1

Proof First we note that the hypothesis that C has in nitely many di erent instances
with the same head forces l + m  1.
Suppose I 2 IPJ and T (I ) j= :p(d), where T denotes TPJ as usual. Consider the
neighbourhood G = G (:p(d)) of T (I ). Let G = G (r (f ) ^    ^ r (f ) ^ :r0 (f 0 ) ^
2

22

   ^ :r0 (f 0 )) be an arbitrary basic neighbourhood of I in Q. Thus, I j= r (f ) ^    ^


r (f ) ^ :r0 (f 0 ) ^    ^ :r0 (f 0 ). By the hypothesis, there must be an instance C j v of
the clause C , say p(d) p (d ); : : : ; pl (dl ); :q (e ); : : : ; :qm (em ), such that no ri(fi)
occurs (either positively or negatively) in the body of C j v, for i = 1; : : : ; , and no
rj0 (f 0 j ) occurs (either positively or negatively) in the body of C j v, for j = 1; : : : ; .
Let I 0 = fp (d ); : : : ; pl (dl ); r (f ); : : : ; r (f )g; then I 0 2 G and I 0 j= C ? j v. Hence
p(d) 2 T (I 0) i.e. T (I 0) j= p(d) and so T (I 0) 62 G . Therefore, T (G ) 6 G and so
1

T is discontinuous at I , as required, since a basic neighbourhood G suces for this


argument.2
We now consider some examples which illustrate this theorem, the previous one and
Corollary 6.
1

Example 4.

1) Let P be the program

p(o)
p(s(x)) p(x)
p(s (o)) p(s (x)):
Let J be the Herbrand preinterpretation. By Theorem 8, TPJ is discontinuous at ,
fp(o)g, fp(s(o))g and fp(o); p(s(o))g since all these satisfy TPJ (I ) j= :p(s (o)) and the
remaining hypotheses of Theorem 8 are satis ed.
On the other hand, if I is any interpretation other than the four already listed and
J
TP (I ) j= :p(sn (o)), for some n, then n 6= 3. But then P is of nite type relative to J
and p(sn(o)) and therefore TPJ is continuous at such I in Q by Theorem 7.
2) Let P be the program
p(o)
p(s(x)) p(x)
p(f (x)) p(s (x)):
Let J be the preinterpretation in which the domain is the Herbrand universe of the
previous example and in which o is assigned to itself, s is assigned to the function
t 7?! s(t) and f is assigned to the function f 0 de ned by f 0(t) = s (o) for all t. Again,
TPJ is discontinuous at exactly the same points as in 1).
3) Many of the well known standard Prolog programs, such as quicksorting list
sorting programs, are of nite type relative to their intended preinterpretations and
therefore have continuous immediate consequence map.
Note. The program 2) in Example 4 above has no local variables. Of course the
function f 0 there is highly non injective and so this example shows that it is essential
to impose the condition that each f 0 be injective in the hypothesis of Corollary 6.
This suggests that the search for a purely syntactic condition ensuring continuity of the
immediate consequence map in every interpretation is unlikely to succeed.
These two theorems, i.e. Theorems 7 and 8, together do not provide necessary
and sucient conditions for the continuity of TPJ , although they suggest the right sort
of conditions to consider; we delay the provision of such conditions until Theorem 9
below. Nevertheless, they are easier to apply than Theorem 9 and together cover many
3

23

situations dealing with numerous examples and counterexamples, some of which we


have just seen and more we will see later. For instance we proceed next to settle
an obvious question prompted by Theorem 8: \What happens if instances of certain
atoms occur in nitely often in the bodies of the clauses postulated in Theorem 8?" The
answer to this question, as we show, is that TPJ will be continuous at some I s for which
TPJ (I ) j= :p(d) and discontinuous at others also satisfying TPJ (I ) j= :p(d).

Example 5.

Consider the program P as follows

p(o)
p(s(x)) p(x)
p(s (o)) p(s(o)); p(s (x)):
Let J be the Herbrand preinterpretation. There are in nitely many di erent instances
of the third clause with head p(s (o)) and the instance p(s(o)) occurs in each body and
therefore in nitely often. Consider again the four interpretations ; fp(o)g; fp(s(o))g
and fp(o); p(s(o))g; they all satisfy TPJ (I ) j= :p(s (o)).
a) TPJ is not continuous at fp(s(o))g and fp(o); p(s(o))g.
Proof We show this for I = fp(o); p(s(o))g with a similar argument for fp(s(o))g.
Consider the sequence of interpretations In de ned by:3

In = fp(o); p(s(o)); p(sn (o)); : : :g:


+1

By Proposition 4 it is immediate that In ! I . Furthermore, we have TPJ (I ) =


fp(o); p(s(o)); p(s (o))g and p(s (o)) 2 TPJ (In) for every n. Hence, TPJ (In) 6! TPJ (I )
and so TPJ is not continuous at I . Similarly for I = fp(s(o))g.
b) TPJ is continuous at  and fp(o)g.
Proof Take I = fp(o)g with a similar argument for I = .
Let In be any sequence such that In ! I in the atomic topology Q. Now TPJ (I ) =
fp(o); p(s(o))g. Consider TPJ (In). Obviously p(o) 2 TPJ (In) for all n. Since p(o) 2 I , we
have p(o) 2 In eventually and hence p(s(o)) 2 TPJ (In) eventually. So eventually p(o)
and p(s(o)) both belong to TPJ (In). For non containment, since p(s(o)) 62 I , we have
p(s(o)) 62 In eventually. So eventually In 6j= p(s(o)) ^ p(s (x)) and so eventually the
third clause in the program ceases to apply and thus eventually ceases to put p(s (o))
into TPJ (In).
As far as the second clause is concerned, if p(sm (o)) 2 TPJ (In) for some m  2 as a
result of this second clause, then p(sm? (o)) 2 In for m ? 1  1 which is eventually not
the case since p(sm? (o)) 62 I for m ? 1  1. Therefore, TPJ (In) ! TPJ (I ) and so TPJ is
continuous at I as required. Similarly for I = .2
We shall return to this example again in illustrating Theorem 9.
2

4.2 Necessary and sucient conditions

We turn our attention now to the derivation of necessary and sucient conditions for
continuity of TPJ in the topology Q, and it will be convenient to rst extend slightly
24

the notation used to express De nitions 1 and 2. So let C be a clause in the normal
program P and let p(d) 2 DL. We shall let CSp d denote the set of all instances of C
with p(d) in the head, and we let C (p(d)) = C 2P Cp d denote the set of all instances
of each clause in P which contain p(d) in the head. In general, either of these sets can
be empty, of course, and the latter situation occurs precisely when p(d) occurs as no
instance of the head of any clause C .
Consider once again the proof of Theorem 7. In [29], J. McCarthy noted that the
argument given in Case 2 of this proof can be abstracted as follows. Let us write Ai (ai)
for the elements pi(di ) of DL which occur there, where i = 1; 2; : : : ; , and let us write
Bj (bj ) for the elements qj (ej ), where j = 1; 2; : : : ; . Given I 2 ILJ , McCarthy observed
that the proof of Theorem 7 shows that a sucient condition for continuity of TPJ at
I is that whenever p(d) 2 DL and TPJ (I ) j= :p(d) either C (p(d)) is empty or there
is a nite set S (I; p(d)) = fA (a ); : : : ; A (a ); B (b ); : : : ; B (b )g of elements of DL
with the following properties:(i) I j= :A (a ) ^    ^ :A (a ) ^ B (b ) ^    ^ B (b )
(ii) Given any instance C j v 2 C (p(d)) at least one Ai(ai) or at least one :Bj (bj )
occurs in C ? j v.
J. McCarthy in [29] also gave a partial proof that this condition is necessary for
the continuity of TPJ at I . We now prove in Theorem 9 that this condition is indeed
necessary for continuity and therefore both necessary and sucient for the continuity
of TPJ at I ; thus Theorem 9 is due to J. McCarthy and the author. It will be convenient
to make a slight notational change to the formulation of the condition.
( )

( )

Theorem 9 Let P be a normal program and let J be a preinterpretation of the language L of P . Then TPJ is continuous at I 2 IPJ if and only if whenever p(d) 2 DL
and TPJ (I ) j= :p(d) either C (p(d)) is empty or there is a nite set S (I; p(d)) =
fA (a ); : : : ; Ak (ak ); B (b ); : : : ; Bk (bk )g of elements of DL with the following proper1

ties:(i) I j= A1 (a1 ) ^    ^ Ak (ak ) ^ :B1 (b1 ) ^    ^ :Bk (bk )


(ii) Given any instance C j v 2 C (p(d)) at least one :Ai (ai ) or at least one Bj (bj )
occurs in C ? j v.
0

Proof As we have already observed, the proof of Theorem 7 establishes suciency of


the condition, allowing for the slight notational change made in the formulation of the
condition as stated in the present theorem.
For necessity, we shall in fact establish the contrapositive of the required conclusion,
namely that failure of the stated condition relative to I implies discontinuity of TPJ at
I ; the details resemble those in the proof of Theorem 8.
Suppose, therefore, that there is some p(d) 2 DL satisfying TPJ (I ) j= :p(d),
satisfying C (p(d)) 6=  and such that for every nite set S (I; p(d)) of the stated
form either (i) is not satis ed or (ii) is not satis ed. Let G = G (A (a ) ^    ^
Ak (ak ) ^ :B (b ) ^    ^ :Bk (bk )) be an arbitrary basic neighbourhood of I , and
let S (I; p(d)) = fA (a ); : : : ; Ak (ak ); B (b ); : : : ; Bk (bk )g. Then I j= A (a ) ^    ^
Ak (ak ) ^ :B (b ) ^    ^ :Bk (bk ) and so S (I; p(d)) satis es (i), and therefore does
not satisfy (ii). Hence, it follows that there is an element C j v of C (p(d)), of the
1

25

form p(d) p (d ); : : : ; pl (dl ); :q (e ); : : : ; :qm (em ) say, such that no :Ai (ai) occurs
in C ? j v and no Bj (bj ) occurs in C ? j v. Thus, no Ai(ai ) equals any qj (ej ) and no
Bi(bi ) equals any pj (dj ). Put I 0 = fA (a ); : : : ; Ak (ak ); p (d ); : : : ; pl (dl )g. Then we
have
a) I 0 2 G, since A (a ); : : : ; Ak (ak ) evidently belong to I 0 , and no Bj (bj ) belongs to
I 0 because no Bj (bj ) can be an Ai(ai ) (since (i) is satis ed) and no Bj (bj ) equals any
pi(di ). Also
b) I 0 j= p (d )^  ^pl (dl )^:q (e )^  ^:qm (em), since p (d ); : : : ; pl (dl ) evidently
belong to I 0 and no Ai(ai ) equals any qj (ej ).
But then TPJ (I 0) j= p(d) and therefore TPJ is not continuous at I as required.2
Example 5 bis. It will be illuminating to return to Example 5 and consider it in
the light of Theorem 9. In doing this we will gain some insight into where the Ai (ai)
and the Bj (bj ) in Theorem 9 come from and why Theorem 7 does not provide necessary
and sucient conditions for continuity.
a) TPJ is not continuous at fp(s(o))g and fp(o); p(s(o))g.
Here and in b) below, we take p(d) = p(s (o)) and of course C (p(s (o))) 6= . Let
us take I = fp(o); p(s(o))g, let us suppose S = S (I; p(d)) is any nite set of the form
in the hypothesis of Theorem 9 and let us suppose that (i) is satis ed there. This last
supposition forces S to have one of the following four forms:S = fp(o); p(s(o)); B (b ); : : : ; Bk (bk )g
S = fp(o); B (b ); : : : ; Bk (bk )g
S = fp(s(o)); B (b ); : : : ; Bk (bk )g
S = fB (b ); : : : ; Bk (bk )g
Let p(s (o)) p(s(o)); p(s (sn(o))) be an arbitrary instance of the third clause in P .
Certainly neither :p(o) nor :p(s(o)) occurs in the body of this instance and so if (ii) is
to be satis ed, a Bj (bj ) must occur. But Bj (bj ) cannot be either p(o) or p(s(o)) since
(i) is satis ed, and so we must have Bj (bj ) = p(s (sn(o))). However, this is impossible
to achieve for each n with only nitely many Bj (bj ), whichever form S takes. Therefore
it is impossible to satisfy the hypothesis of Theorem 9 and it follows that TPJ is not
continuous at I as required. A slightly simpler form of precisely this argument settles
the issue if I = fp(s(o))g.
b) TPJ is continuous at  and fp(o)g.
In either case take S (I; p(d)) = fB (b ); B (b )g = fp(s(o)); p(s (o))g; certainly
then the hypothesis (i) of Theorem 9 is satis ed by either value of I . For (ii), let
C j v be an arbitrary element of C (p(s (o))). If C j v is p(s (o)) p(s (o)), then
B (b ) = p(s (o)) 2 C ? j v. If C j v is p(s (o)) p(s(o)); p(s (sn(o))), then B (b ) =
p(s(o)) 2 C ? j v. Therefore (ii) is also satis ed and we have continuity at either value
of I as required.2
This example shows that the set S (I; p(d)) contains elements of DL drawn from
amongst instances of clause bodies. However, the choice is more judicious than merely
taking entire clause bodies which e ectively is what is done in Theorem 7.
1

26

4.3 Some consequences of continuity of TPJ

It is our intention now to consider brie y some of the conclusions which can be drawn
about a normal logic program P if TPJ is known to be continuous in Q.

4.3.1 Connections with Maher's work

In [27, Page 639] Michael Maher introduced the concept of down continuity of TPJ in
the case of the Herbrand preinterpretation J and a de nite program P . We show next
that continuity in Q and down continuity are exactly the same thing.

Theorem 10 Suppose that P is a de nite program and J is the Herbrand preinterpretation of the underlying language of P . Then TPJ is continuous in the topology Q i it
is down continuous.

Proof Suppose
rst that TPJ is continuous in Q and that fIg is a decreasing net. Then
T
J
J
I !
 I in Q by Proposition 9 b). Since TP is continuous, we have TP (I ) !
T
J
J
J
TP ( I). But TP is monotonic and therefore fTTP (I )g is monotone decreasing. Hence
by Proposition 9 b) again we have
TPJ (IT) ! TPJ (I). Using uniqueness of limits
T
once more in Q, we obtain TPJ ( I) = TPJ (I) as required and hence TPJ is down
continuous.
Conversely, suppose that TPJ is down continuous. By [27, Theorem 3] P is subsumption equivalent to a program in which no clause has local variables. By [27, Theorem
2] we may assume that P is itself such a program. By Corollary 6 it now follows that
TPJ is continuous as required.2
Since Maher showed in [27] that a program for which TPJ is down continuous is
canonical, Theorem 10 gives an alternative proof (to Corollary 4) of the fact that TPJ
continuous in Q implies that P is canonical. Of course the converse of this statement
is false and we will show more than this in Example 6 below.
There is an interesting generalisation of these ideas and we now give J. McCarthy's
proof of a result he obtained in [29] connecting canonical programs and continuity, and
which identi es an interesting class of programs which are canonical.

Proposition 11 Let P be a de nite logic program and let T denote TPJ . If T is continuous at T # ! in Q, then P is canonical.
Proof Suppose that T is continuous at T # !. Then for any net I ! T # ! we have
T (I) ! T (T # !). In particular, the sequence T # n converges to T # ! and hence
T (T # n) ! T (T # !) i.e. T # (n + 1) ! T (T # !). Therefore by Proposition 10
we have T # (n + 1) ! T # !, and by using uniqueness of limits in Q yet again we
obtain T (T # !) = T # !. Thus, T # ! is a xed point of TPJ and so P is canonical as
required.2
Since, in general, continuity at a given point does not imply continuity at every point,
the class of programs which satisfy Proposition 11 is strictly larger than the class of
programs for which TPJ is continuous (or down continuous). In fact, in Example 4 1) TPJ
there is continuous at TPJ # ! but is not continuous (nor down continuous therefore).
27

Indeed, continuity at TPJ # ! seems a very weak condition relative to continuity or


down continuity, and therefore the class identi ed in Proposition 11 is likely to be
considerably larger than the class of programs for which TPJ is continuous. Nevertheless,
this class does not include all canonical programs for the following example shows that
the converse of Proposition 11 is false.
Example 6. P de nite and canonical does not imply that TPJ is continuous at
J
TP # ! in the topology Q.
Take P to be the following program
p(a) p(x); q(x)
q(b)
q(f (x)) q(x)
and take J to be the Herbrand preinterpretation. Then we have TPJ # ! = TPJ # (! +1) =
fq(f n(b)); n  0g and it follows that P is canonical. Since we have TPJ # ! j= :p(a) it
follows from Theorem 8 that TPJ is not continuous at TPJ # ! as required.2

Comment.

1) An interesting question which arises at this point is whether or not any normal program can be transformed into an equivalent program for which the immediate
consequence map is continuous in Q (assuming that this is not already the case). By
the term equivalent here is meant preservation of semantics in some sense which would
need to be investigated. In particular, the question arises as to whether or not the
procedure of Ja ar and Stuckey or Blair's adaptation of it, see [7, 18], does this for
de nite programs and, if so, can it be extended to normal programs ? In fact, it cannot
be possible to obtain continuity of TPJ since this is equivalent to down continuity of TPJ
as we have seen and, as observed by Maher in [27], the down continuous programs do
not constitute all cases when gfp(TPJ ) = TPJ # !. Perhaps, however, one can transform
to obtain continuity at TPJ # ! ? Indeed, as we have already observed, the class of
programs P for which TPJ is continuous at TPJ # ! seems to be a much larger class than
the class of continuous or down continuous programs or, for that matter, the class of
programs Fitting [12] considers acceptable (this class coincides with the class of down
continuous programs anyway when P is de nite). We put forward, therefore, this new
class of programs as a candidate for a class of programs with good semantic properties
perhaps large enough to be considered as acceptable although we do not know whether
or not this class can express \transitive closure" ? One nal point in this context. The
requirement that a program be canonical i.e. that gfp(TPJ ) = TPJ # ! is essentially a
\local" condition whereas conditions such as continuity or down continuity are global.
The requirement simply of continuity at TPJ # ! is more sensitive to the conclusions one
wishes to draw and for that reason may well indeed prove to be better suited to these
tasks.
2) The observations made in 1) are related to the decency thesis of Ja ar, Lassez
and Maher [17] in that one would expect that well written programs would, in their
intended interpretation, possess the sort of niteness expressed in Theorems 7 and 9
and would therefore be continuous in the sense that TPJ is continuous in Q. Our point
of view, therefore, is that the class of continuous programs is a natural one to consider
even though it is not big enough for all purposes.
28

4.3.2 Compactness of spaces of models

With our standard notation, let MPJ denote the set of all interpretations I in IPJ which
are models of P . The proof of the next result is based on standard, elementary methods
from the study of dynamical systems.

Proposition 12 Let P be a normal program and suppose that TPJ is continuous in Q.

Then
a) The set MPJ is closed in IPJ .
b) The set Fix(P ) of all xed points of TPJ is closed in IPJ .

Proof a) Suppose that I ! I in Q and I 2 MPJ for each . We must show that
I 2 MPJ . Now, as is well known (see [26]), I is a model for P i TPJ (I )  I . Thus, for
each  we have TPJ (I)  I and we must show that TPJ (I )  I . By continuity, we have
TPJ (I) ! TPJ (I ). Let A 2 TPJ (I ). Then A 2 TPJ (I) eventually and therefore A 2 I
eventually. If A were not in I , then since I ! I , we would have A not in I eventually.
This contradiction means that A 2 I as required.
b) Suppose that I ! I in Q and I 2 Fix(P ) for each . We want to show that
I 2 Fix(P ) i.e. that I is a xed point. By continuity again, we have TPJ (I) ! TPJ (I ).
But TPJ (I) = I for each  and so we have I ! TPJ (I ). Therefore by uniqueness of
limits we have that TPJ (I ) = I and I is a xed point as required.2
We nish our work with an interesting observation concerning the topological nature
of MPJ and Fix(P ).

Corollary 7 With the hypotheses of Proposition 12, both MPJ and Fix(P ) are compact.
Proof By Theorem 1 and Proposition 12 both these spaces are closed subspaces of a
compact Hausdor space and are hence compact.2

References
[1] K. R. Apt, H. A. Blair and A. Walker, Towards a Theory of Declarative Knowledge.
In: Jack Minker (Ed.), Foundations of Deductive Databases and Logic Programming. Morgan Kaufmann Publishers Inc., Los Altos, 1988.
[2] A. Batarekh, Topological Aspects of Logic Programming. Ph. D. Thesis, Syracuse
University, June 1989.
[3] A. Batarekh and V. S. Subrahmanian, A T Space of Models of Logic Programs
and their Completions Part 1: Foundations, Technical Report, LPRG - TR88 -15,
Syracuse University, 1988.
[4] A. Batarekh and V. S. Subrahmanian, Semantical Equivalences of (Non Classical)
Logic Programs. In: K. Bowen and R. Kowalski (Eds.), Proc. 5th Intl. Conference
on Logic Programming. MIT Press, 1988, pp. 960-977.
4

29

[5] A. Batarekh and V. S. Subrahmanian, The Query Topology in Logic Programming.


In: Proc. 1989 Symposium on Theoretical Aspects of Computer Science. Lecture
Notes in Computer Science, Vol. 349, Springer-Verlag, 1989, pp. 375-387.
[6] A. Batarekh and V. S. Subrahmanian, Topological Model Set Deformations in
Logic Programming, Fundamenta Informaticae XII (3) (1989) 357-400.
[7] H. A. Blair, Canonical Conservative Extensions of Logic Program Completions. In:
Proc. 1987 Symposium on Logic Programming, San Francisco, pp. 154-161.
[8] H. A. Blair, personal communication, 1993.
[9] H. A. Blair, A. L. Brown and V. S. Subrahmanian, A Logic Programming Semantics
Scheme Part 1, Technical Report, LPRG - TR88 - 8, Syracuse University, 1988.
[10] H. A. Blair and V. S. Subrahmanian, Paraconsistent Logic Programming. In: Seventh Conference on Foundations of Software Technology and Theoretical Computer
Science, December 1987. Lecture Notes in Computer Science, Vol. 287, SpringerVerlag, 1987, pp. 340-360.
[11] M. H. van Emden, Quantitative Deduction and its Fixpoint Theory, J. Logic Programming (1986) 37-53.
[12] Melvin Fitting, A Kripke-Kleene Semantics for Logic Programs, J. Logic Programming (1985) 295-312.
[13] Melvin Fitting, Bilattices and the Semantics of Logic Programming, J. Logic Programming (1991) 91-116.
[14] Melvin Fitting, Metric Methods: Three Examples and a Theorem, J. Logic Programming , to appear.
[15] G. Gierz, K. H. Hofmann et al., A Compendium of Continuous Lattices. SpringerVerlag, 1980.
[16] I. Guessarian, Some Fixpoint Techniques in Algebraic Structures and Applications
to Computer Science, Fundamenta Informaticae X (1987) 387-414.
[17] J. Ja ar, J-L. Lassez and M. J. Maher, Some Issues and Trends in the Semantics
of Logic Programming. In: Proc. 3rd Intl. Conf. on Logic Programming. Lecture
Notes in Computer Science, Vol. 225, Springer-Verlag, 1986, pp. 223-241.
[18] J. Ja ar and P. J. Stuckey, Canonical Logic Programs, J. Logic Programming
(1986) 143-155.
[19] P. T. Johnstone, Stone Spaces. Cambridge Studies in Advanced Mathematics 3,
Cambridge University Press, 1982.
[20] M. A. Khamsi, V. Kreinovich and D. Misane, A New Method of Proving the
Existence of Answer Sets for Disjunctive Logic Programs: A Metric Fixed Point
Theorem For Multi-Valued Mappings, Preprint, 1994.
30

[21] K. Kunen, Negation in Logic Programming, J. Logic Programming (1987) 289-308.


[22] K. Kunen, Signed Data Dependencies in Logic Programs, J. Logic Programming
(1989) 231-245.
[23] K. Kunen, Declarative Semantics of Logic Programming, Bull. European Association for Theoretical Computer Science 44 (1991) 147-167.
[24] J-L. Lassez and M. Maher, Optimal Fixed Points of Logic Programs, Theoretical
Computer Science 39 (1985) 15-25.
[25] J-L. Lassez, V. L. Nguyen and E. A. Sonenberg, Fixed Point Theorems and Semantics: A Folk Tale, Information Processing Letters 14 (3) (1982) 112-116.
[26] J. W. Lloyd, Foundations of Logic Programming. Springer-Verlag, 2nd Edition,
Berlin, 1988.
[27] M. Maher, Equivalences of Logic Programs. In: Jack Minker (Ed.), Foundations of
Deductive Databases and Logic Programming. Morgan Kaufmann Publishers Inc.,
Los Altos, 1988.
[28] M. Maher, personal communication, 1993.
[29] J. McCarthy, unpublished manuscript, Department of Mathematics, University
College, Cork, 1990.
[30] A. Melton, Topological Spaces for CPOs. In: H. Ehrig et al. (Eds.), Categorical Methods in Computer Science with Aspects from Topology. Lecture Notes in
Computer Science, Vol. 393, Springer-Verlag, 1989, pp. 302-314.
[31] A. Mycroft, Logic Programs and Many-Valued Logic. In: M. Fontet and K. Melhorn
(Eds.), Proceedings 1984 Symposium on Theoretical Aspects of Computer Science.
Lecture Notes in Computer Science, Vol. 166, Springer-Verlag, 1984, pp. 274-286.
[32] A. W. Roscoe, Topology, Computer Science, and the Mathematics of Convergence.
In: G. M. Reed, A. W. Roscoe and R. F. Wachter (Eds.), Topology and Category
Theory in Computer Science. Oxford University Press, 1991, pp. 1-27.
[33] A. K. Seda, Topological Methods in Logic Programming, Technical Report, Department of Mathematics, University College, Cork, 1993.
[34] A. K. Seda, Some Applications of General Topology to the Semantics of Logic
Programs, Bull. European Association for Theoretical Computer Science 52 (1994)
279-292.
[35] A. K. Seda, A Topological View of the Kowalski - van Emden Theorem, Bull.
European Association for Theoretical Computer Science 53 (1994) 256-263.
[36] J. C. Shepherdson, Unsolvable Problems for SLDNF Resolution, J. Logic Programming (1991) 19-22.
31

[37] M. B. Smyth, Power Domains and Predicate Transformers: A Topological View.


In: J. Diaz (Ed.), Automata, Languages and Programming. Lecture Notes in Computer Science, Vol. 154, Springer-Verlag, 1983, pp. 662-675.
[38] M. B. Smyth, Topology. In: S. Abramsky, D. M. Gabbay and T. S. E. Maibaum
(Eds.), Handbook of Logic in Computer Science Vol. 1. Oxford Science Publications, Oxford University Press, 1992, pp. 641-761.
[39] S. Willard, General Topology. Addison Wesley Series in Mathematics, Addison
Wesley Publishing Company Inc., Massachusetts, 1970.

32

Vous aimerez peut-être aussi