Complementing Logic Program Semantics

Roberto Giacobazzi^{⋆} Francesco Ranzato^{⋆⋆}

⋆Dipartimento di Informatica, Università di Pisa Corso Italia 40, 56125 Pisa, Italy

                              giaco@di.unipi.it

⋆⋆Dipartimento di Matematica Pura ed Applicata, Università di Padova Via Belzoni 7, 35131 Padova, Italy

                             franz@math.unipd.it

Abstract. We consider abstract interpretation, and in particular the basic operators of reduced product and complementation of abstract domains, as a tool to systematically derive denotational semantics by composition and decomposition. Reduced product allows to perform the logical conjunction of semantics, while complementation characterizes what is left from a semantics when the information concerning a given observable property is “subtracted” from it. We apply this idea to the case of logic programming, characterizing in a uniform algebraic setting, the interaction between a number of well known declarative semantics for logic programs.

1 Introduction

Abstract interpretation ([6, 7]) is a well established theory for semantics approximation, which is traditionally applied in the field of program analysis, e.g. for the design of program analysis frameworks. In POPL’92 ([8]), Cousot and Cousot showed that abstract interpretation can also be used to systematically derive more abstract semantics, as well as approximate semantics, from a given ground (or standard) semantics for the considered programming language. This is the case for denotational and relational semantics, which can be derived by abstraction from a rule-based operational semantics (e.g. SOS) for the language. Abstract interpretation provides therefore both a mathematical framework where different semantics at different levels of abstraction can be compared to each other, and a number of systematic methods to specify new semantic definitions from more concrete ones by abstraction. As observed in [14], among these methods, the operations for abstract domain refinement and their inverses, like reduced product ([7]), complementation ([5]), disjunctive completion ([7]), least disjunctive basis ([20]), and reduced power for functional dependencies ([7, 19]), may play a central role in semantics design, as well as in analysis, in order to provide formal algebraic methods to manipulate and compare semantics. In this work, we show how reduced product, and its inverse operation which is complementation, can be used to study the semantics of programming languages. The idea is that new, as well as known semantics for programming languages, can be studied and derived in a systematic way by applying the algebraic operations of domain refinements and their inverses, like reduced product and complementation. Abstract interpretation provides here the right framework in order to include these algebraic operations into a lattice structure, where each semantics corresponds to a suitable abstraction, and semantics can be compared and composed by comparing and composing the corresponding abstractions. Here, a semantics S is finer (more precise) than a semantics A, if A can be derived by abstraction from S.

The reduced product is probably the most common and widely known operation for domain composition in program analysis, and it is defined as the reduced cardinal product of abstract domains. We show that the reduced product of two semantics S and T is a new semantics inducing a finer equivalence relation on programs, which is precisely the intersection of the equivalences for S and T . Complementation corresponds to the natural inverse operation for reduced product, namely an operation which, starting from any two semantics S and T , with T more abstract than S, gives as result the most abstract semantics whose reduced product with T is exactly S. Semantics, analogously to domains for analysis, can be decomposed by complementation, providing the least amount of information which is necessary to upgrade a given semantics by reduced product. Thus, complementation is a relevant tool for semantics decomposition into simpler factors, which turns out to be useful to understand the internal structure of a semantics, and the interaction between its factors. Also, semantics decomposition may be important in order to exploit modularity in program verification problems: Instead of proving properties for complex semantics definitions, we can more easily prove that they hold for the corresponding factors, provided that these properties are preserved under reduced product.

In the following of the paper, we will be mainly concerned with logic programming. Logic programming is an example of high-level programming language enjoying a simple semantic definition. Due to its semantic simplicity, logic programming is probably the programming language where the abstract interpretation-based approach to semantics design was mostly successful, as shown by the increasing literature in this field (cf. [3, 4, 17, 19]). Our approach gives rise to a hierarchy of declarative semantics for logic programs where semantics, and the corresponding observable properties, can be manipulated algebraically by complementation and reduced product. After some results in Section 4 on complementation and reduced product in denotational semantics, we show in Sections 5–7 the interaction between well known semantics, like the s-semantics for computed answers of [12], Clark’s semantics for correct answers ([2, 12]), least Herbrand model semantics for successful computations ([10]), and the semantics for call patterns in [16]. Logic programming provides here a clean and simple interpretation for the operators of our framework.

2 Preliminaries

Basic Notation. Let A and B be sets. The powerset of A is denoted by ℘(A), the set-difference between A and B is denoted by A \ B, while A ⊂ B denotes strict inclusion. A^{∗} denotes the set of finite sequences of objects of A, and sequences are typically denoted by ⟨a_{1}, ..., a_{n}⟩, or simply a_{1}, ..., a_{n}, for a_{i}’s symbols in A. The empty sequence is denoted by Λ. Concatenation of sequences s_{1}, s_{2} ∈ A^{∗} is denoted by s_{1} :: s_{2}. The set A equipped with a partial order ≤ is denoted by A_{≤}. If A is a poset, we usually denote ≤_{A} the corresponding partial order. By x < y we mean x ≤ y and x ≠ y. If A is a pre-ordered set and I ⊆ A then ↓I = {x ∈ A | ∃y ∈ I . x ≤_{A} y}. For x ∈ A, ↓x is a shorthand for ↓{x}. ℘^{↓}(A) denotes the set of order ideals of A, where I ⊆ A is an order ideal if I =↓ I . ℘^{↓}(A) is a complete lattice with respect to settheoretic inclusion, where the lub is set union and the glb is set intersection. If A is a poset and I ⊆ A, then Max(I ) = {x ∈ I | ∀y ∈ I . x ≤_{A} y ⇒ x = y}. A complete lattice A with partial ordering ≤, lub ∨, glb ∧, bottom element ⊥ = ∨∅ = ∧A, and top element ⊤ = ∧∅ = ∨A, is denoted by ⟨A, ≤, ∨, ∧, ⊥, ⊤⟩. When A is a lattice, ∨_{A}, ∧_{A}, ⊥_{A} and ⊤_{A} denote the corresponding basic operators and elements. In the following, we will often abuse notation by denoting lattices with their poset notation. We use ≅ to denote isomorphism of ordered structures. We write f : A → B to mean that f is a total function from the set A to the set B. The identity function λx.x is sometimes denoted id. If C ⊆ A then f (C ) = {f (x) | x ∈ C }. By g ∘ f we denote the function λx.g(f (x)). The set of fixpoints of a function f : A → A is denoted by fp(f ), and, if A is a poset, the least fixpoint is denoted by lfp(f ), if it exists.

Abstract Interpretation and Closure Operators. Abstract interpretation is traditionally defined in terms of a pair of adjoint functions which form a Galois connection. If C and D are posets and α : C → D, γ : D → C are monotonic functions such that ∀c ∈ C . c ≤_{C} γ(α(c)) and ∀d ∈ D. α(γ(d)) ≤_{D} d, then we call the quadruple (C , α, D, γ) a Galois connection (G.c.) between C and D. If in addition ∀d ∈ D. α(γ(d)) = d, then (C , α, D, γ) is a Galois insertion (G.i.) of D in C . In the setting of abstract interpretation, C and D are called the concrete and the abstract domain, and they are assumed to be complete lattices, whereas α and γ are called the abstraction and the concretization maps, respectively. D is called an abstraction (or abstract interpretation) of C , and C a concretization of D, while D is a proper abstraction if γ ∘ α ≠ λx.x.

An alternative, but equivalent, approach to abstract interpretation is by closure operators (cf. [7]). Let ⟨L, ≤, ∨, ∧, ⊥, ⊤⟩ be a complete lattice. An (upper) closure operator on L is an operator ρ : L → L monotonic, idempotent and extensive (viz. ∀x ∈ L. x ≤ ρ(x)). Each closure operator ρ is uniquely determined by the set of its fixpoints, which is its image ρ(L). A set X ⊆ L is the set of fixpoints of a closure operator iff X is a Moore-family of L, i.e. ⊤ ∈ X and X is meet-closed (viz. for any non-empty Y ⊆ X , ∧Y ∈ X ). In the following, we will often denote a closure operator by the set of its fixpoints. We denote by ⟨uco(L), ⊑, ⊔, ⊓, id, λx.⊤⟩ the complete lattice of all upper closure operators on the complete lattice L, with bottom element id, top element λx.⊤, and where for every ρ, η ∈ uco(L), {ρ_{i}}_{i∈I} ⊆ uco(L) and x ∈ L: ρ ⊑ η iff ∀x ∈ L. ρ(x) ≤ η(x), or equivalently ρ ⊑ η iff η(L) ⊆ ρ(L); (⊔_{i∈I} ρ_{i})(x) = x ⇔ ∀i ∈ I . ρ_{i}(x) = x; (⊓_{i∈I} ρ_{i})(x) = ∧_{i∈I} ρ_{i}(x). The logical meaning of an abstract domain is exactly captured by the associated closure operator on the concrete domain. More formally, on the one hand, if (C , α, D, γ) is a G.i. then the closure associated with D is the operator ρ_{D} = γ ∘α on C . On the other hand, if ρ is a closure on C and ι : ρ(C ) → D is an isomorphism of complete lattices (with inverse ι^{−1}) then (C , ι∘ρ, D, ι^{−1}) is a G.i.. The complete lattice of all abstract interpretations (identified up to isomorphism) of a domain C is therefore isomorphic to uco(C ). By the above equivalence, it is not restrictive to use the closure operator approach to reason about abstract properties up to isomorphic representations of abstract domains. Thus, in the rest of the paper, we will feel free to use most of the times this approach, and whenever we will say that D is an abstraction of C , we will mean that D is isomorphic to ρ_{D}(C ), for some closure ρ_{D} ∈ uco(C ). In this approach, the order relation on uco(C ) corresponds to the order by means of which abstract domains are compared with regard to their precision. More formally, if ρ_{i} ∈ uco(C ) and D_{i} ≅ ρ_{i}(C ) (i = 1, 2), D_{1} is more precise than D_{2} iff ρ_{1} ⊑ ρ_{2} (i.e. ρ_{2}(C ) ⊆ ρ_{1}(C )). Therefore, to compare domains with regard to their precision, we will only speak about abstractions between them, and use ⊑ to relate both closure operators and domains, and the equality symbol = instead of ≅. In view of this equivalence, the lub and glb on uco(C ) get a clear meaning. Suppose {ρ_{i}}_{i∈I} ⊆ uco(C ) and D_{i} ≅ ρ_{i}(C ) for each i ∈ I . Then, (⊔_{i∈I} ρ_{i})(C ) is the most concrete among the domains which are abstractions of all the D_{i}’s, while (⊓_{i∈I} ρ_{i})(C ) is (isomorphic to) the reduced product ([7]) of all the D_{i}’s, which is the most abstract among the domains (abstracting C ) which are more concrete than every D_{i}.

Logic Programming. In the following, Atom and Program denote, respectively, the set of atoms and (definite), possible infinite, logic programs built on a first-order language L (where Π denotes the set of predicate symbols). A unit-clause is a clause with an empty body. Atoms and unit-clauses will be considered equivalent notions. BClause is the set of atoms (unit clauses) and binary clauses of the form h ← b, with h, b ∈ Atom. Tuples of syntactic objects of the same type (like variables, terms, etc.) are sometimes denoted s̄. The set of variables that occur in a syntactic object s is denoted by var(s). The application of a substitution σ to a syntactic object s is denoted by sσ. The composition of substitutions θ and σ is defined as function composition and denoted θσ. If Θ is a set of substitutions, then sΘ = {sθ | θ ∈ Θ}. We restrict our interest to idempotent substitutions ranging in Sub, unless explicitly stated otherwise. A variable renaming is a (not necessarily idempotent) substitution which is a bijection on the variables. A syntactic object t is more general than t′ (denoted t′ ≤ t) iff there exists a substitution σ such that t′ = tσ. Syntactic objects t_{1} and t_{2} are equivalent up to renaming, denoted t_{1} ∼ t_{2}, iff t_{1} ≤ t_{2} and t_{2} ≤ t_{1}. Atom_{/∼} and BClause_{/∼} are partially ordered with respect to ≤. With abuse of notation, they are still denoted by Atom and BClause. Since all the definitions in the paper are independent on syntactic variable names, we will let a syntactic object to denote its equivalence class by renaming. For a syntactic object s and a set of (equivalence classes by renaming of) objects I , we denote by ⟨c_{1}, …, c_{n}⟩ <<_{s} I (n ≥ 0), that c_{1}, …, c_{n} are representatives of elements of I renamed apart from s and from each other. If A is a set of syntactic objects then ⌊A⌋ denotes the set of ground instances of elements in A. We fix a partial function mgu which maps a pair of syntactic objects (or a set of equations) into an idempotent most general unifier of the objects, if such exists. The operational semantics of logic programs is defined by SLD-resolution. We assume the Prolog selection rule. If P ∈ Program and G = b_{1}, ..., b_{n} (n ≥ 0) is a goal, then we write G⟶^{ϑ}_{P}G′ϑ iff there exists h ← b̄ <<_{G} P, such that ϑ = mgu(b_{1}, h) and G′ = b̄ :: ⟨b_{2}, ..., b_{n}⟩. G⟶\begin{matrix}∗ \\ P \end{matrix}G′ denotes that there exists ϑ such that G⟶^{ϑ}\begin{matrix}∗ \\ P \end{matrix}G′, and G = Gϑ.

3 Complementation in Abstract Interpretation

Complementation ([5]) corresponds to the inverse of the reduced product ([14]), namely an operation which, starting from any two domains C ⊑ D, gives as result the most abstract domain C ∼ D, whose reduced product with D is exactly C (i.e., (C ∼ D) ⊓ D = C ). By the equivalence between closure operators and abstract interpretation, the above notion of complementation corresponds precisely to pseudo-complementation for ρ_{D} in uco(C ).^{1} Recall that a complete lattice C is meet-continuous if for any chain Y ⊆ C and x ∈ C , x ∧ (∨Y ) = ∨_{y∈Y} (x ∧ y). The following result is recalled from [18].

Theorem 3.1 ([18]) If C is meet-continuous then uco(C ) is pseudo-complemented.

This result has been firstly applied in abstract interpretation for analysis in [5], using the above notion of complementation, which is more precisely formulated as follows: whenever C is meet-continuous, the complement C ∼D exists, and it is defined as:

C ∼D = ⊔{ρ ∈ uco(C ) | (ρ_{D} ⊓ ρ)(C ) = C }.

Assume that C ⊑ D, E and let ⊤ be the most abstract interpretation of C (i.e. the top closure λx.⊤). The following are some basic algebraic properties of complementation ([5]):

(a) D ⊑ C ∼(C ∼D);
(b) (D ⊑ E) ⇒ (C ∼E) ⊑ (C ∼D);
(c) (C ∼D) = C ∼(C ∼(C ∼D));
(d) C ∼⊤ = C and C ∼C = ⊤.

Complementation is essential for abstract domain decompositions. If C ⊑ D then ⟨C ∼ D, D⟩ is a (conjunctive binary) decomposition for C , namely C can be reconstructed by reduced product of its factors.

Example 3.2 Consider the usual lattice D for sign analysis of an integer variable ([7]), depicted below. The concrete domain is ℘(ZZ)_{⊆}, and concretization and abstraction maps are the most natural. The (more abstract) lattice of positive values D^{+} can be “subtracted” from D by complementation (viz., D ∼ D^{+}), yielding the lattice of negative values D^{−}.

[figure: •; •; •; •; •; •; •; −; −0; ⊥; 0; ⊤; 0+; +; D]  • • • + 0+ ⊤D^{+}  • • • −0 ⊤ D^{−} = D ∼D^{+}

⟨D^{+}, D^{−}⟩ is therefore a decomposition for D (i.e., D = D^{+} ⊓ D^{−}). In particular, 0 and ⊥, which are not in D^{+} ∪ D^{−}, can be both reconstructed by reduced product from D^{+} and D^{−}. □

1 If L is a meet-semilattice with bottom then the pseudo-complement of x ∈ L, if it exists, is the (unique) element x^{∗} ∈ L such that x ∧x^{∗} = ⊥ and ∀y ∈ L. (x ∧y = ⊥) ⇒ (y ≤ x^{∗}). In a complete lattice L, if the pseudo-complement x^{∗} exists then x^{∗} = ∨{y ∈ L | x ∧y = ⊥}. If every x ∈ L has the pseudo-complement, L is pseudo-complemented.

4 Semantics Design via Abstract Interpretation

We assume that Program denotes the set of syntactically well-defined programs of the considered programming language. We formalize the denotational semantics by means of a semantic valuation mapping [[·]] : Program → D assigning to each program P ∈ Program its denotational meaning [[P]], which is a value of a complete lattice D, called the semantic domain. Elements of the semantic domain D can be execution traces, functions, sets of states, logical interpretations, etc. For instance, for the standard denotational semantics of functional programs the semantic domain will be a function space, while for logic programs it will be the powerset (or powerdomain) of a (ground or non-ground) Herbrand universe. Evidently, any semantic definition induces an equivalence relation ≡ on the set of programs, identifying programs with the same behavior (namely denotation) for the semantics: P ≡ Q ⇔ [[P]] = [[Q]].

Denotational semantics models possible behaviours of a program: the degree of accuracy of this process depends both on the semantic evaluation mapping and on the semantic domain. Hence, varying these two parameters, one may get semantics at different levels of abstraction. Following [8], it is possible to use the framework of abstract interpretation to establish the relationships between various semantics at different levels of abstraction. We adopt here the closure operator approach to abstract interpretation, which is completely equivalent to the more frequently used Galois connection approach (see Section 2), followed, e.g., in [8], while having the advantage of a higher mathematical simplicity.

Assume that for the considered programming language a standard denotational definition [[·]] : Program → D is fixed. An abstraction of the standard semantics is obtained by considering any closure operator on the semantic domain. If ρ ∈ uco(D) then the abstract semantics induced by ρ is defined as [[·]]_{ρ} : Program → ρ(D), where ρ(D) is the image of D through ρ (or, equivalently, the set of fixpoints of ρ), which is a complete lattice with respect to the induced order, while for any P ∈ Program, [[P]]_{ρ} = ρ([[P]]). In the following, we simply denote by [[·]]_{ρ} the abstract semantics induced by ρ. Clearly, this definition leads to a hierarchy of abstract denotational semantics, where semantics are related with respect to their precision: for two abstract semantics [[·]]_{ρ} and [[·]]_{η}, the first one is more precise than the second one iff ρ ⊑ η (in uco(D)). Each abstract semantics induces an equivalence relation between programs: we denote by ≡_{ρ} the equivalence induced by the semantics [[·]]_{ρ}. The following lemma shows the relationship existing between the ordering for closures and the corresponding induced equivalences on programs.

Lemma 4.1 For any ρ, η ∈ uco(D), ρ ⊑ η ⇒ ≡_{ρ}⊆≡_{η}.

Thus, the above result shows that if [[·]]_{ρ} is a more precise abstract semantics than [[·]]_{η} (viz. ρ ⊑ η in uco(D)), then the equivalence induced by [[·]]_{ρ} is finer than the equivalence induced by [[·]]_{η}, i.e. if [[·]]_{η} is able to distinguish two programs (viz. they have different denotations) then [[·]]_{ρ} is able too. It is worth remarking that Lemma 4.1, which is a basic requirement in our approach for semantics comparison, strongly depends on the fact that we deal with closure operators, namely that we use abstract interpretation to relate different semantics. This enforces the importance of using abstract interpretation in this context.

4.1 Product and Complement of Semantics

One of the main advantages offered by abstract interpretation to the design of domains for program analysis is the ability to build abstract domains in an incremental way by combining and refining smaller and simpler domains by means of systematic operations. Below, we consider reduced product and complementation in the field of program semantics.

Reduced Product and Least Common Abstraction of Semantics. As recalled in Section 2, the reduced product of abstract domains corresponds to the meet operation on the respective closure operators, while the lub of a family of abstract domains provides the most concrete among the domains which are abstractions of all the domains in the family.

Clearly, using the approach of this paper, all the facilities offered by abstract interpretation for the design of domains for program analysis transfer “verbatim” in denotational semantics design. In particular, we can combine different semantics (which are abstractions of a common standard semantics) via reduced product, to obtain a richer and more precise semantics. Following the notation of Section 2, if {[[·]]_{ρi} }_{i∈I} is a family of abstract semantics then we denote by [[·]]_{⊓i∈I ρi} the reduced product semantics. This abstract semantics [[·]]_{⊓i∈I ρi} : Program → ⊓_{i∈I} ρ_{i}(D) is defined as [[P]]_{⊓i∈I ρi} = ∧_{i∈I} ρ_{i}([[P]]), where ∧ is the glb of the semantic domain D. The following result formally expresses the intuition that the reduced product semantics corresponds precisely to the logical conjunction of the components semantics.

Theorem 4.2 For any P, Q ∈ Program, P ≡_{⊓i∈I ρi} Q ⇔ ∀i ∈ I . P ≡_{ρi} Q.

The above result says that the reduced product semantics logically coincides with the conjunction of all the components. Stated in other terms, the reduced product semantics does distinguish programs iff all its components do.

Similarly to what done for reduced product, it is possible to interpret the lub operation ⊔ between closure operators as a systematic operator on semantics. The lub of a family {[[·]]_{ρi} }_{i∈I} of abstract semantics defines the least common abstraction of all [[·]]_{ρi} ’s, i.e. the most precise among the abstract semantics less precise of any [[·]]_{ρi} in the family.

Complements of Semantics. Following the lines of the reduced product of semantics above, we can introduce an operation of complement of denotational semantics as follows. If [[·]]_{ρ} and [[·]]_{η} are two abstract semantics such that [[·]]_{ρ} is more precise than [[·]]_{η}, then [[·]]_{ρ∼η} denotes the complement semantics of [[·]]_{η} in [[·]]_{ρ}. This semantics [[·]]_{ρ∼η} : Program → (ρ∼η)(D) is defined as [[P]]_{ρ∼η} = (ρ∼η)([[P]]), where ρ ∼ η is the closure on D corresponding to the complement of η in ρ. Recalling the meaning of the operation of complementation, we can give a precise interpretation of the complement semantics: [[·]]_{ρ∼η} is the most abstract semantics (i.e. the least precise semantics) whose reduced product with [[·]]_{η} gives exactly [[·]]_{ρ}. It is practically always possible to define complements of semantics, since the conditions assuring their existence are extremely weak. In fact, it is well known that each continuous (and therefore algebraic) complete lattice is meet-continuous, and hence for it, the hypothesis of Theorem 3.1 is satisfied. Thus, in order that complements exist, it is enough that the standard semantic domain D is (meet-)continuous, or even better it is sufficient to check locally for each complement ρ ∼ η that ρ induces a meetcontinuous complete lattice ρ(D). Clearly, these conditions are of wide applicability when dealing with domains for denotational semantics, as in our case.

4.2 Least Fixpoint Semantics

One of the most popular and frequent presentations for denotational semantics is as least fixpoint of a suitable operator on a complete lattice. We suppose that for the considered programming language, a standard denotational semantics is given in least fixpoint form as follows. To any P ∈ Program is assigned a semantic operator or transformer T_{P}, which is a function T_{P} : D → D on the semantic domain D (which is a complete lattice) having a least fixpoint (when clear from the context, we simply denote T_{P} by T ). Least fixpoint semantics are therefore presented as pairs ⟨D, T ⟩. To assure the existence of the least fixpoint, as usual, we assume that T is a monotonic operator; in this case, by Tarski’s Theorem, T has a least fixpoint denoted by lfp(T ). The standard least fixpoint semantics is therefore given by the semantic valuation mapping [[·]] : Program → D defined as [[P]] = lfp(T_{P}).

It is well known in abstract interpretation (cf. [7]) that each domain abstraction uniquely determines the best correct approximation for any semantic operation. This leads in our case to the notion of abstract least fixpoint semantics. In fact, each closure operator ρ ∈ uco(D) actually induces a (more abstract) least fixpoint semantics [[·]]_{ρ} on the abstract semantic domain ρ(D) defined as least fixpoint of the abstract semantic operator ρ∘T : ρ(D) → ρ(D), namely [[P]]_{ρ} = lfp(ρ∘T ). It is worth noting that [[·]]_{ρ} can be also equivalently defined as least fixpoint of the semantic operator ρ∘T ∘ρ : D → D defined on D. If one prefers to adopt the Galois insertion approach, it is possible to give similar definitions. If (D, α, A, γ) is a G.i. then the abstract semantics [[·]]_{α} of a program is the least fixpoint of the operator α∘T ∘γ : A → A, that is [[P]]_{α} = lfp(α∘T ∘γ). In both definitions, the abstract semantic operator is the best correct approximation of T .

The approach here slightly differs from the general one presented above. In fact, the abstract semantics of the program is not defined as the given abstraction (ρ) of the standard semantics of the program, viz. ρ(lfp(T )), and, in general, lfp(ρ∘T ) ≠ ρ(lfp(T )). However, it is known (see e.g. [9]) that for any monotonic operator T , ρ(lfp(T )) ≤ lfp(ρ∘T ) holds. Completeness of the abstraction is a well known sufficient condition assuring that the equality holds (see [9, 21]). The abstraction ρ ∈ uco(D) is complete if ρ∘T = ρ∘T ∘ρ; analogously, the abstraction given by the Galois insertion (D, α, A, γ) is complete if α∘T = α∘T ∘γ∘α. Thus, we will say that an abstract least fixpoint semantics [[·]]_{ρ} or [[·]]_{α} is complete if the corresponding abstraction is complete.

Proposition 4.3 ([9]) If [[·]]_{ρ} is complete and P ∈ Program then [[P]]_{ρ} = ρ(lfp(T_{P})).

Clearly, [[·]]_{id} = [[·]] and [[·]]_{λx.⊤} are always complete abstractions. In the following, if X = ⟨D, T^{X} ⟩ specifies a least fixpoint semantics, we will denote by [[·]]^{X} the corresponding least fixpoint semantics. Also, if ρ ∈ uco(D) and Y = ⟨ρ(D), ρ∘T^{X} ⟩

T_{P}^{S} = λI ∈ ℘(Atom). {hϑ | C = h ← b̄ ∈ P, b̄′ <<_{C} I , ϑ = mgu(b̄, b̄′)}
T_{P}^{C} = λI ∈ ℘^{↓}(Atom). {hϑ | C = h ← b̄ ∈ P, ϑ ∈ Sub, b̄ϑ ∈ I }
T_{P}^{H} = λI ∈ ℘(⌊Atom⌋). {h ∈ ⌊Atom⌋ | h ← b̄ ∈ ⌊P⌋, b̄ ⊆ I }

Table 1: The semantic operators.

is the corresponding abstract semantics, then [[·]]^{Y} = [[·]]_{ρ}^{X}. Further, we will denote by Sem(X) the class of semantic definitions Y such that [[·]]^{Y} = [[·]]_{ρ}^{X}, for some ρ ∈ uco(D). Therefore, uco(D) ≅ Sem(X). We keep uco(D) and Sem(X) distinct notations in order to identify the use of closure operators as semantics approximators. However, in order to simplify the notation, we often let the elements in Sem(X) denote both abstract semantics for X, and the corresponding closures, as well as we use ⊓, ⊔, and ∼ to combine elements in Sem(X). Confusing closure names with semantics names may be source of ambiguity. Therefore, in the following, if Y ∈ uco(D), P ∈ Program and T_{P}^{Y} : Y(D) → Y(D) is a semantic operator, then the notation [[P]]^{Y} = [[P]]_{Y}^{X} means that lfp(T_{P}^{Y}) = lfp(Y∘T_{P}^{X}). If this holds then ⟨Y(D), T^{Y}⟩ is equivalent to ⟨Y(D), Y∘T^{X} ⟩. In this case, we abuse notation by letting also ⟨Y(D), T^{Y}⟩ ∈ Sem(X).

4.3 A Hierarchy of Logic Program Semantics

s-semantics, denoted by S, has been introduced in [12] in order to provide a fully abstract description of computed answer substitutions of logic programs. Recall that ϑ is a computed answer substitution for a goal G and a program P iff G⟶^{ϑ}\begin{matrix}∗ \\ P \end{matrix}Λ. Clark’s semantics, denoted by C, has been introduced in [2]. In [12], it was proved that C is fully abstract with respect to the “more abstract” notion of correct answer substitution. Recall that ϑ is a correct answer substitution for a goal G and a program P iff Gϑ⟶\begin{matrix}∗ \\ P \end{matrix}Λ. Finally, Herbrand’s semantics, denoted by H, coincides with the least Herbrand model of the program, and has been fully characterized by van Emden and Kowalski in [10]. In what follows, we assume that a first-order language L is given. The semantic domains for S, C and H are respectively ℘(Atom)_{⊆}, ℘^{↓}(Atom)_{⊆}, and ℘(⌊Atom⌋)_{⊆}, while for any program P, the corresponding operators are T_{P}^{S} : ℘(Atom) → ℘(Atom), T_{P}^{C} : ℘^{↓}(Atom) → ℘^{↓}(Atom), and T_{P}^{H} : ℘(⌊Atom⌋) → ℘(⌊Atom⌋), as defined in Table 1, and are all continuous functions. Thus, [[P]]^{S} = lfp(T_{P}^{S}), [[P]]^{C} = lfp(T_{P}^{C}), and [[P]]^{H} = lfp(T_{P}^{H}).

As proved in [17], s-semantics, Clark’s semantics and Herbrand’s semantics constitute a hierarchy in our framework (i.e. for abstract interpretation), where S is more precise than C, which in turn is more precise than H. We now recall from [17] the details of the abstraction mappings of this hierarchy.

As expected, the operator of instantiation ↓ is the closure on the domain of s-semantics defining Clark’s semantics. In particular, we have that T^{C} =↓∘T^{S}. Also, this abstraction is complete, i.e. for any I ∈ ℘(Atom), ↓(T^{S}(I )) =↓(T^{S}(↓(I ))), viz. T^{C}∘ ↓=↓ ∘T^{S}. Hence, by Proposition 4.3, this implies that for any P ∈ Program, [[P]]^{C} =↓([[P]]^{S}) = [[P]]_{↓}^{S}. This last observation has been firstly reported in [13]. It is worth noting that we have derived it by exploiting the techniques offered by abstract interpretation, which are intrinsically language-independent.

Herbrand’s semantics is an abstraction of Clark’s semantics through the following Galois insertion: (℘^{↓}(Atom), ⌊·⌋, ℘(⌊Atom⌋), ⌈·⌉), where ⌈·⌉ is the unique right adjoint to ⌊·⌋, i.e. for any I ⊆ ⌊Atom⌋, ⌈I ⌉ = ∪{J ∈ ℘^{↓}(Atom) | ⌊J ⌋ ⊆ I }. Thus, T^{H} = ⌊·⌋∘T^{C}∘⌈·⌉, i.e. the immediate consequence operator is the best correct approximation of the semantic operator of Clark’s semantics. This abstraction is also complete, namely ⌊·⌋∘T^{C} = T^{H}∘⌊·⌋. Again by Proposition 4.3, we get that [[P]]^{H} = ⌊[[P]]^{C}⌋, another observation already reported in [13].

Finally, composing the previous two abstractions, we get the abstraction between s-semantics and Herbrand’s semantics. This is defined in terms of the G.i. (℘(Atom), ⌊·⌋, ℘(⌊Atom⌋), ⌈·⌉), where, by a slight abuse of notation, we again denote by ⌈·⌉ the right adjoint to ⌊·⌋ for the concrete domain ℘(Atom). Also in this case, we have a complete abstraction. Hence, ⌊·⌋∘T^{S} = T^{H}∘⌊·⌋, and, by Proposition 4.3, [[P]]^{H} = ⌊[[P]]^{S}⌋. As above, this last observation is in [13]. In this case, λI .⌈⌊I ⌋⌉ ∈ uco(℘(Atom)) is the closure associated with Herbrand’s semantics.

5 Decomposition of Semantics

Let O be a given standard semantics. A (possible infinite) family of semantics ⟨X_{i}⟩_{i∈I} ⊆ Sem(O) is a (conjunctive) decomposition for Y ∈ Sem(O) if Y = ⊓_{i∈I} X_{i}. Filé and Ranzato observed in [15] that ⟨ρ_{i}⟩_{i∈I} is a minimal decomposition for a closure δ (i.e., for all k ∈ I and η closure, (ρ_{k} ⊏ η) ⇒ (δ ⊏ (⊓_{i∈I \{k}}ρ_{i}) ⊓ η)) iff for any k ∈ I , δ ∼ (⊓_{i∈I \{k}}ρ_{i}) = ρ_{k}. Among the possible minimal decompositions, we consider those given by the most abstract factors. It is well known (cf. [22]) that if L is a complete lattice, then uco(L) is a dual-atomistic complete lattice, viz. for any ρ ∈ uco(L), ρ = ⊓_{x∈ρ(L)\{⊤}}φ_{x} , where φ_{x} = {⊤, x}. We call the φ_{x} ’s atomic closures. We exploit these results, by giving a sufficient condition in order that any closure operator, and therefore any abstract semantics, admits a unique minimal factorization, involving the least number of atomic closures.^{2}

Theorem 5.1 Assume that L is an algebraic complete lattice and ρ ∈ uco(L). Then, ⟨φ_{x} ⟩_{x∈MI (ρ(L))} is a minimal decomposition for ρ, involving the least number of atomic closures only.

Morgado proved in [23] that atomic closures φ_{x} defined on meet-irreducible elements are always complemented, i.e. for any x ∈ MI (L), there exists φ̄_{x} ∈ uco(L) such that φ_{x} ⊓φ̄_{x} = id, and φ_{x} ⊔φ̄_{x} = λx.⊤. In particular, since algebraic lattices are also meet-continuous, then φ̄_{x} = φ_{x}^{∗} = id ∼φ_{x} , for any x ∈ MI (L). A natural question is therefore: is it possible to give a characterization of the pseudo-complements of closure operators in terms of the complements of their atomic factors? Actually, we show that a weak form of De Morgan’s identity, involving pseudo-complements, always holds for atomic closures, and that if L is algebraic then the pseudo-complement of any closure operator is uniquely determined by the real complements of its atomic factors.

2 If L is a lattice then x ∈ L is meet-irreducible if ∀y, z ∈ L. (x = y ∧z) ⇒ (x = y or x = z). We denote by MI (L) the set of meet-irreducible elements of L.

Lemma 5.2 If L is an algebraic complete lattice and I ⊆ L\{⊤} then, (⊓_{x∈I} φ_{x} )^{∗} = ⊔_{x∈I} φ_{x}^{∗} = ⊔_{x∈I ∩MI (L)} φ̄_{x} .

Hence, we obtain the following characterization for pseudo-complements of closure operators in terms of complements of atomic closures.

Theorem 5.3 If L is an algebraic complete lattice and ρ ∈ uco(L) then, id ∼ ρ = ρ^{∗} = ⊔_{x∈ρ(L)∩MI (L)} φ̄_{x} .

The interest in this result is that the semantic interpretation for atomic closures and their complements is easier. Again, logic programming provides a clean and immediate meaning for these atomic semantics. Consider the s-semantics S recalled in Section 4.3. Since ℘(Atom)_{⊆} is evidently algebraic, then the least (unique) minimal decomposition for S (= id ∈ uco(℘(Atom))) of Theorem 5.1, is given by the atomic closures ⟨A_{h}⟩_{h∈Atom}, where A_{h} = {Atom, Atom \ {h}}, for any h ∈ Atom. In this case, Ā_{h} = {I ⊆ Atom | h ∈ I } are the corresponding complements. If P is a program, then T_{P}^{Ah} : A_{h} → A_{h} is such that:

T_{P}^{Ah} (I ) = \begin{cases}Atom & if h ∈ T_{P}^{S}(I ); \\ Atom \ \{h\} & otherwise. \end{cases}

It is possible to show that this is a good definition, since for any h ∈ Atom, [[P]]^{Ah} = [[P]]_{Ah}^{S}. The semantics associated with each atomic closure A_{h}, and with its complement Ā_{h}, for h ∈ Atom, have then a clear meaning given by the following result.

Theorem 5.4 Let P and Q be programs, and h ∈ Atom.

1. P ≡_{Ah} Q iff (∃R. h ∉ [[R]]^{S} & h ∈ [[P ∪R]]^{S}) ⇔ (∃T . h ∉ [[T ]]^{S} & h ∈ [[Q ∪T ]]^{S}).

2. P ≡Āh Q iff [[P ∪ {h}]]^{S} = [[Q ∪ {h}]]^{S}.

Atomic semantics are therefore able only to distinguish whether a given atom h can be derived from a program P when this program has been composed with another program module R, whereas their complements, which are almost like the s-semantics, cannot provide any information about h. By Theorem 5.3, for any X ∈ Sem(S), we have:

S ∼X = ⨆_{h ∈ Atom Atom\{h} ∈ X} Ā_{h} = ⋂_{h ∈ Atom Atom\{h} ∈ X} Ā_{h}.

Consider, as a limit case, Herbrand’s semantics H. This complement is somewhat surprising. Indeed, since for any h ∈ Atom, Atom\{h} ∉ ⌈⌊℘(Atom)⌋⌉, then S ∼H = ⊔∅ = S. Thus, for any program P, [[P]]^{S∼H} = [[P]]^{S}. If we recall the meaning of the “best” semantics for analysis introduced in [17], we can draw a striking consequence of this fact. Due to lack of space, we omit the details of the constructions of [17], to which the reader is referred. Roughly, [17] calls a semantics X too concrete for a given property ρ on X (indeed a closure on the semantic domain of X) if there exists a proper abstraction Y of X that allows to perform the desired analysis (viz. ρ) without loosing any information with respect to X. In this sense, [17] shows that there exists always a best semantics for analysis, and provides an equational characterization for it involving the reduced product. Thus, exploiting these results, we may conclude that s-semantics S cannot be the best semantics for the analysis of any property which includes, at least, the least Herbrand model semantics H, i.e. no proper abstraction of S can be combined with H to get back S.

6 Complements in the Hierarchy

We now consider the remaining complements for the semantics of the hierarchy in Section 4.3.

6.1 Logic vs. Operational Semantics

Clark’s semantics is considered a logical semantics for programs (cf. [1]). Instead, the s-semantics captures the operational notion of computed answer substitution. Clark’s semantics is here characterized by the closure λx. ↓ x ∈ uco(℘(Atom)_{⊆}), where Atom_{≤} is a poset.

Lemma 6.1 If P is a poset then (λx. ↓x)^{∗} = λx.x ∪ Max(P).

We can constructively characterize the semantics of the complement S ∼ C ∈ Sem(S) as the semantics induced by the abstraction associated with the pseudocomplement λI .I ∪ Max(Atom). In this case, for a given first-order language L, Max(Atom) = {p(x̄) | p ∈ Π}, and therefore S ∼ C = {I ∪ Max(Atom) | I ⊆ Atom}. Given a program P, the semantic operator T_{P}^{S∼C} associated with S ∼ C is T_{P}^{S∼C} = λI .T_{P}^{S}(I ∪Max(Atom))∪Max(Atom). The following theorem characterizes the semantics of the complement S ∼C in terms of the semantics of computed answer substitutions of a simple transformed program.

Theorem 6.2 Let P ∈ Program. Then,

(i) [[P]]^{S∼C} = [[P]]_{S∼C}^{S} = [[P ∪ Max(Atom)]]^{S}; (ii) [[·]]_{S∼C}^{S} is not complete (i.e., ∃Q. S ∼C([[Q]]^{S}) ⊂ [[Q]]_{S∼C}^{S}).

A consequence of Theorem 6.2-(i) is that the semantics S ∼ C corresponds precisely to the fully abstract semantics for partial computed answer substitutions introduced in [11]. Recall that a substitution ϑ is a partial computed answer for the goal G in the program P iff there exists G′ and σ such that G⟶^{σ}\begin{matrix}∗ \\ P \end{matrix}G′ and Gϑ = Gσ (cf. [11]). Informally, the atoms in Max(Atom) allow us to transform any partial derivation for G in P into a successful derivation for G in P ∪ Max(Atom). The following result is therefore immediate by Theorem 6.2 and Theorem 5.4 in [11].

Theorem 6.3 Let P ∈ Program and G be a goal. ϑ is a partial computed answer substitution for G in P iff there exist b̄ <<_{G} [[P]]^{S∼C} such that Gϑ = G mgu(ḡ, b̄).

Thus, if P, Q ∈ Program, then P ≡_{S∼C} Q iff P and Q allow the same partial computed answer substitutions for any goal. The fact that the composition by reduced product of the partial computed answer and correct answer semantics is the semantics of computed answers, should be clear because: “a substitution which is a partial computed and correct answer for a goal in a program is always a computed answer”. Also, the semantics of partial computed answers is the (unique) most abstract semantics which, whenever composed with the semantics of correct answers, gives as result the s-semantics of computed answers. The intuition behind this result is clear. Clark’s semantics is unable to distinguish programs augmented with Max(Atom). This because, if P ∈ Program then any atom is a possible logical consequence of P ∪ Max(Atom), i.e. Atom is the least C-model for P ∪ Max(Atom). In particular, the program transform λP ∈ Program.P ∪Max(Atom) maps possibly logically different programs into logically equivalent ones. In this sense, P ∪Max(Atom) represents what is left from a logic program, once the information about its logical consequences has been removed, which is the semantics S ∼ C of partial computed answers. Further, the semantics of partial computed answers S ∼ C is also disjoint with respect to Clark’s semantics, namely it is the lattice-theoretic complement of C into Sem(S), i.e. (S ∼C) ⊔ C = λx.Atom. Hence, there is no semantics which can be at the same time correct with respect to both correct and partial answer semantics. For instance, Herbrand’s semantics is not even correct with respect to S ∼ C, i.e. H ∉ Sem(S ∼C).

6.2 Clark’s vs. Herbrand’s Semantics

We conclude by characterizing the complement C ∼ H of the least Herbrand model semantics into Clark’s semantics.

Theorem 6.4 C ∼ H = λI .I ∪ ⌊Atom⌋ ∈ uco(℘^{↓}(Atom)_{⊆}).

In other terms, the semantic domain for C ∼ H is {I ∈ ℘^{↓}(Atom) | ⌊Atom⌋ ⊆ I }. For a program P the semantic operator for C ∼H is defined as follows:

T_{P}^{C∼H} = λI .T_{P}^{C}(I ∪ ⌊Atom⌋) ∪ ⌊Atom⌋.

It is possible to show that C ∼ H is not complete. Analogously to the case of S ∼C, we can give a characterization of the least fixpoint semantics C ∼H in terms of Clark’s semantics of a transformed program.

Theorem 6.5 For any P ∈ Program, [[P]]_{C∼H}^{C} = [[P]]^{C∼H} = [[P ∪ ⌊Atom⌋]]^{C}.^{3}

The equivalence induced by this complement is as follows: if P, Q ∈ Program then P ≡_{C∼H} Q ⇔ P ∪ ⌊Atom⌋ ≡_{C} Q ∪ ⌊Atom⌋. This makes clear the intuitive meaning of this semantics. For instance, P = {p(a).} and Q = {q(a).} have the same C ∼ H semantics (which is ⌊Atom⌋ = {p(a), q(a)}), while they are obviously distinguished by Clark’s semantics C. In view of the general meaning of the complement operator, this is actually what one can expect from the semantics C ∼H.

3 It should be noted that the transform λP ∈ Program.P ∪ ⌊Atom⌋, in general, maps finite programs in infinite programs.

7 Semantics Interaction: Call vs. Success Patterns

Semantics at different levels of abstraction can interact with each other when composed via reduced product. Let O be a given semantics. The interaction among the factors of a conjunctive decomposition ⟨X_{i}⟩_{i∈I} of O (viewed as a closure) is captured precisely by the fact that for some program P, it may happen that [[P]]^{O} < ∧_{i∈I} [[P]]_{Xi}^{O}, even if O = ⊓_{i∈I} X_{i} as closure operators. In this case, we say that the factors {X_{i}}_{i∈I} cooperate in O. Clearly, if O is a least fixpoint semantics and the X_{i}’s are all complete abstractions, then the factors {X_{i}}_{i∈I} do not cooperate in the definition of O. This is however only a sufficient condition to check in order to verify whether semantics do not cooperate, as shown below for the case of Clark’s and partial answer semantics.

The following is a simple sufficient condition to check semantic cooperation among factors in least fixpoint semantics.

Theorem 7.1 Let ⟨X_{i}⟩_{i∈I} ⊆ Sem(O) be a conjunctive decomposition for the least fixpoint semantics O. If for some program P, [[P]]^{O} < ∧_{i∈I} T_{P}(X_{i}([[P]]^{O})), then {X_{i}}_{i∈I} cooperate in O.

Hence, we may characterize when a semantics (viz. a property) X ∈ Sem(O) is used in the definition of O. Intuitively, this is the case when ⟨X , O ∼X ⟩ is a binary decomposition with cooperating factors for O. In this case, the semantics [[·]]^{O} cannot be constructed by composing the semantics [[·]]^{X} and [[·]]^{O∼X}.

Note that there is no cooperation in S between Clark’s semantics and the semantics of partial answers, even if, by Theorem 6.2-(ii), S ∼C is not a complete abstraction. In fact, it is easy to prove that for any program P, [[P]]^{S} = [[P]]^{S∼C} ∩[[P]]^{C}. This confirms that completeness is only a sufficient condition to ensure independency among the factors of a semantic decomposition. Likewise, being S ∼ H = S, H is “useless” for S.

A typical case of semantic interaction in logic programming is given by the semantics for computed answer substitutions and call patterns. Recall that an atom a ∈ Atom is a call pattern for a goal G in a program P if G⟶^{ϑ}\begin{matrix}∗ \\ P \end{matrix} a | b̄. From this definition it is clear that, in order to have a call pattern for p ∈ Π for a goal G = b̄ :: p(t̄) :: b̄′, then b̄ needs to have a computed answer substitution ϑ in the program, and p(t̄)ϑ will be the corresponding call pattern. Hence, call patterns need computed answers to be computed. We formally justify this by complementing the semantics of computed answer substitutions in that of call patterns.

A least fixpoint semantics for call patterns has been introduced by Gabbrielli and Meo in [16] as ⨿ = ⟨℘(BClause), T_{P}^{⨿}⟩, where, if Φ = {p(x̄) ← p(x̄) | p ∈ Π} is the set of tautological clauses, then, for any I ⊆ BClause,

T_{P}^{⨿}(I ) = \{ (h ← b′′)ϑ | \begin{matrix}c = h ← b_{1}, ..., b_{k−1}, b_{k}, ..., b_{n}, k ≤ n \\ ⟨b′_{1}, ..., b′_{k−1}, b′_{k} ← b′′⟩ <<_{c} I ∪ Φ \\ ϑ = mgu(⟨b_{1}, ..., b_{k}⟩, ⟨b′_{1}, ..., b′_{k}⟩) \end{matrix} \} .

Gabbrielli and Meo proved that a is a call pattern for G = b_{1}, ..., b_{k−1}, b_{k}, ..., b_{n} in P iff there exists ⟨b′_{1}, ..., b′_{k−1}, b′_{k} ← b′′⟩ <<_{c} lfp(T_{P}^{⨿}) ∪ Φ, such that a = b′′ϑ and ϑ = mgu(⟨b_{1}, ..., b_{k}⟩, ⟨b′_{1}, ..., b′_{k}⟩).

The interest in call patterns is that S can be derived by abstract interpretation from ⨿. This provides a formal account on the interaction between call patterns and computed answer substitutions in the semantics of logic programs. It is immediate to see that S corresponds to the closure operator λI .I ∪ (BClause \ Atom) ∈ uco(℘(BClause)), while ⨿ is the identical closure on ℘(BClause). It is possible to show that [[·]]_{S}^{⨿} is complete, and for any program P, [[P]]^{S} = [[P]]_{S}^{⨿} ∩ Atom.

The semantics of computed answer substitutions can be “subtracted” from that of call patterns, providing a semantics for logic programs which characterizes nonsuccessful call patterns, and is associated with a simple program transform. We call this information naïve call patterns.

Proposition 7.2 ⨿∼S = λI .I ∪ Atom.

As expected, the semantics of naïve call patterns ⨿ ∼ S is not able to distinguish computed answer substitutions, while it is able to provide a weak form of call patterns. Intuitively, a naïve call pattern in ⨿ ∼ S does not consider the computed answer substitutions for the precedings atoms in the goal. Therefore, a is a naïve call pattern in ⨿ ∼ S for a goal b_{1}, ..., b_{k−1}, b_{k}, ..., b_{n} with k ≤ n in a program P, if a = b_{k}ϑ for some ϑ ∈ Sub defined on var(b_{1}, ..., b_{k−1}). This is obtained independently from the fact that ϑ is actually a computed answer substitution for b_{1}, ..., b_{k−1}. This intuition is captured precisely by the following operator. Let P be a program, and define T_{P}^{⨿∼S} : ℘(BClause) → ℘(BClause) such that for any I ⊆ BClause,

T_{P}^{⨿∼S}(I ) = \{ (h ← b′′)ϑ | \begin{matrix}c = h ← b_{1}, ..., b_{k−1}, b_{k}, ..., b_{n}, k ≤ n \\ ⟨b′_{1}, ..., b′_{k−1}⟩ <<_{c} Atom, b′_{k} ← b′′ <<_{c,b′_{1},...,b′_{k −1}}I ∪ Φ \\ ϑ = mgu(⟨b_{1}, ..., b_{k}⟩, ⟨b′_{1}, ..., b′_{k}⟩) \end{matrix} \} .

The following result proves that T_{P}^{⨿∼S} is exactly the immediate consequence operator associated with the naïve call patterns semantics ⨿ ∼ S, and specifies the semantics of ⨿ ∼ S ∈ Sem(⨿) in terms of a simple program transform. This transform corresponds to enhance a given program by including any possible substitution as computed answer. [[P]]^{⨿∼S} captures precisely the non-successful call patterns of the enhanced program. It is also possible to verify that ⨿∼S is not complete.

Theorem 7.3 Let P be a program.

1. For any I ∈ BClause, T_{P}^{⨿∼S}(I ) = T_{P}^{⨿}(⨿∼S(I )) \ Atom;

2. [[P]]^{⨿∼S} = [[P ∪ Atom]]^{⨿} \ Atom;

3. ∃Q ∈ Program. ⨿∼S([[Q]]^{⨿}) ⊂ [[Q]]_{⨿∼S}^{⨿} = ⨿∼S([[Q]]^{⨿∼S}) = [[Q ∪ Atom]]^{⨿}.

Moreover, by Theorem 7.1, it is easy to observe that the semantics of computed answer substitutions cooperates with that of naïve call patterns in order to compute call patterns for logic programs. In particular, [[·]]^{⨿} ≠ [[·]]_{S}^{⨿} ∩ [[·]]_{⨿∼S}^{⨿}, as in the case of the following simple program: P = {tr(x, y) ← R(x, z), tr(z, y).; R(x, x).}. In this case, tr(x, y) ← tr(z, y) ∉ [[P]]^{⨿}, while tr(x, y) ← tr(z, y) ∈ [[P]]_{S}^{⨿} ∩ [[P]]_{⨿∼S}^{⨿}.

Acknowledgments. We would like to thank Gilberto Filé for his valuable contribution.

References

1. K.R. Apt and M. Gabbrielli. Declarative interpretations reconsidered. In Proc. ICLP ’94 , pp. 74–89, The MIT Press, 1994.

2. K.L. Clark. Predicate logic as a computational formalism. Res. Report DOC 79/59, Dept. of Computing, Imperial College, London, 1979.

3. M. Comini and G. Levi. An algebraic theory of observables. In Proc. ILPS ’94 , pp. 172–186, The MIT Press, 1994.

4. M. Comini, G. Levi, and M.C. Meo. Compositionality of SLD-derivations and their abstractions. In Proc. ILPS ’95 , pp. 561–575, The MIT Press, 1995.

5. A. Cortesi, G. Filé, R. Giacobazzi, C. Palamidessi, and F. Ranzato. Complementation in abstract interpretation. In Proc. SAS ’95 , LNCS 983, pp. 100–117, 1995.

6. P. Cousot and R. Cousot. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proc. ACM POPL ’77 , pp. 238–252, 1977.

7. P. Cousot and R. Cousot. Systematic design of program analysis frameworks. In Proc. ACM POPL ’79 , pp. 269–282, 1979.

8. P. Cousot and R. Cousot. Inductive definitions, semantics and abstract interpretation. In Proc. ACM POPL ’92 , pp. 83–94, 1992.

9. P. Cousot and R. Cousot. Abstract interpretation and application to logic programs. J. of Logic Programming, 13(2,3):103–179, 1992.

10. M.H. van Emden and R.A. Kowalski. The semantics of predicate logic as a programming language. J. of the ACM , 23(4):733–742, 1976.

11. M. Falaschi and G. Levi. Finite failure and partial computations in concurrent logic languages. TCS, 75(7):45–66, 1990.

12. M. Falaschi, G. Levi, M. Martelli, and C. Palamidessi. Declarative modeling of the operational behavior of logic languages. TCS, 69(3):289–318, 1989.

13. M. Falaschi, G. Levi, M. Martelli, and C. Palamidessi.A model theoretic reconstruction of the operational semantics of logic programs. Inf. & Comp., 103(1):86–113, 1993.

14. G. Filé, R. Giacobazzi, and F. Ranzato. A unifying view of abstract domain design. ACM Comp. Surveys, 28(2), Symp. on Models of Progr. Lang. and Computation, 1996.

15. G. Filé and F. Ranzato. Complementation of abstract domains made easy. In Proc. JICSLP ’96 , The MIT Press, 1996.

16. M. Gabbrielli and M.C. Meo. Fixpoint semantics for partial computed answer substitutions and call patterns. In Proc. ALP ’92 , LNCS 632, pp. 84-99, 1992.

17. R. Giacobazzi. “Optimal” collecting semantics for analysis in a hierarchy of logic program semantics. In Proc. STACS ’96 , LNCS 1046, pp. 503-514, 1996.

18. R. Giacobazzi, C. Palamidessi, and F. Ranzato. Weak relative pseudo-complements of closure operators. Algebra Universalis, 1996. To appear.

19. R. Giacobazzi and F. Ranzato. Functional dependencies and Moore-set completions of abstract interpretations and semantics. In Proc. ILPS ’95 , pp. 321-335, 1995.

20. R. Giacobazzi and F. Ranzato. Compositional optimization of disjunctive abstract interpretations. In Proc. ESOP ’96 , LNCS 1058, pp. 141–155, 1996.

21. A. Mycroft. Completeness and predicate-based abstract interpretation. In Proc. ACM PEPM ’93 , 1993.

22. J. Morgado. Some results on the closure operators of partially ordered sets. Portug. Math., 19(2):101–139, 1960.

23. J. Morgado. Note on complemented closure operators of complete lattices. Portug. Math., 21(3):135–142, 1962.