On the semantics of μ Log

On the semantics of μ Log

FGCS ELSEVIER ~UTURE ~ENERATION ~OMPUTER ~YSTEMS Future Generation Computer Systems 10 (1994) 93-135 On the semantics o f / x L o g t Jean-Marie Ja...

2MB Sizes 9 Downloads 54 Views

FGCS ELSEVIER

~UTURE ~ENERATION ~OMPUTER ~YSTEMS

Future Generation Computer Systems 10 (1994) 93-135

On the semantics o f / x L o g t Jean-Marie Jacquet a,,, Koenraad De Bosschere

b

a Institut d'Informatique, FUNDP, Rue Grandgagnage 21, 5000 Namur, Belgium b Universiteit Gent, St.-Pietersnieuwstraat 41, 9000 Gent, Belgium

Abstract The paper aims at a semantic study of the integration of blackboards in logic programming. To that end, a new logic programming framework involving Linda-like primitives is proposed first. It is dedicated to no particular logic language but rather focuses on the key concepts and control operators. As natural consequences, it subsumes existing concrete proposals [2,4,6] and provides a general framework well-suited for their semantic analysis. Five semantics are described and compared. They range in the operational, declarative and denotational types and are issued both from the logic programming and the imperative traditions. They are composed of two operational semantics, describing respectively the success/failure sets, and various failures, of two declarative semantics, extending the classical Herbrand interpretation and immediate consequence operator, and of one denotational semantics, defined compositionally and on the basis of process-like histories. The mathematical tools mainly used are complete lattices and complete metric spaces. Key words: Logic programming; Semantics; Concurrency theory; Blackboard; Linda

1. Introduction 1.1. O n parallel systems

Parallel systems can be classified into two categories according to the organization of their processors and memories. On the one hand, distributed systems are mainly characterized by a large number of processors, interconnected by means of a limited number of links. In such configurations, the time needed to communicate a message depends on the distance between two nodes. On the other hand, centralized systems consist of a limited number of processors, connected to a shared memory by means of a common bus. In such configurations, the time needed to communicate a message does not depend on the distance between two nodes. As a rough comparison, distributed systems are generally considered to be more powerful than their centralized counterparts because the interprocessor communication bandwidth grows with the number of processors, while it is limited by the bus bandwidth in centralized architectures. However, centralized systems are easier to handle because they have only one (common)

* Corresponding author. Email: [email protected] t The authors are supported by the Belgian National Fund for Scientific Research as Senior Research Assistants. Part of this work was carried out when the first author was participating at CWI (Amsterdam, The Netherlands) in the ESPRIT Basic Research Action (3020) Integration.

0167-739X/94/$07.00 © 1994 Elsevier Science B.V. All rights reserved SSDI 0167-739X(93)E0037-Z

94

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

state. This probably explains why shared memory machines (based on VME-bus, Multibus, and so on) have proliferated more than distributed architectures, such as Transputer Networks and Hypercubes. The difference in the architecture is reflected at the software level. Message passing is used as the classical communication mechanism in distributed architectures while semaphores and shared variables are used in centralized architectures. The implementations of concurrent logic programming languages have followed this trend as well. Although some languages have proposed a distributed approach to logic programming (e.g. Delta-Prolog [3]), most of the proposals (Concurrent Prolog [22], Parlog [13], G H C [23], cc [20], Strand [11] . . . . ) have assumed or have been implemented on shared memory systems [14,15]. However, many current parallel logic languages are essentially channel or stream based and do not fully exploit the communicative possibilities of a shared memory architecture such as broadcasting. New languages or frameworks have recently aimed at a better use of these possibilities, in particular at making the shared memory visible in a structured and safe way. Among them, the most popular one is certainly Linda [12]. It consists of a new framework, covering both imperative, functional and logic programming languages. Its main feature is to enrich the considered programming language with a tuple space to be updated in a controlled way during the computations. This paper aims at a better understanding of the instantiation of Linda to logic programming, namely of the combination of blackboards and logic programming. Although our main goal is semantic, a new framework, called/z Log (pronounced as 'myiil6g' according to the Webster's dictionary pronunciation), addressing basic control mechanisms rather than focusing on a particular language, is proposed first. Semantics for it are then described and compared. However, it is worth noting t h a t / z Log has already been instantiated to Prolog several times: a real-size implementation of it has been realized on a Multi 88000 shared memory multiprocessor running under the MTOSux real-time multiprocessing kernel [19]; version 2.1 of Sicstus Prolog supports similar Linda primitives [2]; BinProlog [5] supports a rich set of blackboard primitives, including conditional ones; FLiPSiDE [21] also contains blackboard primitives.

1.2. The tzLog framework As a snapshot, the I~Log blackboard contains active as well as passive objects. The active objects consist of (logic programming) goals, the resolution of each goal being interpreted as the behavior of a process. The passive objects are (logic programming) terms; they act as usual data. Objects, both active or passive, can be put onto the blackboard (tell), can be removed (get) and can be tested for presence (read). To keep the blackboard communication paradigm as pure as possible, processes are forced to use the above operations on objects as the only communication mechanism. As consequences, they are not allowed to share variables, and objects are first renamed before being told, got or read. The i~Log framework distinguishes two kinds of processes. Processes that are created at start up time are called foreground processes. They correspond to the parallel resolution of some list of logic programming queries sharing no variables and therefore must terminate successfully in order to allow the whole computation to be considered as successful. Processes that are created at run time are called background processes. They act as daemons on the blackboard and have their effect on the blackboard as unique point of interest. Hence, their termination and failure is of no concern for the success of the computation. As an illustration, let us program an airline reservation system composed of four flights (ha023, sn~'~0, nwl Z9, kt283) questioned by three terminals (identified as 1, 2 and 3) by means of r e s e r v a t i o n messages. The interesting part of t h e / z Log program is listed in Fig. 1 t. The query is ~-[terminal(1), terminal(2), terminal(3), flightdb].

1As a syntactic matter, the Edinburgh syntax [7] is subsequently used and the ';' and '11' symbols are employed to denote the sequential and parallel compositions of goals.

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

95

terminal(Id) :user_input(Id,Flight,SeatsRequested); tellt(reservation(Flight,SeatsRequmsted,Id)); gett(acknowledge(Id,SeatsLeft,Status)); user_output(Id,SeatsLeft,Status).

flightdb

:--

teXXp(flight(baO2a,aO)) II

tellp(flight(sn720,150))

tellp(flight(nw129,68))

tellp(flight(k1283,185)).

II

flight(Name, SeatsAvailable) :-gett(reservation(Name,SeatsRequested,Id)); reserve~eats(SeatsRequested,SeatsAvailable,SeatsLeft,Status); tellt(acknowledge(Id,SeatsLeft,Status); flight(Name, SeatsLeft). reserve~eats(SeatsRequested,SeatsAvailable,SeatsLeft,aecepted) SeatsAvailable >= 5 e a t s R e q u e s t e d ; SeatsLeft is SeatsAvailable - SeatsRequested. reserve~eats(SeatsRequested,SeatsAvailable,SeatsAvailable,re~used) SeatsAvailable < SeatsRequested.

:--

:-

Fig. 1.

Flights a n d t e r m i n a l s are r e p r e s e n t e d as processes. As it seems n a t u r a l to r e q u i r e that the p r o g r a m c o m p u t a t i o n halts w h e n the t e r m i n a l s have n o m o r e requests to treat, the flight processes are d e s i g n e d as b a c k g r o u n d processes a n d the t e r m i n a l processes as f o r e g r o u n d processes. All these processes c o m m u n i c a t e via the b l a c k b o a r d by m e a n s of r e s e r v a t i o n / 3 a n d a c k n o wt e d g e / 3 terms. C o m p u t a t i o n a l l y speaking, the e v a l u a t i o n of the above list of queries e n g e n d e r s the parallel e v a l u a t i o n of the t e r mi n a t ( 1 ) , t e r mi n a t ( Z ) , t e r mi n a t ( 3 ) a n d f t i g h t d b goals. T h e t h r e e first goals e n g e n der the c r e a t i o n of the ( f o r e g r o u n d ) processes associated with the terminals. T h e last o n e invokes the r e d u c t i o n of the t e t t p calls of the second clause and, consequently, creates the c o n c u r r e n t ( b a c k g r o u n d ) processes associated with the flights. E a c h t e r m i n a l process o p e r a t e s successively as follows: (i) it i n p u t s a q u e r y for seats o n some flight from the user; ( r e d u c t i o n of u s e r i np u t ( I d , F Li g h t ,

SeatsRequested)); (ii) it p r o d u c e s a r e q u e s t for the r e q u e s t e d seats by p u t t i n g the c o r r e s p o n d i n g r e s e r v a t i o n r e q u e s t o n the b l a c k b o a r d ( r e d u c t i o n of t e l l t ( r e s e r v a t i o n ( F l i g h t , SeatsRequested, I d ) ) ) ; (iii) it waits for the a n s w e r by trying to read the c o r r e s p o n d i n g a c k n o w l e d g m e n t message ( r e d u c t i o n of

gett(acknowledge(Id, SeatsLeft, Status))); (iv) it gives the answer to the user a n d possibly calls itself again ( r e d u c t i o n of u s e r

output (Id,

SeatsLeft, Status)). Dually, every flight process b e h a v e s successively as follows: (i) it waits for a r e s e r v a t i o n message a d d r e s s e d to it ( r e d u c t i o n of g e t t ( r e s e r v a t i o n ( Na me ,

SeatsRequested, Id))); (ii) it processes the r e s e r v a t i o n r e q u e s t t h r o u g h the r e d u c t i o n of r e s e r v e seats (SeatsRequested, S e a t s Av a i l a b l e , S e a t s L e f t , S t a t u s ) , resulting in a n accepted or refused S t a t u s with the c o r r e s p o n d i n g n u m b e r of seats left d e p e n d i n g u p o n the availability of seats; (iii) it answers the results by p u t t i n g a n a c k n o w l e d g m e n t message o n the b l a c k b o a r d ( r e d u c t i o n of

tellt(acknowledge(Id, SeatsLeft, Status));

96

J.-M. Jacquet, K. De Bosschere/ Future Generation Computer Systems 10 (1994) 93-135

(iv) it recursively calls itself. The code of the u s e r _ i n p u t , u s e r _ o u t p u t and r e s e r v e _ s e a t s procedures can easily be written in Prolog and are not that much interesting. The r e se r v e _ s e a t s procedure is given in Fig. 1. as an example. 1.3. Blackboards as new means o f communication

As suggested by this example, i.tLog offers a quite new approach to parallelism in logic programming. Its main advantage arises from the clear decoupling of processes provided by the blackboard. Processes may then be though as objects, encapsulating information and reacting independently to messages. In a dual software perspective, thanks to the clear blackboard interconnection, one could think of combining programs developed and tested in isolation under the assumption that the suitable information will eventually be available on the blackboard. All that remains to be proved is that this information will indeed be provided. As a comfortable symptom, we were able to express the various functionalities of the flight and terminal processes in a quite independent way. The use of the blackboard induces another advantage over the classical concurrent languages. Synchronization and mutual exclusion are achieved implicitly via the blackboard and without the coding of merge processes and the use of commitment operators. Furthermore, the suspension stated by the get and read blackboard primitives is expressive enough to avoid the use of suspension rules like the G H C ones or mode declarations such as those of Parlog. A nice consequence is that the format of the clause head is here completely unconstrained. In particular, in contrast with G H C and Parlog, variables may be shared by the arguments regardless of their input and output positions. Another interest of ~ Log comes from the distinction between foreground and background processes. This feature allows to state, without coding effort, which process should terminate successfully in order to consider the whole computation as successfully terminated. Compared with sequential Prolog programs, the use of parallel processes implicitly encouraged by the I.~Log framework, offers a gain of speed but also an increase in functionality. Let us consider the n-queens problem. Instead of solving it sequentially, it is surely better to solve the ( n - 1)-queens problem n times in parallel. Even on a four processor machine, to find a first solution, speedups over a factor 30 have been observed simply because all the n processes are running concurrently and therefore are performing implicitly a kind of breath-first search. All the solutions are generated about 3.9 times faster than in the sequential case. Shared Prolog, a logic language involving blackboards, has been proposed in [6]. Our framework differs from it in three respects. Firstly, the structure of tzLog programs are in general more flexible. Process goals and clause bodies may involve sequential and parallel composition operators whereas sequential ones are only supported by Shared Prolog. Preactivation and postactivation parts are not distinguished in our model though they can be coded by the sequential composition operator. Secondly, the Shared Prolog processes are static objects whereas in ~ L o g , background processes are handled dynamically at run-time: they can be created but also be killed dynamically. Finally, IxLog has been conceived as a general framework that can be instantiated to any logic programming language, while Shared Prolog is to be seen as a particular language. Compared with the cc family of languages [20], our blackboard is not monotonic and is just used for communication and not for constraint solving. We believe that the constraint paradigm proposed there is orthogonal to our research and that the combination of constraints and ~ L o g systems should lead to quite powerful systems. The study of such combinations is however out of the scope of this paper and left for future research. As suggested before, the i~Log framework is strongly related with Linda [12]. It can actually be regarded as an instantiation of Linda to logic programming. However, this particular instantiation enhances the general Linda scheme in several ways. Firstly, the Linda tuples are replaced here by logic

J.-M. Jacquet, K~De Bosschere/ Future Generation ComputerSystems 10 (1994)93-135

97

programming terms and consequently the pattern matching of Linda has been replaced here by (the more powerful) full unification. Secondly, the I~Log framework has a declarative appeal for which, as we shall see, declarative semantics can be clearly designed. Finally, the concern for successful termination, which is natural in logic programming, induces a clear separation between foreground and background processes.

1.4. Comparative semantics of tz Log The remainder of this paper is devoted to the semantic analysis of txLog. Five semantics are presented and compared. They range in the operational, declarative and denotational styles and are issued both from the imperative and logic programming traditions. They consist of two operational semantics Oc, s and Och, twO declarative semantics Decl m and Decl£, and one denotational semantics Den. The two operational semantics Oca s and Och describe operationally the computations by means of a transition system. The operational semantics Oca s reports just the answer substitutions computed by the successful computations. It thus corresponds to the success set and failure set characterizations of logic programs. The operational semantics Qh further analyzes the failure of computations and distinguishes three kinds of failures, leading to three different operational histories: failure induced by infinite computations, failure induced by suspension and (real) failure induced by the absence of suitable clauses. The two declarative semantics adapt the Herbrand interpretations and the immediate consequence operator for classical Horn clause logic to the tzLog framework. An effort has been made to keep these semantics simple as well as in the main stream of logic programming semantics. However, the blackboard primitives - in particular, the destructive get ones - raise new problems for which fresh solutions are proposed. Among the most interesting ones are the notion of truth with respect to traces, allowing a compositional perception of the processes, and the duality in the treatments of terms and processes. The denotational semantics Den formalizes the computations in a compositional way by means of metric processes, similar to those defined in [8], and this without any reference to any declarative model or transition system. It is defined in two steps, reflecting two levels at which compositionality can be thought. The structure of goals, involving the sequential and parallel composition operators ';' and '11 ', is first exploited to build a compositional semantics for the goals. Such semantics are then combined at a second level to determine the semantics of initial goals from those of their goals. The semantic tools mainly used are of two types: complete lattices for the declarative semantics and complete metric spaces for the others. Despite this variety, all the semantics are related throughout the paper. To our best knowledge, semantics for tzLog have never been presented. The two closest works to our semantic study can be found in [6] and [17]. An operational semantics for Shared Prolog is described in the former. It is based on a true concurrency approach to parallelism inspired of [9]. In contrast, our operational semantics takes a more conventional approach based on an interleaving perception of parallelism and on a transition system in the (classical) lines of [18]. A declarative and refutation trace semantics of distributed logic is presented in [17]. It has partly inspired our declarative semantics. However, the notions of background processes and blackboards are not tackled there and thus have received fresh treatments here. Furthermore, referring to our terminology, the semantics of one single ixLog foreground process is just described there whereas we also provide declarative semantics for systems of processes.

1.5. Organization of the paper The rest of this paper is organized in 7 sections. Section 2 describes the basic constructs of/x Log in a formal way and explains our terminology. Section 3 sketches the mathematical tools used subsequently.

98

J.-M. Jacquet, K~De Bosschere/ Future Generation Computer Systems 10 (1994) 93-135

Section 4 presents two operational semantics Ocas and Och. Section 5 discusses the declarative semantics Decl m and Declf and connects them with the operational semantics Ocar Section 6 specifies a denotational semantics Den and compares it with the operational semantics Q h , and, consequently, in view of the previous results, to the other semantics. Finally, section 7 sums up the relationships established in the paper and gives our conclusions.

2. The language As usual in logic programming, the language/z Log comprises denumerably infinite sets of variables, functions and predicates. They are referred to as Svar, Sfunct and Spred, respectively. The notions of term, atom, substitution, ... are defined therefrom as usual (see e.g. [16]). Their set is referred to as Sterm, Satom, Ssubst . . . . . respectively. We assume the reader to be familiar with them and will not recall them here. Rather, we now specify the concepts induced by the blackboard extensions. Definition 1. Blackboard primitives and goals are inductively defined as follows: (i) the blackboard primitives are constructs of the form tellt(t), tellp(p), readt(t), readp(p), gett(t), getp(p), where t is a term and p is a goal; (ii) any atom and any blackboard primitive is a goal; (iii) A is a goal, representing the empty goal; (iv) if G 1 and G 2 are goals, then so are G1; G 2 and G 1 IIG2. The initial goals or igoal's, for short, are non-empty lists of goals [ G 1 , " ' , G m] sharing no variables. The sets of goals and initial goals are subsequently referred to as Sgoal and Sigoal, respectively. Programs are sets of clauses of the form H: G, where H is an atom and G is a goal. The set of programs is subsequently denoted by Sprog.

Background and foreground processes are formalized as follows. Definition 2. Foreground and background processes are constructs of the form ~ G and ~ G, respectively, where G is a goal. A process is either a foreground process or a background process. It is denoted by a ' ~ ' arrow (as in ~ G) when there is no concern for its qualification of being foreground or background. The set of processes is subsequently referred to as Sproc. The set { ~ , ~ } of background and foreground process arrows is referred to as Sarrow.

The similarity between goals and processes induces the generalization of igoal's to lproc's. Lists of background processes, which will be used later as background environments, are formalized as well. Definition 3. The lproc' s are defined as non-empty lists of processes. Their set is subsequently referred to as Slproc. The set of (possibly empty) lists of background processes is subsequently referred to as Sbg. Convention 4. Given an igoal ig, we denote by ig the associated list of processes obtained by considering all the goals of ig as foreground processes.

3. Mathematical preliminaries Complete lattices and metric spaces will be used as important semantic tools. The reader is assumed to be familiar with them as well as with their related notions of convergent sequences, directed and

J.-M. Jacquet, K. De Bosschere/ Future Generation Computer Systems 10 (1994) 93-135

99

closed subsets, completeness, continuous and contracting functions, . . . . He is also assumed to be familiar with Tarski's lemma, describing the set of prefixed points of continuous functions of complete lattices, and Banach's theorem, stating the existence of a unique fixed point of contractions in complete metric spaces. H e is referred to [10] and [16], when need be. We will also employ the classical metric distances and refer the reader to the appendix for their description. As a matter of notation, ~nct(E) is subsequently used to denote the set of non-empty and closed subsets of E.

4. ()lwrational semantics

4.1. Transition system Two first semantics of izLog can be expressed operationally by means of a transition system, defined in Plotkin's style [18] by rules of the form

Assumptions Conclusion

if

Conditions,

- where Assumptions and Conditions may possibly be absent - that assert the Conclusion whenever the Assumptions and Conditions hold. The configurations to be considered here are triplets of the form ( bt, l, O) where (i) bt is a list of terms, representing the terms currently on the blackboard; (ii) l is an lproc, representing the (background and foreground) processes currently running on the blackboard; (iii) 0 is a substitution, representing the values computed so far for the variables. Although the list nature of l suggests an order of selection of its processes, several rules allow to pick some process at some arbitrary place in l. For the ease of presentation, the notation l[] is introduced to denote a list of (background and foreground) processes where a place holder has been introduced at some place and the notation 1[= G] is used to denote the list of processes obtained from l[] by substituting the place holder by = G. As other notations, the list resulting from the concatenation of the list l~ with the list 12 is represented by l 1 + l 2 and the set of lists bt is denoted by Sbt. In tzLog, transitions occur only because of the reduction of atoms and blackboard primitives; the behavior of compound goals is determined therefrom by classical rules composing the behavior of their parts. The transition system can thus be defined by specifying the transition rules for the basic reductions of atoms and of blackboard primitives, and by giving the (classical) rules of composition for the compound goals. However, it turns out that these last rules can be expressed directly in the former rules. The notion of contexts is defined to that end. Essentially, it determines, thanks to a place holder t3, which atoms or blackboard primitives can be reduced. The resulting goal is then obtained from the goal under consideration by replacing the reduced atoms and blackboard primitives by their corresponding subgoals according to their reduction. Definition 5. The contexts are the functions inductively defined on the goals by the following rules. They are

typically represented by the letter c, possibly subscripted. (i) A nullary context is associated with any goal. It is represented by the goal and is defined as the constant mapping from Sgoal ° to this goal with the goal as value. (ii) [] is a unary context that maps any goal to itself. For any goal G, this application is subsequently referred to as •[[G].

100

J.-M. Jacquet,K. De Bosschere/Future GenerationComputerSystems 10 (1994) 93-135

(iii) If C is an n-ary context and if G is a goal, then (c; G) is an n-ary context. Its application is defined as follows: for any goals G1,." ", Gn,

(C; a)~al,"" ,an~ = (c~G1,'",Gn], a). (iv) If c I and c 2 are m-ary and n-ary contexts, then c 1 II c2 is an (m + n)-ary context. Its application is defined as follows: for any goals G 1 , " . , Gin+n,

(cl II c2)~G1,""" ,Gm+n] = (cl~al,""" ,Gm])II(c2~am+l,"" ,am+nD. In the above rules, we further state that the structure (Sgoal, ;, II, a) is a bimonoid. Moreover, in the following, we will simplify the goals resulting from the application of contexts accordingly.

Definition 6. Define the transition relation -->as the smallest relation of (Sbt x Slproc x Ssubst ) x ( Sbt x Slproc × Ssubst) satisfying the following rules. As usual, for the ease of reading, the more suggestive notation (bt, l, O) ~ (bt', l', 0') is subsequently employed instead of (bt, l, 0, bt', l', 0'). Atom reduction (A)

(bt, l [ ~ c ~ A ] ] , O)--->(bt, l[~c~B]], 07) [ ( H : - B ) is a fresh renaming of a clause of e )

if ~ H and A 0 unify with mgu 7 Tell reductions (Tt)

(bt, 1 [ ~ c~tellt(t)]], 0 ) ~ (bt + [u], l [ = c~a]], O)

if {u is a fresh renaming of tO} (Tp)

(bt, l[ = c[tellp(p)]], O)--->(bt, l[ = c~A]] + [ ~ q], 0)

if {q is a fresh renaming of pO} Read reductions (Rt)

(bt, l[~c~readt(t)]], O)--->(bt, l[=c~A]], 07) ( 3v ~ bt: any fresh renaming v' of v unifies with tO

i f / 7 is the mgu corresponding to the unification of tO and of some fresh renaming of such a k term v (Rp)

(bt, l[~c~readp(p)]], O ) ~ ( b t , l[=c~d~], 07) 3 ( ~ A ) ~ l [ ~ c ~readp ( p ) ]]]0: any fresh renaming A' of A unifies with p 0 ) if ~ 3' is the mgu corresponding to the unification of pO and of some fresh renaming of such a process ~ A

Get reductions (Gt)

(bt, 1[ ~ c[gett(t)]], 0 ) ~ (bt', l [ ~ c~A]], 07) ( 3 v ~ bt : any fresh renaming v' of v unifies with tO u is such a term v in bt if | 7 is the mgu corresponding to the unification of tO and of some fresh renaming of u bt' is bt where u has been removed

J.-M. Jacquet, K. De Bosschere/ Future Generation ComputerSystems 10 (1994) 93-135

( 6p)

101

( bt, l[ = c~getp( p)]] , O) --->( bt, l'[ = c~ A]], 03") ( a( ~ A ) ~ l[ = c~ getp( p ) ]] O: any fresh renaming A' of A unifies with pO

]

I

I ~ G is such a process ~ A in 1[ = c~getp( p)]]O if / 3'/s the mgu corresponding to the unification of pO and of some fresh renaming of G l' is I where the process corresponding to ~ G has been removed Note that, thanks to the bimonoid structure imposed in definition 5, it is implicitly understood in the above rules that (A; G), ( d IIG), (G IIA) are to be interpreted as G. It is also assumed there that he foreground and background qualifications are respected by the ' = ' arrow that is that, in any rule, all the occurrences of the ' = ' arrow have to be replaced either by the ' ~ ' arrow or by the ' ~ ' arrow. A word on the meaning of the above rules is in order. Rule (A) rephrases the usual reduction of an atom in our framework: an atom A is reduced to the body B of a unifiable clause H : - B inside some process, this giving rise to the publication of the newly computed bindings 3'- Rules (Tt) and (Tp) explain the writing of terms and processes on the blackboard, respectively. Rules (Rt), (Rp), (Gt) and (Gp) describe the reading of terms and processes with or without consumption. Particularly notice the renamings in the rules (Tt) to (Gp). They ensure that processes communicate only via the writing and reading of terms on the blackboard and not implicitly by means of shared variables. The two following propositions follow directly. Proposition 7 expresses that at any point of a derivation, the terms on the blackboard and the processes (either foreground or background) do not share any variable, provided this property holds in the initial configuration. Proposition 8 states that any derivation for (bt, l, O) amounts to the derivation for (bt, lO, •), and vice versa.

Proposition 7. Let bt ~ Sbt, 1 ~ Slproc, 0 ~ Ssubst such that the terms of bt and the processes of 10 do not share any variable. Then, for any bt' ~ Sbt, l' ~ Slproc, O' ~ Ssubst such that (bt, l, O) ~ * (bt', l', 0'), the terms of bt' and the processes of l'O' do not share any variable. Proof. The proposition follows directly from an inductive reasoning on the length of the derivations.

[]

Proposition 8. For any bt ~ Sbt, l ~ Slproc, 0 ~ Ssubst such that the terms of bt and the processes of 10 do not share any variable, if there is a derivation (bt, I, 0)---~ (bt,, 11, 01)---~ "'" ~ (btm,

lm,

Ore)

then, for any i, 0 i = Otzi for some substitution iz i. Moreover, the following derivation holds: (bt, lO, e)--~(btl, llO , IdOl)"->

" ' "

-->(btm, lmO , ~l,m).

Conversely, if this derivation holds, then so does (bt, l, O)--->(btl, ll, O l x l ) ~ " " ~ ( b t m , lm, Otxm). Proof. The proposition follows directly from an inductive reasoning on the length of the derivations.

[]

4.2. Semantics We are now in a position to define the two operational semantics Oca s and Och. In ixLog, a successful computation is one for which all the foreground processes have been reduced to empty conjunctions,

102

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

while some background processes are possibly still running on the blackboard. A natural semantics to define is therefore one which delivers the substitutions computed by those successful computations. This is the goal assigned to the operational semantics Oc~ ~. It is closely related to a derivation relation, deduced directly from the transition system. It is also interesting to take the failed computations into account. A rough definition of the failed computations, already provided by the semantics Oca~, consists of defining them as the complement of the successful computations. More elaborated and useful definitions arise from the analysis of failure. Failure may in fact result from three different reasons: infinite computations, the absence of suitable information on the blackboard (suspension) and the absence of suitable clauses (real failure). The second operational semantics Q h aims at distinguishing these three kinds of failures. It delivers for any initial goal not a set of substitutions but rather a set of so-called computational histories defined as words formed of pairs (bt, 0}, with bt a list of terms and 0 a substitution, and of a termination status indicating success, real failure or suspension. Before defining those semantics, we first define a central notion, characterizing the points where computations may be regarded as successful. Definition 9. A n lproc is successfully terminated iff all its foreground processes are ~ A.

A derivation relation can be derived directly from the transition system. Definition 10. Define the derivation relation P ~- ig with 0 as the following relation on Sprog x Sigoal x Ssubst: for any P ~ Sprog, any ig ~ Sigoal, any 0 ~ Ssubst, P ~- ig with 0 holds iff there exist m > O, b t o , " ", bt m ~ Sbt, l o . . . . . l m ~ Slproc, 0 o . . . . ,0 m ~ Ssubst such that (i) (bto, lo, 0 o} ~ (btl, ll, 01) ~ . . . ~ (btm, lm, Ore) (ii) (bto, 10, 00} = ([], ~, e} (iii) 0 m = 0

(iv) l m is successfully terminated ( U ) l 1. . . . . I n - 1 are not successfully terminated. Notice that, according to our daemon view of background processes, the computations are considered as successful in the above definition as soon as all foreground processes have been successfully reduced to the empty conjunction: indeed, although there may exist a successor configuration (bt m ÷ 1, lm ÷ 1, Om+1} (i.e.s.t. (btm, lm, On) ~ (btm+l, lm+l, 0m+l)), only the first terminated one is taken into account. We are now in a position to define the first operational semantics Oc~ s. As usual, cas is the abbreviation for 'computed answer substitution' and 01ig denotes the restriction of 0 to the variables of

ig. Definition 11. Define the cas operational semantics as the following function Ocas: Sprog ~ Sigoal ~(Ssubst): for any P ~ Sprog, any ig ~ Sigoal, Q a ~ ( P ) ( i g ) = {O lig: P H ig with O}.

The definition of the second operational semantics Och requires first the definition of its semantic domain. The notation - t ~ is subsequently used to denote a transition due to a process of the list 1. Definition 12. The set o f words formed from Sbt x Ssubst and whose finite elements are ended by one o f the termination marks ~ ÷ (representing success), ~ s (representing suspension), and ~ - (representing failure) is referred to as Sohist. Its elements are called operational histories.

J.-M. Jacquet, I~ De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

103

Definition 13. Define the computational history semantics as the following function Qh: Sprog ~ Sigoal Sbt ~ Ssubst ~ 9 ( S o h i s t ) : for any P ~ Sprog, ig ~ Sigoal, bt ~ Sbt, 0 ~ Ssubst, Och(e)(ig)(btXO ) = {(bt0, 00). "'" .(btm, 0m).~+: (bto, 1o, 0 o) = (bt, ~, 0), (bto, lo, 0o) ~ . . . ~ (btm, Im, On), I m is s u c c e s s f u l l y t e r m i n a t e d , l i is not successfully terminated for 1 < i < m} u{(bt0, 0 0 ) . . . . . ( b t m , Om).6--: (bt o, lo, 0 o) = (bt, -~, 0), (bto, lo, 0o) ~ . . . ~ (btm, lm, On) "¢-~, I m is not successfully terminated, for any bt' ~ Sbt, any bg ~ Sbg, < bt', I m + bg, 0 > ,. -o } u { ( b t 0, 0 0 ) . . - . . ( b t m, Om).6s: (bt o, lo, 0 o) = (bt, ~, 0), (bto, lo, 0o) ~ . . . ~ (btm, lm, Om) -~, l m not successfully terminated, there are bt', btm+ 1 ~ Sbt, bg ~ Sbg, Ore+1 ~ Ssubst, lm+ 1 E Slproc, such t h a t ( b t ' , I m + bg, O) ~ (btm+ a, lm+ 1, Om+l)} u { ( b t o, 0 0 ) . ' ' " .(bt m, Om). ' ' ' : (bto, lo, 0 o) = (bt, -~, 0), (bto, 1o, 0o) ~ "'" ~ (btm, lm, Om) ~ "'" }

The Ocas semantics can, of course, be directly derived from the Q h semantics. To that end, it is sufficient to select the last substitutions reported by the successfully ending histories. Proposition 14. Define al: Sigoal ~ 9 ( Sohist ) ~ ~ ( S s u b s t ) as the following function: for any ig ~ Sigoal, S c_ Sohist, al(ig)(S) = {(Om)lig: (bt 1, 01). "'" .(bt m, Om).6+~ S}. For any P ~ Sprog, ig ~ Sigoal, one has Ocas(PXig) = Otl(igXOch(e)(igX[]XE)).

Proof. The proposition is established by proving, for any P ~ Sprog, any ig ~ Sigoal, the two inclusions

c_al( ig )( Och(e )( ig )([])( Q )

(1)

oq( ig)(Och( P ) ( i g ) ( [ ] ) ( e ) ) c_Ocas( e ) ( ig)

(2)

O¢,s( P )( ig )

Inclusion (1). To prove the first inclusion, let 0 be in O c a s ( P ) ( i g ) . By Definition 11, there is Y ~ Ssubst such that (i) 0 = 3' lig (ii) P ~ ig with 3". Hence, by Definition 10, there are bt o . . . . . bt m E S b t , l 0 l m E Slproc, 0 o . . . . . 0m ~ Ssubst, such that (i) (bt o, l o, 0 o) ~ ... ~ (bt m, lm, Om) (ii) (bt o, l o, 00) = ([], ~, E) (iii) Om = 3" (iv) Im is successfully terminated (v) l I . . . . . lm-1 are not successfully terminated. It follows from Definition 13 that (bto, 0 o ) . . . . . ( b t m , Om}.~ + is in Och(PXigX[])(~), and consequently, in view of the definition of al, that (Om)lig is in Otl(igXOch(eXigX[]Xe)). Inclusion (1) then results from the equalities 0 = 3"lig = (0,,)l,g. Inclusion (2). Inclusion (2) is proved similarly but in a backward manner. [] . . . . .

J.-M. Jacquet, IC De Bosschere/Future Generation Computer Systems 10 (1994) 93-135

104

A desired property is that the semantics Oca s and Och do not depend on the order in which goals are listed in the initial goals. This is actually the case, as stated by the following proposition.

Proposition 15. For any P ~ Sprog, any ig ~ Sigoal, and any permutation ig' of ig, Ocas(PXig)= Ocas(e)(ig') and Och(P)(ig) = Och(eXig'). Proof. Indeed, none of the rules (A) to (Gp) makes use of the order of the processes in the configurations. [] It is finally worth noting that the operational semantics Q h can be related to the fixed point of the higher-order contraction qtop, reflecting the recursive nature of Qh. This property combined with the fortunate circumstance that contractions have one unique fixed point will be useful later to relate Q h with the denotational semantics Den. For the sake of mathematical correctness, subsets of operational histories have to be taken subsequently as non-empty and closed. This is however directly ensured by the transition system, in particular by its finitely branching character. Definition 16. Define qtop: [Sprog ~ Slproc -+ Sbt -) Ssubst -):n~:Sohist)] ~ [Sprog ~ Slproc ~ Sbt Ssubst ~.~n~t(Sohist)] as follows: for any F: Sprog --) Slproc -+ Sbt ~ Ssubst -+:nct(Sohist), P ~ Sprog, l ~ Slproc, bt ~ Sbt, 0 ~ Ssubst

qtop( F ) ( P ) ( l)( b t ) ( O) I {( bt, 0).t~+}, i l l is successfully terminated {(bt, 0).~-}, if(bt,,l isl+n°tbg, o)SUCCeSsfuly~, : terminated and for any b t ' ~ S b t ,

any b g ~ S b g ,

= }{(bt, O).~s}, if l is not successfully terminated, (bt, 1, O) -o and there are bt', bt" ~ Sbt, bg ~ Sbg, 0 " ~ Ssubst, l " ~ Slproc, such that (bt', l + bg, O) : , (bt", l", 0") ~ {(bt, O).h: (bt, l, O) --->(bt', l', 0'), h ~ F(P)(l')(bt')(O')}, otherwise.

I

Proposition 17. The function ~op is well-defined and is a contraction from [Sprog ~ Slproc ~ Sbt ~ Ssubst ---)~nct(Sohist )] to [Sprog ---)Slproc ~ Sbt --->Ssubst --*gnct(Sohist )]. Proof. Well-definedness. For any F: Sprog ~ Slproc ~ Sbt ~ Ssubst ~ ~nct( Sohist ), P ~ Sprog , l ~ Slproc, bt ~ Sbt, 0 ~ Ssubst, the set qtop(F)(P)(1)(bt)(O) is obviously nonempty. It is also closed. Indeed, any converging sequence ( h m ) m is after some finite prefix either constant or composed of elements of the form h m = (bt, O).hr, m for some hr. m ~ F(PXlm)(btmXO m) and some l m ~ Slproc, bt m E Sbt, 0m ~ Ssubst such that (bt, l, O ) ~ (btm, lm, Om). In the first case, the limit of the sequence is manifestly in qtop(F)(PXl)(bt)(O). In the second case, as the transition system is finitely branching, the sequence ( h m ) m contains a subsequence (h~m) m such that hr.~mcF(P)(l')(bt')(O') for some fixed l'~Slproc, bt' ~ Sbt, O' ~ Ssubst. Moreover, the limit h of the sequence ( h m ) m has also the form h = (bt, O).h r and the subsequence (hr,um) m converges to h r. Since F(P)(l')(bt')(O') is closed, it follows that h~ is in it and consequently that h = (bt, O).h r is an element of qtop(F)(P)(l)(bt)(O). Contractivity. To prove the contractivity of XFop, let us establish that for any F1, F2: Sprog ---)Slproc Sbt ---)Ssubst ~ ~nc~( Sohist ),

d(~op(Fl), %p(Fz)) <-ld(Fl, F2),

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

105

or, equivalently that, for any 1 ~ Slproc, bt ~ Sbt, 0 ~ Ssubst, P ~ Sprog,

d(qtop(F1)(P)(l)(bt)(O),

qtop(F2)(P)(l)(bt)(O))

< ½d(F 1, F2).

Let S i be qtop(Fi)(P)(l)(bt)(O), for i = 1, 2. As d( S1, $2)

inf d ( h l , h2) , sup

max{ sup

h i E S 1 h2•S 2

inf d ( h l , h2)!/,

haES 2 h i E S 1

proving the above inequality amounts to demonstrating the two following ones: sup

inf d ( h l , h2) _< ½d(Fl, F2)

hiES1 h2~S 2

sup

1

inf d ( h 1, h2) _< ~d(F1, F2).

h2ES2 h I E S 1

The proofs of these inequalities being similar, we shall only establish the first one. This is achieved by case analysis on S 1. If S 1 = {(bt, 0).6+}, then S 2 = {(bt, 0).6 +} and consequently, for any h I ~ $1, inf d ( h l , hE) = d((bt, 0).6 +, (bt, 0).6 + ) = 0 h2~S 2

The same holds when S 1 is {(bt, 0 ) . 6 - } or {(bt, O).6s}. If S 1 is not one of these singletons, then, for any h I ~ S i , there are h'1 ~Sohist, bt', b t " ~ Sbt, l', l" ~ Slproc, 0', 0" ~ Ssubst such that (i) h I = (bt', O').h' 1 (ii) (bt', l', 0') ~ (bt", l", 0") (iii) h'i ~ Fl(P)(l")(bt")(O"). In that case, the following equalities and inequalities hold, where Sfi denotes Fi(PXI"Xbt"XO") (i = 1, 2): inf d ( h l , hE) _< inf d(hl, (bt', O').h'2) h2~S 2

h'2~Sf 2

inf ½d(h'l, h'2)

=

h '2~Sf 2

= ½ inf d(h'l, h'2) h'2~Sf2 1

_< ~ sup

inf d(hl', h'2)

h~'~Sfl h ' ~ S f z

< ½d(F 1, F2). Summing up, whatever S~ is, the inequality inf d ( h l , h2) < l d ( F 1 , F2) h2ES 2

holds for any h 1 ~ S 1. It follows that sup

1

inf d ( h i , h2) _< ~d(F1, F2).

[]

h l ~ S 1 h2~S 2

Proposition 18. Let &op be the fixed point of qZop. For any P ~ Sprog, any ig ~ Sigoal, one has Qh( e )( ig ) = &op( e )(-~).

J.-M. Jacquet, K. De Bosschere/ Future Generation Computer Systems 10 (1994) 93-135

106

Proofi To establish the proposition, let us extend Och t o arbitrary lproc's, i.e. define Och: Sprog ~ Slproc Sbt ~ Ssubst ~ n c t ( S o h i s t ) as Qh in Definition 13 but by replacing the occurrences of ig and ~ by some arbitrary l ~ Slproc, and let us prove that

or equivalently that, for any P ~ Sprog, 1 ~ Slproc, bt ~ Sbt, 0 ~ Ssubst,

~op('~h~h)( P )( l)( bt)( O) C_'~h~h(P)( l)( bt)( O)

Q"~h(P )( l)( bt )( O) C_~op(~ch )( e )( l)( bt )( O)

(3) (4)

Inclusion (3). Let h be in ~Pop(Qh)(P)(l)(bt)(O) and let us establish, by case analysis on it, that it is also in Och(e)(l)(bt)(O). If h = (bt, 0).6 + then l is successfully terminated and, as a particular case of Definition 13 where m = 0, the history (bt, 0).t5 + is in Och(P)(l)(bt)(O). Similarly, if h is (bt, 0).~- or (bt, 0).6 s, it is also in Och(P)(l)(bt)(O). Finally, in case h = (bt, O).h' with (bt, l, O ) ~ (bt', l', 0'), and h ' Och(P)(l')(bt')(O'), the proof proceeds by case analysis on h'. The reasoning being similar in all the cases, let us treat the case where h' = (bt o, 0o). • • • .(bt m, Om).~ +. In that case, (bt o, 0 o) = (bt', 0') and there are l o . . . . . l m such that l ' = l o and such that

(bto, lo, Oo)~ . . . --~(btm, lm, Om) with Im successfully terminated and 11,..., l m_ 1 not successfully terminated. It follows that

(bt, l , O ) ~ ( b t o ,

lo, Oo)-~ ... ~ ( b t m , lm, Om)

and consequently that (bt, O).(bt o, 0o). "" .(bt m, Om).~+~ Och(P)(1)(bt)(O) that is that h ~ Och(P)(l)

(bt)(O). Inclusion (4). Inclusion (4) is proved as inclusion (3) but this time by case analysis on arbitrary h in Och( e )(1)(bt )(O). If h = (bt, 0).8 +, then l is successfully terminated and (bt, 0).8 +~ ~op(Och)(P)(l)(bt)(O). Similarly, if h = (bt, 0).8- or h = (bt, 0).~ s, then it is also in gtop(Och)(P)(l)(bt)(O). If h = (bt, O).(btl, 0 1 ) . ' - " .(bt m, 0rn).t~ +, (m > 1), then there are I 1. . . . . l m such that (bt, l, O)-~(btl, ll, O1)-~

"'"

--*(bt m, l m, Ore)

with Im successfully terminated, l l , ' - ", l m_ 1 not successfully terminated. Hence, h ' = (bt 1, 0 1 ) . ' " .(bt m, Om).6+~ Och(P)(ll)(btl)(O1) and therefore

h = (bt, O).h'~ ~op(~h~h)(P)(l)(bt)(O). The proof of the remaining cases where h takes the forms

(bt, O).(btl, 01)."" .(btm, Om).~(bt, O).(bt 1, 0 1 ) . ' " .(bt m, Om).~ s (bt, O).(btl, 01)."" .(bt m, Ore).''" follows similar lines.

[]

J.-M. Jacquet, K. De Bosschere/ Future Generation Computer Systems 10 (1994) 93-135

107

5. Declarative semantic~ 5.1. Auxiliary concepts

Whereas the operational semantics Ocas and Och are concerned with the operational derivations of initial goals, declarative semantics is concerned with truth. A generalization of the classical declarative semantics for Horn clauses is required in order to cope with blackboard primitives and their side effects. Because of the latter, truth is not timeless, but depends in general on the current state of the environment, which might have been affected by earlier actions on the blackboard. This is modeled by means of so-called events, to be viewed as blackboard transforming functions. They essentially consist of terms and goals, decorated by one of the action symbols + , - , and *, representing respectively the addition of an object (term or goal) onto the blackboard, the removal of an object, and the check of the presence of an object. The history of blackboard actions is then modeled by sequences of events, called blackboard traces. Definition 19. The set of blackboard events Sev is defined as (Sterm u Sgoal) X { +, - , * }. Each o f them is identified to a partial function which modifies the blackboard (composed o f terms and goals) in the above associated way. A blackboard trace is a possibly empty sequence o f blackboard events. The empty sequence is referred to as A. The set o f blackboard traces is referred to as Str. Of course, not all the traces are associated with computable histories. The constraints to be checked are formally expressed by the notion of validity. Definition 20. A trace a r . . . . a m is valid iff it is either empty ( m = O) or the composition o f functions am ..... a I is defined on the empty blackboard. Notation 21. Given two traces tl, t2, the concatenation o f tl and t 2 is denoted by t~ @ t 2, and their merge by t I ® t 2. Our next task is to find an appropriate notion of interpretation. An interpretation of izLog surely depends on the status of the blackboard. Furthermore, since background processes are only interesting in their effect on the blackboard, there is the need to express non-terminating computations declaratively. As a result an interpretation consists of a set of trace-goal-goal triplets describing the traces needed for transitions from the first goal to the second goal. The set of all interpretations is called the tz base. Definition 22. The/xbase set is defined as the set ~ ( g r o u n d ( S t r ) x ground(Sgoal) x ground(Sgoal)), where for any set S, ground(S) denotes the set o f all ground instances o f elements o f S. A n interpretation is a member o f t~base. The ixbase set can be turned into a complete lattice by ordering the interpretations by the set inclusion. Definition 23. Define < as the following relation on lzbase × izbase: for any I, J ~ txbase, I <_J iff I c J. Proposition 24. The relation < is a partial order on lzbase. Furthermore, (Ixbase, <) is a complete lattice.

J.-M. Jacquet, K. De Bosschere/ Future Generation ComputerSystems 10 (1994) 93-135

108

Proof. The partial order property of < directly follows from the properties of set inclusion. Moreover, for every subset 5 p of ixbase, • i ~ I and U / ~ I define the least upper bound and the greatest lower bound o r s p. []

5.2. Model theory Truth needs first to be defined with respect to an interpretation and a trace. Definition 25. Given a trace t, an interpretation I, and a formula f, the fact that f is true with respect to t and I, denoted by t ~ I f, is defined by the cases below.

Formula: t ~i f iff t o ~1 fo, for any ground instance (t °, f o ) of (t, f ) Ground goal: t ~i G iff ( t, G, A) ~ I. Ground clause: t ~i ( H : - B ) iff t ~1 H whenever t ~l B Ground initial goal: t ~ I [ G I , " ' , G m] iff there exist t l , ' ' ' , t m , rl," • ", rn ~ ground(Sgoal) such that (i) t i ~1 Gi, i = 1 , . . . , m (ii) (ui, Pi, ri) ~ I, i = 1 , ' " , n (iii) t ~ (t 1 ® "'" ® t m) ® (Pl.Ul.r~) ® "'" ® (Pn'Un "r+)"

Ul,...,un~ground(Str),

Pl,'",Pn,

With the help of this auxiliary truth notion, truth can now be defined directly for an interpretation. Definition 26. Given an interpretation I, and a formula f, the fact that f is true with respect to I, denoted by

~ i f, is defined by the cases below. Set of formulae: Wi (fl," " ", fn} iff for any fi, ~I fi" Clauses: ~1 ( H : - B ) iff for any t ~ Str, t ~1 ( H : - B ) . Initial goals: ~I [G1," " ", am] iff there is t valid such that t ~i [G1,'" ", Gin]. To be realistic, any interpretation should contain some minimal information. This captured by the following concept of satisfiability. Definition 27. Let Sg be the set of atoms and blackboard primitives occurring in the bodies of the ground instances of the clauses of P. The interpretation I satisfies the program P iff the following properties hold.

Empty trace: (A, G, G ) ~ I for any G ~ ground(Sgoal). Transitive closure: if (tl, G1, G 2) E I and (t2, G2, G 3) E I, then (t 1 • t2, 61, 6 3) ~ I. Ground atom: if ( A : - B ) is a ground instance of a clause of P such that (t, B, G) ~ I, then (t, A, G) ~ I. Ground tells, gets, reads: for any tellt(t), tellp(p), gett(t), getp(p), readt(t), readp(p) of Sg, ( t +, tellt ( t ) , A) ~ I ( p + , tellp(p), A) ~ I

( t-, gett ( t ) , A) ~ I ( p - , g e t p ( p ) , Zi) ~ I

( t * , readt ( t ) , A) ~ I

( p * , readp(p), A) ~ I .

J.-M. Jacquet, K. De Bosschere~Future Generation Computer Systems 10 (1994) 93-135

109

Ground sequential composition (i) if (t, G 1, G~) ~ I, then (t, (G 6 G2), (G~; G2)) ~ I, for any G 2 ~ Sgoal (ii) if (t l, G l, A) ~ I, and (t 2, G 2, G~) ~ I, then (t 1 • t 2, (G1; G2), G~) ~ 1. Ground parallel composition: (i) if (t, G1, G'1) ~ I, then (t, (G~ II a2), (G~ II G2)) ~ I, for any G 2 ~ Sgoal (ii) !f (t, G2, G'z) ~ I, then (t, (G 1 II a2), (G1 II G~)) ~ I, for any G 1E Sgoal. We are now in a position to define the notions of model and logic consequence.

Definition 28. A model o f a set of formulae S is an interpretation I such that ~ I S. Definition 29. The initial goal ig is a logical consequence of the program P iff every satisfiable model of P is a model of ig. This is subsequently denoted by P ~ ig. The fact that (ixbase, <) is a complete lattice allows to state the model intersection and minimal model properties.

Proposition 30. For any program P, the set of ground(Str) × ground(Sgoal) X ground(Sgoal) is a satisfiable model of P. Proof. Simple verification.

[]

Proposition 31. Given a set {Im}me M of satisfiable models of program P, the intersection • m ~ M lm is a satisfiable model of the program P. Proof. Obviously, J = ("1 m ~ M I m is an interpretation. It is also a model of P. Indeed, for any ground instance ( A : - B ) of a clause of P, and any trace t ~ ground( Str ), t~jB

iff

(t,B,A)~J

iff iff

for all m ~ M , (t, B, A) ~ I m for all m ~ M , t ~ImB.

It follows that, if t ~ j B, then for all m ~ M , t ~z,, A, that is (t, A , A ) ~ I m, and consequently (t, A, A) ~ J . Hence, if t ~ j B, then t ~ j A. Using a similar reasoning, J can also be proved to satisfy P. []

Definition 32.

Given a program P,

the minimal model M e is defined as the intersection of all the satisfiable

models of P.

Proposition 33. For any P ~ Sprog, any ig ~ Sgoal, one has P ~ ig iff ~ Me ig. Proof. Obviously, if P ~ ig then ~Me ig. Conversely, if ig is denoted by [ G 1 , ' " , G m ] , and if ~M ig, then there is t valid in Str such that t o ~Mp [GO, .. ", G°], for any ground instance (t °, [GO, .. ., Gff]) of (t, ig). Therefore, by Definition 25, for any such instance, there are tl,. • -, tm, Ul," • ", u n E ground(Str), Pl," " ", Pn, rl," " ", rn ~ ground(Sgoal) such that (i) t i ~ M p G °, i = 1 , " ", m (ii) (ui, Pi, ri) ~ Mp, i = 1,'" ", n (iii) t ~ (t 1 ® .-- ® t m) ® ( P l . u r r ~ ) ® "'" ® (P~ "Un"r+)"

J.-M. Jacquet, K. De Bosschere/ Future Generation ComputerSystems 10 (1994) 93-135

110

NOW, for any satisfiable model I of P, since Me c_I, it follows from (u i, Pi, ri) ~ Me that (ui, Pi, ri) ~ l, and from t i ~Me G° that (ti, 67, A) ~ Mp E I and consequently that t i ~I G°. Hence, using the above notations, t o ~1 [GO, . " ", GO] holds and consequently, ~i ig holds as well. The thesis then follows from Definition 29. [] The declarative semantics based on model theory is defined as follows. Definition 34. Define the declarative model semantics Declm: Sprog ~ Sigoal ~ ( function: for any P ~ Sprog, ig ~ Sigoal, Declm( P )(ig ) = {0 lig: P ~ igO}.

Ssubst ) as the following

5.3. Fixed-point theory

The models of a program P can be characterized as the prefixed points of a continuous operator Te: ixbase ~ ixbase. It is called the immediate consequence operator and is defined as follows. Definition 35. Let P be a program. Define the immediate consequence operator as the following function Te: ixbase --* i~base: for any I ~ tzbase, T , ( I ) = {(A, G, G): G ~ground(Sgoal)}

U{(t +, tellt(t), A): tellt(t) ~ S g } U {(p+, tellp(p), A): tellp(p) ~ S g } u { ( t * , readt(t), A): readt(t) ~ S g } u { ( p * , readp(p), A): readp(p) ~ S g } u { ( t - , gett(t), A): gett(t) ~ S g } U { ( p - , getp(p), A): getp(p) ~Sg} u { ( t , A, G): (A:-B) is a ground instance of a clause in P, ( t , B, G) ~ I } U{(t, (G1; G2), (G~; G2)): (t, G1, G'l) ~ I , G2~ground( Sgoal)} u { ( t l @ t 2 , (G1; G2), G~): (t 1, G 1, A) ~ I , (t2, G 2, G~) ~ I } u {(t, (G 1 II 62), (6'1 II 62)): (t, G1, 6~) ~ I, 6 2 ~ground(Sgoal)} U {(t, (61 II62), (61 II6~)): (t, 62, 6~) ~ I, 61 ~ground(Sgoal)} u { ( t l @t2, 61, G3): (tl, 61, 62) E l , (t2, 62, 63) El}. The following propositions state the classical properties of the Te operator. Proposition 36. The operator Te is continuous. Proof. The proof directly follows from the property that, for any sets A and B, any operator T: 9(A) ~(B) is continuous iff it is monotonic and finitary. [] Proposition 37. Let I be an interpretation of the program P. Then I is a satisfiable model of P iff Te( I) c_I. Proofi Indeed the following equivalences hold:

I is a satisfiable model of P iff I verifies the properties of Definition 27 and for any trace t, any clause ( H ~ B), any ground instance (t °, ( H ° ~ B°) ) o f ( t , ( H ~ B) ), (t o, H °, A) ~ I whenever iff

(t °, B °, A) ~ I Te( I ) c_I. []

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

111

Proposition 38. For any program P, Mp = lfp(Tp) = Tp "f w. Proof. The equality lfp(T e) = Tp "roo results from the continuity of Tp (see Proposition 36) and Tarski's lemma. The equality M e = Ifp(Tp) is established by the following equalities resulting successively from Definition 32, Proposition 37, and Tarski's lemma: M p = N { I : I is a satisfiable model of P} = n{I:

Tp(I) c_I}

= lfp(Tp).

[]

The declarative semantics based on the fixed point theory is defined as follows. It can be proved to be identical to the declarative semantics defined by the model theory.

Definition 39. Define the declarative fixed point semantics Declf: Sprog---> Sigoal ~ ( S s u b s t following function: for any P ~ Sprog, ig ~ Sigoal, D e c l f ( P ) ( i g ) = {0 lig: ~lfp
) as the

Proposition 40. For any P ~ Sprog, any ig ~ Sigoal, any 0 ~ Ssubst, P ~ igO iff ~tfp(Te) igO. In particular, Decl m = Declf. Proof. The proposition directly follows from Propositions 33 and 38.

[]

5.4. Relating the operational and declarative semantics Let us now relate the operational semantics with the declarative semantics. Soundness first establishes that any successful operational reduction induces logical consequences.

Proposition 41. (Soundness). For any P ~ Sprog, any ig ~ Sgoal, any 0 ~ Ssubst, if P F- ig with 0 then, for any y ~ Ssubst, P ~ igOy. Proof. The proof amounts to establishing that, under the condition of the proposition, P ~ igO. This is done by induction on the length of the derivation. Actually, since after one step, a term or a process can be put on the blackboard, a slightly more general result needs to be proved. Given, on the one hand, some terms b t l , . . . , b t m on the blackboard, some background processes b p l , . ' . , bp n, a substitution tr, and, on the other hand, some b b o , . . . , bbp ~ Sbt, l o , ' " , l p E S l p r o c , 0o,. • .,Op ~ Ssubst such that (i) b t l , . . . , btm, ~, b p l , . . . , bpn have no variable in common (ii) (bbo, lo, 0 o) ~ " " ~ (bbp, lp, Op) (iii) (bb o, l o, 0 o) = ( [ b t l , ' " , btm], -~ + [ b p l , . . . , bp,], or) (iv) Ip successfully terminated (v) l~,. •., lp_ ~ not successfully terminated. We shall demonstrate, by induction on the length of the derivation p, that, rewriting ig as [G~,. •., Gq], for any satisfiable model I of P, there is t valid in Str with no variable in common with the bti's, bpi's, Gi's and such that, for any ground instance (t °, bt°l, . . . , bt ° , bp°, . . . , bp °, GO, . . . , G °) of (t, btl,. . ., btm, bpl ," • ", bp,, G l O p , " • ", GqOp), there are tl,. " ", t q , Ul," • ", Us ~ ground(Str), Pl," " ", Ps, rl," " ", rs ~ ground(Sgoal) such that (i) t k ~ I GO, k = 1 , " ",q (ii) (uk, Pk, rk) ~ I, k = 1 , " ", s

112

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

(iii) t o ~ (bt°l)+® " " ® (bt°m)+®(bp°)+® "'" ® (bp°)+®[(tl ® "'" ® t o) ® ( p f . u l . r ?) ® " " ®(p~-.us.r+ )]. Base case: p = 0. If p = 0, then ~ is successfully terminated, that is ig is composed only of empty goals. Since (A, A, A) is a member of any satisfiable model, t = (btl) +. ....(btm)+.(bPl) +. "'" .(bpn) + is a valid trace satisfying the thesis, with s = 0 and t~ = A, for k = 1 , . - - , q. Induction case: p > 0. If p > 0, one of the rules (A) to (Gp) has been applied first. The proof then proceeds by case analysis on the rules. As all the rules are handled in a similar way, we shall only detail the proofs corresponding to rules (A) and (Tp). They illustrate the modification of the substitution part, and of the list of terms part of the operational configurations, respectively. Rule (A). Assume first that rule (A) has been applied for a foreground process, say ~ G a. In that case, G a is c I A ] for some context c and some atom A and there is a clause H:-B whose head unifies with Ao-, say with mgu y. Moreover, 01 = o-y and I 1 is 10 where G~ = c~A] has been replaced by c~B]. By induction hypothesis, for any satisfiable model I of P, there is t valid in Str such that for any ground instance

(t °, bt°, .. .,bt°m, b p ° , ' " , b p

°, G ° , ' ' ' , G°_I, c[[B]]°, G°+I," • ", G °)

of (t, btl,"',btm,

bpl,'",bp

n, G l O p , ' " , G a _ l O p, c~O]Op, aa+lOp,...,GqOp)

there are tl,. •., tq, Ul,. •., u s ~ ground(Str), Pl," " ", Ps, rl," " ", rs ~ ground(Sgoal) such that (i) t k ~ I G ° , k = l , . . . , q a n d k 4 : a (ii) t~ ~ i c [ B ] ° (iii) (Uk, p~, r k) ~ I, k = 1,'" ", s (iv) t ° ~ (bt°)+ ® " " " ® (bt°m)+ ®(bp°)+ ® "'" ® (bp°)+ ®[tl ® " " ® tq ® (p-~.Urr ~ ) ® "'" ®(pj-.us.G+)]. Now note that, since all the elements of the tuples do not share variables, any ground instance

(t °, ato1,...,at

g, bp °, . . ,apO, . . .G o,

., G oo_,, cUmO, Ga+l, o .. •, a o)

of (t, b t l , ' " , b t m ,

b P l , " ' , b P n , G I O p , ' " , G a _ I O p, cUA]Op, Ga+lOp,'",GqOp)

corresponds to a ground instance (t o, bt°, ' ' . , b t ° , bp°, .. . , b p °, GO, .. - , G ° _ l , c[A]] °, c[[B] °, G ° + I , ' " , G °) of (t, btl,'",bt

m, b p , , ' " , b p

n, G l O v , " ' , G a _ l O p, c[A]Op, c[[BUOp, G ~ + l O p , ' " , G q O p ) .

The thesis then results from the fact that, I being a model of P, t a ~I c~B] 0 and A ° : - B ° a ground instance of a clause of P imply t a ~ i c [ A ] °. If (A) has been applied for a background process, then the proof is similar but is concluded by invoking the satisfiability of I, according to which (t, cUA] °, G) follows from (t, c [ B ] °, G) for any ground instance A ° : - B ° of a clause of P. Rule (Tt). If rule (Tt) has been applied for a foreground process, say ~ Ga, then G a is c[tellt(t)D for same context c and some term t, 11 is l 0 where Ga = c[tellt(t)] has been replaced by cUA]. Moreover,

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93 -135

113

01 = tr and bb I = bb o + [u], with u a fresh renaming of t. Applying the induction hypothesis, for any satisfiable model I of P, there is t valid in Str such that for any ground instance

( t°, bt°, . ", bt°m, . u°,. bP°,". ", bP°, Go, .

" , G°a-1,

c~A] °, Ga+l ,.o

.. ,Gq)°

of

(t, b t l , . . . , b t m , u, b p l , . . . , b p n, GlOp,'",Ga_lOp, c[A]Op, Ga+lOp,"',GqOp) there are q,. •., tq, ul,. •., u s ~ ground(Str), Pl," " ", Ps, q," " ", rs ~ ground(Sgoal) such that (i) t k ~ l GO, k = l , . . . , q and k 4 : a (ii) t a ~i c~A] ° (iii) (Uk, Pk, rk) ~ I , k = 1,'" ", s (iv) t o ~ (bt°)+® "'" ® (bt°)+®(u°)+®(bp°)+® . . . ® (bp°)+®[t! ® . . . ® tq ® ( P l . U l . r ? ) ® . . . ® (p~-.us.r~+)]. Now note that, since variables are again not shared by the members of the tuples, any ground instance

( to, b t ° , " " . bt°, .bP°, "'" . bP. °, 6°1, "'" G ° - l , c~tellt(t)] °, aa+l,.0 . . , a O) of

( t, b t l , " " , b t m , b P l , . . . , bPn , a l O p , . . . , G a _ lOp, c[[tellt( t )l]Op, Ga+ lOp,. . . , GqOp ) corresponds to a ground instance ( to, b t ° , " ' , bt°, u°, bP°, "'" , bP°, GO, . "

" , a°a-1,

c[[A] °, Ga+l , o . . . ,Gq)°

of

(t, b t l , ' " , b t m ,

u, b p l , ' " , b p , , GlOp,...,Ga_lOp, c~A]Op, Ga+,Op,'",GqOp).

The thesis then results from the fact that, I being a model of P, one h a s (uO)+.ta ~ 1 c~tellt(t)B °. The proof is conducted in the same way when (Tt) has been applied to a background process.

[]

The proof of completeness gets simplified by using an auxiliary derivation relation, which essentially rephrases the derivation relation ~- but for ground goals. It is denoted as Pb- [G][G'][u] and takes the meaning that, given the program P, the goal G can be reduced to the goal G' by producing the events occurring in the trace u. Definition 42. Define the derivation relation I~ as the smallest relation of ground(Sprog) × ground(Sgoal)

× ground(Sgoal) × ground(Str) verifying the following rules: for any ground context c, ground goals G and p, ground trace u, ground term t, PI~ [cRB]][G][u] P~,, [c~A]][G][u]

if A:-B is a ground instance of a clause o f F

PI~[G][G][A] el ~ [c~A]][G][u] PI~ [ cltelh( t )]][ G ][ t+.u] PI ~ [c[A]l[G][u] PI- [cUreadt(t)~] [ G l [ t * . u ] PI ~ [ c [ A O ] [ G ] [ u ]

PI ~ [ c~ gett( t )]] [ G ][ t - . u ]

Pl~ PI ~ [ dtellp( p)n][ G][p+.u] PI~ P[- [ readp( p ) ]] [ G ][ p * .u ] PI ~ [ c U A ] ] [ G ] [ u ] P[ ~ [ e getp( p

[ G ][ p - . u ] "

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

114

The two following propositions link the declarative semantics and the operational semantics, first for goals and then for initial goals.

Proposition 43. For any t ~ ground(Str), G, G ' ~ ground(Sgoal), if (t, G, G ' ) ~ M p then PI ~ [G][G'][t]. Proof. By Proposition 38, M e = T e 1' to. Therefore, if (t, G, G ' ) ~ M e , then there is an n such that (t, G, G ' ) ~ Tp $ n. The proposition then follows directly from an inductive reasoning on n. [] Proposition 44. For any t l , " • ", tin, Ul," • ", Un ~ ground(Str), and any G1," • ", am, Pl," " ", P., rl," " ", r. ground(Sgoal), if the following conditions hold: (i) (ti, Gi, A ) ~ Mp, i = 1 , ' " , m (ii) (u j, Pi, ry) ~ Me, j = 1 , " ", n (iii) there is a valid trace in (t 1 ® .-- ® tm) ® ( P l . U l . r ~ ) ® "'" ® (Pn'Un "r+)" then PI ~ [ G 1 , . . . , Gm] with • holds as well. Proof. Indeed, Proposition 43, applied on (ti, Gi, A) can be rephrased as asserting the existence of a ground derivation for each Gi, considered in isolation, provided the events of trace ti can be performed. Similarly, any goal pj can be reduced to rj, provided that the events of uj can occur. Now, as recognized in Proposition 7, since all processes of an lproc list do not share any variables, the parallel execution of the G / s and the Pi'S c a n be regarded as the merge of their executions considered in isolation, but constrained by the availability of data required by the reads and gets. As, this is ensured by the existence of a valid trace in (tl®

"'"

®tm)® (pl.ul.r~)®

.-.

®(Pn.Un.r+n)

the thesis then results from the fact that the G / s being ground, the restriction of any substitution to their set of variables is the identity substitution e. [] As the last step towards completeness, we now prove the lifting lemma rephrased in our setting. Essentially, it establishes that the existence of a derivation for an instance igtr of the igoal ig that makes no bindings for the variables of ig implies the existence of a derivation for ig yielding a computed answer substitution more general than o-.

Proposition 45. (Lifting Lemma). For any P ~ Sprog, any ig ~ Sigoal, any tr ~ Ssubst, if P F- igo~ with • then there is 0 ~ Ssubst, such that P F- ig with 0 and igO < igcr. Proof. The proposition is established by proving a slightly more general result. In the conditions of the proposition and for any finite set of variables V containing the variables of tr and the variables of ig, there are two substitutions 0 and p such that P ~- ig with O, and Xtr = XOp, for any variable X ~ V. By definition, P ~- igtr with • is associated with a derivation (bto, to, 0o)--* . . . --,(btm '

Im, Om~

with

(i) ( b t o, 10, 00) = ([], ~tr, e) (ii) Im successfully terminated (iii) l l , ' - - , l m_ 1 not successfully terminated ( i v ) Omligtr = •. The proof consists of proving the existence of a similar derivation for ([], ~, • ) ending with a suitable substitution 0m. This is achieved by induction on the length m of the derivation. However, after one step,

J.-M. Jacquet, 1<2De Bosschere/ Future Generation Computer Systems 10 (1994) 93-135

115

the configuration is generalized to a possibly non-empty list of blackboard terms, a list of processes possibly containing background processes and a possibly non-empty substitution. Hence, we shall actually prove that, for any bt ~ Sbt, l ~ Slproc, o-, 6 ~ Ssubst such that (i) bt contains no variable appearing in l, or and t5 (ii) the terms of bt have no variable in common (iii) the processes of lo-~ have no variable in common and for any set of variables V containing the variables of tr and l, if there exists a derivation

(bto, 10, 0 0 ) ~ . . . ~ (bt m, lm, Om) with (i) (bt o, 10, O) = (bt, l, or) (ii) lm successfully terminated (iii) 11,. - ", l m _ 1 not successfully terminated then there is also a derivation

(bt~, l~, 0 ~ ) ~ "'" ~ ( b t ' , l ' , Om) such that (i) (bt~, l~, 0~) = (bt, l, •) (ii) l " successfully terminated. (iii) l~,. • ", l m_ ~ not successfully terminated (iv) for any variable X ~ V, XO" < Xo-.

Base case: m = 0. If m = 0, then all the foreground processes of lo- are A's and the thesis is obviously verified.

Induction case: m > 0. If m > 0, then one of the rules (A) to (Gp) has been applied first. The thesis is established straightforwardly by induction if rules (Tt) or (Tp) have been applied. It is demonstrated in a similar way when rule (A) or rules (Rt) to (Gp) are applied. Let us detail the proof for one of them, say (Gt). If (Gt) has been applied first and if t is the term to be got, u is the selected term of bt, and v is its considered fresh renaming, the unification of to- and v by the mgu y leads to the equality to-y = vy, and, as v is a fresh renaming, to the equality tory = vo'y. Hence, t and v unify and if ~ is their mgu, there is a substitution sr such that o-y = ~:~'. Moreover, in that case the configuration (btl, 11, 01) rewrites as (bt', l', ~ ) with bt' and l' as determined by rule (Gt). It follows from Proposition 8 that the derivation (bt', l', ~ ) - ~ (bt2, 12,

~ O - 2 ) ---~ " ' "

--~

( btm, lm, ~o-m)

holds and, consequently the derivation

(bt', l'~, ~ ) ~ (bt2, 12~ , o-2)~ "'" ~ (btm, ImP,

o-m)

holds as well. Applying the induction hypothesis on the set W D_var(ll) U var(~) U var(l) u var(~) then leads to the existence of the derivation

(bt', l'~, e)---~ (b/2, 12~, 0 ~ ) ~ . . . ~ (btm, lm~, O" ) and consequently thanks to Proposition 8, to the existence of the derivation

(bt', l', ~)--~ (bt2, 12, ~0~)--~ "'" ~ (btm, lm, ~0" ). AS (bt, l, •) -~ (bt', l', ~) holds by application of rule (Gt), the derivation (bt, l, •) ~ (bt', l', ~ ) ~ (bt2, 12, ~:0~)~ " ' " ~ (btm, Ira, COrn)

116

J.-M. Jacquet, K. De Bosschere /Future Generation Computer Systems 10 (1994) 93-135

is then established. It remains to be proved that, for any X of V, Xtr > X ~ O ' . Indeed, as P ~ igtr with E, y may be assumed to be chosen such that, for any X c V, Xo- = X t r y . Therefore, since try = ~ and since by the application of induction, for any Y ~ W, there is /z such that Yff = YO'I~, the following equalities hold for any X ~ V:

x~=xtry=x~¢=x~o'u.

[]

We are now in a position to prove the completeness proposition. Essentially it asserts the property that any substitution that instantiates an initial goal to a logical consequence of a program is less general than a computed answer substitution for the initial goal and the program.

Proposition 46. (Completeness). For any P ~ Sprog, any ig ~ Sgoal, any 0 ~ Ssubst, if P ~ igO then there exists y ~ Ssubst such that igy >_igO and P ~- ig with y. Proof. If P ~ igO, then, by Proposition 33, ~Me igO and consequently, there is a valid trace t such that t ~Me igO. Therefore if ig = [G1,. •., Gin] and if (t °, GO, .. -, G ° ) is a ground instance of (t, G1,.. ", Gm)O obtained by replacing all the variables of t and ig, say X1,.--, X s by distinct constants, say a l , . . . , as, there are tl,. • -, tin, U l , " " " , Un E ground(Str), Pl," " ", Pn, rl," " ", rn ~ ground(Sgoal) such that (i) (ti, G °, A ) ~ Me, i = 1 , ' " , m (ii) (ui, Pi, ri) ~ Me, i = 1 , " ", n (iii) t ° ~ (t 1 ® . . . ® tm) ® ( P l .ul.r~ ) ® "'" ® ( P n "Un"r+ )" It follows from Proposition 44 that P k- [GO, • •., G °] with e. Hence, by textually replacing the constants al," • ", a s by the corresponding variables X1,. • -, Xs, in the derivation associated with P ~- [GO, • • -, G °] with e, a derivation is pointed out that proves P ~- igO with e. T h e thesis then results from Proposition 45. [] Summing up the results of this section, the declarative semantics and the operational semantics Oca s are related as follows.

Proposition 47. Let a2: Sigoal x ~ ( S s u b s t ) ~ ( S s u b s t ) be the following function: for any ig ~ Sigoal, any S ~(Ssubst), a2(ig)(S) = {Olig: igy <_ igO, y ~ S}. Then, for any P ~ Sprog, any ig ~ Sigoal, Decl m( P )( ig ) = Decl f ( P )( ig ) = a 2(ig , O cas( P )( ig ) ). Proof. Immediate consequence of Propositions 41 and 46.

[]

6. Denotational semantics This section presents our last semantics. Its main features are that it is defined compositionally, without the help of any transition system and without reference to any declarative paradigm. It is called denotational in view of these properties. Compositional definitions might actually be thought at two levels. On the one hand, goals are formed from atoms and blackboard primitives and from the sequential and parallel composition operators ';' and 'lr. One might thus think of defining the semantics of goals compositionally by defining that of the basic constructs - the atoms and the blackboard primitives - and by providing semantic counterparts for the sequential and parallel composition operators. On the other hand, initial goals consist essentially of lists of goals to be reduced in parallel. One might therefore also think of defining their semantics compositionally by combining the semantics of goals by means of a suitable semantic operator. These two

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

117

levels are reflected in this section. A denotational semantics is first defined for goals, or equivalently for processes considered in isolation. It is then used to design the semantics of initial goals, or equivalently of processes considered globally. A central notion for both kinds of semantics is the notion of state. It aims at describing the minimal information a process needs to continue its execution. It consists of the current contents of the blackboard (both terms and background processes) and of the values computed so far for the variables (that is a substitution). Any computation for a process can then be seen as a succession of transitions from initial states to final states, this succession ending, if finite, by a failure, a suspension or a success termination mark. As states do not refer to foreground processes, the whole computation of any initial goal can be seen in the same way. Parallel executions require however a slight adaptation of these computation perceptions. Because of them, the state reached by one component may indeed be modified by a subsequent computation step of another concurrent component. To allow compositional treatments, computations are thus best regarded as sequences of elementary transitions from states to states with possible breakdowns between the initial state of a transition and the output state of its preceding transition in the sequence. These sequences are subsequently called denotational histories. Of course, as several clauses may, in general, be applied in a given state, a process may, in general, choose among several possible transitions. The semantics to be reported for a goal or an initial goal consists therefore not of a single history but of a set of histories. It is taken, as in Section 4, as non-empty and closed for correctness of some results. A final technicality differentiates the nature of the semantics of goals and of initial goals. As might be guessed, the semantics of an initial goal is actually derived not only from the semantics of its goals but also from the semantics of the blackboard, summing up the effect of the background processes. However, in contrast with foreground processes, background processes are to be considered as successfully terminated at any moment. This difference is marked semantically by adding, when necessary, a flag to the histories of processes, indicating at each step whether the histories can be considered as associated with successfully terminated computations or not. The following definition precises the concepts just introduced. Definition 48. (1) Define the set Sstate o f states as Sbt x Ssubst x Sbg. States are typically represented by the ss symbol, possibly super- or subscripted. (2) Define the set Sterm o f terminators as {succ, susp, fail}. (3) Define the set Sflag o f termination flags as {t, nt}. Termination flags are typically represented by the f f symbol, possibly super- or subscripted. (4) Define the sets Sghist and Sphist o f denotational histories as the following sets: Sghist = (Sstate x Sstate) < o~× (Sstate x Sterm) u ( S s t a t e x Sstate) ~ Sphist = (Sflag x Sstate x Sstate) < o~x (Sstate x {fail, succ}) L)(Sflag x Sstate x Sstate) <'° x (Sflag x Sstate x {susp}) u ( S f l a g x Sstate x SstateY" Denotational histories are thus basically streams written as (ssia, SSo,1).(ssi.z, SSo,z).(ssi,3, SSo,3). . . . and (ffl, ssi,1, SSoa).(ff2, ssi,2, SSo,2).(ff3, ssi.3, SSo,3)."" thanks to the outermost Cartesian products. Each tuple o f the form (ssi, SSo) , (ssi, succ), (ssi, susp), (ss i, fail), ( ff, ssi, SSo), ( ff, ss i, susp) is called an elementary transition; its states ss i and ss o are called its input and output states. A denotational history is said to start in state ss if it is a sequence whose first elementary transition has ss as input state. It is said to end in success, failure or suspension if its last elementary transition has succ, fail, susp as last component, respectively. For readability the parentheses o f the elementary transitions are often rewritten by the symbols ( a n d ) , as in ( ss i, ss o ).

J.-M. Jacquet, K. De Bosschere/ Future Generation ComputerSystems 10 (1994) 93-135

118

Endowed with the distance dstream , the spaces (Sghist, dstream) and (Sphist, dstream) can be proved complete. For further recursive reasoning, it is worth noting that they can also be obtained as the solutions of the following recursive equations Sghist = (Sstate x Sterm) U ((Sstate x Sstate) x Sghist ), Sphist = (Sstate x {fail, succ}) u (Sflag x Sstate x {susp}) U ((Sflag x Sstate x Sstate) x Sphist). respectively (see [1] or [8] for the resolution of these equations). (5) Define the semantic domains G s e m and Psem as the sets ~nct(Sghist ) and ~n¢l(Sphist ), respectively. 6.1. Denotational semantics of a process The definition of a compositional semantics for a process considered in isolation first requires the definitions of semantic counterparts ',' and 'llg' for the sequential and parallel composition operators ';' and ' I1'. The definition of the first semantic operator is quite intuitive. Given two histories, h I and h2, it returns the history composed of the steps of h 1, continued by a fail or a susp mark if h 1 terminates as such, or by the steps of h 2, otherwise. This definition may then be lifted straightforwardly to sets of histories. The recursive nature of the histories might suggest a recursive definition. However, their possible infinite nature makes a direct definition incorrect. This problem is circumvented by using a higher-order function lIfse q of the same recursive nature but that turns out to be a well-defined contraction. Definition 49. Define the function llIseq'- [ Sghist X Sghist ~ Sghist ] ~ [Sghist × Sghist ~ Sghist ] as follows: for any F: Sghist x Sghist ~ Sghist, any hi, h2, hlr ~ Sghist, any ss, ss 1, ss 2 ~ Sstate,

(hi, if h 1 = ( SS, f a i l ) o r ha = ( ss, susp ) I

altseq(F)( hl, h2) = ~h2, if h 1 = (ss, succ ) /~(SSl ' ss2).F (hlr, h2), ifh 1 = (SSl, ss2).hlr Proposition 50. The function ~Ifseq is a contraction. Proof. Let F1, F2: Sghist x Sghist ~ Sghist be arbitrary functions, and let us prove that

d(attseq( F1), Xltseq(F2) ) < ~1 d ( F l , F2) or, equivalently, that for any hi, h 2 ~ Sghist, 1 d(~I~tseq(F1)( hl, h2), l[tseq(F2)( hl, h2)) ~ ~d( Fx, Fz)

To that end, let us proceed by case analysis on h r

Case 1: h 1 is of the form (ss, fail) or (ss, susp). In that case, attseq(FiXhl, h 2) = h I for i = 1, 2, and therefore

d(qtseq(F1)(hl, h2), attseq(F2)(hl, h2) ) = d ( h l , hi) = 0 < ld(F1, F2). Case 2: h I is of the form (ss, succ). In that case, attseq(FiXhl, h 2) = h2, for i = 1, 2, and the thesis results as for case 1.

Case 3: h I is of the form (SSl, ss2).hlr. In that case, ~seq( Fi)( hl, h2) = (ssl, ss2).Fi( hlr, h2)

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

119

for i = 1, 2 and consequently

d(lltseq( F1)( hl, h2), lltseq( F2)( hl, h2)) = d(( SSl, ss2).Fl( hxr, h2), (ssl, ss2).F2( hlr, h2)) = ½d(Fl(hlr , h2), F2(hlr, h2))

< ~1

sup

d ( F l ( h l ,'

h'2) , F2(h ~, h'2) )

h ~,h '2~ Sghist

= ½d( F1, F2).

[]

Definition 51. Define the function. : [Gsem × Gsem -~ Gsem ] as the natural extension of the unique fixed point Oseq of ~seq: for any $1, S 2 ~ Gsem, S1.$2= {qb~eq(hl, h2): hi ~ S 1, h 2 ~ $ 2 }

Proposition 52. For any h 1, h2, l 1, l 2 ~ Sghist, one has d(hl, h2) < d(chseq(hl, ll), (°~eq(h2, 12)) d(~bseq(hl,/l), qb~eq(h2, 12)) < max{d(hl, h2), ld(ll, 12)}Moreocer, for any S1, S 2, T 1, T 2 ~ Gsem, d(S1.T1, S2.T2) _ max{d(Sl, S2), ½d(T,, T2) }. Proof. Indeed, it is easy to verify that if h I = h 2 and if l is their length, then

d(qbseq(hl, ll), qb~eq(h2,/2)) =

0, 2 - t d ( l l , la),

if h i and h e end in failure or suspension otherwise.

Moreover, it is also easy to establish that if h I :~ hE, then

d( q~~eq(hl, ll), d~eq( h2, la)) = d( hl, h2). Hence, the first two inequalities. The last one results directly from the previous one by recalling the definition of the Hausdorff distance. []

Proposition 53. For any S 1, S 2 ~ Gsem, the set SI~S 2 is non-empty and closed. In particular, the function, is well-defined. Proof. For any S1, S 2 ~ Gsem, the set 51,52 is obviously non-empty. To prove that it is closed, let ( h m ) m be a converging sequence in S1.$2, and let us prove that its limit h is in S1.S 2. 1 h _2 ) for some h_1 ~ S, and h_2 E S,. By Definition 51, each element h m is of the form ~bo~(h~, Therefore, the sequence (h,")," induces two sequences (h~)m"and"(h2)m in S 1 and $2, respectively" Moreover, the sequence (hlm)m is converging. Indeed, as it is converging, (hm) m is a Cauchy sequence and therefore so is ( h i ) , . in view of Proposition 52. As Sghist is complete and S 1 is closed, it follows that 1 (hm)," converges to a limit, say h 1, in S v Two cases need now to be considered. On the one hand, if h 1 is infinite then, for any h E ~ $2, C~seq(h 1 , h 2 ) converges to C~seq(hl, hE), On the other hand, if h I is finite, then after some prefix, (hi),. becomes equal to h 1. In that case, if h i ends in failure or suspension, then for m great enough, ~bseq(h1, h E) = h I and h = h i. The thesis then results from the equality h I = C~seq(h1, h'2) for any h 2' ~ S 2. Otherwise, it follows from the convergence of (hl)m that (h,.),,, 2 is also a converging sequence and, as S 2 is closed, that its limit, say h 2 is also in S 2. In that case, Proposition 52 establishes that Chseq(h1, h2m) converges to d~eq(h 1, he). []

J.-M. Jacquet, K. De Bosschere/Future Generation ComputerSystems 10 (1994) 93-135

120

The definition of the semantic counterpart 'Jig' of '11' reflects the interleaving perception of parallelism. The result of the semantic combination of two histories is a set of histories obtained by merging the steps of the two histories and by combining their final status when both of them have been explored. As before, a suitable higher-order contraction is used in order to provide a correct definition. The definition of histories is then lifted in a direct manner to sets of histories.

Definition 54. Define the function ltCgara: [Sghist × Sghist ~ 9,d(Sghist )] ~ [Sghist x Sghist ~ g~ct(Sghist )] as follows: for any F: Sghist × Sghist ~ , d ( Sghist ), any h l, h e, hr, hlr , h2r E Sghist, any ssi, ss o ~ Sstate, {h,, h2}, if Cond 1 {hi}, /f Cond 2

~,ara(F)(hl, h2) =

{h2}, ifCond3 {(ssi, SSo).hr: h I =(ssi, SSo).hlr , h r E F ( h l r , h2) }

u {(ssi, SSo).hr: h2=(ssi, SSo).h2r, h r ~F(hx,

h2r)},

otherwise,

where the Cond/s stand for the following conditions: Condl: h i ~ {(ssi, fail), (ssi, susp), (ss i, succ)} (i = 1, 2) with ss I ~ ss 2 Cond2: one of the following conditions holds: (i) h 1 = (ss, fail) and h 2 E {(ss, fail), (ss, susp), (ss, succ)} (ii) h 1 = (ss, susp) and h 2 ~ {(ss, susp), (ss, succ)} Cond3: one of the following conditions holds: (i) h 1 = (ss, succ) and h 2 E {(ss, susp), (ss, succ)} (ii) h 1 ~ {(ss, susp), (ss, succ)} and h 2 = (ss, fail). Proposition 55. The function ~ r a

is well-defined and is a contraction.

Proof. For any F: Sghist × Sghist -~ncl(Sghist), any hi, h 2 ~ Sghist, the set attogara(FXhl, h 2) is obviously non-empty. It is also closed in case hj ~ {(ssj, fail), (ssj, susp), (ss~, succ)}, ( j = 1, 2). To prove its closedness in the remaining case, let us first note that any sequence of rFgara(F)(hl, h E) then contains a subsequence of the form ((ss i, SSo).hm) m for h i = (ssi, SSo).hlr and h m ~ F(hlr , h E) for any m, or h 2 = (ssi, SSo).h2r and h m ~ F ( h 1, h2r) for any m. Closedness then results from that of F(hlr, h 2) or

F(hl, h2r). Contractivity is proved by choosing 1 / 2 as contractivity factor and by establishing that, for any F 1, F2:

Sghist × Sghist --*~nd( Sghist ), any hi, h 2 E Sghist, d(~flara(F1)(hl, h2), ~gara(F2)(hl, h2)) < ld(F1, F2) This inequality is immediate in case h~ ~ {(ssj, fail), (ss i, susp), (ssi, succ)} ( j = 1, 2) because then the first distance is 0. In the remaining case, recalling the Hausdorff distance between two sets, the following inequalities must be proved where St stands for aItgara(Fj)(hl, hE) , ( j = 1, 2): sup

inf d(h~, h'2) < ½d(F 1, F2)

h]ES 1 h'2ES 2

sup

t

1

inf d(h 1, h'2) < Td(F 1, F2).

hl2ES2 h~ E S 1

Let us establish the first one, the proof of the other one being similar. To that end, let us first note that, by definition of S 1, for any h~ ~ S 1, one of the two following situations holds: (i) h~ (ssi, SSo).h'lr with h 1 (SSi, SSo).hlr and h~r~Fl(hlr, h 2) (ii) h'1 = (ss i, SSo).h'lr with h 2 = (ssi, SSo).h2r and h'lr~Fl(h 1, h2r). =

=

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems I0 (1994) 93-135

121

A s s u m e that the first situation h o l d s - - t h e second one is treated similarly. Since, for any h'zr c Fz(har , h2) ,

d((ssi, SSo).h r, (ssi, SSo).h' r)= ½d( h'lr, h' r) and since F2(har, h 2) is n o n - e m p t y by hypothesis, the following equalities and inequalities hold inf d ( h l ,

d(h~, (ssi, SSo).h'2r )

inf

<_

ht2~S2

h'2r ~ F 2 ( h l r , h 2 ) 1

= ~

!

t

d(hlr, hzr )

inf h ~ 2 r E F 2 ( h l r , h 2)

1

_< ~

sup h]'r~Fl(hlr,

inf h 2) h2r

t!

d(h~r , h2r )

F 2 ( h l r , h 2)

< l d ( F l ( h l r , h2), F2(hlr, h 2 ) ) < ~

sup d(Fl(h~, h ~'~ Sghist h '~~ Sghist

h'~), F 2~,rh"1 , h~))

= l d ( F 1 , F2). Therefore, since h~ has b e e n chosen arbitrarily in S 1 inf d( h'l, h'2) < ½d( F1, F2).

sup h~S

[]

1 h'2ES 2

Proposition 56. Define ~bpara g as the fixed-point of qt~,r~. For any hi, h2, ll, 12 ~ Sghist, d(q~gara(hl, l l ) , q~gara(h2, 12)) -< m a x { d ( h l ,

h 2 ) , d ( l l , 12)}.

Proof. By definition d(hl, h 2) and d(ll, l 2) are either 0, 1 or 2 -m for some m > 1. Hence, M = max{d(h 1, h2), d(l 1, 12)} takes also these values. If M = 0, then d(hl, h 2) = d(ll, 12)= 0, and consequently h I = h2, and l I = l 2. It follows that d( q~ara( hl, l l ) , dP~ara(h 2, 12) ) = 0 < M If M = 1, then the thesis is immediate because by definition

0 _< d ( c ~ p ag r a ( h l ,

g ll) , q~para(h2, 12) ) -<- 1.

Let finally M be 2 -m for some m > 1. In that case,

d( hl, h2) < 2 -m d(ll, 12) < 2 -m and therefore, on the one hand, one of the situations (i) and (ii) holds, and, on the other hand, one of the situations (iii) and (iv) holds: (i) h 1 = h 2 ~ {(ss, fail), (ss, susp), (ss, succ)} (ii) h I = s-s1. -...sS--m.hlr and h 2 = ss 1. ....sS--m.h2r for some SSl,-.. ,ss--m ~ Sstate × Sstate, htr, h2r ~ Sghist (iii) l 1 = 12 ~ {(ss', fail), (ss', susp), (ss', succ)} -- r --¢ --t --! -- ! --r (iv) l I = ss 1. • • • .SSm.llr and l z = ss 1. • • • .SSm.12r for some SSl,. • .,ss m ~ Sstate × Sstate, l~, lzr ~ Sghist. If situations (i) and (iii) hold, then g

d(q~gara(hl , l l ) , C p a r a ( h 2 , / 2 ) )

= 0 _< 2 -m.

g A s s u m e situations (i) and (iv) hold. In that case, any s 1 ~ &p~r~(hl, l 1) is of the f o r m --

--¢

S 1 ~ SSI1. • . . . S S m . S l r

122

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems I 0 (1994) 93-135

g for some Sir E ~ pga r a (hi, llr)" Moreover, for any Ser E ¢bpara (h2, S 2 =S"Stl • ' ' "

is in

12r) ,

.-~m.S2r

g

q~para(h2, 12r).

Hence, if Sj =

g ~)para(hy, lj)

for j = 1, 2, for any s I ~ $1,

inf d( Sl, s2) < 2 -m $2~S 2

and therefore, sup

inf d(s1, $2) _< 2 -m.

sIES 1 s2ES 2

Similarly, one can prove that sup

inf d(s1, $2) _< 2 -m.

SzES 2 sIES 1

Summing up,

d(4)~ara(hl, ll), 4~v.ra( 2, 1 2 ) ) = max

sup

inf d ( s l , s2)

~,S1ES 1 $2~5 2

sup

inf d(Sl, s2)

$2~5 2 s 1~ S 1

<2-m The case where situations (ii) and (iii) hold is treated analogously. To conclude the proof, let us finally assume that situations (ii) and (iv) hold. If so, any s 1 ~ ~b~ar~(hl, 11) is of the form ..--31 __t¢ S 1 = S S 1. • . . . S S m . S l r --t

for some prefix s~'~. • • • .ss--~ of the merge of S-~l. • • • .ss--i (0 < i < m) and o f s s '1. . - . . s 5 (0 < j < m) and some Sir E ( ~ g a r a ( " ~ i + l . ' ' " .-~m.hlr, s"si+l.-.- .SS--'.llr). The thesis is then proved as for situation (i) and (iv) by noting that for any S2r ~ t~gara~SS i+ 1" • .SSm.h2r ---t - - . . . . lS In ~ ) gp a r a ( h l , 12). , --¢ $5+ 1. ' ' ' .SSm.12r) , S 2 = S- -Sol • ' ' " .SSm.S2r

[]

Definition 57. Define the function Ilg: G s e m × Gsem -~ Gsem as the natural extension to Gsem of the g g unique fixed point ~)para of ~gara: for any S1, 52 E Gsem, S 1 IIgS2 = U{t~para(hl, hE): h 1 E S1, h 2 ~ S2} Proposition 58. (1) For any S1, S 2 E Gsem, the set S 1 ~g S 2 is non-empty and closed. In particular, the function IIg is

well-defined• (2) For any S l, S a,

T1, T 2 E Gsem, the following inequality holds:

d ( S 1 H g S 2 , T 1 HgT2) <_ m a x { d ( S , ,

T1) , d ( S 2 , T2)}•

Proof. The first part of the proposition is established as Proposition 53 but by using Proposition 56 instead of Proposition 52. The second part of the proposition results directly from Proposition 56. [] We are now in a position to define the denotational semantics of a process considered solely• Given the operators '.' and '118', our task amounts to defining the semantics of the basic constructs, namely of the processes associated with an empty goal, an atom or a blackboard primitive• The semantics of the former process is quite obvious: it has only one history ending immediately in success whatever state is considered. The semantics of the other processes reflects the case analysis already carried out for the operational and declarative semantics.

J.-M. Jacquet, K De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

123

Definition 59. Define the function ~ . : [Sprog ~ Sproc ~ Gsem] ~ [Sprog ~ Sproc ~ Gsem] as the following function: for any F: Sprog ~ Sproc ~ Gsem, any P ~ Sprog, any A ~ Satom, any t ~ Sterm, any p ~ Sgoal, any G 1, G 2 ~ Gsem, qrfe.( F ) ( P ) ( = A ) = {(ss, ss').h: Cond,} to {(ss, fail): Cond2} to {(ss, succ): Cond3} qrfe.( F ) ( P ) ( = tellt( t ) ) = {((bt, O, bg), ( bt + [u], 0, bg) ).h: u is a fresh renaming of tO, h ~F(P)(

~ A), bt ~ Sbt, 0 ~ Ssubst, bg ~ Sbg}

qr~en( F ) ( P ) ( = tellp( p ) ) = {((bt, 0, bg), ( bt, O, bg + [ ~ q]) ).h: q is a fresh renaming of pO, h ~ F ( P ) ( ~ A), bt ~ Sbt, 0 ~ Ssubst, bg ~ Sbg} 'Ir~n( F ) ( P ) ( = readt( t) ) = {(ss, ss').h: Cond4} to {(ss. susp): Conds} 'Irk.( F ) ( P ) ( = readp( p ) ) = {(ss, ss').h: Cond6} u {(ss, susp): Cond7} qr~n( r ) ( P ) ( = gett( t) ) = {(ss, ss').h: Conds} (3 {(ss, susp): Condg} qr~e.( F ) ( P ) ( = getp ( p ) ) = {( ss, ss' ).h " Cond lo} to {( ss, susp ): Cond H } qr~.( F ) ( p ) ( = A ) = {(ss, succ): ss e Sstate} qrfen( r ) ( P ) ( = G,; G2) = qrd~n(r ) ( P ) ( = G , ) . F ( P ) ( = G2) qrd~n( F ) ( P ) ( = G,

IIG2) =

qr~e.( F ) ( P ) ( = G , ) HgaIr~e.(F ) ( P ) ( = Gz)

where the Condj's stand for the following conditions: Condl: (i) ss = ( bt, O, bg ) ~ Sstate (ii) (H:-B) is a fresh renaming of a clause of P such that H and AO unify with mgu y ( iii ) s s ' = (bt, Oy, bg) (it,) h ~ F ( P ) ( ~ B) Cond2: (i) ss = (bt, O, bg) ~ Sstate (ii) there is no fresh renaming (H:-B) of a clause of P such that H and AO unify (iii) A is a foreground process Cond3: (i) ss = (bt, O, bg) ~ Sstate (ii) there is no fresh renaming (H:-B) of a clause of P such that H and AO unify A is a background process ( iii ) Cond4: (i) ss = (bt, O, bg) ~ Sstate (ii) there is v ~ bt such that some fresh renaming v' of v unifies with tO, say with mgu y ( iii ) s s ' = (bt, Oy, bg) (iv) h ~ F ( P ) ( ~ A) Conds: (i) ss = ( bt , O, bg ) ~ Sstate (ii) there is no v ~ bt such that some fresh renaming v' of v unifies with tO Cond6: (i) ss = (bt, O, bg) ~ Sstate (ii) there is ~ G ~ bgO such that some fresh renaming G' of G unifies with pO, say with mgu y (iii) s s ' = (bt, Oy, bg) (iv) h ~ F ( P X ~ A) Cond7: (i) ss = (bt, O, bg) ~ Sstate (ii) there is no ~ G ~ bgO such that some fresh renaming G' of G unifies with pO Cond8: (i) ss = ( bt , O, bg ) ~ Sstate (ii) there is v ~ bt is such that some fresh renaming v' of v unifies with tO, say with mgu y (iii) bt' is bt where v has been removed (it,) s s ' = (bt', 0y, bg) (v) h ~ F ( P X ~ A)

124

J.-M. Jacquet, IE De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

Cond9:

(i) (ii) Condlo: (i) (ii) (iii) (iv)

(v) Condn: (i) (ii)

ss = ( bt , O, bg ) ~ Sstate there is no v ~ bt such that some fresh renaming v' of v unifies with tO ss = ( bt , O, bg ) ~ Sstate <--"G ~ bgO is such that some fresh renaming G' of G unifies with pO, say with mgu y bg' is bg where <--"G has been removed s s ' = (bt, Oy, bg') h ~ F ( P ) ( = A) ss = (bt, O, bg) ~ Sstate there is no ~ G ~ bgO such that some fresh renaming G' of G unifies with pO.

Proposition 60. The function ltt~e n is well-defined and is a contraction. Proof. Well-definedness. On the one hand, for any F: Sprog ~ Sproc ~ Gsem, any P ~ Sprog, and any G ~ Sgoal, q t f e , ( F ) ( P ) ( = G) is non-empty. This is obviously the case for G = A or for G an atom or a blackboard primitive. Moreover, when G is a composed goal, non-emptyness results directly from Propositions 53 and 58 and from an inductive reasoning. On the other hand, for any F: S p r o g ~ S p r o c ~ Gsem, any P ~ S p r o g , and any G ~Sgoal, qtfen(F)(P)(= G) is closed. This is again established by induction. When G is a composed goal of the form (G~; G2) or (G 1 II G2), closedness directly follows from Propositions 53 and 58. Closedness is also directly established when G = A, because then any converging sequence becomes constant after some finite prefix. Finally, when G is an atom or a blackboard primitive, any converging sequence is again after some finite prefix either constant or composed of elements of the form (ss, ss').h with h F ( P ) ( = Gc) for some Gc ~ Sgoal. In the first case, closedness is certainly ensured. In the second case, since P is finite, it is possible to fix Gc: more precisely, any converging s e q u e n c e ( h m ) m has a subsequence ( h k . ) m w h o s e elements are of the form hkm = (ss, s s ' ) . h " for some (ss, ss') fixed in Sstate x Sstate and h'~ ~ F ( P ) ( ~ Gc) for some fixed Gc in Sgoal. Two remarks are then in order. First, the limit of ( h m ) m in necessarily of the form (ss, ss').h', for some h' ~ Sghist. Secondly, ( h ' ) m is also necessarily converging to h'. Now, since by hypothesis, F ( P ) ( ~ Gc) is closed, it follows that h ' ~ F(P)( ~ Gc) and therefore that (ss, ss').h' ~ qt~a~(F)(P)( = G).

Contractizity. To prove the contractivity property of qtfe~, let us establish that, for any F~, F2: Sprog ~ Sproc ~ Gsem, any P ~ Sprog, and any G ~ Sgoal, 1

d( qtfe,( F1)( P ) ( = G ) , qtfen( F2)( P ) ( = G) ) < 2d( F 1, F2) The proof proceeds by induction on G.

Case 1: G = A. If G is the empty goal, then r[Zfen(F1XPX~ G) = ~ f e ~ ( F z ) ( P ) ( ~ G) and the inequality is obvious. Case 2: G is an atom. If G is an atom, say A, then using the notations of Definition 59, for any i = 1, 2, ~ n ( Fi)( P )( ~ G) = {( ss, ss').h: Condl} U {( ss, fail): Cond2} u {( ss, succ ): Cond3}. Establishing the above inequality then amounts to proving that, if S i denotes rlZfen(Fi)(P)(= G), sup

inf d ( s l , $2) _~<½d(F1, F2)

sl~Sa s2~$2

sup

inf d( s 1, s2) < ½d( F 1, Fz).

s2ES 2 sI~S 1

J.-M. Jacquet, K. De Bosschere /Future Generation Computer Systems 10 (1994) 93-135

125

The proofs of these inequalities being similar, let us simply demonstrate the first one. Let s I ~ S~. If sl is (ss, fail) for some ss ~ Sstate, then Cond z holds and therefore (ss, fail) ~ S 2. Hence inf d ( s 1, s2) < d ( s 1, (ss, fail)) s2~$2

=0

<- l d( Fx, F2). The same reasoning applies when Cond 3 instead of Cond 2. Finally, B ~ Sgoal and with Cond I holding, following equalities and inequalities inf d(Sl, s2) _< s2~$2

inf

s I is (ss, susp), for some ss ~ Sstate, but this time by employing if s 1 is (ss, ss').h I for some ss, ss'~Sstate, h I ~ F I ( P ) ( = B ) , then (ss, ss').h 2 ~ S 2, for any h 2 ~ F 2 ( P ) ( = B), and therefore the hold:

d(s 1, (ss, ss').h'2)

h ~ F z ( P ) ( ~ B)

=

inf

l d ( h , , h'2)

h'2EF2(PX ~ B)

= ~ _< ~1

inf d ( h l , h'2) h'2~F2(PX~ B) sup

inf

d ( h lt, h'2)

h]~FI(PX~ B) h'z~Fz(P)(~ B)

<_ ½ d ( F I ( P ) ( = B ) , F 2 ( P ) ( = B ) ) <_ ½d(F 1, F : ) . Summing up, for any s 1 ~ $1, inf d( s~, s2) <- ½d( F1, F2) s2ES 2

and consequently, sup

1

inf d(Sl, s2) __ ~d(F~, F2).

sIES 1 s2ES 2

Case 3." G is a blackboard primitive. The cases where = G is a blackboard primitive is treated in the same way as for G an atom. Case 4: G is a composed goal. Finally, in case G is a composed goal of the form (G1; G 2) or (G 1 II G2), the thesis results directly from Propositions 52 and 58, respectively. [] Definition 61. Define the function Denp: Sproc --->Gsem as the unique fixed point of ~f~en"

6.2. Denotational semantics of initial goals To be considered at a global level, the previous semantics of processes (considered solely) has to be enriched by a termination flag. It is determined by considering the foreground processes as terminated only when a terminator symbol is reached and background processes as terminated at any moment. This transformation is described formally by the following conversion function cony: Sarrow × Gsem ~ Psem. It is defined as before by means of a suitable higher-order contraction, first at the level of histories and then at the level of their sets.

126

J.-M. Jacquet, I£ De Bosschere/ Future Generation Computer Systems 10 (1994) 93-135

Definition 62. Define ~conL,: [ Sarrow × Sghist --->Sphist ] --->[Sarrow x Sghist ~ Sphist ] as the following function: for any F: Sarrow X Sghist --->Sphist, any h ~ Sghist, any 0 ~ Ssubst, any bg ~ Sbg, any ss, ssi, ss o ~ Sstate, any h, h r ~ Sghist, any h'r ~ Sphist, ~h, if h ~ {(ss, fail), (ss, succ)} qt .... ( F ) ( ~ , h) = ~ ( t, ss, susp ), if h = ( ss, susp ) .hPr, if h = , if h = (ss, susp> ~ ( n t , ssi, SSo>.h'r, if h = (ssi, SSo>.hr, h'r = F ( ~ , hr). Proposition 63. The function tP~on,, is a contraction. Proof. The proof follows the lines of the proof of Proposition 50 and is therefore omitted.

[]

Definition 64. Define cony: [Sarrow × Gsem --->Psem] as the natural extension of the unique fixed point q5..... of tP~o~v: for any a ~ Sarrow, any S ~ Gsem, cony(a, S) = {fbconv(a , h): h ~ S} Proposition 65. For any a ~ Sarrow, any S ~ Gsem, the set cony(a, S) is non-empty and closed. In particular, cony is well-defined. Proof. The proof follows the lines of the proof of Proposition 53 and is therefore omitted.

[]

Definition 66. Define the denotational semantics Den*: Sprog ~ Sproc --->Psem as follows: for any P ~ Sprog, any ( ~ G) ~ Sproc, D e n * ( P ) ( ~ G) = c o n y ( = , Denp(eX = G)). As before, the compositional definition of the denotational semantics of initial goals requires the definition of a semantic operator providing the counterpart of the association of goals in igoal's. As these goals are to be reduced in parallel, the semantic operator has the flavor of a parallel operator and is named ' lip'. It is defined in a similar way to the operator 'llq' but in addition succ marks are combined both with terminator marks and with histories equipped with a flag reporting termination. Definition 67. Define the function ~pPara: [Sphist X Sphist ~ Psem] ~ [Sphist × Sphist --> Psem] as follows: for any F: Sphist × Sphist --->Psem, any h 1, h 2 ~ Sphist, { h i , he}, ifCondl ( h i } , / f Cond 2 qSpra(F)(h~, h2) =

{he}, ifCond3 {(if, ssi, SSo>.hr: hi = (fix, ssi, SSo).h~, h r ~ F ( h~r, h2)} u {(ff, ssi, SSo>.hr: h2 = (ff2, ssi, SSo>.h2r, h ~ F ( h l ,

h2~)}, ifCond4

where the C o n d / s stand for the following conditions: Cond l : h i E {( ss i , fail>, ( f f i , ss i , susp >, ( ss i , succ >} with ss I ~ ss 2, for some ss 1, ss 2 ~ Sstate, f f l , if2 ~ Sflag. Cond2: one of the following conditions holds, for some ss, ss' ~ Sstate, h 2 r E Sphist: ( i ) h 1 =
J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

127

(ii) h 1 = (t, ss, susp) and h 2 = (t, ss, susp) (iii) h 1 = (nt, ss, susp) and h 2 ~ {(t, ss, susp), (nt, ss, susp), (ss, succ)} (iv) h I = (ss, succ) and h 2 ~ { ( t , ss, s s ' ) . h 2 r , ( t , ss, s u s p ) , (ss, succ)} Cond3: one of the following conditions holds, for ss, ss' ~ Sstate, hlr ~ Sphist: (i) h 2 : (ss, fail) and h 1 ~ {(t, ss, susp), (nt, ss, susp), (ss, succ)} (ii) h 2 = (nt, ss, susp) and h 1 ~ {(ss, succ), (t, ss, susp)} (iii) h e = (ss, succ) and h 1 ~ {(t, ss, ss').hl,, (t, ss, susp)} Cond 4: none of the conditions Condl, Cond 2 or Cond 3 holds and one of the following conditions holds: (i) f f = nt and at least one of the hi's is in (({nt} × Sstate × Sstate) × Sphist) U ({nt} × Sstate × {susp}), i = 1, 2 (ii) f f = t and none of the hi's is in ({nt} × (Sstate × Sstate) × Sphist) u ({nt} × Sstate × {susp}), i=1,2. Proposition 68. The function ~pPara is well-defined and & a contraction. Proof. Similar to that of Proposition 55.

[]

Definition 69. Define the function lip: [Psem × Psem ~ P s e m ] as the natural extension to Psem of the P S1, S 2 ~ Psem, S 1 IlpS2 = U{~kpara(hl, h2): hi E S1, h 2 E 52}

P unique fixed point ~)para of ~pPara: for any

Proposition 70. For any $1, S 2 ~ Psem, the set S 1 ~pS 2 is non-empty and closed. In particular, the function lip is well-defined. Proof. Similar to that of Proposition 58.

[]

Defining a denotational semantics for igoal's requires the semantic knowledge of its goals but also the semantic perception of the effect of background processes acting on the blackboard. This effect is modeled semantically by the function bb. Given a state and in particular a list of background processes, it essentially consists of performing one step of the background processes and of calling itself recursively. For correctness purposes, it is also defined by means of a higher-order contraction. As shown in the following definition, it is worth noting that the first steps to be performed can be obtained by combining the denotational semantics of the background processes under consideration. Definition 71. Define the function q~bb: [Sprog --->Psem] --->[Sprog --->Psem] as follows: for any F: Sprog ---> Psem, any P ~ Sprog, qtbb(FXP) = {((bt, 0, []), succ): bt ~ Sbt, 0 ~ Ssubst} U {((bt, 0, [ ~ G1," • ", <--"Gn]) , succ): bt ~ Sbt, 0 ~ Ssubst, G 1," " ", Gn ~ Sgoal, ((bt, O, ['~ G~," " , ~ Gn]), succ) ~ D e n * ( P ) ( ~ G~)Hp "-" Hp D e n * ( P ) ( ~ Gn)} U {(t, (bt, 0, [ ~ G1,. •., ~ Gn]), susp): bt ~ Sbt, 0 ~ Ssubst, G 1," " ", G, ~ Sgoal, (t, (bt, 0, [,--" G1," " ", ~ Q ] ) , susp) ~ Den~(P)(<--" G,)~p --. Hp D e n * ( P ) ( , ~ G,)} U

{(t, (bt, 0, [ ~ G 1 , ' " , ~ G,]), ss).h: bt ~ Sbt, 0 ~ Ssubst, G1, " • ", G, ~ Sgoal, h ~ F( P ) (t, (bt, 0, [,--" G1,. •., ~ G,]), ss).h' ~ D e n * ( P ) ( ~ G1)H p . . . Hp D e n * ( P ) ( ~ G,)}.

J.-M. Jacquet, K. De Bosschere ~Future Generation Computer Systems 10 (1994) 93-135

128

Proposition 72. The function gtbb is well-defined and is a contraction. Proof. Well-definedness. For any F: Sprog ~Psem, any P ~ Sprog, the set gtbb(F)(P) is obviously a non-empty set of histories of Sphist. It is also closed. Indeed, any converging sequence (hm) m of ~Fbb(F)(P) is after a finite number of elements either constant--with h m ~ {(ss, succ), (t, ss, susp): ss ~ Sstate}--or composed of elements h m = ( t , ss, s s ' ) . h ' m for some (fixed) ss, ss' ~ Sstate and some h m E F(P). In the first case, the limit is manifestly in aFbb(F)(P). In the second case, the limit has also the form (t, ss, ss').h', for some h' c Sphist, and the sequence h " is converging to h'. As F(P) is closed, it follows that h' ~ F ( P ) and therefore that the limit (t, ss, ss').h' is in ~bb(F)(P)

Contractivity. Proving the contracting property of ~bb(F)(P) amounts to establishing that, for any F1, F2: Sprog ~ Psem, any P ~ Sprog, sup

d(hl, h2) < ½d(F 1,/72)

inf

h 1~ ~Fbb(F1XP) h2~ ~bb(F2)(P)

sup

d(hl, h2) < ld(F1, F2).

inf

h2~ ~bb(F2XP) hi ~ ~bb(FIXP)

The proof of these inequalities being similar, let us demonstrate the first. Let h I ~ ~bb(F1)(P). It is of the form (ss, succ), (t, ss, susp), or (t, ss, ss').h~r with h~r~Fa(P). In the first two cases, it is also in ~bb(F2Xe) SO that inf d(h 1, h2) = 0 < ld(F1, F2). h2~ g'bb(F2XP) In the last case, for any h2r ~ F2(P), (t, ss, ss').hzr is in ~bb(F2)(P), SO that inf

d(hl, h2) <

h2~ al~bb(g2XP)

inf

d(hl, (t, ss, s s ' ) . h 2 r )

h2r E F2(P)

= 12

inf

h2r ~F2(P) 1

_< ~

d(hlr, hzr )

sup

inf

d(hlr, her )

hlrEFl(P) h2rEF2(P)

< ld(F1, F2). Summing up, in all the cases, inf

d( h l, hE) < ½d( F 1, F2)

h2~ ~P'bb(F2XP)

and therefore sup

inf

1

d ( h l , h2) < ~d(F 1, F2).

[]

h I E altbb(F1Xe) h 2 ~ qtbb(F2XP)

Definition 73. Define the function bb as the unique fixed point of ~bb" Definition 74. Define the denotational semantics Den: [Sprog -~ Sigoal -~ Psem] as the following function: for any P ~ Sprog, any [G 1," " ", Gm ] ~ Sigoal, O e n ( P ) ( [ G 1 , . - - ,Gin] ) = D e n * ( P ) ( ~- G1) H p " " Hp D e n * ( P ) ( ~- Gm) Np b"b(P). A direct consequence of this definition and of Definition 67 is that the denotational semantics of an initial goal is independent of the order in which its goals are listed. This fact combined with the relation

J.-M. Jacquet, K. De Bosschere/ Future Generation ComputerSystems 10 (1994)93-135

129

between the operational and denotational semantics (stated in Proposition 80) establishes once more Proposition 15. Proposition 75. Any program P ~ Sprog, any igoal ig ~ Sigoal and any permutation ig' of it verify the equality Den( P )( ig ) = Den( P )( ig ' ). Proof. The operator Hp being obviously commutative (see Definition 67), the proposition directly follows from Definition 74. [] 6.3. Relating the operational and denotational semantics We conclude this section by relating the operational semantics Och and the denotational semantics Den. Intuitively, a valid operational history can be derived from any denotational history by collecting the pairs (bt, O) of the denotational history, successively reached from the input state ([], e, []), by suitably changing the termination marks and by considering a computation as successfully terminated when reported by its flag. This is precisely what is performed formally by the following function 0/3 but from any given state. Definition 76. Define a history of Sphist as coherent iff the output state of any of its elements is the input state of its successor element, if any. Define Scphist as the subset of coherent histories of Sphist. Then define q/tel: [Scphist ~ Sohist] ~ [Scphist ~ Sohist] as follows: for any F: Scphist ~ Sohist, any bt ~ Sbt, any 0 ~ Ssubst, any bg ~ Sbg, any ss ~ Sstate, any h, h r ~ Scphist, (bt, O) .~-, i f h = ( ( b t , O, bg), fail) (bt, O) .6 s, if h = ( nt, ( bt, O, bg ) , susp ) attrel( F ) ( h ) =

(bt, O) .~ +, if h = (t, ( bt, O, bg ), susp ) (bt, O) .~ +, if h = ( ( bt, O, bg ) , succ ) (bt, O) .F ( hr ) , if h = ( nt , ( bt , O, bg ) , ss ).h r (bt, O) .~+, if h = (t, (bt, O, bg), ss).hr

Proposition 77. The function attreI is well-defined and is a contraction. Proof. The proof follows the (by now) classical lines, already exposed for previous propositions.

[]

Definition 78. Define 0/3: Psem ~ Sbt ~ Slproc ~ Ssubst ~ ( S o h i s t ) as the natural extension of the unique fixed point q~rel o f 1tire I for histories starting in a given operational configuration: for any S ~ Psem, any bt ~ Sbt, any l ~ Slproc, any 0 ~ Ssubst, 0/3( S ) ( bt )( l)( O) = {¢~rel( h ) : h coherent history of S starting in ( bt, 0, bg ) with bg the background processes of l}. Proposition 79. For any S ~ Psem, any bt ~ Sbt, any l ~ Slproc, any 0 ~ Ssubst, the set 0/3(S)(btXl)(O) i. closed. Proof. The proof follows the (by now) classical lines, already exposed for previous propositions.

[]

J.-M. Jacquet, K. De Bosschere /Future Generation Computer Systems I0 (1994) 93-135

130

Relating the semantics Och and Den then consists of proving that the function a 3 composed with the semantics Den delivers the semantics Qh. This is indeed the case as claimed by the following proposition.

Proposition 80. For any P ~ Sprog, any ig ~ Sigoal, any bt ~ Sbt, any 0 ~ Ssubst, Och( P)( ig)( bt)( O) = a3( Den( P)( ig) )( bt )(~)( O). Proof. Let Den a be the natural extension of Den to arbitrary lists of processes: for any P ~ Sprog,

l ~ Slproc, Deno(P)(I) = D e n p ( P ) ( ,-- G1) Hp .." ~p D e n * ( P ) ( ,-- Gm)I'lp b~(P) where ~ G1,- • -, ~ G m are all the foreground processes of l. Obviously, for any ig ~ Sigoal, Dena(PX-~) =Den(P)(ig). Therefore, in view of the unicity of the fixed point of contradictions and in view of Proposition 18, proving the thesis amounts to establishing that the function

a 3 ~ Dena: Sprog ~ Slproc ---)Sbt ~ Ssubst ~ ( S o h i s t ) defined by (a3 ~ Den~) ( P )( l)( bt )( O) = a3( Den~( P )(1) )( bt )( l)( O) for any P ~ Sprog, I ~ Slproc, bt ~ Sbt, 0 ~ Ssubst, verifies the following properties: (i) using the above notations, ( a 3 ~ Den~)(P)(l)(bt)(O) is non-empty and closed (ii) a 3 ~ Den~ is a fixed point of qtop. Property (i) is quite easy to establish. Non-emptyness of (a 3 ~ Den a)( P )( l )( bt )( O) results from Definitions 59 and 71. Its closeness follows from Proposition 79. Property (ii) is established by demonstrating the two inclusions

qtop( a 3 ~ Dena)( P )( l)( bt )( O) c ( a 3 ~ Dena)( P )( l)( bt )( O)

(1)

(a 3~ Den~)(P)(l)(bt)(O)

(2)

c_ aPop(a 3 ~ D e n a ) ( P ) ( l ) ( b t ) ( O )

for any P E Sprog, and l ~ Slproc, any bt ~ Sbt, and any 0 ~ Ssubst. To ease the notations, let us first adopt the following notation: given 1 ~ Slproc, we denote by ~ G1," • ", *-- Gin(t) its foreground processes, and by bg(l) the list of its background processes.

Inclusion (1). Inclusion (1) is established by proving that, by using the above notations, any h of ~op(a3 ~ Den a)( P )(1)( bt )( O) is also in ( a 3 ~ Dena)(P)(IXbtXO). Let us proceed by case analysis on h. (1) If h is (bt, 0).8 +, then 1 is successfully terminated and therefore, any a i (i = 1 , . . . , m(l)) is za. It successfully follows from Definition 59, that, for any i = 1,- •., m(1), ((bt, O, bg(l)), s u c c ) e D e n ~ , ( P ) ( ~ Gi). As there is a history starting from (bt, O, bg(l)) in bb, Definition 67 allows us to conclude that

(( bt, O, bg(l)), succ)~Den~( P)(1), and consequently that

( bt, 0).6+ ~ ( a 3 ~ Dena)( P )( l)( bt )( O). (2) If h is (bt, 0).6-, then the proof proceeds similarly but by noting this time that, at most differs from za (i = 1 , . . . , m(l)) and that • ((bt, O, bg(l)), succ) ~ D e n * ( e ) ( ~ - G i ) , for any G i = A (i = 1 , . . . , m ( l ) )

one

Gi

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

131

• ((bt, O, bg(I)), fail) ~ D e . n * ( P ) ( ~ Gi), for any G i ¢ , 4 (i = 1,...,m(l)) • ((bt, O, bg(1)), succ) ~ bb. (3) If h is (bt, 0).~ s, then the proof follows the same lines but with the following facts: • (nt, (bt, O, bg(l)), susp) ~ . D e n * ( P ) ( ~ Gi) , for any G i ~ A (i = 1 , ' ' ' , r e ( l ) ) • (t, (bt, O, bg(1)), susp) ~ bb, if bg(l) is non-empty; ((bt, O, bg(l)), succ) ~ bb, otherwise. (4) Finally, if h = (bt, O).h r with (bt, l, O) ~ (bt', l', 0'), for some bt' ~ Sbt, l' ~ Slproc, O' ~ Ssubst, and h r E ( a 3 ~ Dena)(P)(l')(bt')(O') , then the transition rules of Definition 6 reveal that for some process = G of l, and some list 1"[] with a place holder

(bt, l " [ = G], 0 ) ~ (bt', l " [ = G ' ] , 0 ' ) with l = l " [ ~ G] and l' = l " [ ~ G']. Two cases need to be distinguished. On the one hand, if ~ G is one of the foreground processes of l, say ~ G k, then for any h d ~ Den*(P)(G'),

(nt, ( bt, O, bg(l)), (bt', 0', bg(l')) ) . h d ~ D e n * ( P ) ( G k ) . Moreover, if h r ~ (or 3 g Dena)(P)(l')(bt')(O') , then there is a coherent history hc of Den~(P)(l') starting in (bt', 0', bg(l')), and such that h r = lI)'rel(hc). It follows that

(nt, (bt, O, bg(l)), (bt', 0', bg(l')) ).h~ ~ D e n ( P ) ( l ) and, consequently, that

( bt, O).h r E (O~3 g Den~)( P )( l)( bt )( O). One the other hand, if = G is a background process of l, then for any h d ~ bb(P),

(t, (bt, O, bg(l)), (bt', 0', bg(l')) ) . h d e ~ ( P ). Using a similar reasoning

on hr,

but noting that l is non-terminated, it follows that

(nt, (bt, O, bg(l)), (bt', 0', bg(l')) ).hc c D e n ( P ) ( l ) and consequently that

(bt, O).h r ~ (o/3 g Den~)( P)( l)( bt )( O). Inclusion (2). Inclusion (2) is established by proving that, using the above notations, any h in ( a 3 ~ Dena)(P)(l)(bt)(O) is also in qtop(a 3 ~ Den a)( P )(1)( bt )( O). If h ~ ( a 3 ~ Dena)(P)(l)(bt)(O) then there exists a coherent history h c of Dena(P)(l) such that h = altrel(h c) with h and h c related according to the cases listed in Definition 76. Moreover, it is easy to check from Definitions 62 and 67 that the third and sixth cases cannot occur since no histories (t, ss, susp) and (t, ss, ss').hr can appear in Den~(P)(l). The proof thus reduces to checking that, in the remaining cases, h is a m e m b e r of qtop(a 3 ~ Den a)( P )(l )( bt )( O). As far as the first two cases and the fourth case are concerned, it is straightforward to verify that ((bt,O, bg(l)), fail), (nt, (bt, O, bg(1)), susp) and ((bt, O, bg(l)), succ) are in Dena(P)(l) if and only if the following conditions hold respectively (i) l is not successfully terminated and for any bt' ~ Sbt, any bg ' ~ Sbg, ( bt, l + bg ', O) - 1 -~ (ii) l is not successfully terminated, (bt, l, O) +~ and there are bt', bt" ~ Sbt, bg' ~ Sbg, O' ~ Ssubst, l' ~ Slproc, such that ( b t ' , l + bg', O) - l ~ (bt", l', 0'). (iii) l is successfully terminated. Therefore, in these cases, h - - w h i c h is (bt, 0).~ +, (bt, 0).~-, (bt, 0).~ s, respectively--is in 1I¢op(0¢3 "~Den a)( P X l )( bt )( O).

In the fifth case, h = (nt, (bt, O, bg(l)), s s ) . h r , following properties hold: (i) h is not terminated

and, as established by Definitions 62 and 67, the

J.-M. Jacquet, K. De Bosschere/ Future Generation ComputerSystems 10 (1994) 93-135

132

(ii) (bt, 1, 0 ~ ~ (bt', l', 0' ) for some bt' ~ Sbt, 1' ~ Slproc and 0' ~ Ssubst (iii) ss = (bt', 0', bg(l')) (iv) h r ~ Dena(P)(l'). As h is coherent, hr starts in (bt', 0', bg(l')). It then follows from Definition 16 that, if h ' = ~ret(hr), the history h = (bt, O).h' is in

~op(C~3 ~ D e n a ) ( P ) ( l ) ( b t ) ( O ) .

[]

7. Conclusion The paper has presented a new logic programming framework, called tzLog, as well as five semantics for it. All these semantics have been related throughout the paper, thanks to Propositions 40, 47 and 80. The minimal relations have only been stated. From them, it is possible to deduce other relations, for instance to connect Den with Decl,~ and Declf. It is furthermore impossible to add nonredundant relations. For instance, it is impossible to guess the infinite derivations contained in Och and Den in view of the only computed substitutions of Ocas. It is also impossible to guess the substitutions computed in Oca s from all substitutions pointed out declaratively in Decl m or Declf. However, it is worth noting that although they are associated with different semantics, it is possible to connect the derivation relation ~and the model theory, as established by Propositions 41 and 46. The txLog framework as it stands is well-suited for a first semantic study of the integration of blackboards in logic programming and therefore for concrete proposals such as [2,4,6]. However, finer semantics for these proposals require the treatment of other control mechanisms such as Prolog backtracking. Other semantics remain also to be described such as fully abstract ones. Besides their interest in their own, they would allow a study of the expressiveness of i~Log and a comparison with other frameworks a n d / o r languages. All these extensions are as many subjects for future research.

8. Acknowledgments The research reported herein has been supported by the Belgian National Fund for Scientific Research, the Belgian National incentive program for fundamental research in Artificial Intelligence and the Esprit BRA 3020 Integration project. The first author is grateful to L. Wulteputte for his implementation of Multi-Prolog, and to J. Van Campenhout for support and advice. The second author likes to thank the members of the C.W.I. concurrency group, J.W. de Bakker, F. de Boer, F. van Breugel, A. de Bruin, P. Knijnenburg, J. Kok, C. Palamidessi, J. Rutten, D. Turi, E. de Vink and J. Warmerdam, for their weekly intensive discussions. He is also grateful to B. Le Charlier for support and advice.

9. Appendix: metric spaces Definition 81. A metric space is a pair (M, d) with M a set and d a mapping of type M x M ~ • that satisfies the following properties: (i) d(x, y ) = 0 i f f x = y , f o r a n y x , y ~ M (ii) d(x, y) = d ( y , x), for any x, y ~ M (iii) d(x, y ) < d ( x , z ) + d ( z , y), for any x, y, z ~ M . The mapping d is called a distance.

J.-M. Jacquet, K. De Bosschere /Future Generation Computer Systems 10 (1994) 93-135

133

Definition 82. Let (M, d) be a metric space, x an element of M and (Xi) i be a sequence in M. (1) (xi) i is a Cauchy sequence whenever the following condition holds: Ve > 0 3 u ~ ~ V m , n >~ u d ( x m , Xn) <~..

(2) (xi) i converges to x whenever the following condition holds: Ve > 0 3 u ~

~ Vm > u d(x,

Xm) <6.

In that case, x is called the limit of the sequence (xi) i. Definition 83. The metric space ( M, d) is complete if any Cauchy sequence converges to an element of M. Definition 84. A subset X of a metric space is closed iff any converging sequence of X has its limit in X. The set of non-empty and closed subsets of M is denoted by ~ncl(M). Proposition 85.

(1) Given a set S, define the mapping ddisc: S × S ~ [0, 1] as follows: for any x, y ~ S, O, 1,

ddi'c(X' Y) =

ifx =y i f x --/:y.

The pair ( S, d disc) ts a complete metric space. The distance d disc is called the discrete distance. (2) Given a set A, let A ~ o, be the set of sequences either finite or infinite with elements from A. Let, for any s ~ a <-o,, and any integer n, s[n] be the prefix o f s of length n. Define the mapping dstr: A < ~o X A <-oJ ..._> [0, 1] as follows: for any s, t ~ A <-°~, dstr( S ,

t) = 2 -suptn:s[nl=t[nl}

with the convention that 2 -~ = O. Then, ( A <_o~,d~tr) is a complete metric space.

(3) Let X be a set and (M, d) be a (complete) metric space whose distance d is bounded i.e. admits an integer N such that d(x, y) < N, for any x, y ~ M. Define the mapping d f c t : [ g ~ M] X [ X --'> M ] --> on the set [ X ~ M] of functions from X to M as follows: for any f, g: X ~ M, d r , ( f , g) = s u p d ( f ( x ) ,

g(x)).

xEX

The pair ([X---> M], dfc t) is a (complete) metric space. (4) Let ( M 1, d 1) and (M 2, d 2) be (complete) metric spaces. Define the mapping d~art: M 1 × M 2 ~ ~ as follows: for any (xl, Yl), (x2, Y2)~M1 ×M2, dcart((Xl,

Yl), (x2, Y2))= max{dl(Xl, x2), d2(Yl, YE)}-

The pair (M 1 × M2, dcart) is a (complete) metric space. (5) Let (M, D) be a (complete) metric space. Define the mapping dn: 9 . ¢ l ( M ) Xg.~l(M) ~ ~, called the Hausdorff distance as follows: for any X, Y ~ . ~ t ( M ) , dn(X,g)=max(sup

inf d ( x , y ) , s u p

~x~X y~Y

inf d ( x , y ) } .

y~Y x~X

The pair (~nct( M), d14) is a (complete) metric space. Proof. Admitted results.

[]

134

J.-M. Jacquet, I¢2 De Bosschere/ Future Generation Computer Systems 10 (1994) 93-135

Convention 86. In case no distance has been explicitly defined, any set S, any set o f sequences A ~'°, any set o f functions [X--> M], any Cartesian product M 1 × M2, and any powerset ~ n c t ( M ) are assumed to be endowed with the distances d disc, dstr, dfct, dcart and dE, respectively. Note that, to be really rigorous in the notations, the sets S, A , X , M, M1, M 2 should be mentioned in the notations o f the distances. However, they are always well understood and are consequently omitted. Definition 87. Let ( M 1, d 1) and ( M 2, d 2) be metric spaces. The function f: M 1 --* M 2 is a c o n t r a c t i o n if there exists c ~ [0, 1) such that, d 2 ( f ( x ) , f ( y ) ) < cdl(x, y). The real c is called a c o n t r a c t i v i t y f a c t o r o f f . Proposition 88. (Banach's theorem) L e t ( M , d ) be a complete metric space. A n y contraction f: M ~ M has a unique fixed point. P r o o f . A d m i t t e d result.

[]

10. R e f e r e n c e s [1] P. America and J.J.M.M. Rutten, Solving reflexive domain equations in a category of complete metric spaces, J. Comput. Syst. Sci. 39(3) (1989) 343-375. [2] S. Andersson, Linda primitives in Sicstus Prolog, Personal communication, 1991. [3] N.J. Aparico, J. Cunha, L. Monteiro and L.M. Pereira, Delta-Prolog: A distributed backtracking extension with events, In E. Shapiro, ed., Proc. 3rd Int. Conf. on Logic Programming, vol. 225 of Lecture Notes in Computer Science, London, UK, 1986 (Springer, Berlin) 225-260 [4] K. de Bosschere and J.-H. Jacquet, Multi-Prolog: Definition, operational semantics and implementation, in: D.S. Warren, ed., Proc. Int. Conf. on Logic Programming (MIT Press, Cambridge, MA, 1993) 299-313. [5] K. De Bosschere and P. Tarau, Some issues in the implementation of a Unix-based blackboard, in: K. De Bosschere, J.-M. Jacquet and P. Tarau, eds., Proc. ICLP'93 Postconference Workshop on Blackboard-Based Logic Programming, Budapest, Hungary (1993) 91-104. [6] A. Brogi and P. Ciancarini, The concurrent language shared Prolog, ACM Trans. Programming Languages and Syst., 13(1) (Jan. 1991) 99-123. [7] W.F. Clocksin and C.S. Mellish, Programming in Prolog (Springer, Berlin, 1981). [8] J.W. de Bakker and J.I. Zucker, Processes and the denotational semantics of concurrency, Information and Control 54 (1982) 70-120. [9] P. Degano and U. Montanari, Concurrent histories: A basis for observing distributed systems, J. Comput. Syst. Sci. 34(3) (June 1987) 422-461. [10] R. Engelking, General Topology (Heldermann Verlag, 1989). [11] I. Foster and S. Taylor, Strand: New Concepts in Parallel Programming (Prentice-Hall, Englewood Cliffs, N J, 1989). [12] D. Gelernter, Generative communication in Linda, ACM Trans. on Programming Languages and Systems 7(1) (Jan. 1989) 80-112. [13] S. Gregory, Design, application and implementation of a parallel logic programming language, PhD thesis, Department of Computing, Imperial College, London, UK, 1985. [14] J. Levy, Shared memory execution of committed-choice languages, in: E. Shapiro, ed., Proc. 3rd Int. Conf. on Logic Programming, vol. 225 of Lecture Notes in Computer Science, London, UK, 1986 (Springer-Verlag) 298-312. [15] Y.-J. Lin and V. Kumar, And-parallel execution of logic programs on a shared memory multiprocessor: A summary of results, in: R.A. Kowalski and K.A. Bowen, eds., Proc. 5th Int. Conf. and Syrup. on Logic Programming, Seattle, USA (1988) (MIT Press, Cambridge, MA) 1123-1141. [16] J.W. Lloyd, Foundations of Logic Programming (Springer-Verlag, second ed., 1987). [17] L. Monteiro, Distributed logic, a theory of distributed programming in logic, Research report, Departamento de Informa{tica, Universidade de Lisboa, 2885 Monte da Caparica, Lisbon, Portugal, 1986. [18] G. Plotkin, A structured approach to operational semantics, Technical Report DAIMI FN-19, Computer Science Department, Aarhus University, 1981. [19] D. Ripps, An Implementation Guide to Real-Time Programming (Prentice-Hall, Englewood Cliffs, NJ, 1989). [20] V.A. Saraswat, Concurrent Constraint Programming Languages (MIT Press, Cambridge, MA, 1993).

J.-M. Jacquet, K. De Bosschere / Future Generation Computer Systems 10 (1994) 93-135

135

[21] D.G. Schwartz, Cooperating heterogeneous systems: a blackboard-based meta approach, PhD thesis, Department of Computer Science, James Cook University of North Queensland, USA, 1992. [22] E.Y. Shapiro, A subset of concurrent Prolog and its interpreter, Technical Report TR-003, Institute for New Generation Computer Technology (ICOT), Tokyo, 1983. [23] K. Ueda, Guarded Horn clauses, PhD thesis, Faculty of Engineering, University of Tokyo, Tokyo, Japan, 1986.

K~en De Bosschere is lecturer in the Department of Electronics and Information Systems (ELLS) of the University of Ghent, Belgium, and senior research assistant with the Belgian National Fund for Scientific Research. He got his engineering degree, MS in computer science, and Ph.D. from the same university. His primary research interests are logic programming, systems programming, and computer architecture. He is member of the Koninklijk Vlaamse Ingenieursvereniging (KVIV).

Jean-Marit~ Jacquct received the B.S. degree in Mathematics from the University of Liege, Belgium, in 1982, and the M.S. and Ph.D. degrees in Computer Science from the University of Namur, Belgium, in 1984 and 1989, respectively. He is currently Senior Research Assistant of the Belgian National Fund for Scientific Research. In 1989-1992, he has been a researcher at the Center for Mathematics and Computer Science (CWI), Amsterdam, The Netherlands, involved in the ESPRIT BRA project Integration. His primary research interests include logic programming, programming methodologies, semantics, abstract interpretation, and theory of concurrency.