32

Topology and the Semantics

  • Upload
    ndrja

  • View
    215

  • Download
    1

Embed Size (px)

DESCRIPTION

.

Citation preview

  • Topology and the Semantics of Logic Programs

    Anthony Karel Seda

    Department of Mathematics, University College, Cork, Ireland.

    E-mail : [email protected]

    Abstract

    We introduce topologies on spaces of interpretations which extend and gener-

    alise 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 I

    J

    L

    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 T

    P

    dened on I

    J

    L

    is lattice

    continuous. An application is then made of a theorem, usually attributed to Kleene,

    to provide least xed points of T

    P

    , see [26] for a detailed account. The term classical

    used here reects 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 T

    P

    . 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"

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

    1

  • 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

    0

    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

    0

    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 lattice-

    theoretic 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 infor-

    mative 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 topo-

    logically 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

    2

  • 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 declara-

    tive 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 pro-

    gramming 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 Sub-

    rahmanian in their papers [2, 3, 4, 5, 6]. They have already introduced topological

    ideas into the study of logic programs; specically they have introduced two topologies

    (the query topology and the positive query topology) both of which are naturally dened

    in terms of L. It is, hence, necessary to devote a certain amount of space to consid-

    ering 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 blan-

    ket 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 eectively 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 briey consider the declarative semantics of denite logic programs

    and show how topological continuity of T

    P

    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

    dened on a topological space X and x

    0

    2 X is some distinguished element of

    X. Consider the \orbit" x

    0

    ; T (x

    0

    ); T

    2

    (x

    0

    ); : : : of x

    0

    and suppose that the sequence

    T

    n

    (x

    0

    ) converges to x, say, i.e. T

    n

    (x

    0

    )! x. Then by continuity of T we have that

    T (T

    n

    (x

    0

    ))! T (x), and therefore T

    n

    (x

    0

    )! 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 dene the aforementioned notion of

    greatest limit when dealing with convergence in the topology Q

    +

    dened there.

    On the other hand, we use the fact that the topologyQ we dene 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 T

    P

    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

    1

    ) [ comp(P

    2

    ) is consistent given that comp(P

    1

    ) and comp(P

    2

    ) 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 T

    P

    which are readily veried. 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 T

    P

    is continu-

    ous in the query topology. This condition is of interest and occurs in several places

    in the literature in dierent guises, see for example [10, x6,x7], [11, Theorem 3:1

    0

    ],

    [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 ex-

    actly 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 T

    P

    is continuous in the query topology computes all

    partial recursive functions.

    The equivalence noted above between down continuity of T

    P

    and topological conti-

    nuity of T

    P

    , for the Herbrand universe at least, permits two further topological interpre-

    tations 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 denite clauses, precisely the class for which is topologically continuous, see

    [17]. The other is that the programs P for which T

    P

    is continuous in the query topol-

    ogy 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

    4

  • 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 T

    P

    is continuous merely at the single

    point T

    P

    # ! 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 pro-

    gramming which are close in spirit to ours, although there is no actual overlap between

    our results and those of [14, 20].

    2 Topologies on I

    J

    L

    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 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 J

    v

    (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

    1

    ; : : : ; t

    n

    ) is a vector of terms in L, then J

    v

    (t), or t j v, is by denition the vector

    (J

    v

    (t

    1

    ); : : : ; J

    v

    (t

    n

    )). We let D

    L

    denote the set of all J-instances of predicate symbols in

    L, thus D

    L

    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 D

    n

    to which I assigns the n-ary predicate symbol p. In

    the usual way, we can identify I with a subset of D

    L

    ; thus p(d) 2 I i I(p)(d) = true.

    Hence, the setX or I

    J

    L

    of all interpretations of L based on the preinterpretation J can be

    identied with the power set P(D

    L

    ) of D

    L

    , that is to say X = I

    J

    L

    = P(D

    L

    ). Let 0 and 1

    be distinct symbols not in L. By identifying each subset I of D

    L

    with its characteristic

    function

    I

    we can identify P(D

    L

    ) with the set 2

    D

    L

    of all functions from D

    L

    into 2,

    where 2 denotes the set f0; 1g. Therefore, if we let f0; 1g

    i

    = f0; 1g for each i 2 D

    L

    ,

    then we can further identify P(D

    L

    ) and 2

    D

    L

    with the product

    Q

    i2D

    L

    f0; 1g

    i

    . 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(J

    v

    (t)) 2 I,

    and when L(t) is :p(t), I j=

    v

    L(t) i p(J

    v

    (t)) 62 I. Suppose E = 9L(t) or E = 9(L)

    5

  • denotes the existential closure of the literal L(t) and fx

    1

    ; : : : ; x

    m

    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

    1

    ; : : : ; d

    m

    in D such that

    I j=

    u

    L, where u = v(x

    1

    ; : : : ; x

    m

    =d

    1

    ; : : : ; d

    m

    ) is the variable assignment v except that

    x

    i

    is assigned to d

    i

    for i = 1; 2; : : : ; m. More generally, if E = 9(L

    1

    ^ ^ L

    n

    ), where

    each L

    i

    is a literal L

    i

    (t

    i

    ), then E is the general form of a query and we write I j= E

    to mean that I j=

    u

    L

    i

    for i = 1; 2; : : : ; n, where u is as before except that fx

    1

    ; : : : ; x

    m

    g

    denotes the union of the sets of free variables which occur in each of the L

    i

    . 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 J

    v

    (t) = d, we will sometimes write I j= p(d)

    to mean exactly that p(d) 2 I or in other words that p(J

    v

    (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(J

    v

    (t)) or I j= L(t j v) and by extension to write I j= L

    1

    (d

    1

    ) ^ ^ L

    n

    (d

    n

    ),

    this latter meaning, of course, that I j= L

    i

    (d

    i

    ) 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.

    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 I

    J

    L

    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 dened by G(E) = fI 2 X; I j= Eg and then form

    the class G of subsets of X, where G = fG(E);E is a queryg. The query topology is,

    by denition, 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

    1

    ^ ^ E

    n

    ), where

    E

    1

    ; : : : ; E

    n

    are queries and G(E

    1

    ^ ^ E

    n

    ) denotes the intersection of the sets G(E

    i

    ),

    for i = 1; 2; : : : ; n; of course, the collection B of sets of this latter type G(E

    1

    ^ ^E

    n

    )

    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

    6

  • 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 I

    J

    L

    , 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 dene 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

    0

    , see x3.

    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

    s

    0

    : R ! R dened by s

    0

    (r) = r + 1. Thus, the term assignment J(s

    n

    (o)) of s

    n

    (o) is

    n, i.e. J(s

    n

    (o)) = n. Here D

    L

    = 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 I

    J

    L

    is naturally in one-to-one correspondence with the set of all

    subsets of R. If we let I

    1

    = fp(1=2)g and I

    2

    = fp(3=4)g for example, so that I

    1

    ; I

    2

    2 X,

    it is straightforward to show that I

    1

    and I

    2

    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.

    2.3 The topology Q

    In order to overcome some of the diculties identied 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

    1

    ; x

    2

    ; : : : ; x

    n

    be variable symbols in

    L. If v denotes a variable assignment with v(x

    i

    ) = d

    i

    , say, then we write v(x) = d, where

    of course x denotes the vector (x

    1

    ; x

    2

    ; : : : ; x

    n

    ) and d denotes the vector (d

    1

    ; d

    2

    ; : : : ; d

    n

    ).

    Next, we dene 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 dene 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 dene 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 D

    L

    . We dene the atomic topology Q on X = I

    J

    L

    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

    1

    (d

    1

    )) \ \ G(L

    n

    (d

    n

    )) which we may write on

    occasions as G(L

    1

    (d

    1

    ) ^ ^ L

    n

    (d

    n

    )) or G(

    V

    n

    i=1

    L

    i

    (d

    i

    )) by our abuse of notation. So,

    7

  • 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

    in this case is all of I

    J

    L

    . It is useful notation to let

    denote the empty conjunction

    L

    1

    (d

    1

    )^ ^L

    n

    (d

    n

    ) of literals with n = 0. Thus, G(

    ) is the intersection of the empty

    family and therefore G(

    ) = I

    J

    L

    , and hence I j=

    for all I 2 I

    J

    L

    .

    2) In general, I j= p

    1

    (d

    1

    )^ ^ p

    n

    (d

    n

    )^:q

    1

    (e

    1

    )^ ^ :q

    m

    (e

    m

    ) i p

    i

    (d

    i

    ) 2 I and

    q

    j

    (e

    j

    ) 62 I for i = 1; 2; : : : ; n; j = 1; 2; : : : ; m. In particular, this is so when I = i

    n = 0, and when I = D

    L

    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 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.

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

    Proof Let E = 9(L

    1

    (t

    1

    ) ^ ^ L

    n

    (t

    n

    )) be an arbitrary query in L and suppose

    fx

    1

    ; : : : ; x

    m

    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= Eg in the query topol-

    ogy and let v be a variable assignment. Then an interpretation I belongs to G(E)

    i there are elements d

    1

    ; : : : ; d

    m

    of D such that I j=

    u

    L

    i

    (t

    i

    ) for i = 1; 2; : : : ; n, where

    u = v(x

    1

    ; : : : ; x

    m

    =d

    1

    ; : : : ; d

    m

    ). But then I 2 G(

    V

    n

    i=1

    L

    i

    (d

    i

    )), where d

    i

    = J

    u

    (t

    i

    ) for

    i = 1; 2; : : : ; n. Conversely, if I 2 G(

    V

    n

    i=1

    L

    i

    (d

    i

    )), 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

    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.

    8

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

    in the domainD 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 satises the matching con-

    dition. 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 D

    L

    . 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

    D

    L

    be

    dened to be that subset of D

    L

    whose elements have arguments each of which is the

    denotation of a variable free term in L. Then by hypothesis

    D

    L

    6= D

    L

    and, since the

    topology Q is Hausdor, it follows that

    D

    L

    and D

    L

    can be separated by basic open

    sets. Thus, there is a basic neighbourhood of D

    L

    in Q which does not contain

    D

    L

    . Now

    suppose that G(E) is a subbasic neighbourhood of D

    L

    in the query topology. Thus,

    E = 9(L

    1

    ^ ^ L

    n

    ) is a query and D

    L

    j= E. Therefore, by Remark 1, all the literals

    L

    i

    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(L

    i

    ) 2

    D

    L

    for i = 1; 2; : : : ; n and so

    D

    L

    j= E or, in other

    words,

    D

    L

    2 G(E). Therefore every subbasic, and hence basic, neighbourhood of D

    L

    in

    the query topology contains

    D

    L

    and so these points of X cannot be separated therein.

    Therefore, the query and atomic topologies do not coincide.2

    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.

    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 = I

    J

    L

    . 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

    0

    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 = D

    L

    . Thus, if I = , only the second half of the condition

    applies (and then the conclusion is valid), whereas if I = D

    L

    , 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

    0

    such

    that

    0

    implies I

    2 U i.e. I

    j= p(d) and so p(d) 2 I

    . Thus, A 2 I

    whenever

    0

    , 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

    0

    such that

    0

    implies I

    2 G(:p(d)). Thus, I

    j= :p(d) or, in

    other words, p(d) 62 I

    . Therefore, A 62 I

    whenever

    0

    as required.

    Conversely, suppose that the \eventual" conditions hold relative to I

    and I. Let U

    be a neighbourhood of I; without loss of generality we can suppose that U is a basic

    neighbourhood of I of the form U = G(

    V

    n

    i=1

    p

    i

    (d

    i

    ) ^

    V

    m

    j=1

    :q

    j

    (d

    0

    j

    )). Then we have that

    p

    1

    (d

    1

    ); : : : ; p

    n

    (d

    n

    ) 2 I and q

    1

    (d

    0

    1

    ); : : : ; q

    m

    (d

    0

    m

    ) 62 I:

    By hypothesis and the directedness of (;), we can choose

    0

    so large (after n +m

    steps) that whenever

    0

    we have

    p

    1

    (d

    1

    ); : : : ; p

    n

    (d

    n

    ) 2 I

    and q

    1

    (d

    0

    1

    ); : : : ; q

    m

    (d

    0

    m

    ) 62 I

    :

    Thus, I

    2 U whenever

    0

    and so I

    ! I in Q as required. 2

    Let us now use the identication described in x2:1 to carry the topology Q over to

    2

    D

    L

    ; thus a net

    I

    !

    I

    i I

    ! I. Suppose in fact that

    I

    !

    I

    and A 2 D

    L

    .

    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 D

    L

    , 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 identications being

    considered i

    I

    converges to

    I

    pointwise. Thus, the topology on 2

    D

    L

    is the topology

    of pointwise convergence. Therefore, the atomic topology Q on X = P(D

    L

    ) carries

    over to the product topology on

    Q

    i2D

    L

    f0; 1g

    i

    , where each set f0; 1g

    i

    is endowed with

    the discrete topology. Many results follow from this central fact as we now see.

    10

  • Theorem 1 Let J denote an arbitrary preinterpretation of L, let X = I

    J

    L

    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 preinter-

    pretation, and is innite, 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 2

    D

    L

    coincides with the product topology on 2

    D

    L

    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 con-

    dition.

    Theorem 2 For an arbitrary preinterpretation J the topology Q on I

    J

    L

    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 D

    L

    = 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 D

    L

    is

    countable, although there is no obvious way of listing the elements of D

    L

    in a sequence.

    Let A = p(d) denote a typical element of D

    L

    and choose some xed listing fA

    i

    g of the

    elements of D

    L

    , where i = 1; 2; 3; : : :.

    Now in general, if (M

    i

    ;

    i

    )

    i=1;2;3;:::

    is a sequence of metric spaces, where each

    i

    is

    bounded by 1, and we form the product M =

    Q

    1

    i=1

    M

    i

    , then the product topology on

    M is generated by the metric , where

    (;

    0

    ) =

    X

    1

    i=1

    i

    (

    i

    ;

    0

    i

    )

    2

    i

    in which expression = (

    1

    ;

    2

    ; : : :) and

    0

    = (

    0

    1

    ;

    0

    2

    ; : : :) 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 2

    A

    i

    = 2

    i

    = 2

    for i = 1; 2; 3; : : :. Now dene the metric

    i

    on 2

    i

    for each i by

    i

    (0; 0) = 0 =

    i

    (1; 1) and

    i

    (1; 0) = 1 =

    i

    (0; 1):

    Then

    i

    generates the discrete topology on 2

    i

    and the metric described above generates

    the product topology on

    Q

    1

    i=1

    2

    i

    , and hence the atomic topology on P(D

    L

    ). This metric

    has an intuitive description when applied to elements of P(D

    L

    ) as we now show.

    11

  • Consider the identications above of P(D

    L

    ), 2

    D

    L

    and

    Q

    1

    i=1

    2

    i

    . These equate I with

    I

    which in turn is equated with the sequence I = (

    1

    ;

    2

    ; : : :), where

    n

    = 1 i A

    n

    2 I

    and

    n

    = 0 i A

    n

    62 I. Thus, if I and I

    0

    are two interpretations and I and I

    0

    the

    corresponding sequences, then

    (I; I

    0

    ) = (I; I

    0

    ) =

    X

    1

    i=1

    i

    (

    i

    ;

    0

    i

    )

    2

    i

    :

    Consider now the symmetric dierence I 4 I

    0

    of I and I

    0

    . An element A

    i

    belongs to

    this symmetric dierence i either A

    i

    2 I n I

    0

    or A

    i

    2 I

    0

    n I. In other words, i either

    i

    = 1 and

    0

    i

    = 0 or

    i

    = 0 and

    0

    i

    = 1 which is the case i

    i

    (

    i

    ;

    0

    i

    ) = 1. Thus, in

    reality, the metric can be expressed in the form (I; I

    0

    ) =

    P

    A

    i

    2I4I

    0

    1

    2

    i

    and we have

    the following result.

    Theorem 3 If the domain, D, of J is countable and fA

    i

    g is a listing of the elements

    of D

    L

    , where i = 1; 2; 3; : : :, then the topology Q is generated by the metric dened by

    (I; I

    0

    ) =

    X

    A

    i

    2I4I

    0

    1

    2

    i

    :

    An alternative approach to and proof of this theorem can be found in [33] where it

    is shown that, with a slightly modied form of , the process above determines, up to

    equivalence, all metrics which generate Q.

    3 Further topologies on I

    J

    L

    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 be-

    tween it and the well known Scott topology dened on the lattice I

    J

    L

    . 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 denite logic program and also some interesting convergence results in our gen-

    eralisation, 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 denite logic programs.

    3.1 The Positive Query Topology

    With the notation established earlier and following [3, 5] we dene a positive query

    to be a query E = 9(L

    1

    ^ ^ L

    n

    ) in which each literal L

    i

    is in fact positive or, in

    other words, is an atom. Again, we let G(E) denote the set fI 2 X; I j= Eg 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

    this topology is a set of the type G(E

    1

    ^ ^ E

    n

    ) which is, by denition,

    T

    n

    i=1

    G(E

    i

    ),

    where E

    1

    ; E

    2

    ; : : : ; E

    n

    are positive queries. Of course, the collection B

    +

    of all sets of

    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.

    3.2 The topology Q

    +

    With reference to x2, let G

    +

    denote the set fG(p(d)); p(d) 2 D

    L

    g. 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

    1

    (d

    1

    )^ ^ p

    n

    (d

    n

    )) by which

    we mean the set

    T

    n

    i=1

    G(p(d

    i

    )).

    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

    0

    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(

    ) = I

    J

    L

    , we have

    a) I j=

    for every I 2 I

    J

    L

    .

    b) In particular, j=

    . Indeed, if j= p

    1

    (d

    1

    ) ^ ^ p

    n

    (d

    n

    ), 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 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 su-

    ciency 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 neces-

    sity given in Proposition 3 does not carry over directly, as it made use of the Hausdor

    13

  • separation property which is not satised by the topologies currently in question. We

    therefore reason as follows.

    Let p(d) be an element of D

    L

    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 D

    L

    n

    D

    L

    , where

    D

    L

    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

    1

    ) ^ ^ p(z

    n

    )) in which p is the only predicate symbol and z

    1

    ; : : : ; z

    n

    are

    vectors of terms (not necessarily variables), and for each vector z

    i

    , 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

    1

    ) ^ ^ p(z

    n

    )) 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

    1

    ^ ^ E

    l

    for some nite number of positive

    queries E

    1

    ; E

    2

    ; : : : ; E

    l

    , where

    (i) E

    i

    = 9(p(z

    i

    1

    ) ^ ^ p(z

    i

    n

    i

    )), for i = 1; 2; : : : ; l.

    (ii) Each z

    i

    j

    is a vector of terms, not necessarily variables, not all of whose compo-

    nents are variable free.

    (iii) For some variable assignment v

    i

    , we have (p(z

    i

    1

    ) ^ ^ p(z

    i

    n

    i

    )) j v

    i

    = 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(z

    i

    j

    ) j u be denoted by p(d

    i

    j

    ). Then, for

    i = 1; 2; : : : ; l and each j = 1; 2; : : : ; n

    i

    , we have p(d

    i

    j

    ) 2

    D

    L

    and therefore p(d

    i

    j

    ) 6= p(d).

    Letting

    I

    denote the set fp(d

    i

    j

    ); i = 1; 2; : : : ; l and j = 1; 2; : : : ; n

    i

    g, 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 dierent.2

    Corollary 2 If J satises 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.

    3.3 Convergence results in Q

    +

    We consider next certain results concerning net convergence in I

    J

    L

    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 I

    J

    L

    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

  • 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 identication of each subset I with its characteristic function

    I

    , as described in x2:1, this time to transport the topologyQ

    +

    to 2

    D

    L

    . 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 I

    J

    L

    coincides

    with the Scott topology.

    Proof Suppose that

    I

    !

    I

    in Q

    +

    and A is any element of D

    L

    . 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 D

    L

    we have

    I

    (A)!

    I

    (A) in the Scott topology on 2.

    Conversely, suppose for each A 2 D

    L

    that

    I

    (A) !

    I

    (A) in the Scott topology

    on 2; we will show then that

    I

    !

    I

    in 2

    D

    L

    i.e. that I

    ! I in I

    J

    L

    . 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 2

    D

    L

    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

    0

    but not T

    1

    , 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 = I

    J

    L

    consider the set fJ 2 X; I

    ! Jg. This

    set contains and is hence never empty. We are led naturally, therefore, to dene the

    notion of the greatest limit, gl(I

    ), of the net I

    by gl(I

    ) =

    S

    fJ 2 X; I

    ! Jg. 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 I

    J

    L

    .

    a) If I

    is monotonic increasing in the sense that I

    I

    0

    whenever

    0

    , then

    gl(I

    ) =

    S

    I

    .

    b) If I

    is monotonic decreasing in the sense that I

    I

    0

    whenever

    0

    , then

    gl(I

    ) =

    T

    I

    .

    15

  • Proof a) Case 1. Suppose gl(I

    ) = and

    S

    I

    6= .

    In this case, some I

    is non-empty, say I

    0

    is non-empty. Let A 2 I

    0

    . Then A 2 I

    whenever

    0

    by the monotonicity hypothesis. Hence, I

    ! I

    0

    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 I. Then A 2 I

    eventually, since I

    ! gl(I

    ), and so A 2

    S

    I

    and

    therefore I

    S

    I

    . Conversely, suppose A 2

    S

    I

    . Then A 2 I

    0

    for some

    0

    and by

    monotonicity A 2 I

    whenever

    0

    . Therefore, I

    !

    S

    I

    and we have

    S

    I

    I.

    Thus, I =

    S

    I

    as required.

    b) Case 1. Suppose gl(I

    ) = and

    T

    I

    6= .

    Let A 2

    T

    I

    . Then A 2 I

    for all and so A is eventually in I

    . It follows that

    I

    !

    T

    I

    and hence gl(I

    ) 6= . This contradiction gives

    T

    I

    = and so we get

    gl(I

    ) =

    T

    I

    in this case.

    Case 2. Suppose gl(I

    ) = I 6= .

    Let A 2 I. Then A 2 I

    eventually i.e. there is

    0

    such that A 2 I

    whenever

    0

    . Now let

    1

    be any element of the index set of the given net. Since is

    directed by , there is

    2

    2 such that

    0

    2

    and

    1

    2

    . But then I

    0

    I

    2

    and

    I

    1

    I

    2

    . By the fact that A 2 I

    whenever

    0

    we conclude that A 2 I

    2

    , and in

    turn we deduce that A 2 I

    1

    . In other words, A 2 I

    for every . Therefore, A 2

    T

    I

    and so gl(I

    )

    T

    I

    . In addition, we see that

    T

    I

    6= in this case.

    Conversely, if A 2

    T

    I

    , then A 2 I

    for all and so A is eventually in I

    . Therefore,

    I

    !

    T

    I

    and we have

    T

    I

    I as required.2

    In fact, we also have the following result.

    Proposition 9 a) If I

    is monotonic increasing, then I

    !

    S

    I

    in Q.

    b) If I

    is monotonic decreasing, then I

    !

    T

    I

    in Q.

    Proof a) If

    S

    I

    = , then I

    = for all and the result is clear. So suppose that

    S

    I

    6= . If A 2

    S

    I

    , then A 2 I

    0

    for some =

    0

    . Thus, by monotonicity, A 2 I

    whenever

    0

    and so A is eventually in I

    . If A 62

    S

    I

    , if such A exists, then A 62 I

    for any and so A is eventually not in I

    . Therefore, I

    !

    S

    I

    in Q as required.

    b) Suppose A 2

    T

    I

    , if such A exists. Then A 2 I

    for all and so A is eventually

    in I

    . Suppose A 62

    T

    I

    , if such A exists. Then A 62 I

    0

    for some =

    0

    . But then

    by monotonicity, A 62 I

    whenever

    0

    , and so A is eventually not in I

    as required.

    Therefore, I

    !

    T

    I

    in Q.2

    We now turn our attention to the immediate consequence map, T

    J

    P

    or simply T ,

    associated with any normal logic program, P , and we establish next the important fact

    that T

    J

    P

    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 T

    J

    P

    : I

    J

    P

    ! I

    J

    P

    is dened as follows, where I

    J

    P

    denotes I

    J

    L

    and L is the underlying language of P :- T

    J

    P

    (I) is dened to be the set of all p(d) 2 D

    L

    such that there is a program clause p(t) L

    1

    (t

    1

    ); : : : ; L

    n

    (t

    n

    ) in P and a variable

    assignment v satisfying J

    v

    (t) = d i.e. p(t j v) = p(d) and I j=

    v

    L

    1

    (t

    1

    ) ^ ^ L

    n

    (t

    n

    ).

    It is clear that T

    J

    P

    (I) 2 I

    J

    P

    for each I 2 I

    J

    P

    .

    16

  • Theorem 5 The immediate consequence map T

    J

    P

    is continuous in the topology Q

    +

    for

    any denite logic program P .

    Proof Let I 2 I

    J

    P

    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 T

    J

    P

    . 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 denition of T , there is a program clause p(t) p

    1

    (t

    1

    ); : : : ; p

    n

    (t

    n

    )

    and a variable assignment v such that p(t j v) = A and I j=

    v

    p

    1

    (t

    1

    ) ^ ^ p

    n

    (t

    n

    ).

    Case 1. The program clause is a unit clause i.e. n = 0.

    In this case 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

    1

    (t

    1

    )^ ^p

    n

    (t

    n

    ) we have that p

    1

    (t

    1

    j v); : : : ; p

    n

    (t

    n

    j v) 2 I. But I

    ! I

    and so eventually p

    i

    (t

    i

    j v) 2 I

    for i = 1; 2; : : : ; n. Thus, I

    j=

    v

    p

    1

    (t

    1

    ) ^ ^ p

    n

    (t

    n

    )

    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 T

    J

    P

    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 I

    J

    P

    and let T denote T

    J

    P

    . Then in either Q or Q

    +

    we have

    T

    n

    (I) convergent to an interpretation K i T

    n+1

    (I) converges to K.

    Corollary 3 For any I 2 I

    J

    P

    , we have that gl(T

    n

    (I)) = gl(T

    n+1

    (I)) = gl(T (T

    n

    (I))).

    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 denite program and let T denote T

    J

    P

    .

    a) Suppose I 2 I

    J

    P

    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 I

    J

    P

    is such that fT

    n

    (I)g is monotone decreasing,

    then gl(T

    n

    (I)) is a xed point of T .

    Proof a) Here gl(T

    n

    (I)) =

    S

    1

    n=1

    T

    n

    (I). Hence, since every net converges to its great-

    est limit, we have that T

    n

    (I) !

    S

    1

    n=1

    T

    n

    (I). Therefore, by Theorem 5, T (T

    n

    (I)) !

    T (

    S

    1

    n=1

    T

    n

    (I)) and so T

    n+1

    (I)! T (

    S

    1

    n=1

    T

    n

    (I)). By Proposition 10 it now follows that

    T

    n

    (I)! T (

    S

    1

    n=1

    T

    n

    (I)) and we obtain the inclusion

    T (

    [

    1

    n=1

    T

    n

    (I)) gl(T

    n

    (I)) =

    [

    1

    n=1

    T

    n

    (I):

    17

  • In the other direction, if A 2

    S

    1

    n=1

    T

    n

    (I), then A 2 T

    m

    (I) for some m and we

    can assume m > 1 since fT

    n

    (I)g is monotonic increasing. Hence, A 2 T (T

    m1

    (I))

    T (

    S

    1

    n=1

    T

    n

    (I)) since T is monotonic, P being a denite program. Therefore, we obtain

    the reverse inclusion

    S

    1

    n=1

    T

    n

    (I) T (

    S

    1

    n=1

    T

    n

    (I)) as required.

    For the converse statement, suppose that I is a xed point of T . Then T

    n

    (I) = I

    for all n and so the sequence fT

    n

    (I)g is monotonic increasing. Therefore gl(T

    n

    (I)) =

    S

    1

    n=1

    T

    n

    (I) = I and this establishes the claim.

    b) Here gl(T

    n

    (I)) =

    T

    1

    n=1

    T

    n

    (I) and so by Proposition 9 b) we have T

    n

    (I) !

    T

    1

    n=1

    T

    n

    (I) in Q. Therefore, by the hypothesis that T is continuous in this topology,

    T (T

    n

    (I)) ! T (

    T

    1

    n=1

    T

    n

    (I)) i.e. T

    n+1

    (I) ! T (

    T

    1

    n=1

    T

    n

    (I)). Hence, by Proposition 10

    we have T

    n

    (I)! T (

    T

    1

    n=1

    T

    n

    (I)). Finally, using the uniqueness of limits in a Hausdor

    space we obtain the required equality

    T

    1

    n=1

    T

    n

    (I) = T (

    T

    1

    n=1

    T

    n

    (I)).2

    Corollary 4 Suppose P is a denite logic program and T denotes T

    J

    P

    . 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 a) If I is any xed point, then I. Hence T

    n

    () I for all n, and so

    S

    1

    n=1

    T

    n

    () I. But T

    n

    () is monotonic increasing and so gl(T

    n

    ()) =

    S

    1

    n=1

    T

    n

    () I.

    By Theorem 6, gl(T

    n

    ()) is a xed point and, by the last inclusion, is now seen to be

    the least such. By denition, T " ! =

    S

    1

    n=1

    T

    n

    () and so T " ! = lfp(T ) as stated.

    b) Let I be any xed point of T . Then I D

    L

    and so I

    T

    1

    n=1

    T

    n

    (D

    L

    ). By

    Proposition 8 b) this intersection is equal to gl(T

    n

    (D

    L

    )) which is a xed point according

    to the present hypothesis and Theorem 6 b). It is now clear that gl(T

    n

    (D

    L

    )) is the

    greatest xed point of T and, by denition, T # ! =

    T

    1

    n=1

    T

    n

    (D

    L

    ) = gl(T

    n

    (D

    L

    )).

    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.

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

    T denote T

    P

    and let M

    P

    denote the least Herbrand model of P . Then M

    P

    = lfp(T ) =

    T " !.

    Proof Now M

    P

    is a model of P and so we have T (M

    P

    ) M

    P

    , and hence T (T (M

    P

    ))

    T (M

    P

    ) using monotonicity of T . Therefore, T (M

    P

    ) is also a model of P . Hence,

    M

    P

    T (M

    P

    ) by denition of M

    P

    and it follows that T (M

    P

    ) = M

    P

    and so M

    P

    is a

    xed point of T . Clearly M

    P

    is equal to the least xed point of T since every xed

    point is a model.2

    4 Continuity in the topology Q

    4.1 Sucient conditions for continuity in Q

    In this section, we study in some considerable detail the map T

    J

    P

    : I

    J

    P

    ! I

    J

    P

    and its

    continuity with respect to the topology Q; we also consider some of the consequences of

    18

  • continuity. In general, T

    J

    P

    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

    1

    (t

    1

    ); : : : ; L

    n

    (t

    n

    ), where n 0 and the L

    i

    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

    1

    (t

    1

    ); : : : ; p

    l

    (t

    l

    );:p

    l+1

    (t

    l+1

    ); : : : ;:p

    n

    (t

    n

    );

    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

    1

    (t

    1

    ); : : : ; p

    l

    (t

    l

    );:q

    1

    (s

    1

    ); : : : ;:q

    m

    (s

    m

    );

    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 D

    L

    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

    1

    (t

    1

    ); : : : ; L

    n

    (t

    n

    ) in P , where n 0. We

    will call p(t j v) L

    1

    (t

    1

    j v); : : : ; L

    n

    (t

    n

    j v), where v is a given variable assignment, the

    J - instance of C determined by v and denote it by J

    v

    (C) or C j J

    v

    . 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

    1

    (t

    1

    j v); : : : ; L

    n

    (t

    n

    j v) of a clause C, we shall refer

    to p(t j v) as the head of that instance and to L

    1

    (t

    1

    j v); : : : ; L

    n

    (t

    n

    j v) as the body .

    This terminology will not conict 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 D

    L

    , 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

    1

    (t

    1

    ); : : : ; L

    n

    (t

    n

    ) in P , where n 0,

    will be said to be of nite type relative to an element p(d) of D

    L

    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)

    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 D

    L

    .

    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

    1

    (t

    1

    ); : : : ; L

    n

    (t

    n

    ) is of nite type relative to some

    p(d) and J , then in general many dierent variable assignments give the same value

    with respect to J to each literal L

    i

    (t

    i

    ) in the body of C. In other words, we get

    L

    i

    (J

    v

    (t

    i

    )) = L

    i

    (J

    v

    0

    (t

    i

    )) for possibly many dierent variable assignments v; v

    0

    , where

    i = 1; 2; : : : ; n.

    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 D

    L

    . 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 D

    L

    .

    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 I

    J

    P

    and suppose that P has the property that whenever p(d) 2 D

    L

    and

    T

    J

    P

    (I) j= :p(d), then P is of nite type relative to p(d) and J. Then T

    J

    P

    is continuous

    at I in the topology Q. In particular, if P is of nite type relative to J, then T

    J

    P

    is

    continuous in Q.

    Proof Let I 2 I

    J

    P

    be any interpretation satisfying the hypothesis of the theorem, and let

    G

    2

    = G(L(d)) be an arbitrary subbasic neighbourhood of T (I) in Q, where T denotes

    T

    J

    P

    . We need to nd a neighbourhood G

    1

    of I in Q such that T (G

    1

    ) G

    2

    .

    SinceG

    2

    = 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

    2

    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

    p(t) p

    1

    (t

    1

    ); : : : ; p

    l

    (t

    l

    );:q

    1

    (s

    1

    ); : : : ;:q

    m

    (s

    m

    )

    (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

    1

    (d

    1

    ); : : : ; p

    l

    (d

    l

    );:q

    1

    (e

    1

    ); : : : ;:q

    m

    (e

    m

    )

    and I j= p

    1

    (d

    1

    )^ ^p

    l

    (d

    l

    )^:q

    1

    (e

    1

    )^ ^:q

    m

    (e

    m

    ), where d

    i

    = J

    v

    (t

    i

    ) for i = 1; 2; : : : ; l

    and e

    j

    = J

    v

    (s

    j

    ) for j = 1; 2; : : : ; m. If a) is the case, put G

    1

    = G(

    ) = I

    J

    P

    . Then

    G

    1

    is a neighbourhood of I and if I

    0

    2 G

    1

    , 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

    2

    and we have T (G

    1

    ) G

    2

    as required. In case b), put

    G

    1

    = G(p

    1

    (d

    1

    ) ^ ^ p

    l

    (d

    l

    ) ^ :q

    1

    (e

    1

    ) ^ ^ :q

    m

    (e

    m

    )) which is a neighbourhood of I.

    20

  • If I

    0

    2 G

    1

    , then I

    0

    j= p

    1

    (d

    1

    )^ ^ p

    l

    (d

    l

    )^:q

    1

    (e

    1

    )^ ^:q

    m

    (e

    m

    ) and so p(d) 2 T (I

    0

    )

    i.e. T (I

    0

    ) j= p(d) and so T (I

    0

    ) 2 G

    2

    . Thus, again we have T (G

    1

    ) G

    2

    as required.

    This covers the case when L is positive.

    Now suppose that L is negative, so that G

    2

    = 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

    1

    = I

    J

    P

    itself so that G

    1

    is a neighbourhood of I. Now let I

    0

    2 G

    1

    .

    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

    2

    and again we have T (G

    1

    ) G

    2

    , 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

    p(t) p

    1

    (t

    1

    ); : : : ; p

    l

    (t

    l

    );:q

    1

    (s

    1

    ); : : : ;:q

    m

    (s

    m

    )

    (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

    1

    (t

    1

    ) ^ ^ p

    l

    (t

    l

    ) ^ :q

    1

    (s

    1

    ) ^ ^ :q

    m

    (s

    m

    ) 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

    I 6j= p

    1

    (d

    1

    ) ^ ^ p

    l

    (d

    l

    ) ^ :q

    1

    (e

    1

    ) ^ ^ :q

    m

    (e

    m

    ) (1)

    where d

    i

    = J

    v

    (t

    i

    ), for i = 1; 2; : : : ; l, and e

    j

    = J

    v

    (s

    j

    ), for j = 1; 2; : : : ; m. It follows that

    some of the p

    i

    (d

    i

    ) do not belong to I, for 0 i l, and some of the q

    j

    (e

    j

    ) do belong to

    I, for 0 j m. Let p

    1

    (d

    1

    ); : : : ; p

    k

    (d

    k

    ), where 0 k l, be the totality of the p

    i

    (d

    i

    )

    in (1) which do not belong to I, and let :q

    1

    (e

    1

    ); : : : ;:q

    k

    0

    (e

    k

    0

    ), where 0 k

    0

    m, be

    the totality of the :q

    j

    (e

    j

    ) in (1) for which q

    j

    (e

    j

    ) does belong to I, in some reordering of

    the body if necessary. Then I j= :p

    1

    (d

    1

    )^ ^ :p

    k

    (d

    k

    )^ q

    1

    (e

    1

    )^ ^ q

    k

    0

    (e

    k

    0

    ). 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

    1

    (d

    1

    ); : : : ; 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

    1

    (e

    1

    ); : : : ;: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

    1

    (e

    1

    ); : : : ; q

    (e

    ) do belong to I. Then

    I j= :p

    1

    (d

    1

    ) ^ ^ :p

    (d

    ) ^ q

    1

    (e

    1

    ) ^ ^ q

    (e

    ):

    Put G

    1

    = G(:p

    1

    (d

    1

    )^ ^:p

    (d

    )^q

    1

    (e

    1

    )^ ^q

    (e

    )) so that G

    1

    is a neighbourhood

    of I in Q. Now suppose that I

    0

    2 G

    1

    . Then I

    0

    j= :p

    i

    (d

    i

    ), for i = 1; : : : ; , and

    I

    0

    j= q

    j

    (e

    j

    ), 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 p

    i

    (d

    i

    ), where

    i = 1; : : : ; , or at least one :q

    j

    (e

    j

    ), where j = 1; : : : ; . It follows that I

    0

    6j= C

    j v and

    21

  • so p(d) 62 T (I

    0

    ) i.e. T (I

    0

    ) j= :p(d). Therefore, T (I

    0

    ) 2 G

    2

    and we have T (G

    1

    ) G

    2

    as

    required.

    Since a basic neighbourhood of T (I) is a nite intersection of subbasic neighbour-

    hoods 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].

    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 T

    J

    P

    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 T

    J

    P

    is continuous in Q.

    Proof Let C be a program clause p(t) p

    1

    (t

    1

    ); : : : ; p

    n

    (t

    n

    ) in P and suppose that

    x

    1

    ; : : : ; x

    k

    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

    v

    0

    be two variable assignments and suppose that p(t j v) = p(t j v

    0

    ). By the hypothesis

    concerning injectivity, which holds in particular in any Herbrand preinterpretation, we

    see that v(x

    i

    ) = v

    0

    (x

    i

    ) for i = 1; : : : ; k. From this it follows that C

    j v = C

    j v

    0

    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 dened in Example 1. It is clear that P is of nite

    type relative to J and so T

    J

    P

    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

    1

    (t

    1

    ); : : : ; p

    l

    (t

    l

    );:q

    1

    (s

    1

    ); : : : ;:q

    m

    (s

    m

    )

    which has innitely many dierent J - instances with the same head p(d), say, but is

    such that no instance of any literal occurs innitely often in the bodies. Then T

    J

    P

    is

    discontinuous in Q at any I 2 I

    J

    P

    such that T

    J

    P

    (I) j= :p(d).

    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 I

    J

    P

    and T (I) j= :p(d), where T denotes T

    J

    P

    as usual. Consider the

    neighbourhood G

    2

    = G(:p(d)) of T (I). Let G

    1

    = G(r

    1

    (f

    1

    ) ^ ^ r

    (f

    ) ^ :r

    0

    1

    (f

    0

    1

    ) ^

    22

  • ^ :r

    0

    (f

    0

    )) be an arbitrary basic neighbourhood of I in Q. Thus, I j= r

    1

    (f

    1

    ) ^ ^

    r

    (f

    )^ :r

    0

    1

    (f

    0

    1

    )^ ^ :r

    0

    (f

    0

    ). By the hypothesis, there must be an instance C j v of

    the clause C, say p(d) p

    1

    (d

    1

    ); : : : ; p

    l

    (d

    l

    );:q

    1

    (e

    1

    ); : : : ;:q

    m

    (e

    m

    ), such that no r

    i

    (f

    i

    )

    occurs (either positively or negatively) in the body of C j v, for i = 1; : : : ; , and no

    r

    0

    j

    (f

    0

    j

    ) occurs (either positively or negatively) in the body of C j v, for j = 1; : : : ; .

    Let I

    0

    = fp

    1

    (d

    1

    ); : : : ; p

    l

    (d

    l

    ); r

    1

    (f

    1

    ); : : : ; r

    (f

    )g; then I

    0

    2 G

    1

    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

    2

    . Therefore, T (G

    1

    ) 6 G

    2

    and so

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

    1

    suces for this

    argument.2

    We now consider some examples which illustrate this theorem, the previous one and

    Corollary 6.

    Example 4.

    1) Let P be the program

    p(o)

    p(s(x)) p(x)

    p(s

    3

    (o)) p(s

    3

    (x)):

    Let J be the Herbrand preinterpretation. By Theorem 8, T

    J

    P

    is discontinuous at ,

    fp(o)g, fp(s(o))g and fp(o); p(s(o))g since all these satisfy T

    J

    P

    (I) j= :p(s

    3

    (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

    T

    J

    P

    (I) j= :p(s

    n

    (o)), for some n, then n 6= 3. But then P is of nite type relative to J

    and p(s

    n

    (o)) and therefore T

    J

    P