Compositionality in SLD-derivations and their abstractions Marco Comini , Giorgio Levi and Maria Chiara Meo Dipartimento di Informatica , Universit?a di Pisa , Corso Italia 40 , 56125 Pisa , Italy fcomini , levi , meog@di.unipi.it Abstract We define a semantic framework to reason about compositional properties of SLD-derivations and their abstractions -LRB- observables -RRB- . The framework allows us to address problems such as the relation between the -LRB- top-down -RRB- operational semantics and the -LRB- bottom-up -RRB- denotational semantics , the existence of a denotation for a set of definite clauses and their properties -LRB- compositionality w.r.t. various syntactic operators , correctness and minimality -RRB- . This leads us to a flexible classification of the observables , where we can reason about properties such as OR-compositionality and existence of abstract transition system . Using abstract interpretation techniques to model abstraction allows us to state very simple conditions on the observables which guarantee the validity of several general theorems . 1 Introduction Our goal is the definition of a semantic framework , which allows us to reason about properties of SLD-derivations and their abstractions -LRB- observables -RRB- , in the case of definite logic programs . The issues we want to be able to address in the framework are the following ffl the relation between the -LRB- top-down -RRB- operational semantics and the -LRB- bottom -- up -RRB- denotational semantics , ffl the existence of a denotation for a set of definite clauses , ffl the properties of the denotation -LRB- compositionality w.r.t. various syntactic operators , correctness and minimality -RRB- . Similar problems have been studied in detail for various abstractions of SLD-derivations . Computed answers were considered in -LSB- 6 , 7 -RSB- , call patterns and partial answers were considered in -LSB- 11 -RSB- and resultants were considered in -LSB- 10 -RSB- -LRB- see -LSB- 2 -RSB- for a survey of the approach -RRB- . Moreover , a framework where one can define denotations modeling various observables -LRB- thus inheriting the basic constructions and results -RRB- was given in -LSB- 9 , 8 -RSB- , by defining abstractions by means of equivalence relations . The same problem was tackled by -LSB- 3 -RSB- for CLP and by -LSB- 12 -RSB- , by modeling abstractions according to abstract interpretation theory . This means that it is possible to accommodate in the framework observables which are useful for -LRB- approximate -RRB- program analysis . In this paper we build upon the idea in -LSB- 3 -RSB- of providing an algebraic characterization of the observables . We extend the approach , by taking two basic semantics : a denotational semantics and a transition system which define SLD-derivations . In addition , our semantic properties are expressed as compositionality properties . This leads us to a more flexible classification of the observables , where we can reason about properties such as OR-compositionality and existence of abstract transition system . Using abstract interpretation techniques to model abstraction allows us to state very simple conditions on the observables which guarantee the validity of several general theorems . In Section 3 we define the denotational semantics and the transition system for SLD-derivations in terms of four semantic operators , directly related to the syntactic structure of the language . In Section 3.4 we prove several properties of SLD-derivations . In Section 4 we define the observables as Galois insertions and characterize two classes of observables in terms of simple properties of the Galois insertion and of the basic semantic operators . The first class -LRB- perfect observables of Section 4.4 -RRB- has all the properties of SLD-derivations . In the other class , the properties are preserved only for the denotational semantics -LRB- denotational observables of Section 4.5 -RRB- . The reconstruction of an existing semantics or the construction of a new semantics in the framework requires just a few very simple steps . i . The formalization of the property we want to model as a Galois insertion hff ; i between SLD-derivations and the property domain . ii . The verification of very simple algebraic properties relating hff ; i and the basic semantic semantic operators on SLD-derivations , to assign the property to the right class of observables . iii . Depending on the class , we automatically obtain the new denotational semantics , transition system , top-down and bottom-up denotations , together with several interesting theorems -LRB- equivalence , compositionality w.r.t. the various syntactic operators , correctness and minimality of the denotations -RRB- . Since it is based on standard operational and denotational semantic definitions , the framework can be adapted to other programming languages . 2 Preliminaries In the following sections , we assume familiarity with the standard notions of logic programming as introduced in -LSB- 1 -RSB- and -LSB- 17 -RSB- . We denote by G and B possibly empty sequences of atoms , by t ; x tuples of , respectively , terms and distinct variables . Moreover we denote by t both the tuple and the set of corresponding syntactic objects . B ; B0 denotes the concatenation of B and B0 . The set of all atoms is denoted by Atoms and the set of all goals is denoted by Goals . The empty goal is denoted by ? . We consider idempotent substitutions only . Subst is the set of all idempotent substitutions . Given a substitution # 2 Subst , dom -LRB- # -RRB- = fx j # -LRB- x -RRB- < > xg is the domain of # and range -LRB- # -RRB- = f y j x < > # -LRB- x -RRB- ; y 2 var -LRB- # -LRB- x -RRB- -RRB- g is the range of # . If # 2 Subst is a substitution and E is a syntactic expression , #jE is the restriction of # to the variables var -LRB- E -RRB- of E. G # 1 ?! c1 : : : # n ?! cn Gn : : : ; -LRB- n > = 0 -RRB- denotes a -LRB- partial -RRB- SLD-derivation of goal G via the leftmost selection rule . The derivation uses the renamed apart clauses c1 ; : : : ; cn and # = -LRB- # 1 ? ? ? # n -RRB- jG is the computed answer substitution of G. Given a derivation d , first -LRB- d -RRB- and last -LRB- d -RRB- are respectively the first and the last goal of d , answer -LRB- d -RRB- is the computed answer substitution of d . We denote a zero-length derivation of G by G itself . Given two derivations d and d0 such that last -LRB- d -RRB- = first -LRB- d0 -RRB- = G and var -LRB- d -RRB- \ var -LRB- d0 -RRB- = var -LRB- G -RRB- , d : : d0 denotes the derivation obtained by concatenation of d and d0 and clauses -LRB- d -RRB- is the set of clauses of d. ? is the equivalence modulo variance -LRB- extended also to derivations -RRB- . 3 The basic framework In the following for the sake of simplicity we consider the PROLOG leftmost selection rule . All our results can be generalized to local selection rules . When we want to formalize program execution we must take into account , in addition to the inference rules which specify how derivations are made , the properties we observe in a computation -LRB- observables -RRB- . An observable is any property which can be extracted from a goal computation , i.e. , observables are abstractions of SLD - trees . We assume the reader to be familiar with the notions of SLD-resolution and SLD-tree -LRB- see -LSB- 17 , 1 -RSB- -RRB- . We represent here , for notational convenience , SLD-trees as sets of derivations . i . We define a preorder ? on derivations : d ? d0 iff first -LRB- d -RRB- = first -LRB- d0 -RRB- and there exists a renaming ae such that dae is a prefix of d0 . ii . Let ss be the equivalence relation induced by ? . We denote by Deriv the set of all derivations modulo ss . In the following we denote the equivalence class of a derivation d by d itself and derivations are always intended as equivalence classes of derivations . iii . S ? Deriv is well-formed iff d 2 S implies 8d0 2 Deriv , d0 ? d -RRB- d0 2 S. iv . A collection D is a set of pairs hG ; Si such that -LRB- a -RRB- for any hG ; Si 2 D , S < > ; is a well-formed set of derivations starting from the goal G , -LRB- b -RRB- if hG1 ; S1i and hG2 ; S2i are distinct elements of D then G1 < > G2 . Definition 3.1 D is the domain of all the collections ordered by v , where D v D0 if and only if 8hG ; Si 2 D ; 9hG ; S0i 2 D0 : S ? S0 . The partial order on D formalizes the evolution of the computation process . It is easy to prove that -LRB- D ; v -RRB- is a complete lattice . Proposition 3.2 Each collection where all the clauses used in derivations are in P is a representation of a family of partial SLD-trees of P . Moreover each maximal collection in P is a representation of the family of all SLD-trees of G in P , for each goal G 2 Goals . Note that every clause c = p -LRB- t -RRB- : ? B of P can be viewed as the \ one step '' col - lection tree -LRB- c -RRB- = f hp -LRB- x -RRB- ; f p -LRB- x -RRB- ; p -LRB- x -RRB- f x = t g ?! c B gi g , where x is a tuple of new distinct variables . In the following we often denote the derivation associated to the clause c by c itself . Moreover every goal G can be viewed as the collection f hG ; f G gi g containing the \ zero step '' derivation G . The goal we want to achieve is to develop a denotation modeling partial SLD - trees . We follow the approach in -LSB- 3 , 2 -RSB- , by defining a \ syntactic '' semantic domain -LRB- interpretation -RRB- . Our modeling of partial SLD-trees is similar to the basic denotation defined in terms of clauses in -LSB- 8 , 9 -RSB- . Definition 3.3 A most general collection is a collection such that each initial goal is a most general atomic goal . An interpretation I is a most general collection modulo variance . We denote by I the set of interpretations . -LRB- I ; v -RRB- is a complete lattice . XjI represents the -LRB- greatest -RRB- most general sub-collection of any X 2 D = ? . Note that in interpretations the variance relation allows us to abstract w.r.t. the variables occurring in the initial goals of any collection . 3.1 Denotational semantics of SLD-derivations Our algebraic framework is defined by a set of semantic operators obtained from a denotational definition of derivations . We start with some notation . We denote the equivalence class -LRB- modulo variance -RRB- of a collection oe by oe itself . Moreover , any subset I of I is implicitly considered also as an arbitrary collection obtained by QUERY : : = GOAL in PROG GOAL : : = ? j ATOM ; GOAL PROG : : = ; j f CLAUSE g -LSB- PROG CLAUSE : : = ATOM : ? GOAL Figure 1 : Syntax of logic programs choosing for each equivalence class oe 2 I an arbitrary representative of oe . All the operators that we will use on interpretations are independent from the choice of the representative . Therefore we can define any operator on Iin terms of its counterpart defined on D , independently from the choice of the representative . All the definitions will be independent from the choice of the syntactic object . To simplify the notation , we denote the corresponding operators on Iand D by the same name . Several denotational semantics have been defined for logic programs -LRB- see , for example , -LSB- 13 , 14 , 5 -RSB- -RRB- . The main differences w.r.t. the above definitions are that we do not consider the PROLOG search rule and that our denotations model SLD -- derivations rather than just computed answers . We define the denotational semantics inductively on the syntax of logic programs of Figure 1 -LRB- the syntactic structure of atoms is not defined -RRB- . We express denotations in algebraic notation . This will be useful in Section 4 for reasoning about the abstract denotations . The choice of the semantic operators is induced by the syntactic operators , due to the compositional nature of definitions in the denotational style . The informal meaning of the operators is the following . The operator ? \ solves '' an atomic goal A into an interpretation I . The operator ? computes the conjunction of two denotations . The operator on computes the denotations obtained by replacement . Finally the operator P computes the non-deterministic union of a class of denotations . Note that when the class is finite we use the infix notation + . Q : QUERY ! D ; Q -LSB- -LSB- G in P -RSB- -RSB- = G -LSB- -LSB- G -RSB- -RSB- lfp P -LSB- -LSB- P -RSB- -RSB- G : GOAL ! -LRB- I ! D -RRB- ; G -LSB- -LSB- ? -RSB- -RSB- I = f h ? ; f ? gi g G -LSB- -LSB- A ; G -RSB- -RSB- I = A -LSB- -LSB- A -RSB- -RSB- I ? G -LSB- -LSB- G -RSB- -RSB- I A : ATOM ! -LRB- I ! D -RRB- ; A -LSB- -LSB- A -RSB- -RSB- I = A ? I P : PROG ! -LRB- I ! I -RRB- ; P -LSB- -LSB- ;] -RSB- I = Id jI P -LSB- -LSB- fcg -LSB- P -RSB- -RSB- I = C -LSB- -LSB- c -RSB- -RSB- I + P -LSB- -LSB- P -RSB- -RSB- I C : CLAUSE ! -LRB- I ! I -RRB- ; C -LSB- -LSB- p -LRB- t -RRB- : ? B -RSB- -RSB- I = tree -LRB- p -LRB- t -RRB- : ? B -RRB- on G -LSB- -LSB- B -RSB- -RSB- I : In order to define the semantic operators we first we need to define an auxiliary operation on derivations . This operation formalizes the instantiation of a derivation . Let d = G00 # 01 ?! c1 : : : be a derivation and let be a substitution such that var -LRB- G00 -RRB- \ var -LRB- clauses -LRB- d -RRB- -RRB- = ; . Then d = G0 # 1 ?! c1 : : : is the maximal derivation such that G0 = G00 and 8i > 0 : i. i = mgu -LRB- Gi ? 1 ; G0i ? 1 # 0i -RRB- s.t. var -LRB- range -LRB- i -RRB- -RRB- \ var -LRB- G0i ? 1 -RRB- ? var -LRB- Gi ? 1 -RRB- , ii . # i = -LRB- # 0i i -RRB- j -LRB- A ; ci -RRB- where A is the first atom in Gi ? 1 and iii . Gi = G0i i : Let D ; D1 ; D2 be collections in D and A be an atom . Id is the collection of zero -- length derivations for each goal , f hG ; f G gi j G 2 Goals g . The instantiation of D with A is A ? D = f hA ; Si j S = f d j hA0 ; Si is a renamed apart -LRB- from A -RRB- version of an element of D , d 2 S and there exists such that A = A0 g ; S < > ; g : The product of D1 and D2 is D1 ? D2 = f hG ; Si j S = f d j G = -LRB- G00 ; G000 -RRB- , hG00 ; S0i 2 D1 , hG000 ; S00i 2 D2 , d1 = G00 # 1 ?! c1 : : : 2 S0 , d2 2 S00 , var -LRB- d1 -RRB- \ var -LRB- d2 -RRB- = var -LRB- G00 -RRB- \ var -LRB- G000 -RRB- , and if exists k s.t. G0k = ? then d = d0 : : d2 -LRB- # 1 ? ? ? # k -RRB- else d = d0 , where d0 = G0 # 1 ?! c1 : : : is the derivation i. G0 = -LRB- G00 ; G000 -RRB- , ii . 8i > 0 , Gi = G0i ; ? G # i , if there exists ? G s.t. Gi ? 1 = G0i ? 1 ; ? G and G0i ? 1 < > ? g , S < > ; g . The replacement of D2 in D1 is D1 on D2 = f hG ; Si j hG ; S1i 2 D1 , S = S1 -LSB- f d : : d0 j d 2 S1 , hlast -LRB- d -RRB- ; S2i is a renamed version of an element in D2 , d0 2 S2 and var -LRB- d -RRB- \ var -LRB- d0 -RRB- = var -LRB- first -LRB- d0 -RRB- -RRB- g . The sum of a class f Di gi2I is X f Di gi2I = f hG ; Si j S = -LSB- fSi j hG ; Sii 2 Di ; i 2 I g ; S < > ; g : In infix notation D1 + D2 = PfD1 ; D2 g. Note that D1 v D2 , D1 + D2 = D2 and that the lub operation on -LRB- D ; v -RRB- coincides with P . The operation P can be naturally extended to each domain of set of pairs where the second component is a set . In the following we call such an operation pair set union . Note that if D ? D0 then A ? D = A ? D0 , because of the renaming apart property and the \ collecting '' nature of ? . 3.2 Operational semantics The operational semantics is described in terms of a transition system T = -LRB- D ; TP -RRB- . The rules of T are hG ; Si 2 D ; G # 1 ?! c1 : : : # n ?! cn -LRB- A ; G0 -RRB- 2 S ; c 2 P ; D @ D on -LRB- -LRB- A ? tree -LRB- c -RRB- -RRB- ? f hG0 ; f G0 gi g -RRB- TP -LRB- D ; D on -LRB- -LRB- A ? tree -LRB- c -RRB- -RRB- ? f G0 g -RRB- -RRB- TP -LRB- D1 ; D01 -RRB- ; TP -LRB- D2 ; D02 -RRB- TP -LRB- D1 + D2 ; D01 + D02 -RRB- The initial states of T are all the collections of SLD-derivations of zero-length , while the final states are all the collections of SLD-refutations . It can easily be shown that the transition system T defines the usual notion of SLD-derivation . Its specificity is due to the fact that we have defined it using the same semantic operators used in the denotational definition . Note that the first transition rule can be expressed in a more general fashion like D 2 D ; c 2 P ; A 2 Atoms ; D @ D on -LRB- -LRB- A ? tree -LRB- c -RRB- -RRB- ? Id -RRB- TP -LRB- D ; D on -LRB- -LRB- A ? tree -LRB- c -RRB- -RRB- ? Id -RRB- -RRB- thus obtaining an equivalent transition relation . Since we are interested in all the SLD-derivations of a query G in P , we define its behavior as B -LSB- -LSB- G in P -RSB- -RSB- = X f D j T?P -LRB- f hG ; f G gi g ; D -RRB- g where T?P is the reflexive and transitive closure of TP . As we will see in the following -LRB- Corollary 3.9 -RRB- the operational and denotational semantics of each query are the same . We define the equivalence of two programs P1 , P2 as P1 ss P2 -LRB- -RRB- 8G 2 Goals ; B -LSB- -LSB- G in P1 -RSB- -RSB- = B -LSB- -LSB- G in P2 -RSB- -RSB- : 3.3 The program denotation We can note that the semantic function P -LSB- -LSB- P -RSB- -RSB- is essentially the \ bottom-up '' TP operator in the case of derivations . Using standard techniques it can be proved that P -LSB- -LSB- P -RSB- -RSB- is continuous , hence we can define the fixpoint denotation of the program P as the interpretation F -LSB- -LSB- P -RSB- -RSB- = lfp P -LSB- -LSB- P -RSB- -RSB- = P -LSB- -LSB- P -RSB- -RSB- '' ! . This can be viewed as a program denotation , since it is the semantics of the program as a set of definite clauses -LRB- or a set of procedure definitions -RRB- . We can also define a top-down program denotation . This can be obtained by collecting the behaviors for all most general atomic goals , i.e. , the behaviors of the procedures with no constraints on the inputs . The top-down SLD-derivations denotation of a program P is the interpretation O -LSB- -LSB- P -RSB- -RSB- = X f B -LSB- -LSB- p -LRB- x -RRB- in P -RSB- -RSB- = ? gp -LRB- x -RRB- 2Goals : In the following we will prove that F -LSB- -LSB- P -RSB- -RSB- and O -LSB- -LSB- P -RSB- -RSB- are equivalent . Now we give two definitions to relate program equivalences to denotations . Let S -LSB- -LSB- P -RSB- -RSB- be a program denotation -LRB- F -LSB- -LSB- P -RSB- -RSB- or O -LSB- -LSB- P -RSB- -RSB- -RRB- and ? be a program equivalence . Then i. S is correct w.r.t. ? if S -LSB- -LSB- P1 -RSB- -RSB- = S -LSB- -LSB- P2 -RSB- -RSB- =-RRB- P1 ? P2 , ii . S is minimal w.r.t. ? if P1 ? P2 =-RRB- S -LSB- -LSB- P1 -RSB- -RSB- = S -LSB- -LSB- P2 -RSB- -RSB- . 3.4 Semantic properties of SLD-derivations We show that the program denotation O -LSB- -LSB- P -RSB- -RSB- has several interesting properties , which can all be viewed as compositionality properties . The first compositionality result is a theorem which shows that the semantic function B is compositional w.r.t. procedure calls -LRB- atomic goals -RRB- and composition -LRB- conjunction -RRB- inside goals -LRB- AND -- compositionality -RRB- . Theorem 3.4 Let A be an atom G1 , G2 be goals and P be a program . Then B -LSB- -LSB- A in P -RSB- -RSB- = A ? O -LSB- -LSB- P -RSB- -RSB- ; B -LSB- -LSB- G1 ; G2 in P -RSB- -RSB- = B -LSB- -LSB- G1 in P -RSB- -RSB- ? B -LSB- -LSB- G2 in P -RSB- -RSB- : Corollary 3.5 Let A be an atom , G be a goal and P be a program . Then B -LSB- -LSB- ? in P -RSB- -RSB- = f h ? ; f ? gi g and B -LSB- -LSB- A ; G in P -RSB- -RSB- = A ? O -LSB- -LSB- P -RSB- -RSB- ? B -LSB- -LSB- G in P -RSB- -RSB- : The above closure property of O w.r.t. B allows us to show that the denotation O is correct and minimal w.r.t. ss . Corollary 3.6 Let P1 , P2 be two programs . Then P1 ss P2 -LRB- -RRB- O -LSB- -LSB- P1 -RSB- -RSB- = O -LSB- -LSB- P2 -RSB- -RSB- : By using the replacement operator we can define an operator -RSB- which computes the OR -LCB- composition of two denotations . Namely D1 -RSB- D2 = ffD1 + D2gg where ffDgg is the least solution of the equation ffDgg = IdjI + Pf ffDgg on -LRB- -LRB- A ? D -RRB- ? Id -RRB- gA2Atoms : The following theorem shows the next compositionality property . Namely , O -LSB- -LSB- P -RSB- -RSB- is compositional w.r.t. -LSB- -LRB- OR-compositionality -RRB- . Theorem 3.7 Let P1 , P2 be programs . Then O -LSB- -LSB- P1 -LSB- P2 -RSB- -RSB- = O -LSB- -LSB- P1 -RSB- -RSB- -RSB- O -LSB- -LSB- P2 -RSB- -RSB- : The top-down and the bottom-up denotations are indeed equivalent . Theorem 3.8 Let P be a program . Then O -LSB- -LSB- P -RSB- -RSB- = F -LSB- -LSB- P -RSB- -RSB- : The following theorem asserts the equivalence between the denotational and the operational semantics . Corollary 3.9 Let G be a goal and P be a program . Then Q -LSB- -LSB- G in P -RSB- -RSB- = B -LSB- -LSB- G in P -RSB- -RSB- : 4 The abstraction framework The properties we found for O and F allow us to claim that we have a good denotation modeling SLD-derivations . Our goal however is to find the same results for the denotations modeling more abstract observables . We want then to develop a theory according to which the semantic properties of SLD-derivations shown in subsection 3.1 are inherited by the denotations which model abstractions of the SLD - derivations . We will model the abstractions by using the Abstract Interpretation theory -LSB- 4 -RSB- . 4.1 Galois Insertions and Abstract Interpretation Abstract Interpretation is a theory developed to reason about the abstraction relation between two different semantics . The theory requires the two semantics to be defined on domains which are complete lattices . -LRB- C ; ? -RRB- -LRB- concrete domain -RRB- is the domain of the concrete semantics , while -LRB- A ; <=-RRB- -LRB- abstract domain -RRB- is the domain of the abstract semantics . The partial order relations reflect an approximation relation . The two domains are related by a pair of functions -LRB- abstraction -RRB- and -LRB- concretization -RRB- , which form a Galois Insertion . Definition 4.1 -LRB- Galois Insertion -RRB- Let -LRB- C ; ? -RRB- be the concrete domain and -LRB- A ; <=-RRB- be the abstract domain . A Galois insertion is a pair of maps : C ! A and : A ! C such that i. and are monotonic , ii . 8x 2 C , x ? -LRB- ffi -RRB- -LRB- x -RRB- and 8y 2 A , -LRB- ffi -RRB- -LRB- y -RRB- = y. Given a Galois Insertion between the concrete and the abstract domain and a concrete semantics , we want to define an abstract semantics . The concrete semantics is the least fixpoint of a semantic function F : C ! C . The abstract semantic function ~ F : A ! A is correct if 8x 2 C , F -LRB- x -RRB- < = -LRB- ~ F -LRB- -LRB- x -RRB- -RRB- -RRB- . The same property holds for the least fixpoints of F and ~ F . F is in turn defined as composition of \ primitive '' operators . Let f : Cn ! C be one such an operator and assume that ~ f is its abstract counterpart . Then ~ f is locally correct w.r.t. f if 8x1 ; : : : ; xn 2 C , f -LRB- x1 ; : : : ; xn -RRB- ? -LRB- ~ f -LRB- -LRB- x1 -RRB- ; : : : ; -LRB- xn -RRB- -RRB- -RRB- . The local correctness of all the primitive operators implies the global correctness . Hence , we can define an abstract semantics by defining locally correct abstract primitive semantic functions . An abstract computation is then related to the concrete computation , simply by replacing the concrete operators by the corresponding abstract operators . According to the theory , for each operator f , there exists an optimal -LRB- most precise -RRB- locally correct abstract operator ~ f defined as ~ f -LRB- y1 ; : : : ; yn -RRB- = -LRB- f -LRB- -LRB- y1 -RRB- ; : : : ; -LRB- yn -RRB- -RRB- -RRB- . However the composition of optimal operators is not necessarily optimal . The abstract interpretation theory allows us to model the approximation process which is typically involved in program analysis . In this paper we are only concerned with different semantics and therefore we look for precise abstractions . The abstract operator ~ f is precise if 8x1 ; : : : ; xn 2 C ; -LRB- f -LRB- x1 ; : : : ; xn -RRB- -RRB- = ~ f -LRB- -LRB- x1 -RRB- ; : : : ; -LRB- xn -RRB- -RRB- . Hence the optimal abstract operator ~ f is precise if and only if -LRB- f -LRB- x1 ; : : : ; xn -RRB- -RRB- = -LRB- f -LRB- -LRB- ffi -RRB- x1 ; : : : ; -LRB- ffi -RRB- xn -RRB- -RRB- . So the precision of the optimal abstract operators can be reformulated in terms of properties of , and the corresponding concrete operator . The above definitions are naturally extended to \ primitive '' semantic operators from P -LRB- C -RRB- to C. 4.2 The observables An observable property domain is a set of properties of the derivation with an ordering relation which can be viewed as an approximation structure . An observation consists in looking at an SLD-derivation , and then extracting some property -LRB- abstraction -RRB- . Our concrete domain D is then the domain of all the collections . We have already shown that -LRB- D ; v -RRB- is a compete lattice . Therefore the observable is a function from D to a suitable property domain D , which preserves the approximation structure . Such a function must be a Galois connection . Definition 4.2 Let -LRB- D ; <=-RRB- be a complete lattice . A function : D ! D is an observable if there exists s.t. -LRB- ff ; -RRB- : -LRB- D ; v -RRB- ! -LRB- D ; <=-RRB- is a Galois insertion and 8D ; D0 2 D , D ? D0 -LRB- -RRB- -LRB- -LRB- D -RRB- -RRB- ? -LRB- -LRB- D0 -RRB- -RRB- . The last condition states that the observation does not depend on the choice of the variable names . Hence we can define an abstract variance relation ~ ? as S ~ ? S0 -LRB- -RRB- -LRB- S -RRB- ? -LRB- S0 -RRB- . Note that in the following if there exists a bijective Galois connection between two domains , we identify them . Each observable induces an observational equivalence ss on programs . Namely P1 ss P2 iff 8G 2 Goals , -LRB- B -LSB- -LSB- G in P1 -RSB- -RSB- -RRB- = -LRB- B -LSB- -LSB- G in P2 -RSB- -RSB- -RRB- , i.e. , if P1 and P2 can not be distinguished by looking at their abstract behaviors . Note that whenever we have two equivalent observables , the induced equivalences on programs are the same , but the converse does not hold . For example P1 ss P2 iff P1 ? P2 . Therefore , the equivalence on programs induced by the SLD-derivations semantics is the same as the syntactical equivalence on programs -LRB- variance -RRB- . However , we can observe much more properties in SLD-derivations than in programs . Example 4.3 If ? denotes computed answer substitutions we can take D = P -LRB- Goals ? P -LRB- Subst -RRB- -RRB- as abstract domain and define -LRB- ? ; ? -RRB- : D ! D as ? -LRB- D -RRB- = f hG ; ? i j hG ; Si 2 D , ? = f # j G # 1 ?! c1 : : : # n ?! cn ? 2 S and # = -LRB- # 1 ? ? ? # n -RRB- jG g , ? < > ; g. ? -LRB- X -RRB- = f hG ; Si j S = f d j first -LRB- d -RRB- = G , last -LRB- d -RRB- = ? ; hG ; ? i 2 X , answer -LRB- d -RRB- 2 ? g -LSB- f d j first -LRB- d -RRB- = G ; last -LRB- d -RRB- < > ? g ; S < > ; g : It is easy to see that P1 ss ? P2 iff for any goal G , G has the same computed answer substitutions in P1 and in P2 . 4.3 From the observables to the abstract semantics Once we have an observable : D ! D , we want to systematically derive the abstract semantics . The idea is to define the optimal abstract versions of the various semantic operators and then check under which conditions -LRB- on the observable -RRB- we obtain the optimal abstract semantics . This will allow us to identify some interesting classes of observables . We start by defining the optimal abstract counterparts of the basic operators defined on I. Hence 8S ; S1 ; S2 ; Si 2 D ffl ~ Pf Si gi2I = -LRB- Pf -LRB- Si -RRB- gi2I -RRB- , ffl A ~ ? S = -LRB- A ? -LRB- S -RRB- -RRB- , ffl S1 ~ ? S2 = -LRB- -LRB- S1 -RRB- ? -LRB- S2 -RRB- -RRB- , ffl S1 ~ on S2 = -LRB- -LRB- S1 -RRB- on -LRB- S2 -RRB- -RRB- . Once we have the optimal abstract operators , we can define the corresponding abstract semantics , obtained from the denotational and operational semantics of SLD - derivations by replacing the basic semantic operators by their optimal abstract versions . Q -LSB- -LSB- G in P -RSB- -RSB- = G -LSB- -LSB- G -RSB- -RSB- lfp P -LSB- -LSB- P -RSB- -RSB- G -LSB- -LSB- ? -RSB- -RSB- S = -LRB- f ? g -RRB- G -LSB- -LSB- A ; G -RSB- -RSB- S = A -LSB- -LSB- A -RSB- -RSB- S ~ ? G -LSB- -LSB- G -RSB- -RSB- S A -LSB- -LSB- A -RSB- -RSB- S = A ~ ? S P -LSB- -LSB- ;] -RSB- S = -LRB- Id jI -RRB- P -LSB- -LSB- fcg -LSB- P -RSB- -RSB- S = C -LSB- -LSB- c -RSB- -RSB- S ~ + P -LSB- -LSB- P -RSB- -RSB- S C -LSB- -LSB- p -LRB- t -RRB- : ? B -RSB- -RSB- S = -LRB- tree -LRB- p -LRB- t -RRB- : ? B -RRB- -RRB- ~ on G -LSB- -LSB- B -RSB- -RSB- S ; F -LSB- -LSB- P -RSB- -RSB- = lfp P -LSB- -LSB- P -RSB- -RSB- = P -LSB- -LSB- P -RSB- -RSB- '' ! : S 2 D ; c 2 P ; A 2 Atoms ; S < S ~ on ? -LRB- A ~ ? -LRB- tree -LRB- c -RRB- -RRB- -RRB- ~ ? -LRB- Id -RRB- ? TP ; ff ? S ; S ~ on ? -LRB- A ~ ? -LRB- tree -LRB- c -RRB- -RRB- -RRB- ~ ? -LRB- Id -RRB- ?? TP ; ff -LRB- S1 ; S01 -RRB- ; TP ; ff -LRB- S2 ; S02 -RRB- TP ; ff -LRB- S1 ~ + S2 ; S01 ~ + S02 -RRB- B -LSB- -LSB- G in P -RSB- -RSB- = ? ~ Pf S j T?P ; ff -LRB- -LRB- f G g -RRB- ; S -RRB- g ? = ~ ? O -LSB- -LSB- P -RSB- -RSB- = ~ Pf B -LSB- -LSB- p -LRB- x -RRB- in P -RSB- -RSB- gp -LRB- x -RRB- 2Goals : We are looking for conditions which guarantee that this definition does not lead to a loss of precision . 4.4 Perfect observables The first class of observables we consider is the class of observables for which both the abstract denotational and the abstract operational semantics are as precise as possible . As a consequence , we can equivalently compute the abstract property in a top-down and in a bottom-up way , by mimicking the concrete computations . Definition 4.4 Let : D ! D be an observable . Then is a perfect observable if i. -LRB- PfDi gi2I -RRB- = -LRB- Pf -LRB- ffi -RRB- Di gi2I -RRB- , ii . -LRB- A ? D -RRB- = -LRB- A ? -LRB- ffi -RRB- D -RRB- , iii . -LRB- D1 ? D2 -RRB- = -LRB- -LRB- ffi -RRB- D1 ? -LRB- ffi -RRB- D2 -RRB- , iv . -LRB- D1 on D2 -RRB- = -LRB- -LRB- ffi -RRB- D1 on -LRB- ffi -RRB- D2 -RRB- . Example 4.5 We consider the computed resultants observable defined by O -LRB- D -RRB- = f hG ; Ri j R = f G # B j hG ; Si 2 D , G # 1 ?! c1 : : : # n ?! cn B 2 S ; # = -LRB- # 1 ? ? ? # n -RRB- jG g , R < > ; g : O -LRB- X -RRB- = f hG ; Si j S = wf -LRB- f d j first -LRB- d -RRB- = G , hG ; Ri 2 X , G # last -LRB- d -RRB- 2 R , # = answer -LRB- d -RRB- g -RRB- , R < > ; g : where wf -LRB- S -RRB- is the -LRB- greatest -RRB- well-formed subset of any S ? Deriv . It is easy to show that O and O satisfy the conditions of Definition 4.4 . Hence computed resultants are a perfect observable . The ~ ? , ~ on and ~ ? operations are A ~ ? X = f hA ; Ri j R = f -LRB- A B -RRB- # j hH ; R0i is a renamed apart element of X , H B 2 R0 , there exists s.t. . A = H and # = mgu -LRB- A ; H -RRB- g , R < > ; g ; X1 ~ ? X2 = f hG ; Ri j R = f -LRB- -LRB- G01 ; G02 -RRB- B -RRB- # j G = -LRB- G1 ; G2 -RRB- , hG1 ; R1i 2 X1 , hG2 ; R1i 2 X2 , r1 = G01 B1 2 R1 , r2 = G02 B2 2 R2 , var -LRB- r1 -RRB- \ var -LRB- r2 -RRB- ? var -LRB- G1 -RRB- \ var -LRB- G2 -RRB- and if B1 < > ? then # = mgu -LRB- G01 ; G1 -RRB- and B = -LRB- B1 ; G2 -RRB- else B = B2 and # = mgu -LRB- -LRB- G1 ; G2 -RRB- ; -LRB- G01 ; G02 -RRB- -RRB- g , R < > ; g , X1 ~ on X2 = f hG ; Ri j hG ; R1i 2 X1 , R = R1 -LSB- f -LRB- G0 G3 -RRB- # j r1 = G0 G2 2 R1 , hG2 ; R2i 2 X2 , r2 = G02 G3 2 R2 , var -LRB- r1 -RRB- \ var -LRB- r2 -RRB- = var -LRB- G2 -RRB- , # = mgu -LRB- G2 ; G02 -RRB- g g. while the optimal ~ P operation turns out to be pair set union . Another interesting observable which can be proved to be perfect is the proof trees observable , whose corresponding derivation is the Heyting semantics in -LSB- 16 , 15 -RSB- . Note that there exist observables which are not perfect . For example , the observable ? of example 4.3 is not a perfect observable , since the axiom -LRB- 4.4 . iv -RRB- does not hold . The following theorem shows that the abstract denotational semantics and the bottom-up denotation are precise . Theorem 4.6 Let : D ! D be a perfect observable , c be a clause , A be an atom , G be a goal and P be a program . Then -LRB- A -LSB- -LSB- A -RSB- -RSB- I -RRB- = A -LSB- -LSB- A -RSB- -RSB- -LRB- I -RRB- -LRB- G -LSB- -LSB- G -RSB- -RSB- I -RRB- = G -LSB- -LSB- G -RSB- -RSB- -LRB- I -RRB- -LRB- C -LSB- -LSB- c -RSB- -RSB- I -RRB- = C -LSB- -LSB- c -RSB- -RSB- -LRB- I -RRB- -LRB- P -LSB- -LSB- P -RSB- -RSB- I -RRB- = P -LSB- -LSB- P -RSB- -RSB- -LRB- I -RRB- P -LSB- -LSB- P -RSB- -RSB- is continuous on D -LRB- F -LSB- -LSB- P -RSB- -RSB- -RRB- = F -LSB- -LSB- P -RSB- -RSB- -LRB- Q -LSB- -LSB- G in P -RSB- -RSB- -RRB- = Q -LSB- -LSB- G in P -RSB- -RSB- : The following theorem shows that the abstract transition relation is also precise . Theorem 4.7 Let : D ! D be a perfect observable and P be a program . Then 8D ; D0 2 D , TP -LRB- D ; D0 -RRB- -LRB- -RRB- TP ; ff -LRB- -LRB- D -RRB- ; -LRB- D0 -RRB- -RRB- : We show now that all the properties of SLD-derivations stated in Section 3.2 hold for the abstract top-down denotation for any perfect observable as well . Corollary 4.8 Let : D ! D be a perfect observable , A be an atom , G , G1 , G2 be goals and P , P1 , P2 be programs . Then B -LSB- -LSB- A in P -RSB- -RSB- = A ~ ? O -LSB- -LSB- P -RSB- -RSB- ; B -LSB- -LSB- G1 ; G2 in P -RSB- -RSB- = B -LSB- -LSB- G1 in P -RSB- -RSB- ~ ? B -LSB- -LSB- G2 in P -RSB- -RSB- ; B -LSB- -LSB- ? in P -RSB- -RSB- = -LRB- f ? g -RRB- ; B -LSB- -LSB- A ; G in P -RSB- -RSB- = A ~ ? O -LSB- -LSB- P -RSB- -RSB- ~ ? B -LSB- -LSB- G in P -RSB- -RSB- ; P1 ss P2 -LRB- -RRB- O -LSB- -LSB- P1 -RSB- -RSB- = O -LSB- -LSB- P2 -RSB- -RSB- : In order to express the abstract OR-compositionality we have to define also the operator ~ -RSB- , S1 ~ -RSB- S2 = ffS1 ~ + S2gg where ffSgg is the least solution of the equation ffSgg = -LRB- Id jI -RRB- ~ + ~ Pf ffSgg ~ on -LRB- -LRB- A ~ ? S -RRB- ? -LRB- Id -RRB- -RRB- gA2Atoms : Theorem 4.9 Let : D ! D be a perfect observable , c be a clause and P , P1 , P2 be programs . Then O -LSB- -LSB- P1 -LSB- P2 -RSB- -RSB- = O -LSB- -LSB- P1 -RSB- -RSB- ~ -RSB- O -LSB- -LSB- P1 -RSB- -RSB- ; We can now show that the operational semantics and the top-down denotation are indeed precise . Corollary 4.10 Let : D ! D be a perfect observable , G be a goal and P be a program . Then -LRB- B -LSB- -LSB- G in P -RSB- -RSB- -RRB- = B -LSB- -LSB- G in P -RSB- -RSB- and -LRB- O -LSB- -LSB- P -RSB- -RSB- -RRB- = O -LSB- -LSB- P -RSB- -RSB- : Finally we can prove the equivalences between the denotational and the operational semantics on one side , and between the top-down and bottom-up denotations on the other side . Corollary 4.11 Let : D ! D be a perfect observable , G be a goal and P be a program . Then O -LSB- -LSB- P -RSB- -RSB- = F -LSB- -LSB- P -RSB- -RSB- and Q -LSB- -LSB- G in P -RSB- -RSB- = B -LSB- -LSB- G in P -RSB- -RSB- : There are several examples of observables for which ~ on is not precise -LRB- for example , as already mentioned , computed answers -RRB- . We can still try to define the semantics by choosing the optimal abstractions for an upper level semantic operation . In the denotational semantics , the operator on is only used to define the semantic function C . We obtain a new class of observables by taking the optimal abstraction ~ C. 4.5 Denotational observables To define a denotational observable we relax the optimality condition of axiom -LRB- 4.4 . iv -RRB- and admit a ~ on operator which is not precise . Hence every perfect observable is a denotational observable , but the converse does not hold . Definition 4.12 Let : D ! D be an observable . Then is a denotational observable if i. -LRB- PfDi gi2I -RRB- = -LRB- Pf -LRB- ffi -RRB- Di gi2I -RRB- , ii . -LRB- A ? D -RRB- = -LRB- A ? -LRB- ffi -RRB- D -RRB- , iii . -LRB- D1 ? D2 -RRB- = -LRB- -LRB- ffi -RRB- D1 ? -LRB- ffi -RRB- D2 -RRB- , iv . -LRB- D1 on D2 -RRB- = -LRB- D1 on -LRB- ffi -RRB- D2 -RRB- . The following theorem shows that under these conditions we can just replace C by the optimal abstraction ~ C of C to make the definition precise . ~ C -LSB- -LSB- c -RSB- -RSB- = ffi C -LSB- -LSB- c -RSB- -RSB- ffi : Theorem 4.13 Let be a denotational observable . Then -LRB- C -LSB- -LSB- c -RSB- -RSB- I -RRB- = ~ C -LSB- -LSB- c -RSB- -RSB- -LRB- I -RRB- : As a consequence the abstract denotational semantics and bottom-up denotation are precise . In particular F -LSB- -LSB- P -RSB- -RSB- = -LRB- O -LSB- -LSB- P -RSB- -RSB- -RRB- . Hence F is correct and minimal w.r.t. . Example 4.14 We show now how to reconstruct the s-semantics -LSB- 6 , 7 -RSB- by means of the observable ? of example 4.3 . We can prove that ? is indeed a denotational observable , since the condition -LRB- 4.12 . iv -RRB- now holds . The abstract operation ~ P turns out to be pair set union while ~ ? and ~ ? are : A ~ ? X = f hA ; ? i j ? = f # j hH ; ? 0i is a renamed apart version of an element in X , # 0 2 ? 0 , 9 s.t. . A = H and # = mgu -LRB- A ; H # 0 -RRB- jA g , ? < > ; g , X1 ~ ? X2 = f hG ; ? i j ? = f # j G = -LRB- G1 ; G2 -RRB- , hG1 ; ? 1i 2 X1 , hG2 ; ? 2i 2 X2 , # 1 2 ? 1 , # 2 2 ? 2 , var -LRB- # 1 -RRB- \ var -LRB- # 2 -RRB- ? var -LRB- G1 -RRB- \ var -LRB- G2 -RRB- and # = mgu -LRB- -LRB- G1 ; G2 -RRB- ; -LRB- G1 # 1 ; G2 # 2 -RRB- -RRB- jG g , ? < > ; g . The abstract semantic function is ~ C -LSB- -LSB- p -LRB- t -RRB- : ? B -RSB- -RSB- X = f hp -LRB- x -RRB- ; ? i j ? = f # j x are new variables , hAi ; ? ii are renamed apart elements of X , # i 2 ? i and # = -LRB- f x = t gmgu -LRB- B ; -LRB- A1 # 1 ; : : : ; An # n -RRB- -RRB- -RRB- jx g , ? < > ; g . The abstraction of the top-down denotation ? -LRB- O -LSB- -LSB- P -RSB- -RSB- -RRB- = f hp -LRB- x -RRB- ; ? i j ? = f # j p -LRB- x -RRB- # 1 ?! c1 : : : # n ?! cn ? , # = -LRB- # 1 ? ? ? # n -RRB- jp -LRB- x -RRB- , ci 2 P g , ? < > ; g = ? : is isomorphic to the top-down definition of the s-semantics Os -LSB- -LSB- P -RSB- -RSB- . It is easy to see that it is just a matter of representation . In the s-semantics case the substitution is simply applied to the general atom , while in our case is not . The same isomorphism holds between the abstract semantic function P ? -LSB- -LSB- P -RSB- -RSB- X = f hp -LRB- x -RRB- ; ? i j ? = f # j 9 p -LRB- t -RRB- : ? B1 ; : : : ; Bn 2 P , x are new variables , hAi ; ? ii are renamed apart elements of X , # i 2 ? i # = -LRB- f x = t g # 0 -RRB- jx and # 0 = mgu -LRB- -LRB- B1 ; : : : ; Bn -RRB- ; -LRB- A1 # 1 ; : : : ; An # n -RRB- -RRB- g , ? < > ; g. and the immediate consequences operator of the s-semantics . From Theorem 4.11 and 4.8 we can derive the usual properties of the s-semantics , namely that F ? -LSB- -LSB- P -RSB- -RSB- is correct and minimal w.r.t. computed answers and that the answers computed for any goal can be obtained from the answers computed for the most general atomic goals . The proof of the same results , using classical methods -LSB- 6 -RSB- , is much harder . Example 4.15 The call patterns -LRB- with state -RRB- of a program P for a goal G are the atoms selected in any SLD-derivation of G in P via R . We define the domain of the objects of the form hG ; C ; # i , where the interpretation is \ the execution of the goal G generates a procedure call C with state -LRB- computed answer substitution -RRB- # '' . Note that C can be ? . The abstraction which allows us to obtain the call patterns is ? -LRB- D -RRB- = f hG ; Ri j R = f hC ; # i j hG ; Si 2 D , G # 1 ?! c1 : : : # n ?! cn C ; B 2 S , # = -LRB- # 1 ? ? ? # n -RRB- jG and B < > ? -RRB- C < > ? g , R < > ; g : ? -LRB- X -RRB- = f hG ; Si j S = wf -LRB- f d j first -LRB- d -RRB- = G , hG ; Ri 2 X , last -LRB- d -RRB- = -LRB- C ; B -RRB- , hC ; answer -LRB- d -RRB- i 2 R and B < > ? -RRB- C < > ? g -RRB- , S < > ; g : where wf -LRB- S -RRB- is the -LRB- greatest -RRB- well-formed subset of any S ? Deriv . The axioms -LRB- 4.12 . i , ii , iii , iv -RRB- are satisfied , while the axiom -LRB- 4.4 . iv -RRB- is not . Hence ? is a denotational observable . The operation ~ P turns out to be pair set union while ~ ? and ~ ? are : A ~ ? X = f hA ; Ri j R = f hC # ; #jAi j hH ; R0i is a renamed apart element of X , hC ; # 0i 2 R0 , there exists s.t. . A = H and # = mgu -LRB- A ; H # 0 -RRB- g , R < > ; g ; X1 ~ ? X2 = f hG ; Ri j R = f hC ; # i j G = G1 ; G2 , hG1 ; R1i 2 X1 , hG2 ; R2i 2 X2 , r1 = hC1 ; # 1i 2 R1 , r2 = hC2 ; # 2i 2 R2 , var -LRB- r1 -RRB- \ var -LRB- r2 -RRB- ? var -LRB- G1 -RRB- \ var -LRB- G2 -RRB- and if C1 < > ? , then hC ; # i = hC1 ; # 1i else C = C2 and # = mgu -LRB- -LRB- G1 ; G2 -RRB- ; -LRB- G1 # 1 ; G2 # 2 -RRB- -RRB- jG g , R < > ; g : The abstract semantic function is ~ C -LSB- -LSB- p -LRB- t -RRB- : ? B -RSB- -RSB- X = f hp -LRB- x -RRB- ; Ri j R = f hC # 0 ; # i j B = B0 ; B00 , x are new variables , 9k s.t. hpi -LRB- xi -RRB- ; Rii are renamed apart elements of X , 8i < k h ? ; #ii 2 Ri , hC ; #ki 2 Rk , # = -LRB- f x = t g # 0 -RRB- jx , # 0 = mgu -LRB- -LRB- B -RRB- ; -LRB- p1 -LRB- x1 -RRB- # 1 ; : : : ; pk -LRB- xk -RRB- # k -RRB- -RRB- and B00 < > ? -RRB- C < > ? g , R < > ; g : 5 Conclusions and Future Work The main feature of our construction is that we have now a powerful framework where we can easily reason about operational properties of definite logic programs . The overall construction has several similarities with the abstract interpretation frameworks , which were one of the sources of inspiration . The main difference has to do with the fact that we are concerned with abstractions which are not only correct but also precise . As a consequence we do n't have to worry about the design of good abstract operators , since we always automatically obtain the best operators . A second peculiarity of our framework is that we handle a denotational and operational semantics in an uniform way . This allows us to reason about the relation between the two definitions . We are currently working on an extension of the framework , where we relax the requirement about precision by moving to the standard notion of correct approximation . This will allow us to accommodate abstract semantics useful for program analysis . Our extended algebraic framework will allow us to discuss various issues related to the definition of abstract domains useful for program analysis , by providing the tools for formally comparing top-down and bottom-up analyses . We are currently studying other classes of observables , where the conditions on the operators P , ? and ? are not satisfied . This is typically the case in observables used in program analysis . For example , the abstract version of P is often forced to loose precision in order to achieve termination . We are also considering the properties of those observables which are obtained by composition of observables of different classes . References -LSB- 1 -RSB- K. R. Apt . Introduction to Logic Programming . In J. van Leeuwen , editor , Handbook of Theoretical Computer Science , volume B : Formal Models and Semantics , pages 495 -LCB- 574 . Elsevier , Amsterdam and The MIT Press , Cambridge , 1990 . -LSB- 2 -RSB- A. Bossi , M. Gabbrielli , G. Levi , and M. Martelli . The s-semantics approach : Theory and applications . Journal of Logic Programming , 19-20 :149 -LCB- 197 , 1994 . -LSB- 3 -RSB- M. Comini and G. Levi . An algebraic theory of observables . In M. Bruynooghe , editor , Proceedings of the 1994 Int ' l Symposium on Logic Programming , pages 172 -LCB- 186 . The MIT Press , Cambridge , Mass. , 1994 . -LSB- 4 -RSB- P. Cousot and R. Cousot . Systematic Design of Program Analysis Frameworks . In Proc . Sixth ACM Symp . Principles of Programming Languages , pages 269 -LCB- 282 , 1979 . -LSB- 5 -RSB- S. K. Debray and P. Mishra . Denotational and Operational Semantics for Prolog . Journal of Logic Programming , 5:61 -LCB- 91 , 1988 . -LSB- 6 -RSB- M. Falaschi , G. Levi , M. Martelli , and C. Palamidessi . Declarative Modeling of the Operational Behavior of Logic Languages . Theoretical Computer Science , 69 -LRB- 3 -RRB- :289 -LCB- 318 , 1989 . -LSB- 7 -RSB- M. Falaschi , G. Levi , M. Martelli , and C. Palamidessi . A Model-Theoretic Reconstruction of the Operational Semantics of Logic Programs . Information and Computation , 102 -LRB- 1 -RRB- :86 -LCB- 113 , 1993 . -LSB- 8 -RSB- M. Gabbrielli . The Semantics of Logic Programming as a Programming Language . PhD thesis , Dipartimento di Informatica , Universit?a di Pisa , 1992 . -LSB- 9 -RSB- M. Gabbrielli , G. Levi , and M. C. Meo . Observational Equivalences for Logic Programs . In K. Apt , editor , Proc . Joint Int ' l Conf . and Symposium on Logic Programming , pages 131 -LCB- 145 . The MIT Press , Cambridge , Mass. , 1992 . Extended version to appear in Information and Computation . -LSB- 10 -RSB- M. Gabbrielli , G. Levi , and M. C. Meo . Resultants semantics for PROLOG . Journal of Logic and Computation , 1995 . -LSB- 11 -RSB- M. Gabbrielli and M. C. Meo . Fixpoint Semantics for Partial Computed Answer Substitutions and Call Patterns . In H. Kirchner and G. Levi , editors , Algebraic and Logic Programming , Proceedings of the Third International Conference , volume 632 of Lecture Notes in Computer Science , pages 84 -LCB- 99 . Springer-Verlag , Berlin , 1992 . -LSB- 12 -RSB- R. Giacobazzi . On the Collecting Semantics of Logic Programs . In F. S. de Boer and M. Gabbrielli , editors , Verification and Analysis of Logic Languages , Proc . of the Post-Conference ICLP Workshop , pages 159 -LCB- 174 , 1994 . -LSB- 13 -RSB- N. D. Jones and A. Mycroft . Stepwise Development of Operational and Denotational Semantics for PROLOG . In Sten - ? Ake T?arnlund , editor , Proc . Second Int ' l Conf . on Logic Programming , pages 281 -LCB- 288 , 1984 . -LSB- 14 -RSB- N. D. Jones and H. Sondergaard . A Semantics-based Framework for the Abstract Interpretation of PROLOG . In S. Abramsky and C. Hankin , editors , Abstract Interpretation of Declarative Languages , pages 123 -LCB- 142 . Ellis Horwood Ltd , 1987 . -LSB- 15 -RSB- R. Kemp and G. Ringwood . Reynolds base , clark models and heyting semantics of logic programs . submitted for publication . -LSB- 16 -RSB- R. Kemp and G. Ringwood . An Algebraic Framework for the Abstract Interpretation of Logic Programs . In S. K. Debray and M. Hermenegildo , editors , Proc . North American Conf . on Logic Programming ' 90 , pages 506 -LCB- 520 . The MIT Press , Cambridge , Mass. , 1990 . -LSB- 17 -RSB- J. W. Lloyd . Foundations of Logic Programming . Springer-Verlag , Berlin , 1987 . Second edition .

B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O