Multi-Dimensional Logic Programming
Mehmet A. Orgun
Weichang Du
Department of Computing
Macquarie University
Sydney, NSW 2109, Australia
E-mail:
[email protected]
Department of Math & Computer Science
University of New Brunswick
Saint John, N.B. E2L 4L5, Canada
E-mail:
[email protected]
ABSTRACT This paper introduces an extension of logic programming based on
multi-dimensional logics. In a multi-dimensional logic the values of elements vary
depending on more than one dimension, such as time and space. The resulting logic
programming language is suitable for modelling objects which involve implicit and/or
explicit temporal and spatial dependencies. The execution of programs of the language is based on a resolution-type proof procedure called MSLD-resolution. MSLDresolution is based on the axioms and rules of inference of the underlying multidimensional logic. Several example programs are given, including Conway's game of
life. A spreadsheet interface to multi-dimensional logic programming is also outlined;
it can be used as a powerful display tool with the advantage of non-determinism
inherent in logic programming.
1 Introduction
Non-classical logics such as temporal and modal logic have been successfully used as
a formalism in many areas, including program speci cation and veri cation, temporal
reasoning, and knowledge representation. More recently, it has been suggested that
temporal and modal logics can be directly used as a programming language in applications involving the notion of dynamic change. There are a number of proposed
Proc. ICCI’94, 1501-1520 1994 Int. Conf. on Computing and Information
temporal and modal logic programming languages: In Tempura [13, 10], programs
are systematically transformed into a sequence of state descriptions over an interval
that satis es the original program Templog [2], Temporal Prolog [9], and Chronolog
[15] are temporal extensions of logic programming. Molog [8] uses modal inference
rules, and a resolution-type proof procedure. Tokio [3] is based on the same interval
logic as Tempura, but its execution mechanism is a mixture of transformation and
resolution.
There are also several attempts at developing the declarative and operational
semantics for these languages. Since it is known that rst-order temporal (and modal)
logic is incomplete [1], it is important to show that there are fragments of temporal
and modal logic which can be given an operational semantics, and that the declarative
and operational semantics of these languages coincide. Baudinet [6] showed that the
declarative and operational semantics of Templog programs coincide. Orgun and
Wadge [17] provided analogous results for Chronolog programs. Gabbay [9] de ned
a resolution procedure for Temporal Prolog and proved its soundness. Balbiani et
al [5] provided a tree-like semantics for certain instances of Molog. These results
suggest that temporal and modal logic programming is feasible. For more details on
extensions of logic programming, we refer the reader to the literature; Orgun and
Ma [14] provide an extensive survey.
In this paper, we introduce multi-dimensional logic programming (MLP). MLP
is based on a countably in nite number of dimensions, each of which is modeled by
the set of integers Z . A context in MLP is a point in the hyper eld of Z ! . There
are three contextual operators de ned for each dimension (say k): initialk refers to
the origin in that dimension, that is, point 0; priork refers to the previous point of
the current point in that dimension; and restk refers to the next point of the current
point in that dimension. MLP allows us to capture the dynamic aspects of certain
problems such as simulation, data ow computation, mesh-oriented computation, and
spreadsheets.
In MLP programs, dynamic relationships among data are formalized through the
1502
use of contextual operators. The following program adapted from [16] de nes the
predicate pascal. All program clauses are interpreted as assertions true at all points
in the hyper eld of contexts. Contextual operators are indexed by dimension indicators (natural numbers).
initial0 initial1 pascal(1).
initial0 pascal(X) <- initial0 rest1 pascal(X).
initial1 pascal(X) <- initial1 prior0 pascal(X).
pascal(X) <- rest1 pascal(Y), prior0 pascal(Z), X is Y+Z.
Since the de nition of pascal only involves contextual operators on the rst two dimensions, the value of pascal varies only in those two dimensions. Then the resulting
program is said to be in MLP(2), i.e., two-dimensional logic programming.
If these are the only axioms for the pascal predicate, Pascal's triangle is constructed on the south-east quadrant of the two-dimensional space, whose apex is at
< 0; 0 >, i.e., at < 0; 0 >, pascal(1) is true (from the rst clause.) Figure 1 shows an
approximate two-dimensional graphic representation of Pascal's triangle as speci ed
by the pascal predicate. The triangle is observed by rotating the gure by 45 degrees
in the clock-wise direction.
Multi-dimensional logic programs with a nite number of dimensions such as the
one given above can be translated into ordinary logic programs by adding extra
contextual parameters to every predicate (as many as the number of dimensions
used), and the e ects of contextual operators can then be simulated by explicitly
manipulating these extra parameters. However, in the general case, translation is
not possible, because it would require the addition of a countably in nite number of
extra parameters to every predicate, even though most of the predicates would vary
only in a small number of dimensions. In practice, the number of dimensions used in
a given program with nitely many program clauses is always nite, so translation
is possible, but it is not really practical. In most programs, predicates would have
di erent dimensionality, but extra parameters for each dimension must be added to all
1503
Dimension 0
Dimension 1
0
1
2
3
4
0
pascal(1)
pascal(1)
pascal(1)
pascal(1)
pascal(1)
-1
pascal(1)
pascal(2)
pascal(3)
pascal(4)
pascal(5)
-2
pascal(1)
pascal(3)
pascal(6)
pascal(10)
pascal(15)
-3
pascal(1)
pascal(4)
pascal(10)
pascal(20)
pascal(35)
-4
pascal(1)
pascal(5)
pascal(15)
pascal(35)
pascal(70)
Figure 1: Pascal's triangle on the south-east quadrant
predicates regardless of their dimensionality. Translated programs could be executed
using a standard Prolog interpreter, but an interpreter which does not know about the
speci c nature of these parameters would be hopelessly inecient than an interpreter
with an inherent knowledge of the way in which contextual operators interact with
one another.
In the following we rst discuss the underlying logic of MLP. We then outline
the syntax and semantics of multi-dimensional logic programs, and summarize the
features of the proof procedure of MLP, which we call MSLD-resolution. MSLDresolution forms the basis for implementations of MLP. We also give examples of
multi-dimensional logic programming, including Conway's game of life. We then
outline a spreadsheet interface to MLP, which can be used as a powerful tool for
spreadsheet computations with the advantage of non-determinism inherent in logic
programming.
1504
2 Multi-dimensional logic
Multi-dimensional logic is a form of modal logic [7]. The set of possible contexts
(possible worlds) is modeled by Z ! (the Cartesian product Z Z Z ). For a
given context x 2 Z ! , we write x = hx0; x1; x2; : : : i where each xk is the coordinate
(value) for the kth dimension. For each dimension k 0, there are three contextual
operators: initialk , priork , and restk . Here k is used as a dimension indicator.
The syntax of multi-dimensional logic extends that of rst-order logic with three
formation rules: if A is a formula, so are initialk A, priork A, and restk A, for all
k 0. Note that contextual operators are applied to formulas, not to terms of the
language. For any given m 0, we write priork[m] and restk[m] for m successive
applications of priork and restk . In case m = 0, priork[m] and restk[m] are the
empty string.
We write ML(!) for the multi-dimensional logic with countably in nite dimensions. In MLP, we are interested in multi-dimensional logics with a nite number of
dimensions, for instance, ML(5) is a logic with 5 dimensions.
2.1 Semantics of formulas
The semantics of formulas of ML are provided by multi-dimensional interpretations.
A multi-dimensional interpretation assigns meanings at all possible contexts to all the
basic elements of the language such as function and predicate symbols, and variables.
Interpretations are extended upward to all elements of the language by a satisfaction
relation j=. The meaning of a formula is context-dependent. However, we restrict
the discussion to those interpretations in which the values of variables and function
symbols are \rigid". The value of a rigid term is an invariant of contexts.
We assume a standard de nition of the satisfaction relation j= in terms of multidimensional interpretations. In the following, the fact that a formula A is true at
context x in some multi-dimensional interpretation I is denoted as j=I;x A. The
formal semantics of contextual operators of ML are given as follows. Let I be an
1505
interpretation of ML, x = hx0; x1; x2; : : : i 2 Z ! , k 0, and A is a formula of ML.
j=I;x initialk A if and only if j=I;x A where x is just like x except that xk = 0.
0
0
0
j=I;x priork A if and only if j=I;x A where x is just like x except that xk = xk ?1.
j=I;x restk A if and only if j=I;x A where x is just like x except that xk = xk +1.
0
0
0
0
0
0
If a formula A is true in a multi-dimensional interpretation I at all possible contexts, we say that A is true in I or I is a model of A. We denote this fact as j=I A.
If a formula A is true in any multi-dimensional interpretation, we denote this fact
as j= A. We regard :; ^, and 8 as primitives and assume the usual de nitions of
_; !; () and 9 in terms of these primitives.
2.2 Axioms and rules of inference
Let the notation ` A denote the fact that A is a theorem of ML. A theorem is
interpreted as a true statement at all possible contexts. The notion of deducibility
can be characterized in terms of theoremhood: ? ` A means that the formula A is
deducible from a set ? of formulas in ML. The following axioms state some of the
important theorems and properties of ML. Here k is a dimension indicator (k 0), 5
is any contextual operator, and 5 k is any contextual operator for the kth dimension.
Cancellation axioms: The rst axiom (C1) says that initial truths along any given
dimension persist. The axioms C2 and C3 capture that fact that priork and restk
are complete inverses for any given dimension k.
C1. 5 k (initialk A) () initialk A.
C2. priork (restk A) () A.
C3. restk (priork A) () A.
1506
Distribution axioms: The rst two axioms (D1 and D2) say that contextual operators commute with the Boolean operators ^ and :. The last two axioms (D3 and
D4) state the conditions under which contextual operators commute with each other.
D1. 5 (A ^ B ) () ( 5 A) ^ ( 5 B ).
D2. 5 (:A) () :( 5 A).
D3. For all j; k 0, 5 j 5 k A () 5 k 5 j A.
D4. For all j; k 0, 5 j k A () k 5 j A when k 6= j . Here j is any contextual
operator for the dimension j .
Rigidness of variables: This axiom stipulates that the values of individual vari-
ables range over extensions (data values), not intensions (context-varying values).
V. 5 (8x)(A) () (8x)( 5 A)
Rules of inference: In addition to substitution and Modus Ponens, we have the
following contextual operator introduction rules.
R1. if ` A, then ` initialk A.
R2. if ` A, then ` priork A.
R3. if ` A, then ` restk A.
We read the rules of inference as \given A as a theorem, infer initialk A, priork A,
and restk A as theorems.
The presentation of an axiomatic system for ML begs the question whether it
is complete with respect to the semantics scheme of ML. In this paper, we do not
attempt to answer this question. However, we include the following theorem showing
the correctness (soundness) of the axioms and the rules of inference.
Lemma 1 All of the axioms and the rules of inference are valid with respect to the
semantics scheme of ML.
1507
3 Multi-dimensional logic programs
The basic building blocks in a multi-dimensional logic program are contextual units
(i.e., formulas of the form 5 0 5 1 : : : 5 n?1 A where n 0, A is an atomic formula
and all 5 i's are contextual operators). Program clauses and goal clauses are made
up of contextual units de ned as follows:
A program clause is the universal closure of a clause of the form A<-B0; : : :; Bn?1
(n > 0) where each Bi and A are contextual units.
A goal clause is the universal closure of a clause of the form <-B0; : : :; Bn?1
(n > 0) where each Bi is a contextual unit.
A multi-dimensional logic program then consists of the conjunction of a set of program
clauses regarded as axioms true at all contexts. For convenience, we use standard
Prolog syntax.
Programs of MLP are executed using a resolution-type proof procedure called
MSLD-resolution (for Multi-dimensional SLD-resolution). MSLD-resolution is applied to a set of canonical instances of program clauses and queries. Again, for
practical purposes we focus on MLP with a nite number of dimensions.
Let n 0. For any given multi-dimensional logic ML(n), the canonical instances
of a given formula A, for any given dimension k (for 0 k < n), are obtained by
systematic applications of the rules of inference R1, R2, and R3 as follows:
initialk A (by R1)
initialk priork A (by R2,R1)
initialk restk A (by R3,R1)
initialk priork priork A (by R2,R2,R1)
initialk restk restk A (by R3,R3,R1)
:::
1508
and so on. We repeat this process for each dimension in turns on the resulting
formulas until all the n dimensions are exhausted. The resulting set of formulas is
called the set of canonical instances of A. We assume that in canonical instances of
a given formula, all super uous applications of contextual operators are eliminated
using the cancellation and distribution axioms.
For ML(!), canonical instances contain a countably in nite number of initial
operators applied to them. Therefore the notion of a canonical instance does not
apply to formulas of ML(!).
The following lemma says that the value of a given formula in a multi-dimensional
interpretation of ML(n) can be expressed using the values of its canonical instances.
Lemma 2 Let A be a formula of ML(n) and I a multi-dimensional interpretation of
ML(n). Then j=I A if and only if j=I Az for all canonical instances Az of A.
For a given multi-dimensional logic program P , canonical instances of program
clauses and queries are naturally obtained by the rules of inference and axioms. By
lemmas 1 and 2, P ` C for each canonical instance C of any program clause in P . In
short, we can carry out proofs from the canonical instances of the clauses in P , and
the results are justi ed by the lemmas. Goal clauses are assumed to be canonical.
When the canonicality restriction is lifted for goal clauses, they can be open-ended.
Open-ended goal clauses can be used to initiate non-terminating computations (see
the next section).
Given a program P in ML(n) for some n 0 and a goal G, an MSLD-derivation
of P [fGg consists of a sequence G0 ; G1; : : : of goal clauses where G0 = G, a sequence
C0; C1; : : : of variants (up to renaming) of canonical instances of program clauses in P
and a sequence 0; 1; : : : of substitutions. At every step of an MSLD-derivation, some
contextual unit from the current goal is selected and uni ed with the conclusion (head)
of a canonical instance of a program clause after renaming of the variables in the
canonical instance. A new goal is produced by replacing the selected contextual unit
in the goal by the premise (body) of the canonical instance and then the substitution
(mgu) obtained from uni cation is applied to the new goal.
1509
We now give an example MSLD-derivation. Consider the Pascal program in ML(2)
given earlier; with the goal <- initial0 initial1 rest0 prior1 pascal(X). The
goal clause is canonical in ML(2), up to the reordering of contextual operators in the
goal with respect to the axioms D3 and D4. We assume that all the contextual units
in the derivation are canonical (up to the reordering of contextual operators). The
only contextual unit in the goal G0 is selected and then matched with the head of
a canonical instance of the fourth program clause by uni cation after renaming the
variable X in the clause.
G0 = <- initial0 initial1 rest0 prior1 pascal(X).
C0 = initial0 initial1 rest0 prior1 pascal(X0) <- initial0
initial1
rest0 pascal(Y), initial0 initial1 prior1 pascal(Z), initial0
initial1 rest0 prior1 X0 is Y+Z.
(fourth program clause, by rules
of inference, axioms)
0 = fX=X0g
Then a new goal is produced after replacing the selected contextual unit in G0 by
the body of C0. The substitution 0 is applied to the new goal. We select the rst
contextual unit for the next step in the derivation. The contextual unit initial0
initial1 rest0 pascal(Y) in G1 is matched with a canonical instance of the third
program clause in the program.
G1 = <-
initial0 initial1 rest0 pascal(Y), initial0 initial1 prior1
pascal(Z), initial0 initial1 rest0 prior1 X0 is Y+Z.
initial0 initial1 rest0 pascal(X00) <- initial0 initial1
1
pascal(X0).
Y X00
1
C =
=f = g
(third program clause, by rules of inference, axioms)
In the rest of the derivation, we proceed in the above manner to arrive at the empty
goal, say Gi. If we reach the empty goal, we say that the derivation is successful. A
1510
successful MSLD-derivation is called a MSLD-refutation. The composition of mgu's
0, 1 etc is regarded as a computed answer substitution for the original goal. In the
answer to the original goal, X is substituted by 2. It follows that initial0 initial1
rest0 prior1 pascal(2) is a logical consequence of the Pascal program. Note that
MSLD-resolution is a complete proof procedure for languages based on ML(n) for
any n 0; for n = 0, it degenerates into ordinary SLD-resolution.
4 Examples
4.1 2-D programming
The Sieve of Erastosthenes is a well-known prime number generation technique. It
operates by putting all of the natural numbers from 2 onwards into a \sieve". We
then perform the following steps ad in nitum:
1) Remove the smallest number from the sieve. This is our prime number; and
2) Remove all the multiples of this number from the sieve.
Each step naturally corresponds to a moment in time. The notion of time can be
modeled in ML using the positive fragment of the dimension 0.
The following program is adapted from Mitchell [11, page 32]:
initial1 ints(2) <- !.
rest1 ints(X) <- ints(Y), X is Y+1.
initial0 sieve(X) <- ints(X), !.
rest0 sieve(X)<- initial1 sieve(Y),smallest(X),(X mod Y) =\= 0,!.
initial1 smallest(X) <- newsmallest(X).
smallest(X) <- prior1 rest0 sieve(Y), newsmallest(X), X =\= Y.
newsmallest(X) <- sieve(X).
newsmallest(X) <- rest1 newsmallest(X).
prime(X) <- initial1 sieve(X).
1511
4
3
Dimension 1 2
1
0
sieve(6)
sieve(5)
sieve(4)
sieve(3)
sieve(2)
sieve(11)
sieve(9)
sieve(7)
sieve(5)
sieve(3)
sieve(15)
sieve(13)
sieve(11)
sieve(7)
sieve(5)
sieve(19)
sieve(17)
sieve(13)
sieve(11)
sieve(7)
0
1
2
3
Dimension 0
Figure 2: The sieve/1 relation in two dimensions
At each moment in time, the sieve predicate represents all the natural numbers left
in the sieve, along the dimension 1. The prime predicate just picks the smallest
number from the sieve at each moment in time.
As shown in Figure 2, the sieve predicate represents the sequence of prime numbers along the time dimension at point 0 in the dimension 1. The sieve predicate
varies in both dimensions, whereas the prime predicate varies along the dimension 0
because its de nition involves the use of initial1.
Given an open-ended goal like <- prime(X), the question is how to produce the
canonical instances of the goal. Since there is no notion of a beginning point in
ML(2), the direction of the computation is important. There is no general rule for
generating canonical instances in a prede ned order other than the data dependencies
in a given program. Since the prime predicate varies only along the dimension 0, we
are interested in the canonical instances of the goal of the form
,
<- initial0 initial1 prime(X)
1512
,
<- initial0 initial1 rest0 prime(X)
<- initial0 initial1 rest0[2] prime(X)
,
and so on. Of course, the variable X is assumed to be di erent for each canonical
instance. In other words, the goal spawns an in nite sequence of independent canonical instances (goals), hence it models a non-terminating computation to produce the
sequence of prime numbers. The answers to the original goal are those answers to
canonical instances obtained from it.
However, for a given goal such as <- sieve(X), there is no apriori ordering imposed on the way in which canonical instances are produced: the predicate sieve
varies in two dimensions. The user should guide the implementation in producing the
canonical instances of the goal. The direction of the computation is also vital, for
instance, in the above example, a computation in the negative direction would not
produce any results.
4.2 3-D programming
Conway's game of life is one of the best examples which include relative references to
the neighbors of a point in space at di erent moments in time. The game involves
a (possibly in nite) plane divided into grids. Inside each grid (or cell) resides an
organism that may become alive or dead depending on the status of its immediate
neighbors in the surrounding cells on the plane. The game starts with an initial
con guration on the plane in which some of the organisms are alive.
In ML(3), plane can be modeled by the rst two dimensions, say dimensions 0
and 1, and time can be modeled by (the positive fragment of) the dimension 2.
Supposing the initial con guration of the game is de ned elsewhere, the following
program describes all relationships and state changes in the game; it is adapted from
a program given in [16].
1513
rest2 organism(alive) <- neighbors(L), count-alive(L,2).
rest2 organism(alive) <organism(alive), neighbors(L), count-alive(L,3).
rest2 organism(dead) <- neighbors(L), lonely(L).
rest2 organism(dead) <- neighbors(L), overcrowded(L).
rest2 organism(dead) <organism(dead), neighbors(L), count-alive(L,3).
neighbors([X1,X2,X3,X4,X5,X6,X7,X8]) <prior0 rest1 organism(X1), rest1 organism(X2),
rest1 rest0 organism(X3), rest0 organism(X4),
rest0 prior1 organism(X5), prior1 organism(X6),
prior1 prior0 organism(X7), prior0 organism(X8).
lonely(L) <- count-alive(L,X), X < 2.
overcrowded(L) <- count-alive(L,X), X > 3.
count-alive([],0).
count-alive([alive|L],N) <- count-alive(L,X), N is X+1.
count-alive([dead|L],X) <- count-alive(L,X).
The rst clause says that an organism will become alive at the next moment (at
the next point in the dimension 2) if exactly two of its neighbors are alive at the
current moment. This clause also covers the case where the birth of an organism will
occur at the next moment if it is dead and exactly two of its neighbors are alive at the
current moment. The second clause says that an alive organism will continue to live
at the next moment if exactly three of its neighbors are alive at the current moment.
The next two clauses state that an organism will become dead at the next moment
if it is lonely or the surrounding area is overcrowded. The fth clause says that an
organism will stay dead if it is already dead and has exactly three alive neighbors.
The rest of the clauses de ne some auxiliary predicates. According to the program, at
any possible context exactly one of the units organism(alive) and organism(dead)
is true.
1514
The problem is again how to produce the canonical instances of a given goal such
as <- organism(X). We are in fact interested in all canonical instances of this goal,
and thus it is very dicult to impose any ordering on the way in which canonical
instances are produced. The next section gives an elegant solution to this problem.
5 A spreadsheet interface
For multi-dimensional logic programming, a good visual interface would enhance the
appreciation of the results of computations, and it would also provide an aid in
writing programs. For 2-dimensional programming, a spreadsheet interface seems to
be a natural choice. Consider the Pascal program given earlier: the value of pascal
at each context in Z Z corresponds to the value displayed in a cell in a spreadsheet.
Figure 3 shows the result of the computation initiated by the goal <- pascal(X).
It is displayed in a 5 8 spreadsheet. In the gure, the dimensions 0 and 1 are
displayed. The pascal predicate is designated as the spreadsheet predicate, that is,
the predicate whose values are going to be displayed in the spreadsheet. Origin refers
to the left-most cell in the top row, and it gives the coordinate of the possible context
chosen to be displayed in that position. The cells (contexts) at which pascal(X) fails
is left blank.
Canonical instances of the given goal are produced for all the cells chosen for
the spreadsheet. For the above example, the following canonical instance would be
produced for Cell (d0,d1)=(-1,1):
<- initial0 initial1 prior0 rest1 pascal(X).
It is also possible to use the spreadsheet interface for programs in ML(n) for
arbitrary n 3. This would allow the user to view a multi-dimensional object
from di erent angles and/or points of view. In general, the dimensionality of the
spreadsheet predicate is not restricted to be 2-D.
Consider the program for the game of life, which is in ML(3). The rst two
dimensions (0 and 1) can be chosen for the spreadsheet display and the assumed time
1515
Origin: (d0,d1)=(-1,1)
d0
Goal: pascal(X)
0
1
2
3
4
5
6
0
1
1
1
1
1
1
1
-1
1
2
3
4
5
6
7
-2
1
3
6
10
15
21
28
-3
1
4
10
20
35
56
84
d1
-1
Dimensions:
1
Figure 3: Pascal's triangle on a 2-dimensional spreadsheet
dimension (dimension 2) is orthogonal to the spreadsheet plane. It is possible that
the initial con guration of the game is as displayed in Figure 4-a). Supposing that
the organisms are dead at all cells outside the boundaries of the spreadsheet, the
second stage of the game is as displayed in Figure 4-b). Dimensions refers to the
remaining dimensions, in this case the dimension 2. The canonical instances of the
goal <- organism(X) can be produced using the information provided by Origin and
Dimensions.
Complicated goals can also be given: for example, the goal <- organism(X),
rest2 organism(X). It says that \Display the values X such that organism is true of
those values at two consecutive moments in time." As a result of such a goal, the cell
(0; ?1) would be left blank in the spreadsheet display, using Origin: (d0,d1) = (0; 0)
and Dimensions: (d2)=(0). If the goal involves more than one variable, the choice of
the variable for the display should be made speci c by the user.
1516
Origin: (d0,d1)=(0,0)
d0
1
2
3
4
5
6
7
0
dead
dead
dead
dead
dead
dead
dead
dead
-1
dead
alive
dead
alive
alive
dead
alive
dead
-2
dead
alive
dead
dead
alive
dead
dead
dead
-3
dead
alive
alive
alive
dead
alive
alive
dead
-4
dead
dead
dead
dead
dead
dead
dead
dead
Origin: (d0,d1)=(0,0)
d0
Dimensions: (d2)=(1)
Goal: organism(X)
0
1
2
3
4
5
6
7
0
dead
dead
alive
alive
alive
alive
dead
dead
-1
alive
dead
dead
alive
alive
dead
dead
dead
-2
dead
alive
dead
dead
dead
dead
dead
alive
-3
alive
alive
alive
alive
dead
alive
dead
dead
-4
dead
alive
dead
alive
alive
alive
alive
dead
d1
(b)
Goal: organism(X)
0
d1
(a)
Dimensions: (d2)=(0)
Figure 4: The rst two stages of the game of life
1517
It is possible for the user to enter speci c goals at individual cells, overriding
the global goal <- organism(X). It is also possible to exploit the inherent nondeterminism in logic programming. If we use a multiple-valued predicate as the
spreadsheet predicate, we can simply request another value for any given individual
cell. This would not be possible in traditional spreadsheets.
6 Conclusions
Our work on MLP is closely related to InTense [12] and it provides a sound theoretical basis for the language and proposes a novel spreadsheet interface. The proof
procedure of InTense has been formalized in this paper for the rst time. We have
the completeness result for MSLD-resolution based on ML(n) for any given n 0;
it is based on the idea of the equivalence between a given program P and the set of
canonical instances of program clauses in P.
Implementations of MLP rely on MSLD-resolution for correctness. For eciency,
we must combine features of logic programming (Prolog) implementations with features of data ow implementations (associative memory, tagging) such as those of
Lucid [4]. Mitchell [11] reports on an implementation of InTense, based on an extension of the Warren Abstract Machine (WAM) with an associative memory in which
contexts are used as tags on atoms. Rolston [18] outlined an eductive evaluation
mechanism for logic programming, which can also be used to implement contextual
extensions such as MLP. Contextual extensions of logic programming o er an extra
form of parallelism, which we call context-paralellism, in addition to the standard
AND- and OR-parallelism. We believe that context-parallelism can be e ectively
exploited in a parallel implementation. Further research continues in this direction.
Acknowledgements
The work of Weichang Du was supported in part by NSERC of Canada under a research grant. Thanks are due to three anonymous referees for their helpful comments.
1518
References
[1] M. Abadi. The power of temporal proofs. Theoretical Computer Science, 65(1989):35{
83, 1989.
[2] M. Abadi and Z. Manna. Temporal logic programming. Journal of Symbolic Computation, 8:277{295, 1989.
[3] T. Aoyagi, M. Fujita, and T. Moto-oka. Temporal logic programming language Tokio.
In E. Wada, editor, Logic Programming'85, volume 221 of LNCS, pages 138{147.
Springer-Verlag, 1986.
[4] E. A. Ashcroft, A. A. Faustini, and B. Huey. Eduction: A model of parallel computation
and the programming language Lucid. In Proc. of Phoenix Conference on Computers
and Communications, pages 9{15. IEEE Computer Society Press, 1985.
[5] Philippe Balbiani, Luis Fari~nas del Cerro, and Andreas Herzig. Declarative semantics
for modal logic programs. In Proceedings of the 1988 International Conference on Fifth
Generation Computer Systems, pages 507{514. ICOT, 1988.
[6] M. Baudinet. Temporal logic programming is complete and expressive. In Conference
Record of the Sixteenth ACM Symposium on Principles of Programming Languages,
pages 267{280, Austin, Texas, January 1989. The Association for Computing Machinery.
[7] B. F. Chellas. Modal Logic: An Introduction. Cambridge University Press, 1980.
[8] Luis Fari~nas del Cerro. MOLOG: A system that extends PROLOG with modal logic.
New Generation Computing, 4:35{50, 1986.
[9] D. M. Gabbay. Modal and temporal logic programming. In A. Galton, editor, Temporal
Logics and Their Applications, pages 197{237. Academic Press, 1987.
1519
[10] R. Hale. Temporal logic programming. In A. Galton, editor, Temporal Logics and
Their Applications, pages 91{119. Academic Press, 1987.
[11] W. H. Mitchell. Intensional Horn clause logic as a programming language { it's use and
implementation. Master's thesis, Department of Computer Science and Engineering,
Arizona State University, Tempe, Arizona, 1988.
[12] W. H. Mitchell and A. A. Faustini. The intensional logic language InTense. In Proceedings of the 1989 International Symposium on Lucid and Intensional Programming,
Arizona State University, May 8 1989.
[13] B. Moszkowski. Executing Temporal Logic Programs. Cambridge University Press,
1986.
[14] M. A. Orgun and W. Ma. An overview of temporal and modal logic programming.
To appear in Proc. of ICTL'94: First International Conference on Temporal Logic,
Gustav Stresemann Institut, Bonn, Germany, July 11{15 1994. Springer-Verlag.
[15] M. A. Orgun and W. W. Wadge. 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, 1992.
[16] M. A. Orgun and W. W. Wadge. Towards a uni ed theory of intensional logic programming. Journal of Logic Programming, 13(4):413{440, August 1992.
[17] M. A. Orgun and W. W. Wadge. Chronolog admits a complete proof procedure. In
Proceedings of the Sixth International Symposium on Lucid and Intensional Programming, pages 120{135, Universite Laval, Quebec City, Quebec, Canada, April 26{27
1993.
[18] D. W. Rolston. Parallel Logic Programming Using an Intensional Model of Computation. PhD thesis, Department of Computer Science and Engineering, Arizona State
University, Tempe, Arizona, 1992.
1520
View publication stats