0% found this document useful (0 votes)
47 views5 pages

Chronolog : Linear-Time Logic Programming: First Next

This document introduces Chronolog(Z), a logic programming language based on linear-time temporal logic with unbounded past and future. Chronolog(Z) programs can be executed using a resolution-type proof procedure called TiSLD-resolution. The language is suitable for applications involving dynamic change over time, such as modeling non-terminating computations and sequential circuits. A modular extension of Chronolog(Z) is also proposed to model objects with internal memory.

Uploaded by

mcmcsoto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views5 pages

Chronolog : Linear-Time Logic Programming: First Next

This document introduces Chronolog(Z), a logic programming language based on linear-time temporal logic with unbounded past and future. Chronolog(Z) programs can be executed using a resolution-type proof procedure called TiSLD-resolution. The language is suitable for applications involving dynamic change over time, such as modeling non-terminating computations and sequential circuits. A modular extension of Chronolog(Z) is also proposed to model objects with internal memory.

Uploaded by

mcmcsoto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Chronolog(Z ): Linear-time logic programming

Mehmet A. Orgun William W. Wadge Weichang Du


Department of Computing Department of Computer Science Department of Computer Science
Macquarie University University of Victoria University of New Brunswick
Sydney, NSW 2109, Australia Victoria, B.C. V8W 3P6, Canada Saint John, N.B., Canada

Abstract complete; and established the equivalence of the


declarative and the operational semantics of Templog
This paper introduces Chronolog(Z ), a logic pro- programs. Orgun and Wadge [13, 14] provided the
gramming language based on a discrete linear-time semantics of Chronolog programs and outlined a com-
temporal logic with unbounded past and future. plete proof procedure for the language. Gabbay [10]
Chronolog(Z ) is suitable for applications involving de ned a resolution procedure for Temporal Prolog
the notion of dynamic change such as modeling non- and proved its soundness. These results suggest that
terminating computations, the simulation of sequential temporal logic programming is feasible.
circuits, and temporal databases. The execution of the This paper in particular introduces the tempo-
programs of the language is based on a resolution-type ral language Chronolog(Z ), which is an extension of
proof procedure called TiSLD-resolution. A modular Chronolog [13], based on a linear-time temporal logic
extension of Chronolog(Z ) is proposed which can be with unbounded past and future with the set Z of
used to model objects with internal memory. integers as the collection of moments in time. The
temporal logic of Chronolog(Z ) has an operator to
1 Introduction look into the past as well as the operators first and
next of Chronolog. The \execution" of Chronolog(Z )
Temporal logic has been successfully used as a for- programs is based on a resolution-type proof proce-
malism in concurrent program speci cation and ver- dure called TiSLD-resolution. In [14], it is also shown
i cation, modeling temporal databases, and various that the declarative and the operational semantics of
forms of temporal reasoning. In temporal logic [15], Chronolog(Z ) programs coincide.
the meanings of formulas vary depending on an im- Consider the following program that de nes the
plicit time parameter and elements from di erent mo- predicate f which is true of the t + 1 Fibonacci num-
th

ments in time can be combined through the use of ber for time t  0 and no other.
temporal operators, not by explicit references to time.
More recently, a number of logic programming lan- first f(1).
guages based on diverse temporal logics have been pro- first next f(1).
posed: Tempura [12] and Tokio [2] are based on inter- next next f(N) <- next f(X), f(Y), N is X+Y.
val logic; Templog [1] and Chronolog [13] are based on
linear-time temporal logics and Temporal Prolog [9] is Read all clauses as assertions true at all moments in
based on linear and branching time temporal logics. time. The rst two clauses de ne the rst two Fi-
In Tempura, programs are systematically trans- bonacci numbers as 1; and the last clause de nes the
formed into a sequence of state descriptions over an current Fibonacci number as the sum of the previ-
interval that satis es the original program [12]. Tem- ous two. For example, the answer to the given goal
plog [1], Temporal Prolog [9] and Chronolog [13] are <- first next next f(X) is a (substitution) in-
extensions of logic programming in which temporal stance of the goal with X replaced by 2.
logic programs are executed to obtain answers by the In the following, we rst outline the temporal logic
use of resolution-type proof procedures. Tokio has a of Chronolog(Z ). We then discuss several applications
mixed execution mechanism [2]. of the language, including modeling non-terminating
There are also several attempts at developing se- computations and the simulationof sequential circuits.
mantics of temporal logic languages. Baudinet [3] We also propose a modular extension of Chronolog(Z )
showed that Templog's proof procedure is sound and for specifying objects with internal memory.
2 Temporal Logic of Chronolog(Z ) 2.2 Axioms of Temporal Logic
In the temporal logic of Chronolog(Z ), the collec- Let the notation ` A denote the fact that A is a
tion of moments in time is the set Z of integers. The theorem of TL. The notion of deducibility can be char-
temporal logic o ers three temporal operators: first, acterized in terms of theoremhood: ? ` A means that
prev and next. Informally, the temporal operators the formula A is deducible from a set ? of formulas in
refer to the initial moment, the previous moment and TL. The following axioms state some of the important
the next moment in time respectively. We choose a properties of the temporal operators. Let 5 stand for
linear-time temporal logic with unbounded past and any of first, prev and next.
future as the underlying logic of Chronolog(Z ), be- (i) Temporal operator cancellation rules:
cause certain time-dependent properties are more nat- E1. 5(first A) $ first A.
ural and easier to express with past operators and the E2. next prev A $ A.
symmetry between past and future operators is best E3. prev next A $ A.
expressed in such a temporal logic. The rst axiom (E1) says that initial truths persist.
The syntax of the temporal logic of Chronolog(Z ) The axioms E2 and E3 capture the fact that prev and
extends that of rst-order logic with three new forma- next are complete inverses.
tion rules: if A is a formula, so are first A, prev A (ii) Temporal operator distribution rules:
and next A. We write next(n) and prev(n) for n D1. 5(A ^ B) $ (5 A) ^ (5 B).
successive applications of next and prev respectively. D2. 5(: A) $ :(5 A).
From here on, we refer to the underlying logic as TL. These axioms state that the temporal operators
commute with ^ and :.
2.1 Temporal Interpretations (iii) Rigidness of variables:
V. 5(8x)(A) $ (8x)(5 A).
The semantics of formulas of TL are provided by This axiom stipulates that the values of individual
temporal interpretations. A temporal interpretation variables range over extensions (data values).
of TL assigns meanings at all moments in time to all (iv) Rules of inference: we have the following tempo-
basic elements of the language such as function and ral operator introduction rules.
predicate symbols, and variables. Interpretations are R1. If ` A, then ` first A.
extended upward to all terms and formulas of TL by a R2. If ` A, then ` prev A.
satisfaction relation j=. The meaning of a formula of R3. If ` A, then ` next A.
TL varies in time. However, we restrict the discussion It is straightforward to show the correctness of the
to those temporal interpretations in which the values axioms and the rules of inference (that is, the sound-
of variables and function symbols are \rigid". The ness of the axiomatic system).
value of a rigid term is an invariant of time.
We assume a standard de nition of the satisfaction Lemma 1 [14] All of the axioms and the rules of in-
relation j= in terms of temporal interpretations. In ference are valid with respect to the semantics scheme
the following, the fact that a formula A is true at a of TL.
moment t in time in a temporal interpretation I is
denoted as j= A. The formal semantics of temporal We assume that the rules of inference given above
I;t

operators of TL are given as follows: are extended to consider the notion of deducibility
from a set of formulas. The resolution-type proof pro-
 j= first A i j= 0 A.
I;t I;
cedure of Chronolog(Z ) is based on these axioms and
rules of inference [14].
 j= prev A i j= ?1 A.
I;t I;t
2.3 Temporal Logic Programs
 j= next A i j= +1 A.
In programs of Chronolog(Z ) such as the Fibonacci
I;t I;t

where A is a formula, and t 2 Z . program given earlier, program clauses can contain
If a formula A is true in a temporal interpretation applications of temporal operators to atomic formu-
I at all moments in time, we say that A is true in I las. We call atomic formulas with a number (possibly
or I is a model of A and denote this fact as j= A.
I 0) of applications of temporal operators as temporal
We regard :, ^ and 8 as primitives and assume the atoms. All variables in program clauses are assumed
usual de nitions of _, !, $ and 9 in terms of these to be universally quanti ed. For convenience, we use
primitives. upper-case letters for variables and lower-case letters
for function and predicate symbols. A temporal logic hamming(X) <- residue([X|L]).
program of Chronolog(Z ) is the conjunction of a set first residue([1]).
of program clauses regarded as assertions true at all residue(L1) <- prev residue([X|L]),
moments in time. Programs of Chronolog(Z ) are ex- multiply(2,X,X2),multiply(3,X,X3),
ecuted using a resolution-type proof procedure called multiply(5,X,X5),merge([X2,X3,X5],L,L1).
TiSLD-resolution [14]. merge(L1,L2,L3) <- ...
We need the notion of a canonical formula: Given multiply(X,Y,Z) <- ...
a formula A, by systematic applications of R1, R2 and We assume a standard de nition for merge in which
R3, the following initial truths can be formed: given two ordered lists are merged to produce a third
first A (by R1),
first prev A (by R2, R1),
ordered list with duplicates removed. The residue
first next A (by R3, R1),
predicate holds all those Hamming numbers produced
but not yet consumed by the hamming predicate. In
first prev prev A (by R2, R2, R1),
the program, the hamming predicate is speci ed for the
first next next A (by R3, R3, R1) non-negative part of the linear-time.
and so on. Initial truths obtained from a formula A in According to the program, the residue predicate
the above fashion are called canonical instances of A. is true of the residue list [1] at time 0, which means
As the following lemma says, the value of a given that, by the rst clause, 1 is the rst Hamming num-
formula in a temporal interpretation can be expressed ber. At time 1, by the third clause, 1 is removed from
in terms of the values of its canonical instances. the residue list and then multiples of 1 are merged with
Lemma 2 [14] Let A be a formula and I a temporal the rest of the residue list (the empty list[]). Thus the
residue predicate represents the residue list [2,3,5]
interpretation of TL. j= A if and only if j= A for
I I t
at time 1, meaning that the second Hamming number
all canonical instances A of A.t
is 2. At time 2, by the third clause, 2 is removed from
TiSLD-resolution is applied to a set of canonical the residue list and multiples of 2 are merged with the
program and goal clauses. We assume that, in canon- rest of the residue list (the list [3,5]). The residue
ical instances of program clauses, all super uous ap- predicate represents the residue list [3,4,5,6,10] at
plications of temporal operators are eliminated by ax- time 2, meaning that the third Hamming number is 3.
ioms E1-E3. For a given temporal logic program, The computation proceeds along these lines.
canonical instances of program clauses are obtained The open-ended goal clause <- hamming(N) trig-
by rules R1-R3 and axioms D1 and D2. When the gers a non-terminating computation of Hamming
canonicality restriction is lifted for goal clauses, they numbers. The goal is interpreted as an in nite se-
can be open-ended. Open-ended goal clauses are used ries of canonical sub-goals into the future of the form
to initiate non-terminating computations (see below). <- first hamming(N), <- first next hamming(N),
Note that a thorough exposition to TiSLD-resolution <- first next(2) hamming(N) and so forth. The
can be found in [14]. answers to canonical sub-goals obtained by TiSLD-
resolution in fact constitute the answers to the orig-
inal goal [14]. The sequence of answer substitutions
3 Applications for N represents the sequence of Hamming numbers.
An implementation of Chronolog(Z ) produces an-
3.1 Non-terminating Computations swers to canonical sub-goals as long as time and re-
In temporal logic programming, non-terminating sources permit. The starting point and direction of
computations can be modeled by time-varying predi- the computation may be determined by users or de-
cates. Consider Hamming numbers which are multi- tected automatically by the implementation. The
hamming predicate depends on the residue predicate;
ples of 2, 3 and 5 of the form the residue predicate is de ned by an initial clause
2 3 5 for some i; j and k.
i j k and a program clause with recursive past dependen-
cies. Therefore a non-terminating computation in the
We write a Chronolog(Z ) program to produce the se- negative direction cannot produce any results.
quence of Hamming numbers in increasing order with- 3.2 Circuit Simulation
out any repetitions. In the program, the hamming
predicate is true of the t + 1 Hamming number at
th
Clocksin [5] outlined a logic programming method
time t  0 and no other. for specifying and reasoning about sequential circuits.
first counter(0,0,0).
Q3 Q2 Q1 next counter(Q1,Q2,Q3) <-
clock(Ck), counter(I1,I2,I3),
J Q J Q J Q jk(1,1,Ck,I3,Q3), and(Ck,I3,C3),
Ck Ck Ck

q q

jk(1,1,C3,I2,Q2), and(Ck,I3,T),
K

K and(T,I2,C2), jk(1,1,C2,I1,Q1).

The rst clause says that the counter is reset at the


input
q q

initial moment in time. The second clause speci es the


behavior of the circuit in terms of its current values
Figure 1: A synchronous 3-bit counter and the clocked input. Shared variables represent con-
nections among the units in the circuit. In the second
clause, two and units are used to model an and unit
A sequential circuit contains memory elements such as with three inputs. As in the Hamming numbers exam-
ip- ops and the next state of the circuit is a function ple, the open-ended goal <- counter(X,Y,Z) starts a
of its current state plus its inputs. We now write a non-terminating computation.
Chronolog(Z ) program to simulate a synchronous 3- Temporal logic programming approach to circuit
bit counter (see Figure 1). The counter consists of two simulation has the advantages of the logic program-
\and" gates and three JK ip- ops. In the counter, ming method of Clocksin [5]. It supports modularity
JK inputs are connected to logic high. and circuit speci cations are directly executable by
In circuit speci cations, a circuit unit with n ports Chronolog(Z ) implementations. Since it is based on a
can be represented by an n-ary predicate specify- linear-time temporal logic, it also o ers additional ad-
ing the behavior of the unit. In the synchronous vantages: feedback loops can be more naturally spec-
3-bit counter circuit, there are two primitive units, i ed and delays and timing requirements can be mod-
that is, an \and" gate and a JK ip- op. The eled in a rigorous manner.
and(In1,In2,Out) predicate speci es the truth ta-
ble of an \and" gate with two input ports In1 and 3.3 Temporal Deductive Databases
In2 and an output port Out; for example, and(0,1,0)
holds where the constants 0 and 1 stand for logic low We now consider a subset of Chronolog without any
and logic high respectively. The jk(J,K,Ck,Q,Qnext) function symbols, that is, Temporal Datalog. Pro-
predicate speci es a clocked JK ip- op with J-input grams of Temporal Datalog can be regarded as \tem-
J, K-input K, clock input Ck, output Q and the next poral deductive databases". The meaning of a Tempo-
state Qnext. We have left out the negated Q output ral Datalog program is considered as the temporal
and S and R inputs, usually available in JK ip- ops, database the program models intensionally, in which
to simplify the speci cation. We now give the de ni- each predicate in the program represents a temporal
tion of the jk predicate: relation. Slices of temporal relations are nite at par-
jk(0,0,1,Q,Q).
ticular moments in time or over periods of time owing
jk(0,1,1,Q,0).
to the restriction to the function-free subset of logic
jk(1,0,1,Q,1).
programs, but they are in nite in the aggregate.
jk(1,1,1,0,1).
Consider a simple database for a library. Suppose
jk(1,1,1,1,0). that new books do not go into circulation until after
jk(_,_,0,Q,Q). two weeks of their arrival. After then, they stay in
circulation on a daily basis. Here the logical time is
In Chronolog(Z ), the frequency of a clock can be interpreted as days. Let the in-circ predicate rep-
de ned by making the use of the linear-time of the resent all those books that are in circulation. The
logic. For instance, the program clause clock(1) following is the partial de nition of in-circ:
speci es a clock synchronized with Chronolog(Z ) time
under the assumption that the clock signal is high first in-circ(mobbydick).
when it is sampled at each moment in time, but it first in-circ(les-miserables).
is low between any two consecutive moments in time. first in-circ(the-hobbit).
In the speci cation of the counter circuit, the input ...
to the circuit is taken from the clock predicate. The next(14) in-circ(Book) <- new-arrival(Book).
following is the de nition of the counter predicate: next in-circ(Book) <- in-circ(Book).
The rst three rules de ne the books mobbydick, include the multi-dimensional language InTense [11]
les-miserables and the-hobbit to be in circulation and the modal framework Molog [6]. For more details
on the rst day (time 0). The last two rules formalize on temporal and modal logic programming, we refer
our assumptions about the books in circulation. Note the reader to the literature; for example, see [7]. We
that the new-arrival predicate is not formalized in believe that these non-classical languages will open up
the program, but supplied as input. new application areas for logic programming.
Bottom-up evaluation strategies such as the xed
point computation are used to compute the meaning References
of a given Datalog program [4]. In Temporal Data-
log, only slices ( nite portions) of temporal relations [1] M. Abadi and Z. Manna. Temporal logic program-
represented by time-varying predicates can be com- ming. In Proceedings of the 1987 Symposium on Logic
puted by bottom-up evaluation strategies. Programming, pages 4{16. IEEE Computer Society
Press.
3.4 Modular Chronolog(Z ) [2] T. Aoyagi, M. Fujita, and T. Moto-oka. Temporal
logic programming language Tokio. In E. Wada, edi-
In a modular extension of Chronolog(Z ), we can tor, Logic Programming'85, pages 138{147. Springer-
specify software modules with internal memory. The Verlag, 1986.
extension is based on Fitting's proposal [8] for modular [3] M. Baudinet. Temporal logic programming is com-
logic programming. As an example, we give the speci- plete and expressive. In Conference Record of the
cation of a stack module with unlimited capacity [13]. Sixteenth ACM Symposium on Principles of Program-
The actions on the stack is controlled by supplying ming Languages, pages 267{280, 1989.
a sequence of commands through the cmd predicate. [4] S. Ceri, G. Gottlob, and L. Tanca. Logic Programming
Items are added to the stack with push commands and Databases. Springer-Verlag, 1990.
and the top item is removed with pop commands. We [5] W. F. Clocksin. Logic programming and digital anal-
assume that at any moment in time, exactly one ac- ysis. J. Logic Programming, 4:59{82, 1987.
tion is allowed: we can push an item onto the stack or [6] L. Fari~nas del Cerro. Molog: A system that extends
remove the top item. The pop command has no e ect prolog with modal logic. New Generation Comput-
if the stack is empty. The output of the module is the ing, 4:35{50, 1986.
top predicate which is true of the item on top of the [7] L. Fari~nas del Cerro and M. Penttonen, editors. In-
stack (if there is one) at any given moment in time. tensional Logics for Programming. Oxford University
module mod:
Press, 1992.
import cmd; export top. [8] M. Fitting. Enumeration operators and modular logic
first stack([]). programming. J. Logic Programming, 4:11{21, 1987.
next stack([X|S])<- cmd(push(X)),stack(S). [9] D. M. Gabbay. Modal and temporal logic program-
next stack(S) <- cmd(pop),stack([X|S]). ming. In A. Galton, editor, Temporal Logics and Their
next stack([]) <- cmd(pop),stack([]).
Applications, pages 197{237. Academic Press, 1987.
top(X) <- stack([X|S]). [10] D. M. Gabbay. A temporal logic programming
end. machine [modal and temporal logic programming,
Part 2]. Imperial College, 1989.
The rst clause says that the stack is initially empty. [11] W. H. Mitchell and A. A. Faustini. The intensional
The next three clauses specify the next state of the logic language InTense. The 1989 International Sym-
stack depending on its current state and the action posium on Lucid and Intensional Programming, Ari-
indicated by cmd. The last clause speci es the output zona State University.
predicate top. The stack predicate models the inter- [12] B. Moszkowski. Executing Temporal Logic Programs.
nal memory for the module which is not observable Cambridge University Press, 1986.
from the outside world. Thus the notion of a \state" [13] M. A. Orgun and W. W. Wadge. Theory and practice
is captured within the module. of temporal logic programming. In [7], pages 23{50.
[14] M. A. Orgun and W. W. Wadge. Chronolog admits
a complete proof procedure. The Sixth International
4 Conclusions Symposium on Lucid and Intensional Programming,
We have introduced the temporal logic language Universite Laval, Quebec City, Canada, 1993.
Chronolog(Z ) and outlined its features. Other appli- [15] N. Rescher and A. Urquhart. Temporal Logic.
cations of non-classical logics to logic programming Springer-Verlag, 1971.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy