Académique Documents
Professionnel Documents
Culture Documents
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 denite programs; (iv)
Maher's down continuous programs; (v) the decency thesis of Jaar, 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 denite 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 dened 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 stratied programs by adopting a dierent 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"
dened 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 dened 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 denite)
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 unied 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 dened
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 dened 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 dene
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
closure. We nish by observing that the result of McCarthy [29], which we discuss in
Section 4, to the eect 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 signicant 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
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 dened 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 denition 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
identied 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
Example 1.
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 dened 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
=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 .
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 dierent, 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.
=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 quantier in a query.
This forces one to take unions as above with the result that there are not enough open
sets.
Proposition 3 The query topology coincides with Q i J satises the matching condition. In particular, these topologies coincide for the Herbrand preinterpretation.
Proof Suppose rst that J satises 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 satised and let DL be
dened 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 satises 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.
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.
=1
=1
By hypothesis and the directedness of (; ), we can choose so large (after n + m
steps) that whenever we have
0
10
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
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 dene the metric i on 2i for each i by
=1 2 3
=1
=1
11
=1
=1
1
2
With the notation established earlier and following [3, 5] we dene 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 denition, 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 denition, 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 quantier 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.
With reference to x2, let G denote the set fG (p(d)); p(d) 2 DLg. By denition, the
positive atomic topology is the topology Q dened 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 quantier 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
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 satises
the matching condition. In particular, they coincide for the Herbrand preinterpretation
J.
Proof For suciency, if J satises the matching condition, then the proof of the suciency part of Proposition 3 easily modies 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
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 dene 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
Let us again use the identication 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.
+
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 dene 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.
+
15
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 denite 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 dened as follows, where IPJ denotes ILJ
and L is the underlying language of P :- TPJ (I ) is dened 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
+
Proposition 10 Let I 2 IPJ and let T denote TPJ . Then in either Q or Q we have
+
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.
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
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 denite 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
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 denition, 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 denition, 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 denite 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 denition 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
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 denite 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
denition is a natural companion to the notions DL and p(d) in that it is a combination
of both syntactic and semantical entities.
Denition 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 dierent if either (i) C j v and C j u are dierent
elements of DL, or (ii) a J - instance of a literal present in C ? j v resp. present in
C ? j u is dierent 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 dierent will be said to be equal
or the same.
Denition 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 dierent 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
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.
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(d)
20
p(t)
(1)
I j= :p (d ) ^ ^ :p (d ) ^ q (e ) ^ ^ q (e ):
1
21
Proof First we note that the hypothesis that C has innitely many dierent 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
Example 4.
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 satised.
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 dened 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
Example 5.
p(o)
p(s(x)) p(x)
p(s (o)) p(s(o)); p(s (x)):
Let J be the Herbrand preinterpretation. There are innitely many dierent instances
of the third clause with head p(s (o)) and the instance p(s(o)) occurs in each body and
therefore innitely 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 dened by:3
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 Denitions 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
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 satised) 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 satised 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 satised, a Bj (bj ) must occur. But Bj (bj ) cannot be either p(o) or p(s(o)) since
(i) is satised, 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 satised 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 satised 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 eectively is what is done in Theorem 7.
1
26
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.
In [27, Page 639] Michael Maher introduced the concept of down continuity of TPJ in
the case of the Herbrand preinterpretation J and a denite program P . We show next
that continuity in Q and down continuity are exactly the same thing.
Theorem 10 Suppose that P is a denite 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 identies an interesting class of programs which are canonical.
Proposition 11 Let P be a denite 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
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 Jaar and Stuckey or Blair's adaptation of it, see [7, 18], does this for
denite 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 denite). 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 Jaar, 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
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.
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
32