Academia.eduAcademia.edu

Dealing with Multiple Granularity of Time in Temporal Logic Programming

1996, Journal of Symbolic Computation

Chronolog(MC) is an extension of logic programming based on a linear-time temporal logic with multiple granularity of time calledTLC. A Chronolog(MC) program consists of a clock definition, a clock assignment and a program body. Each predicate symbol appearing in the program body is associated with a local clock through the clock definition and assignment. This paper investigates the logical basis of the language, presents a clocked temporal resolution where time-matching is essential, and in particular proposes three algorithms for time-matching. The paper also discusses the declarative semantics of Chronolog(MC) programs in terms of clocked temporal Herbrand models. It is shown that Chronolog(MC) programs also satisfy the minimum model semantics. The language can be used to model a wide range of simulation systems and other relevant tasks where the notion of dynamic change is central.

See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/220161758 Dealing with Multiple Granularity of Time in Temporal Logic Programming. Article · January 1996 Source: DBLP CITATIONS READS 17 20 2 authors: Chuchang Liu 40 PUBLICATIONS 218 CITATIONS SEE PROFILE Mehmet Ali Orgun Macquarie University 277 PUBLICATIONS 1,948 CITATIONS SEE PROFILE Some of the authors of this publication are also working on these related projects: Information Security Mechanisms for Real Wireless Mesh Network Scenario (E-healthcare) View project All content following this page was uploaded by Chuchang Liu on 01 July 2015. The user has requested enhancement of the downloaded file. All in-text references underlined in blue are linked to publications on ResearchGate, letting you access and read them immediately. Dealing with Multiple Granularity of Time in Temporal Logic Programming CHUCHANG LIU AND MEHMET A. ORGUN Department of Computing, Macquarie University, NSW 2109, Australia Tel: +61 2 850-9514 (dept), Fax: +61 2 850-9551 E-mail: fcliu,mehmetg@krakatoa.mpce.mq.edu.au Abstract Chronolog(MC) is an extension of logic programming based on a clocked temporal logic (CT L), a linear-time temporal logic with multiple granularity of time. A Chronolog(MC) program consists of a clock de nition, a clock assignment and a program body, and each predicate symbol appearing in the program body is associated with a local clock through the clock de nition and assignment. This paper investigates the logical basis of the language, presents a clocked temporal resolution where time-matching is essential, and in particular proposes three algorithms for time-matching. The paper also discusses the declarative semantics for Chronolog(MC) programs in terms of clocked temporal Herbrand models. It is shown that Chronolog(MC) programs also satisfy the minimum model semantics. The language can be used to model a wide range of simulation systems and other relevant tasks where the notion of dynamic change is central. 1 Introduction An important activity in computer science is the invention, analysis and application of formal logics which are designed to specify, reason about and represent algorithms, programs and systems. Recently, there is a substantial interest in temporal logic which has been widely used as a formalism for program speci cation and veri cation (Manna and Pnueli, 1981), reasoning about time (Sadri, 1987) and modeling temporal databases (Chomicki, 1994; Gabbay and McBrien 1991; Gagne and Plaice, 1995). Some researchers have recently suggested that temporal logic can be directly used as programming languages. For instance, Tokio (Aoyagi et al, 1986) is a logic language based on interval temporal logic; Templog (Abadi and Manna, 1989; Baudinet, 1992) and Chronolog (Wadge, 1988; Orgun and Wadge, 1992) are based on linear-time temporal logics; Temporal Prolog (Gabbay, 1987,1991) is based on linear and branching time temporal logics; and Metatem (Fisher and Owens, 1992; Fisher, 1994; Fisher and Reynolds, 1995) is a framework for the direct execution of temporal logics within which programs are represented as sets of temporal rules of a particular form. There are also a number of other temporal logic programming languages (Brzoska,1993; Tang,1989; Hrycej, 1993; Fruhwirth, 1993). For more information, we refer the reader to the surveys of Fisher and Owens (1993), and Orgun and Ma (1994). 1.1 Motivation { Why Extend Chronolog? Chronolog is suitable for specifying time-dependent properties of certain problems in a natural way (Orgun and Wadge, 1992; Liu and Orgun, 1995). It is based on a linear-time 1 temporal logic (Goldblatt, 1987) in which the collection of moments in time is modeled by the set of natural numbers with its usual ordering relation <. The temporal logic has two temporal operators, first and next. The intuitive meanings of these operators are as follows: - A: A is true at the initial moment in time, A: A is true at the next moment in time. first next In Chronolog, all predicates are actually considered to be de ned on the global clock, i.e. the sequence of natural numbers < 0; 1; 2; ::: >. However, in some applications one may nd that it is necessary to consider \local times". For instance, in analysis of distributed computations, complications arise when it is time to decide how a process is to perform its function and when it does an action. The processes involved in such a computation have their own local time. A process only \sees" local events, such as sending a message to and receiving a message from other processes through its bu ers (in the case of asynchronous communication). That is, one process is not always de ned at all the moments in time on the global clock. To describe such systems, it is better to introduce multiple granularity of time or provide local clocks for modeling the behavior of processes. Granularity of time is also an issue in temporal databases (Wiederhold et al, 1991). In some applications, the granularity is days, in others it can be seconds or years, or a combination of multiple granularity. Granularity of time is also important in ecological modeling (Mota et al, 1995), where we may need to consider how a number of actions performed at di erent levels of time interact with each other. We propose an extension of Chronolog, called Chronolog(MC), by introducing multiple clocks, that is, multiple or granularity of time (Liu, 1995; Liu and Orgun, 1995). In particular, Chronolog(MC) is based on a clocked temporal logic (CTL) in which there is a local clock associated with each predicate symbol. In CTL, each formula is also clocked, determined by the clocks of predicate symbols which appear in the formula. In Chronolog(MC), the programmer is free to choose the granularity of each predicate symbol through clock de nitions and assignments. The clocked extension has brought an essential change on the meanings of the temporal operators first and next. In the extension, the temporal operators next and first keep their intuitive meanings \the initial moment in time" and \the next moment in time" respectively, but these meanings depend on the actual clocks given. 1.2 Chronolog(MC) Programming A Chronolog(MC) program consists of three parts { a clock de nition, a clock assignment and a program body { and these parts can be viewed as independent Chronolog programs. In a Chronolog(MC) program, di erent predicate symbols may be de ned on di erent local clocks. Some program clauses are involved only in local clocks di erent from the global clock, and therefore we do not need to consult the global clock for answering some queries, so that some unnecessary computations are avoided. For instance, suppose that a process, say p, runs at even moments in time. In a multipletask problem, it needs n time units to perform a task, and 1 time unit to receive data from its input bu er before starting each task, and 1 time unit to send the result to its output bu er after it performs a task. To describe the process, we may de ne the following predicates: process-p(X): p executes X. send-bufout-p(X): A message X is sent to the output bu er. 2 receive-bufin-p(X): bufin-p(L): bufout-p(L): A message X is received from the input bu er. The content of the input bu er is L. The content of the output bu er is L. Suppose that bufin-p and bufout-p are de ned on the global clock 0 1 2 and send-bufout-p, receive-bufin-p and process-p are de ned on the local clock 024 . We may have the following program clauses (in an informal notation): < < ; ; ; ; ; ::: > ; ::: > next process-p([X,M]) <- process-p([X,I]), I > 0, M = I-1. next send-bufout-p(Y) <- process-p([X,I]), I = 0, the result for task X. next bufout-p(L*Y) <- bufout-p(L), send-bufout-p(Y). where [X,I] indicates that, for performing task X, I time units are needed, and L*e denotes the list formed by appending the data item e to list L. The rst clause says that at the next moment in time (based on the local clock 024 ) the process will do [X,I-1] if it is currently executing [X,I] and I 0. The second clause says that, if is currently executing [X,0] and a result Y for task X is therefore produced, then Y is sent to the output bu er at the next moment in time. The third clause says that at the next moment in time the value of the output bu er is L*Y if at the current moment in time the value of the bu er is L and Y is sent to it. Suppose that we are given an initial condition: < ; ; ; ::: > p > p first process-p([a,3]). Let us consider the query <- first next process-p([a,2]). It asks the question: Does the process do [a,2] at the next moment in time (on the local clock, not on the global clock), i.e. time 2, after the initial moment in time when the process does [a,3]? We can obtain the answer (Yes) to the query without consulting the global clock. Because of the introduction of multiple local clocks, Chronolog(MC) programming can deal with such systems where the notion of dynamic change is central, and can be applied to the speci cation of a wide range of simulation systems and other relevant tasks (Liu and Orgun, 1995). For instance, we can model a distributed computation with local clocks de ned for all the processes involved in it, so that we can make analysis using scheduling theory to determine its timing properties in relation to its use of computational resources through building a simulation system. p 1.3 Structure of the Paper In this paper, we study the logical basis of Chronolog(MC). We also propose a clocked temporal resolution as a refutation procedure for the execution of Chronolog(MC) programs. Orgun and Wadge (1993) have shown that Chronolog admits a sound and complete proof procedure, called TiSLD-resolution, and established the equivalence of the declarative and operational semantics of Chronolog programs. This paper discusses the operational semantics of Chronolog(MC) programs in terms of the new temporal resolution, and presents the declarative semantics for such programs in terms of temporal Herbrand models by extending their results. 3 In section 2, we rst discuss Clocked Temporal Logic (CTL), and present its axioms and inference rules. In section 3, we discuss the structure of Chronolog(MC) programs and give a simple example. Section 4 discusses the execution of Chronolog(MC) programs based on a clocked TiSLD-resolution. In section 5, we show that Chronolog(MC) programs satisfy the minimum model semantics based on clocked Herbrand models. Section 6 concludes the paper with a brief summary and future work. 2 Clocked Temporal Logic (CTL) In this section, we introduce the clocked temporal logic CTL, which is an extension of the underlying logic TL of the original Chronolog. 2.1 Formulas Any formula of classical rst-order logic is also a formula of CTL. In addition to the formation rules of the rst-order logic, we have a new formation rule to produce new formulas: any CTL formula A may be pre xed by a temporal operator to form a new formula of the form first A or next A. A formula of CTL is also called a temporal formula. Particularly, if A is an atomic formula of rst-order logic, then we say that A is a temporal atomic formula, or simply, an atom of CTL; and if A is an atom of CTL, so are first A and next A. We also say that an atom is pure if it does not contain any temporal operators. 2.2 Clocks In CTL, the set ! of natural numbers models the collection of moments in time, and clocks are sequences over !. Formally, we de ne that the global clock is the increasing sequence of all natural numbers: < 0; 1; 2; ::: >, and a local clock is a subsequence of the global clock. In other words, a local clock is a strictly increasing sequence of natural numbers, either in nite or nite: < t0 ; t1 ; t2 ; : : : >. In particular, the empty sequence <> which does not contain any moments in time is also a local clock, called the empty clock. By de nition, the global clock is also a local clock. Let CK denote the set of all local clocks. We now de ne an ordering relation on the elements of CK as follows: for any ck1 ; ck2 2 CK, ck1 v ck2 i for all t 2 ck1 , we have t 2 ck2 , where the expression t 2 ck denotes the fact that t is a moment in time on the clock ck . It is easy to show that (CK; v) is a complete lattice. Thus, we can de ne i i ck1 u ck2 def = g:l:b:fck1 ; ck2 g ck1 t ck2 def = l:u:b:fck1 ; ck2 g where ck1 ; ck2 2 CK, g:l:b: stands for \greatest lower bound" and l:u:b: for \least upper bound" under the relation v. The de nitions can be extended to any given set of clocks. We now give the de nition of a clock assignment, which assigns local clocks for all predicate symbols. De nition 1 A clock assignment ck of CTL is a map from the set SP of predicate symbols to the set CK of clocks, i.e. ck 2 [SP ! CK]. The notation ck(p ) denotes the clock which is associated with a predicate symbol p on a given clock assignment ck. We now extend the notion of a clock to formulas. 4 De nition 2 Let A and B be formulas, p(x1; x2 ; : : : ; x ) an atomic formula, and ck a clock assignment. We de ne a clock assignment ck on formulas of CTL as follows: n ck (:A) = ck (A) ck (A _ B ) = ck (A) u ck (B ) ck (nextA) = ck (A) ck ((9x)A) = ck (A) ck(p(x ; x ; : : : ; x )) = ck(p) ck(A ^ B ) = ck (A) u ck (B ) ck(firstA) = ck (A) ck((8x)A) = ck (A) 1 2 n We now establish the result that every formula of CTL can be clocked. The proof of the lemma is straightforward by induction on the structure of formulas. Lemma 1 Let A be a formula of CTL, SPA the set of predicate symbols occurring in A, and ck a clock assignment. Then ck (A) = u 2SPA ck(p) (i.e., every formula of CTL can be clocked). p Since ck (A) is completely determined by the given clock assignment ck, we refer to the clock of A under ck simply as ck(A). In notation, ck(A) = u 2SPA ck(p). In the following, we always use ck to represent a clock assignment and simply call it a clock, and we also use the notation ck(A); ck(B ); :::; ck0 ; ck1 ; ::: to represent local clocks. Particularly, we denote the global clock as gck. p De nition 3 (rank) Given a local clock ck =< t ; t ; t ; ::: >. We de ne the rank of t 0 i 1 2 n on ck to be n, written as rank(ck ; t ) = n. Inversely, we write t = ck , which means that t is the moment in time on ck whose rank is n. i i n (n) n n i i Obviously, for the global clock, we have that rank(gck; t) = t and gck( ) = t. t 2.3 Temporal Interpretations, Semantics In CTL, at a given time t 2 !, the value of a formula can be true, false or unde ned, depending on the clocks of predicate symbols appearing in it. The meaning of a predicate symbol p is actually a partial mapping from ! to P (D ) where n is the arity of p, D is the domain of discourse, D is the n-folded Cartesian product of D, and P (D ) is the power set of D . For any t 2 ck(p), the mapping is naturally de ned, i.e., there will be a corresponding subset of D ; otherwise the image is unde ned. A temporal interpretation together with a clock assignment assigns meanings to all the basic elements of CTL. n n n n n De nition 4 A temporal interpretation I on a given clock ck of CTL comprises a nonempty set D, called the domain of the interpretation, over which the variables range, together with for each variable, an element of D; for each n-ary function symbol, an element of [D ! D]; and for each n-ary predicate symbol p, an element of [ck(p) ! P (D )]. n n Now we give the de nition of the satisfaction relation j=. In the following, j= denotes the fact that a formula A is true at moment t(2 ck(A)) under I on ck. I ;ck;t A De nition 5 Let I be a temporal interpretation on a given clock ck of CTL, and A and B formulas of CTL. The semantics of elements of CTL are given inductively by the following: (1) If f (e ; :::; e ? ) is a term, then I (f (e ; :::; e ? )) = I (f )(I (e ); :::; I (e ? ))(2 D) 0 n 1 0 n 5 1 0 n 1 (2) For any n-ary predicate symbol p and terms e ; :::; en? and any t 2 ck(p), j=I;ck;t p(e ; :::; en? ) i < I (e ); :::; I (en? ) >2 I (p)(t). (3) For any t 2 ck(A), j=I;ck;t :A i it not the case that j=I;ck;t A. (4) For any t 2 ck(A ^ B ), j=I;ck;t (A ^ B ) i j=I;ck;t A and j=I;ck;t B . (5) For any t 2 ck(A), j=I;ck;t (8x)A i j=I d=x ;ck;t A for all d 2 D where the interpretation 0 0 1 0 1 1 [ ] I [d=x] is just like I except that the varible x is assigned the value d in I [d=x]. (6) For any t 2 ck(A), j=I;ck;t firstA i j=I;ck;ck A A. (7) For any t 2 ck(A), j=I;ck;t nextA i j=I;ck;ck A A, where i = rank(ck(A); t). ( )(0) ( )(i+1) Let j=I;ck A denote the fact that A is true under I on ck, in other words, j=I;ck A if and only if j=I;ck;t A for all t 2 ck(A). Let j=ck A denote the fact that A is true in any temporal interpretation on ck and j= A denote the fact that A is true in any temporal interpretation on any clock. If j=I;ck A, then we say that the temporal interpretation I on ck is a model on ck of the formula A. 2.4 Axioms and Inference Rules Let A be a formula of CTL and ck a clock. We write `A: `ck A: `ck;t A: A is a theorem of CTL A is a theorem on ck of CTL A is a theorem at moment t(2 ck(A)) on ck of CTL The following axioms (theroems) related to the temporal operators state some of important properties of the extended language. Let A and B be formulas of the language. Read $ as \if and only if". Axioms A1. ` first first A $ first A. A2. ` first (:A) $ :(first A). A3. ` next (:A) $ :(next A). A4. ` first (8x)(A) $ (8x)(first A). A5. ` next (8x)(A) $ (8x)(next A). A6. `ck first (A ^ B ) $ (first A)^(first B ), where ck(A) = ck(B ) . A7. `ck next (A ^ B ) $ (next A)^(next B ), where ck(A) = ck(B ). Inference rules (0) (0) In addition to substitution and Modus Ponens(MP), we have the following rules: R1. If `ck A, then `ck R2. If `ck A, then `ck A, when ck(A) is a non-empty. A, when ck(A) is in nite. first next 6 R3. If `ck B ! A, `ck;t B and t 2 ck(B ! A), then `ck;t A. R1 and R2 are called the temporal operator introduction rules, and R2 holds only when there is always a next moment in time on the clock ck(A). Using R3, we are allowed to consider the case when ck(A) 6= ck(B ). In this paper, we do not attempt to discuss the completeness of the axiomatic system for CTL. However, the correctness (soundness) of the axioms and the rules is straightforward. Lemma 2 The axioms A1{A7 and the rules R1{R3 are valid with respect to the semantics scheme for CTL. 2.5 Clocked Atoms We say that an atom is xed-time if it has an application of first followed by a number of applications of next. Any xed-time atom is xed to some moment in time on the local clock associated with the formula which the atom is currently involved in. For example, suppose that p(x) appears in formula A and ck(A) =< 2; 5; 8; ::: >. Then, for ck(A), first p(x) is xed to moment 2, first next p(x) is xed to moment 5 and so on. Since di erent formulas may have di erent local clocks, the same predicate appearing in di erent formulas may have di erent xed forms even when it is xed to the same moment in time in the di erent formulas. Therefore we need the following de nition. De nition 6 Let Q be a pure atom, cki a local clock, t rank(cki ; t). Then first 2 cki, cki v ck(Q), and n = next(n)Q is a xed-time atom on cki , xed to the moment t in time. Furthermore we call first next(n)Qjtck a clocked xed-time atom on cki and t the current time of the clocked xed-time atom. i Lemma 3 Let Q be a pure atom appearing in a formula A and t 2 ck(A). Then first next(n)Q is true on ck(A) i first next(m)Q is true on ck(Q) where n = rank(ck(A); t) and m = rank(ck(Q); t). Proof: We rst show the following assertion by induction on n. For any given n, first next(n)Q is true on ck(A) i Q is true at time ck(A)(n) . For n = 0, according to the satisfaction relation given by de nition 2.5 and the fact that Q is a subformula of A, we have that first Q is true on ck(A) i Q is true at time ck(A)(0) , and the assertion is obviously true. Assume the assertion is true for n = k. By the inductive hypothesis, first next(k) next Q is true on ck (A) i next Q is true at time ck (A)(k) . Moreover, by de nition 2.5, next Q is true at time ck (A)(k) i Q is true at time ck (A)(k+1) . Therefore we have that first next(k ) next Q, i.e. first next(k + 1) Q is true on ck (A) i Q is true at time ck(A)(k+1) , which proves the assertion. Similarly, for any given m, we can also show that first next(m)Q is true on ck(Q) i Q is true at time ck(Q)(m) . By de nition 2.2 and from the assumption that t 2 ck(A) and Q is a pure atom in A, we have t 2 ck(Q). Let n = rank(ck(A); t) and m = rank(ck(Q); t), then we have 7 ck(A)(n) = t = ck(Q)(m) . Therefore, n)Q is true on ck(A) i first next( m)Q is true on ck(Q). first next( The lemma can simply be reformulated as: n)Qjtck(A) is true i first next( m)Qjtck(Q) is true. first next( It actually forms the basis of the clocked TiSLD-resolution (see section 4). 3 Program Structure in Chronolog(MC) A Chronolog(MC) program consists of three components: a clock de nition, a clock assignment and the program body. Formally, we write P = P c 1 Pa 1 P b , where P is a Chronolog(MC) program, Pc , Pa and Pb are the clock de nition, the clock assignment and the program body of the program, respectively. The symbol 1 means \jointing", that is, Pc , Pa and Pb jointly form the program P . Pc and Pa can be viewed as two independent programs. The clock ck of the Chronolog(MC) program P is totally determined by Pc and Pa . Pc is an ordinary Chronolog program which speci es all the local clocks involved in the program body. Program clauses in Pc are of the form A<-B0 ; : : : ; Bn?1 where A and all Bi 's are (temporal) atomic formulas. Informally, any given local clock cki can be represented as a meta-Chronolog program, which speci es the predicate cki that is true at the moments in time appearing on the clock cki , as follows: first cki(cki(0) ). next cki(S) <- cki(T), K=rank(cki,T), S is cki(K+1) . Since Pc is an ordinary Chronolog program, the de nition of each cki may or may not \represent" an actual clock. We stipulate that each cki satisfy the following clock constraints: De nition 7 (clock constraints) - For any successful query first next(m) cki(X), - For any pair of successful queries we have that X = < m n, then X < Y. m X . first next(m) cki(X) and first next(m) cki(Y), Y. - For any pair of successful queries if we have that first next(m) cki(X) and first next(n) cki(Y), The intuitive meaning of these constraints are as follows. The rst one says that the rank of a moment on a clock is not greater than the moment. The second one says that clocks are single-valued at each moment. When the second constraint is relaxed, we have branching time. The third one says that clocks can only tick forwards, that is, cki de ned by the representation is monotonic. In short, the last two constraints ensure that clocks are linear. The main motivation for the rst constraint is computational (see section 4). 8 Now the problem is that we have, in general, no way of checking whether clock constraints are satis ed by each clock de nition or not. We can include some axioms in Pc formalizing the clock constraints, but then the semantics of clock de nitions will be complicated. In this paper we impose a syntactic restriction on clock de nitions. Program clauses which are allowed to appear in clock de nitions for any given local clock cki can be only of the following form: first cki(n). next cki(N) <- cki(M), N is E(M), N > M. where n2 ! is the initial value of the clock, and E(X) is a single-valued function from ! to !. The second clause speci es the \next" value of the clock using its current value. The declarative semantics of clock de nitions are given in section 5. Pa is a typical Prolog program, which assigns local clocks for all the predicate symbols in the program body. It consists of several facts written in a simpli ed form such as is-ck(p,cki). The clause says that cki is the local clock associated with the predicate symbol p, where cki is de ned in Pc and p appears in Pb . Note that there is only one clock assignment for any given predicate symbol. In short, Pa is the glue that binds a clock de nition and a program body. The program body Pb consists of rules and facts. It looks like an ordinary Chronolog program, but the meanings of all the program clauses appearing in Pb depend on a given clock, i.e. the clock de nition Pc and clock assignment Pa . Two programs with di erent clock de nitions or di erent clock assignments will give di erent results even when they have the same program body. 3.1 An Example Program The following is a simple Chronolog(MC) program, which we call the Cat-and-Mouse (CAM) system. Suppose that there is a room where it is quiet only at odd moments in time when nobody occupies it, and the room is occupied at even moments in time by a cat and a mouse in turns. Also, there is an alarm set in the room. It makes a long sound and a short sound alternately, and the interval between two sounds is 3 time units. The rst sound made by the alarm at the initial time 1 is short. We de ne three predicates: occupies(X): X occupies the room. quiet: it is quiet in the room. alarm(X): X represents either long or short. In the following program, the rst part de nes three local clocks, i.e. ck1 ; ck2 ; ck3 ; the second part assigns clocks for three predicate symbols in the third part (the program body). Note that the global clock is not included in the clock de nition and we do not have a clause in the clock assignment which indicates the fact that a predicate has the global clock as its local clock; it is accessible using the symbol gck. 9 % CLOCK DEFINITION (ck1, first ck1(0). next ck1(N) <- ck1(M), N first ck2(1). next ck2(N) <- ck2(M), N first ck3(1). next ck3(N) <- ck3(M), N ck2, ck3) % is M+2. is M+2. is M+3. % CLOCK ASSIGNMENT (ck) % is-ck(occupies,ck1). is-ck(quiet,ck2). is-ck(alarm,ck3). % PROGRAM BODY % first occupies(mouse). next occupies(cat) <- occupies(mouse). next occupies(mouse) <- occupies(cat). first quiet. next quiet <- quiet. first alarm(short). next alarm(long) <- alarm(short). next alarm(short) <- alarm(long). Note that ck1, ck2, and ck3 all satisfy the syntactic restriction on clock de nitions stated above. We omit the the condition N > M from clock de nitions, because it is satis ed trivially. Given the above program, suppose that we want to nd who occupies the room at the next (even) moment in time after the initial moment 0. The query can be represented as the xed-time goal: <- first next occupies(X). The answer to the goal is X = cat at time 2. Goals can be xed-time as above or open. If all atoms of a goal are xed-time, then the goal is a xed-time goal; otherwise it is an open goal. An open goal stands for a series of independent xed-time goals. For example, the open goal <- occupies(X) stands for a series of independent xed-time goals of form <- first next(n) occupies(X). In principle, any number of xed-time goals can be executed in parallel. We call this form of parallelism \context parallelism". It is exploited in the parallel execution model for Chronolog (Liu, Orgun and Zhang, 1995). Chronolog(MC) programs keep all forms of parallelism of original Chronolog programs. Furthermore, because of introducing multiple clocks, reasoning about time can also be performed in parallel. 4 Clocked TiSLD-Resolution TiSLD-resolution (Orgun and Wadge, 1993) is a proof procedure for Chronolog, which is applied to a set of canonical ( xed-time) program clauses and goal clauses. The correctness of TiSLD-resolution is based on the idea that the value of a given formula can be expressed in terms of the values of its canonical instances. In this section, we propose a clocked TiSLD-resolution for the execution of Chronolog(MC) programs as an extension of TiSLDresolution. 10 4.1 Temporal-Uni cation We need the notion of a canonical instance of a formula A. A canonical instance of A is a formula whose value is an invariant of time, that is, a formula which is xed to a particular moment in time with respect to a given clock ck. De nition 8 Let A be a formula, and ck a clock. For any moment t 2ck(A), the canonical instance of A xed to that moment is first next(rank (ck (A); t)) A. Canonical instances of a formula can be obtained by the rules of inference. The value of a given formula in a temporal interpretation can be expressed in terms of its canonical instances. The intuitive idea is that, for any given moment in time on the local clock ck(A), we can nd a canonical instance of the formula xed to that moment in time and then combine the values of the canonical instances. Lemma 4 Let A be a formula, I a temporal interpretation, and ck a clock of CTL. Then j= I ;ck A if and only if j= I ;ck A for all canonical instances A of A on ck(A). t t Proof: j= A i j= A for all t 2 ck(A), by de nition 2.5, i j= first next(rank (ck (A); t))A, for all t 2 ck (A), i j= first next(rank(ck(A); t))A, for all t 2 ck(A), because the value of the initial truths first next(rank(A); t))A are invariants of the moments on ck(A), i j= A for all canonical instances A of A, for all t 2 ck(A). I ;ck I ;ck;t I ;ck;t I ;ck I ;ck t t By lemma 2.3, if two clocked xed-time atoms have the same pure atom and the same current time, then they have the same truth value. Therefore, we can have the following de nition. De nition 9 Let Aj 1 and B j 2 be two clocked xed-time temporal atoms. If t = s and t ck s ck the pure atoms contained in A and B can be uni ed, then we say that Aj 1 and B j 2 can be uni ed, and the substitution , which uni es the pure atoms, is a substitution unifying Aj 1 and B j 2. t ck t ck s ck s ck Note that there may be a di erence between the numbers of applications of next's in Aj 1 and B j 2. But, we are still allowed to write that Aj 1 = B j 2 to express the fact that they are uni ed. For example, suppose that we have ck1 = f0; 1; 2; 3; :::g and ck2 = f0; 2; 4; :::g, then the temporal atoms first next next p(30)j2 1 and first next p(X)j2 2 can be uni ed by the substitution fX=30g. The result of the substitution can be either first next next p(30)j2 1 or first next p(30)j2 2. The user can choose one of them as the result in a proof procedure. Thus, in Chronolog(MC), the concept of temporal-uni cation has been extended, so that we are allowed to make uni cation on di erent local clocks. t ck s ck t ck s ck ck ck ck ck 4.2 Algorithms for Time-Matching In Chronolog(MC), temporal-matching involves the matching of a selected clocked temporal atom from the current goal and the variant of a program clause. The matching includes two aspects: (1) matching the pure atoms, (2) matching the current time. The matching of pure atoms is trivial; while time-matching is involved in the execution of clock de nitions and clock assignments. Therefore, in executing a Chronolog(MC) program, 11 time-matching, or reasoning about time in the refutation procedure is essential. Suppose that we are given a Chronolog(MC) program P = Pc 1 Pa 1 Pb . The following three algorithms are used for time-matching. Algorithm A is used to nd all local clocks (di erent from the global clock) associated with the predicate symbols appearing in any given clause in Pc . Let SP denote a set of predicate symbols and SC a set of local clocks. Algorithm A ( nd local clocks for a given clause A0 <(1) Initialization. Set SP = fg, SC = fg and i = 0. A1 , ..., An ) (2) Get the predicate symbol p from Ai . (3) If p 2 SP , go to step 5. (4) Given the query <- is-ck(p, X). Execute the clock assignment Pa using a standard Prolog implementation to obtain the answer. If the execution is successful and the answer is X = ckj, set SC = SC [ fckjg. (5) Set i = i + 1. If i  n, go to step 2. (6) Output SC , then stop. A given clock assigns a unique local clock for each predicate symbol appearing in the program body. For any predicate symbol p, if there is a clause in the form of is-ck(p,X) in the clock assignment of the program, then X is its local clock, otherwise it is assumed that its local clock is the global clock gck. Suppose that p1 ; p2 :::; pr are all the predicate symbols appearing in a given clause C , which have a local clock di erent from the global clock, and ck(p1 ) = ck1; ck(p2 ) = ck2; :::; ck(pr ) = ckr, then the following clauses: is-ck(p1,ck1), is-ck(p2,ck2), ..., is-ck(pr ,ckr) should be included in the clock assignment of the program. Therefore, by running Algorithm A, we may obtain SC =fck1,ck2,...,ckrg. If SC is the empty set, then all predicate symbols have the global clock gck as their clock. Thus, by de nition 2.2, we have ck(C ) = ck1 u ck2 u ... u ckr ugck. The global clock gck is there because there may be other predicate symbols in C running on it. In addition, by lemma 1, we can show that, for any t 2 !, t 2 ck(C ) if and only if t 2 cki for all cki2 SC . In other words, ck (C ) is totally determined by the set of local clocks in SC . Given any t 2 !, Algorithm B is used to determine whether t 2 cki for any given local clock cki which has been de ned in the clock de nition of a program . Algorithm B (Check whether t 2cki ) (1) Set k = t. (2) Given the query <- first next(k) cki(t). Execute the clock de nition using a standard Chronolog implementation to obtain the answer. If the execution is successful, i.e. the answer is \Yes", go to step 5. (3) Set k = k ? 1. If k  0, go to step 2. (4) Output \the fact that t 2cki is not true." Then stop. (5) Output \t 2cki." Then stop. 12 The constraints on clock de nitions proposed in section 3 together with the correctness of the Chronolog implementation (Orgun and Wadge, 1993) guarantee the correctness of algorithm B. If t 2cki, then algorithm B terminates and gives the fact that t 2cki; if t does not belong to cki, then algorithm B terminates and gives the fact that t 2cki is not true. In fact, the rst constraint ensures that the search space for the given query is nite, and therefore the algorithm terminates. Algorithm C is used to nd the rank of a time-value on the local clock ck(C ) for any given clause C of the program body of a program. Algorithm C (Given SC = fck1,ck2,...,ckrg by algorithm A and t 2 ck(C ), nd rank(ck(C ); t)) (1) Let RANK = t and i = RANK ? 1 (2) If i < 0, go to step 8. (3) Set j = 1 (4) Check whether i 2ckj (by algorithm B). If so, go to step 6. (5) let RANK = RANK ? 1, go to step 7. (6) Set j = j + 1. If j  r go to step 4. (7) Let i = i ? 1. Go to step 2. (8) Output rank(ck(C ); t) = RANK , then stop. Based on the correctness of algorithm B, the correctness of algorithm C can be proved by induction on t. Note that if SC is the empty set, then the algorithm terminates immediately with the result t = rank(ck(C ); t). Consider the matching of a selected clocked temporal atom, say Ajtck0 , from the current goal and the variant of a program clause, say C = H <- B1 , ..., Bn . Suppose Ajtck0 and H contain the same predicate symbol and their pure atoms have be matched. Because t 2 ck0 , to check if the current time is matched, we only need to check whether t 2 ck(C ) is true or not. To do this, we can rst nd the all local clocks (di erent from the global clock) associated with the predicate symbols appearing in C by algorithm A. Suppose we have obtained SC =fck1,ck2,...,ckrg. Then, we need to check if t 2cki for all i, 1 i  r by algorithm B. If so, then we have t 2 ck(C ). The fact that t 2 ck(C ) means that the current time can be matched. In other words, there exists a canonical instance of C , whose head can be matched with Ajtck0 . Suppose that Ajtck0 and the head H of the clause C has been matched, then we have to nd rank(ck(C ); t), and obtain the clocked form of the canonical instance of C . This task can be performed by algorithm C. 4.3 Proof Procedure We know that, to obtain the answer to an open goal, we have to obtain the answers from all xed-time subgoals of that goal, which are regarded as independent computations. By lemma 2.1, every clause (formula) in a given Chronolog(MC) program can be clocked, so can every goal. Let P be a Chronolog(MC) program and G = <-L0 ; :::; Ls a xed-time 13 goal. Since G can be clocked, by de nition 2.6, we may rewrite the goal as t t <-L0 jckL0(G) ; :::; Ls jckLs(G) : The clocked xed-time form for G is called its rewritten form. De nition 10 Given a Chronolog(MC) program P and a xed goal G = <-L0 ; :::; Ls . A clocked TiSLD-derivation of P [ fGg is a sequence of triples with the following form: E = f < G0 , C0 , 0 >, < G1 , C1 , 1 >, ...g where G0 is the rewritten form of G as above and G0 , G1 , ... are goal clauses whose atoms are all clocked xed-time; C0 , C1 , ,... the variants (renamed and clocked) of canonical instances of program clauses in P ; and 0, 1, ... the substitutions. In the refutation procedure of Chronolog(MC), when a clocked temporal atom from the goal is selected, it is matched against program clauses by the clocked temporal matching and uni cation. A new goal is produced after replacing the selected atom in the goal by the body of the matching canonical instance and then substitution (i.e. the variable bindings) obtained from uni cation is applied to the new goal. Suppose that at a step of a proof procedure, we have the TiSLD-derivation E = fE0 , E1 , ..., Ei g where Ek =< Gk ; Ck ; k >; k = 0; : : : ; i. Particularly, suppose we have Ei =< (<-A jtckA00 ; : : : ; Al jtckAll ; : : : ; As? jcktAss??11 ); (A<-B ; :::; Bm? ); i > 0 1 0 1 and at the next step, Al is the selected temporal atom in the timed-goal Gi via the computation rules, and it is shown that tAl 2 ck(Ck ) by time-matching algorithms A and B, and furthermore we have Al jtckAll i = AjtckA(l Ck ) i with mgu i, then Ei =< Gi ; Ci ; i > +1 +1 +1 +1 where +1 ; :::; A jtAs?1 ) . Gi+1 = (<-A0jtckA00 ; :::; Al?1 jcktAll??11 ; B0jtckB(0Ck ); :::; Bm?1 jcktB(mC?k1) ; Al+1 jtckAll+1 s?1 cks?1 i t Note that the clocked xed-time atoms B0 jtckB(0Ck ) ; :::; Bm?1 jckB(mC?k1) are all obtained by the time-matching algorithm C, based on the canonical instance of the formula Ck whose head is matched with Al jtckAll . Now the TiSLD-derivation we obtain is E = fE0 , E1 , ..., Ei , Ei+1 g . For any list E associated with a successful TiSLD-derivation, we have that for some n  0, Gn =<-, in which case the list E has length n with the last element < Gn? , Cn? , n? >. 1 1 1 An essential di erence between the Clocked TiSLD-resolution and the original TiSLDresolution is that at every step of a clocked TiSLD-derivation all atoms in the goal clause and the selected canonical instances (variant) of a program clause are clocked. 14 Recall the CAM system, suppose that we are given the xed-time goal G: <- first occupies(X), first alarm(Y). From the clock de nition and assignment of the program, we have ck(occupies) = ck1, ck(alarm) = ck3, ck1 = < 0; 2; 4; 6; 8; 10; ::: > and ck3 = < 1; 4; 7; 10; ::: >, so we have ck(G)=< 4; 10; ::: >. Therefore, the rewritten form of the goal G is: <- first occupies(X)j4ck(G), first alarm(Y)j4ck(G). The proof of the goal is as follows: G0 = <- first occupies(X)j4ck(G), first alarm(Y)j4ck(G). C0 = first next next occupies(mouse)j4ck1 <- first next occupies(cat)j2ck1. 0 = fX/mouseg G1 = <- first next occupies(cat)j2ck1, first alarm(Y)j4ck(G) 0 . C1 = first next occupies(cat)j2ck1 <- first occupies(mouse)j0ck1. 1 = fX/mouseg G2 = <- first occupies(mouse)j0ck1, first next alarm(y)j4ck(G) 1 . C2 = first occupies(mouse)j0ck1. 2 = fX/mouseg G3 = <- first alarm(Y)j4ck(G) 2 . C3 = first next alarm(long)j4ck3 <- first alarm(short)j1ck3. 3 = fX/mouse, Y/longg G4 = <- first alarm(short)j1ck3 3 . C4 = first alarm(short)j1ck3. 4 = fX/mouse, Y/longg When the selected temporal atom in G4 is replaced by the body of C4 , we have that G5 = <-, meaning that the refutation is successful. The answer to the goal is X = mouse, Y=long. Based on clock constraints (de nition 3.1) and the correctness of time-matching algorithms, the soundness of clocked TiSLD-resolution can be proved by induction on the length of a refutation. To show the completeness of clocked TiSLD-resolution, we need to consider the fact that a given Chronolog(MC) program (body) can be expressed as the set of all canonical instances of program clauses in the program (body). Therefore we can rst show that clocked TiSLDresolution is a complete proof procedure when restricted to canonical ground instances of program clauses, then lift a ground clocked TiSLD-refutation to a clocked TiSLD-refutation. Proofs of the analogous results from Orgun and Wadge (1993) can be adapted for the purpose. 15 5 Declarative Semantics The program body is the main component of a Chronolog(MC) program, therefore its semantics is naturally presented as the declarative semantics of the program. However, a Chronolog(MC) program depends on its clock de nition and assignment. Both the clock de nition and assignment can be viewed as procedures attached to the program body; and, as independent programs, the clock de nition and the clock assignment have their own semantics. Therefore, the semantics for the entire program depends on the semantics of the clock de nition. 5.1 The Semantics of Clock De nitions Let P = Pc 1 Pa 1 Pb be a Chronolog(MC) program. The clock assignment of the program, Pa is a set of Horn clauses, i.e. a Prolog program. The semantics results for Prolog programs can be found from a number of references, such as van Emden and Kowalski (1976) and Lloyd (1987). Pc is an ordinary Chronolog program, therefore we can directly obtain the declarative semantics of clock de nitions from the declarative semantics of Chronolog programs; Orgun and Wadge (1992, 1993) showed that the minimum temporal Hebrand model of a Chronolog program exists, and it is characterized by the intersection of all the temporal Herbrand models of the program. Pc, as other Chronolog programs, has the property that all predicates run on the global clock. The declarative semantics of Pc can be developed in terms of temporal Herbrand models as follows. Herbrand universe of Pc , denoted by UPc , is generated by constants and function symbols that appear in Pc . The Herbrand base BPc of Pc consists of all those canonical temporal atoms generated by predicate symbols appearing in Pc with terms in UPc used as arguments. Subsets of BPc are regarded as as temporal Herbrand interpretations of Pc . Let I be a temporal interpretation of Pc with UPc as its domain. Then I is identi ed with a subset H of BPc by the following: < e0 ; :::; en?1 >2 I (p)(t) i first next(t)p(e0 ; :::; en?1 ) 2 H , t 2 !. Thus, we have the following results which are implied by the analogous results for Chronolog (Orgun and Wadge, 1992, 1993). Theorem 1 Let P = Pc 1 Pa 1 Pb be a Chronolog(MC) program. Then (1) j=BPc Pc . (2) \Mc = \ 2Sc I is a temporal Herbrand model of Pc where Mc = fI g 2Sc be a non-empty set of temporal Herbrand models of Pc . (3) MMOD(Pc ) def = \ 2Sc I is the minimum temporal Herbrand model of Pc , where Mc = fI j j=I P g 2Sc be the set of all temporal Herbrand models of Pc. (4) MMOD(Pc ) = fA 2 BPc jPc j= Ag. Recall that clock de nitions have a restricted form of clauses. We need to show that all the clocks de ned in Pc satisfy the clock constraints given in section 3. Lemma 5 Let Pc be a clock de nition. For each predicate symbol cki de ned in Pc , cki satis es the clock constraints with respect to MMOD(Pc ). 16 Proof: The lemma can be proved by induction, based on the syntactic restriction for clock de nitions (see section 3). We rst show, by induction on m, that cki satis es the rst constraint: for any element first next(m) cki(X) in MMOD (Pc ), we have that m  X. For m=0, according to the restriction on the clock de nition, we have X2 !, so mX, and therefore cki satis es the constraint. Assume cki satis es the constraint when m=k. Consider the case when m=k+1. The fact that first next(k+1) cki(X) belongs to MMOD(Pc ) means that it matches a canonical instance of the second clause of the restriction with the following form: first next(k+1) cki(X) <first next(k) cki(Y), first next(k) X is E(Y), first next(k) X > Y. and first next(k) cki(Y), first next(k) X is E(Y), first next(k) X > Y are all successful queries. Hence first next(k) cki(Y) also belongs to MMOD(Pc ), and therefore, by the inductive hypothesis, we have k  Y. Thus, from the facts that first next(k) X is E(Y), and first next(k) X > Y are successful queries and E is a single-valued function from ! to !, we have that k+1Y+1X, which proves the assertion that cki satis es the rst constraint. Based on the requirement that E is a single-valued function within the restriction on clock de nitions, we can similarly show, by induction on m, that cki satis es the second clock constraint. To prove that cki satis es the third clock constraint, i.e. to prove that, for any pair first next(m) cki(X) and first next(n) cki(Y) in MMOD(Pc ), if m < n, then X < Y, we need adopt a double-induction on m and n. We omit the details of the proof because of space limitations. The lemma implies that the clock represented by each cki can be recovered as follows: < tjfirst next(k ) cki(t) 2 MMOD(Pc) >k2! : 5.2 Clocked Temporal Herbrand Models Let P = Pc 1 Pa 1 Pb be a Chronolog(MC) program. Since the predicate symbols appearing in the program body Pb have their own local clocks, the semantics for P depends on the given clock ck. We know that P is true in a temporal interpretation I on a given clock ck if and only if all program clauses in Pb are true in I on ck. By lemma 4.1, a program clause is true in I on ck if and only if all canonical instances of the clause are true in I on ck. Therefore, as far as the declarative semantics is concerned, we can regard P as the set of all canonical instances of the program clauses in Pb . In the program, the given clock ck is determined by Pc and Pa . To discuss clocked temporal Herbrand models, we have to know how to obtain ck. For a given predicate symbol p appearing in Pb , we want to know how to nd ck(p). Formally, we have: De nition 11 Let P = Pc 1 Pa 1 Pb be a Chronolog(MC) program and SP the set of all predicate symbols appearing in Pb . Then the clock ck of Pb is obtained as follows: For all p 2 SP , - 2 MMOD(Pc) >k2! if is-ck(p,cki)2 Pa ; ck(p)=< t|first next(k ) cki(t) 17 - ck(p)=< 0; 1; 2; 3; ::: >= gck if p is not assigned a local clock in Pa . Let UP denote the clocked Herbrand universe of P which is generated by constants and function symbols that appear in Pb . The clocked temporal Herbrand base BP of P consists of all those canonical temporal atoms generated by predicate symbols appearing in Pb with terms in UP used as arguments. We regard subsets of BP as clocked temporal Herbrand interpretations of P . Let I be a temporal interpretation on the clock ck of P with UP as its domain. Then I is identi ed with a subset H of BP by the following: < e ; :::; en? >2 I (p)(t) i 0 1 first next(rank (ck (p); t))p(e0 ; :::; en?1 ) 2 H , t 2 ck(p). Thus we have the result: Lemma 6 Let P = Pc 1 Pa 1 Pb be a Chronolog(MC) program, and ck the clock determined by Pc and Pa . Then j=BP ;ck Pb . Proof: For any program clause C 2 Pb , we want to show that j=BP ;ck C . In other words, we want to show, by lemma 4.1, that j=BP ;ck Ct for all canonical instances Ct of C on ck(C ). To do this, we need only to prove that any ground canonical instance of C is true under the interpretation BP on ck. Assume (A<-B0 ; :::; Bn?1 ) is a ground canonical instance of C , where A; B0 ; :::; B(n?1) are all temporal atoms. By de nition 2.2, the clock for a ground canonical instance of a given program clause is the same clock for that clause. Therefore, we can rewrite the ground tB canonical instance as (AjtckA(C ) <-B0 jtckB(C ) ; :::; Bn?1 jck(nC?) ). Consider AjtckA(C ) . Assume ( 0 AjtckA C = first ( ) next(rank (ck (C ); tA )) 1) p(e ; :::; ei? )jtckA C , 0 1 ( ) where p(e0 ; :::; ei?1 ) is a pure ground atom. Since tA 2 ck(C ), again by de nition 2.2, we have tA 2 ck(p). Also, by lemma 2.3, we have first next(rank (ck (C ); tA ))p(e0 ; :::; ei?1 )jtckA(C ) = first next(rank(ck(p); tA ))p(e0 ; :::; ei?1 )jtckA(p) . According to the de nition of BP , first next(rank(ck(p); tA ))p(e0 ; :::; e(i?1) )jtckA(p) 2 BP , i.e. its truth value is true under the interpretation BP on ck. Therefore AjtckA(C ) is true under BP on ck, so is the ground canonical instance of C . That is what we want to show. The above lemma says that the entire clocked temporal Herbrand base BP of a program P = Pc 1 Pa 1 Pb is a clocked temporal model of the program (program body). The following lemma shows that the set of clocked temporal Herbrand models of a given Chronolog(MC) program is also closed under intersection. Lemma 7 Let P = Pc 1 Pa 1 Pb be a Chronolog(MC) program, ck the clock determined by Pc and Pa , and M = fI g 2Sb a non-empty set of clocked temporal Herbrand models of Pb. Then \M = \ 2Sb I is a clocked temporal Herbrand model of Pb . Proof: Obviously, \M is a clocked Herbrand interpretation of P . We now show, by contradiction, that it is a model of Pb . 18 Suppose \M is not a model of Pb . Then there exists at least one clause of Pb , say C , which is false under the interpretation \M . That means that there exists at least a ground canonical instance of C , say (A<-B0 ; :::; Bn?1 ), which is false under \M . We therefore have that B0 and ... and Bn?1 are all true but A is false under \M . tB We rewrite the ground canonical instance as (AjtckA(C ) <-B0 jtckB(C ) ; :::; Bn?1 jck(nC?) ). As in the above lemma, we can assume that 0 ( 1) AjtckA C = first next(rank (ck (C ); tA )) p(e0 ; :::; ei?1 )jtckA(C ) =first next(rank(ck(p); tA )) p(e0 ; :::; ei?1 )jtckA(p) . jtB0 = first next(rank(ck(C ); t )) p (r ; :::; r )jtB0 ( B 0 ) B0 = first next(rank(ck(p0 ); tB0 )) ck(C ) i0 ?1 ck(C ) p0(r0; :::; ri0 ?1)jtckB(0p0) . 0 0 tBn?1...... Bn?1jck(C ) = first next(rank(ck(C ); tBn?1 )) pn?1(s0 ; :::; si(n?1) ?1)jtckB(0C ) t = first next(rank(ck(pn?1); tBn?1 )) pn?1(s0 ; :::; si(n?1) ?1 )jckB(np?n1?1 ) . where p(e0 ; :::; ei?1 ), p0 (r0 ; :::; ri ?1 ), ..., pn?1(s0 ; :::; si n? ?1 ) are pure ground atoms. t Since B0 jtckB(C ) , ..., Bn?1 jckB(nC?) all are true under \M , 0 ( 1) 1 0 first next(rank (ck (p0 ); tB0 )) ...... p (r ; :::; ri ? )jtckB p , 0 0 0 1 0 ( 0) tB first next(rank (ck (pn?1 ); tBn?1 )) pn?1 (s0 ; :::; si(n?1) ?1 )jck(np?n1?1 ) all belong to \M , and therefore they all belong to any model I ; I 2 M . On other side, since AjtckA(C ) is false under \M , first next(rank(ck(p); tA )) p(e0 ; :::; ei?1 )jtckA(p) does not belong to \M . Therefore there exists at least one model in M , say I , such that first next(rank (ck (p); tA )) p(e0 ; :::; ei?1 )jtckA(p) does not belong to I . Thus, we have that C is false under I , which contradicts our assumption that I is a model of Pb . Theorem 2 Let P = Pc 1 Pa 1 Pb be a Chronolog(MC) program, ck the clock determined by Pc and Pa , and MPb = fI j j=I ;ck P g 2Sb the set of all clocked temporal Herbrand models of Pb . Then MMOD(Pb ) def = \ 2Sb I is the minimum clocked temporal Herbrand model of Pb . Proof: By lemma 5.2, MPb is non-empty. Furthermore, by lemma 5.3, \MPb = \ 2Sb I is a clocked temporal Herbrand model of Pb , and it is therefore the minimum clocked temporal Herbrand model. The following theorem says that the minimum clocked temporal Herbrand model of any Chronolog(MC) program consists of all ground canonical temporal atoms that are logical consequences of the program. Its proof is adapted from an analogous proof for Chronolog. Theorem 3 Let P = Pc 1 Pa 1 Pb be a Chronolog(MC) program, and ck the clock determined by Pc and Pa . Then MMOD(Pb ) = fA 2 BP jP j=ck Ag. Proof: A is a logical consequence of P on ck i Pb [ f:Ag is unsatis able on ck 19 i i i i Pb [ f:Ag have no clocked temporal Herbrand models :A is false under all clocked temporal Herbrand models of Pb A is true under all clocked temporal Herbrand models of Pb A 2 MMOD(Pb ). The minimum clocked temporal Herbrand model of a Chronolog(MC) program can also be characterized by xpoint theory. To do this, we may need discuss the xpoint semantics in two levels (the clock de nition level and the program body level). Because of space limitations, no details for the xpoint semantics are given in this paper. 6 Concluding Remarks Chronolog(MC) is based on a clocked temporal logic which allows predicate symbols, and formulas, to be de ned on di erent clocks. We have presented its logical basis and discussed the declarative semantics of Chonolog(MC) programs in terms of clocked temporal Herbrand models. We have proposed a clocked TiSLD-resolution as the proof procedure for executing Chronolog(MC) programs, which extends the execution mechanism of original Chronolog programs. One application of Chronolog(MC) is simulation (Liu and Orgun, 1995). In describing a simulation system, we may consider that there are two parts which can been split semantically: one decribing the functional aspects of the processes involved in the system, and the other describing their temporal aspects. A Chronolog(MC) program consists of a clock de nition, a clock assignment and a program body. The program body can be used for describing the functional aspects of each process involved in the system; and the clock de nition and assignment together give the description of time/timing properties about the behavior of those processes. Now let us mention a number of related works. Branching temporal logic programming (Tang, 1989) extends the veri cation method for temporal logic to incorporate logic programming, in particular, the states of a model checker for a branching-time logic are extended with Prolog like statements; Mota et al (1995) proposed a new time granularity theory based on modular temporal clauses, which is suitable for the speci cation of ecological models. In Chronolog(MC) programming, the presentation of multiple granularity of time in a program is explicitly given by a clock de nition and a clock assignment. Therefore, it is more exible in describing behavior of those systems. Future work includes completing theoretical study about clocked temporal logic, and implementing the extended language on a real multiprocessor system. Early work on an implementation of Chronolog is reported in (Liu, Orgun and Zhang, 1995). Branching time can be introduced in Chronolog(MC) by relaxing the second clock constraint. Given a goal, then executing the clock de nition involves nding a branch of time in which the goal can be proved. We are also considering a more general form of clock de nitions in which clock constraints are expressed as additional axioms. Acknowledgements This work has been supported in part by an Australian Research Council (ARC) Grant. C. Liu has been supported by an Australian Postgraduate Award (APA). 20 References [1] Abadi, M., Manna, Z. (1989). Temporal logic programming. Journal of Symbolic Computation 8, 277{295. [2] Aoyagi, T. et al (1986). Temporal logic programming language Tokio. In E. Wada editor, Logic Programming'85, Lecture Notes in Computer Science 221, 138{147. [3] Baudinet, M. (1992). A simple proof of the completeness of temporal logic programming. In L. Fari~nas del Cerro and M. Penttonen, editors, Intensional Logics for Programming, pages 51{83. Oxford University Press. [4] Brzoska, C. (1995). Temporal logic programming with metric and past operators. In M. Fisher and R. Owens, editors, Executable Modal and Temporal Logics (IJCAI'93 Workshop). (Published in Lecture Notes in Arti cial Intelligence 897, pages 21-39. Springer-Verlag). [5] Chomicki, J. (1994). Temporal query languages: A survey. In D. M. Gabbay and H. J. Ohlbach, editors, Proceedings of ICTL'94, First International Conference on Temporal Logic, Bonn, Germany, July 1994. (Published in Lecture Notes in Arti cial Intelligence 827, 506{534. SpringerVerlag). [6] Fisher, M. (1994). A survey of Concurrent Metatem | The language and its applications. In D. M. Gabbay and H. J. Ohlbach, editors, Proceedings of ICTL'94, First International Conference on Temporal Logic, Bonn, Germany, July 1994. (Published in Lecture Notes in Arti cial Intelligence 827, 480{505. Springer-Verlag). [7] Fisher, M., Owens, R. (1995). An introduction to executable modal and temporal logics. In M. Fisher and R. Owens, editors, Executable Modal and Temporal Logics (IJCAI'93 Workshop). (Published in Lecture Notes in Arti cial Intelligence 897, pages 1{20, Springer-Verlag). [8] Fisher, M., Owens, R. (1992). From the past to the future: Executing temporal logic programs. In Proceedings of Logic Programming and Automated Reasoning (LPAR), St. Petersberg, Russia, July 1992. (Published in Lecture Notes in Computer Science 624. Springer-Verlag). [9] Fisher, M., Reynolds, M. (1995). The power of METATEM rules. In Proceedings of IJCAI-95 Workshop on Executable Temporal Logics, pages 35{49. Montreal, Canada. [10] Fruhwirth, T. (1995). Temporal logic and annotated constraint logic programming. In M. Fisher and R. Owens, editors, Executable Modal and Temporal Logics (IJCAI'93 Workshop). (Published in Lecture Notes in Arti cial Intelligence 897, pages 58{68, Springer-Verlag). [11] Gabbay D. M. (1987). Modal and temporal logic programming. In A. Galton, editor, Temporal logics and their applications, pages 197{237. Academic Press. [12] Gabbay D. M. (1991). Modal and temporal logic programming II (A temporal Prolog machine). In T Dodd, R. Owens and S. Torrance, editors, Logic Programming { Expanding the Horizon. Intellect Books Ltd. [13] Gabbay D. M. and McBrien, P. (1991). Temporal Logic & Historical Databases. In Proceedings of the 17th Very Large Data Bases Conference, pages 423-430, Morgan Kau man, Los Altos, Calif. [14] Gagne, J.-R., Plaice, J. (1995). A non-standard temporal deductive database system. In Proceedings of IJCAI-95 Workshop on Executable Temporal Logics, pages 51{62. Montreal, Canada. [15] Goldblatt, R. (1987). Logics of time and computation. Lecture Notes No: 7. CSLI{Centre for the Study of Language and Information, Stanford University. [16] Hrycej, T. (1993). A temporal extension of Prolog. The Journal of Logic Programming 15, 113{145. [17] Liu, C. (1995). A temporal logic language with time granulation. In 30th Anniversary of the Australian Association for Logic Conference, Armidale, Australia. 21 [18] Liu, C., Orgun, M. A. (1995). Chronolog as a simulation language. In Proceedings of IJCAI-95 Workshop on Executable Temporal Logics, pages 109{119. Montreal, Canada. [19] Liu, C., Orgun, M. A., Zhang, K. (1995). A framework for exploiting parallelism in Chronolog. In Proceedings of the First IEEE International Conference on Algorithms and Architectures for Parallel Processing, pages 163{172. Brisbane, Australia. IEEE Press. [20] Lloyd, J. W. (1987). Foundations of Logic Programming, 2nd ed., Springer-Verlag. [21] Manna, Z., Pnueli, A. (1981). Veri cation of concurrent programs: the temporal framework. In Boyer and Moore, editors, Correctness Problem in Computer Science, pages 215{273. Academic Press. [22] Mota, E. et al (1995). Time granularity in simulation of models of ecological systems. In Proceedings of IJCAI-95 Workshop on Executable Temporal Logics, pages 77{94. Montreal, Canada. [23] Orgun, M. A., Ma, W. (1994). An overview of temporal and modal logic programming. In D. M. Gabbay and H. J. Ohlbach, editors, Proceedings of ICTL'94, First International Conference on Temporal Logic, Bonn, Germany, July 1994. (Published in Lecture Notes in Arti cial Intelligence 827, 445{479. Springer-Verlag). [24] Orgun, M. A., Wadge, W. W. (1992). Theory and practice of temporal logic programming. In L. Fari~nas del Cerro and M. Penttonen, editors, Intensional Logics for Programming, pages 23{50. Oxford University Press. [25] Orgun, M. A., Wadge, W. W. (1993). Chronolog admits a complete proof procedure. In Proceedings of the 6th International Symposium on Lucid and Intensional Programming, pages 120{135. Quebec, Canada. [26] Sadri, F. (1987). Three approaches to temporal reasoning. In A. Galton, editor, Temporal logics and their applications, pages 121{168. Academic Press. [27] Tang, T. (1989). Temporal logic CTL+Prolog. Journal of Automated Reasoning 5, 49{65. [28] van Emden, M. H., Kowalski, R. A. (1976). The semantics of predicate logic as a programming language. Journal of the Association for Computing Machinery 23, 733{742. [29] Wadge, W. W. (1988). Tense logic programming: a respectable alternative. In Proceedings of the 1988 International Symposium on Lucid and Intensional Programming, pages 26{32. Sidney, B.C., Canada. [30] Wiederhold, G., Jajoida, J., Litwin, W. (1991). Dealing with granularity of time in temporal databases. In Advanced Information Systems Enginering: Proceedings of the Third International Conference CAiSE'91, pages 124{140, Springer-Verlag. 22