Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/277892587

Description Logic as Programming Language

Conference Paper · October 2014


DOI: 10.1145/2661136.2661139

CITATIONS READS
0 52

1 author:

James Skene
Auckland University of Technology
28 PUBLICATIONS   991 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

TAPAS - Trusted and quality-of-service Aware Provision of Application Services View project

All content following this page was uploaded by James Skene on 24 May 2016.

The user has requested enhancement of the downloaded file.


Description Logic as Programming Language

James Skene
Auckland University of Technology, New Zealand
jskene@aut.ac.nz

Abstract controlling what calculations a computer completes. Why


This paper introduces the use of Description Logic as a pro- might this be a good idea?
gramming language, giving: a logic with appropriate con- Many programming languages, modelling languages and
cept constructors and sentential forms; some example pro- data representations give programmers the opportunity to
grams; requirements for the results of program execution; a base their designs on what they know of the kinds of en-
tableau algorithm that provably produces the desired results; tities that are present in the domain that they are working
principles for discarding sentences once no longer needed with – and the structure and relationships those entities have.
so that algorithms that take more time than space can be im- By breaking down large or complex programming problems
plemented; a worked example of program execution; and a along these lines they can be addressed in a piecemeal fash-
discussion of outstanding theoretical challenges. ion, building software for each part according to the pro-
grammer’s understanding of it and verifying that it operates
Categories and Subject Descriptors D.3.1 [Programming according to expectations before tackling the larger prob-
Languages]: Formal Definitions and Theory lem in aggregate. This is a data-oriented, modular, or even
declarative view of programming. The other popular way to
Keywords Programming Languages; Description Logic. decompose programming problems is in terms of what se-
quences of actions need to be accomplished and their or-
1. Introduction ganisation into processes and procedures – the imperative
Description Logic (DL) is a family of logics, formed by viewpoint. Nowhere have these two approaches been com-
picking different basic constructors, but all based on the bined more successfully than in modern Object-Oriented
idea that objects can be described in terms of the concepts (OO) programming languages, which typically permit state-
that they participate in – essentially propositions such as ments of two kinds, describing the allowable structure and
Dog(fred), which asserts that the author’s dog Fred is a relationships of objects on the one hand, using types, asser-
dog – and binary relationships between them called roles, tions and other specification elements, and giving commands
e.g. Owner(james, fred). Constructors, such as intersection to cause objects to be created and operate within these con-
written u, build more complex concepts for use in assertions straints on the other.
such as (Dog u Female)(fred), to state that Fred is both We know from languages such as Smalltalk and Javascript
a dog and female. DLs are used in applications such as that declarative elements are inessential to object-oriented
medical ontologies and the semantic web [11]. For example, programming. Programs can give the steps to build an ob-
in a sufficiently expressive DL we can state that all websites ject rather than a type specification of what parts it has. On
about dogs are about pets and that the author’s website is the other hand, maybe programming can be accomplished
about Fred – known to be a dog – and now when you ask only by describing the types of objects needed – perhaps
for all pet websites, you should get the author’s website standing for actions where necessary – and allowing the ex-
among others. Clearly DLs have their place in applications, ecution environment to infer the results of execution from
but the topic of this paper is how to use a DL as a basis for this information? This work started from that question, and
in this paper we show how a particular DL, which we call
ALP, captures the semantics of domains of objects in a way
Permission to make digital or hard copies of all or part of this work for personal or that makes this kind of programming possible.
classroom use is granted without fee provided that copies are not made or distributed Although expressive, ALP lacks the features that a pro-
for profit or commercial advantage and that copies bear this notice and the full citation
on the first page. Copyrights for components of this work owned by others than ACM grammer would expect from a full-blown language for any
must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, real practical purpose. However, we can show two impor-
to post on servers or to redistribute to lists, requires prior specific permission and/or a
fee. Request permissions from permissions@acm.org. tant things. First, a tableau algorithm applied to programs
Onward! 2014, October 20–24, 2014, Portland, OR, USA. written in this language will generate explicit representations
Copyright c 2014 ACM 978-1-4503-3210-1/14/10. . . $15.00.
of the corresponding domains of objects – and some easily-
http://dx.doi.org/10.1145/2661136.2661139
justified and independent assumptions suggest this should Beyond this in Section 7 we discuss what remains to be done
be the goal of execution. Second, because descriptions of to prove that the language can be executed efficiently.
some objects become available sooner than others during ex- In Section 8 we present a fully worked example of pro-
ecution, and their influence over their neighbours is finite, gram execution. This was accomplished with the aid of
such an algorithm can output and discard information as it a prototype implementation, the performance of which is
progresses. This allows the tableau algorithm, more usually briefly mentioned.
a theorem-proving approach that delivers a result only on This work stands at the intersection of research concern-
termination, to be adapted to serve as the engine for long- ing programming languages, program specification and De-
running and even non-terminating calculations. scription Logics. In Section 9 we discuss related work in
Clearly what we propose differs considerably from a con- these contexts. It is not the first work to consider DLs in a
ventional view of OO programming, discarding – for the programming context. Efforts have been made to integrate
time being at least – ideas such as encapsulation and mes- Description Logic with rule-based logic programming and
sage passing that might be considered essential when dis- the closed-world assumption, resulting in the field referred
cussing object-orientation. But it nevertheless retains the to as Description Logic Programming. In contrast, our work
idea that programming can be accomplished by capturing the demonstrates that general purpose programming is possi-
characteristics of domains of – for want of a better word – ble using Description Logic alone. This results in a logic-
objects. Programming using a DL in this way is also similar programming language with an open-world assumption, and
but distinctively different to traditional declarative program- a form other than Horn clauses.
ming paradigms, in which programs are given using other
sorts of abstractions: functions, equations or rules of infer- 2. A Description Logic for programming
ence. 2.1 Abstract syntax
But why bother, other than as an academic exercise to es-
As is usual with DLs, ALP consists of a concept language
tablish a kind of equivalence between imperative and declar-
establishing the membership of complex concepts in terms
ative descriptions of objects? Beyond supporting program-
of participation in more primitive concepts, and relationships
mers who might prefer to express themselves in this way
defined by roles. Various sentential forms can then be de-
rather than some other, the possible benefits include facilitat-
fined to describe constraints on a domain in which objects
ing software development processes that progress – at least
participating in those concepts may reside.
initially – by refinement of specifications, such as Model-
Given an infinite alphabet of atomic concepts {A, B, . . .}
Driven Architecture (MDA) [4]. Because specification lan-
and another of atomic roles {P, Q, . . .}, the concept lan-
guages such as UML class diagrams [13] that are used early
guage for ALP is constructed according to the following
on in these processes cannot later be executed, at some point
syntax.
they must switch to a programming language, usually an im-
perative one. If instead an interpreter could reason with the
specification, automatically creating systems of objects with C, D → > | ⊥ | A | ¬C | (C u D) | (C t D) |
the intended structure, this switch could be avoided. ∃R.C | ∀R.C | #R ≤ 1 | #R > 1 | R ⊆ S
These potential benefits would be unrealistic if DLs were
without merit for actually writing programs, and therefore R, S → P | R ◦ S
nobody would wish to go on to develop a practical language
on these foundations. But in fact ALP seems to have some
nice properties in terms of the economy and flexibility with We call a concept that is not an atomic concept a complex
which abstractions can be defined and combined. We do not concept. More specifically, ¬C is a complement, (C u D)
attempt to systematically examine or prove the benefits of a intersection, (C t D) a union, ∃R.C an existential quan-
the language in this paper. However, after describing ALP tification, ∀R.C a value restriction, #R ≤ 1 a maximum
formally in Section 2, we give a number of examples in number restriction, #R > 1 a minimum number restriction,
Section 3 that show what can be achieved. We also draw and R ⊆ S a containment role-value map. > is the top con-
some parallels with features of other languages. cept and ⊥ the bottom concept. If a role is of the form R ◦ S
Then in Section 4 we give detailed requirements for exe- then it is a composite role.
cutions based on the idea that required categories of objects Sentences for our purposes are of four kinds. Given a
in domains described by ALP programs should be enumer- set of instance variables {a, b, . . .} we can make: instance
ated along with their necessary features. In Section 5 we assertions of the form C(a); role assertions of the form
present our first main theoretical result, that a tableau algo- R(a, b); role denials of the form ¬R(a, b); and inequalities
rithm will provably deliver these results. Our second theoret- of the form a 6= b. We state that a program K is a non-empty
ical contribution is to show in Section 6 how outputs can be ordered sequence of sentences.
generated and memory reclaimed as execution progresses. Given a sentence p let V(p) be the set of instance vari-
ables involved in p, determined as follows: V(C(a)) = {a};
V(R(a, b)) = {a, b}; V(¬R(a, b)) = {a, b}; and V(a 6= Note that such programs cannot be satisfied by any domains,
b) = {a, b}. Given a program K and instance variable a we since a domain would have to contain an object to be as-
call the subset of sentences in K involving a the subprogram signed to the instance variable ai , but this object cannot also
for a, i.e. K(a) = {p ∈ K | a ∈ V(p)}. be a member of the bottom concept ⊥ since that concept is
defined to be empty.
2.2 Descriptive semantics The semantics of ALP can alternatively be given by
The semantics of the concept language are given by an translating the language into First-Order Logic with equality
interpretation function ·I mapping concepts to subsets of the (FOL); a straightforward translation maps atomic concepts
domain of the interpretation >I (the interpretation of the top to unary relations and roles map to binary relations.
concept in I), and roles to subsets of the pairs >I × >I .
Any interpretation of complex concepts must satisfy the 3. Programming with ALP
following constraints: What can be done with the formal elements defined in the
previous section? First, supposing that we restrict ourselves
⊥I = ∅ to a single instance variable, atomic concepts and the usual
propositional operators (u, t, ¬) then we have the same
(¬C)I = >I \ C I
power to describe a single subject that propositional logic
(C u D)I = C I ∩ DI gives us.
(C t D)I = C I ∪ DI
(∃R.C)I = {oa ∈ >I | ∃ob .((oa , ob ) ∈ RI ∧ ob ∈ C I )} (Dog u (¬Awake t Hungry))(fred)
(∀R.C)I = {oa ∈ >I | ∀ob .((oa , ob ) ∈ RI → ob ∈ C I )} Here we intend to state that Fred is a dog and if she is
(#R ≤ 1)I = {oa ∈ >I | |{ob | (oa , ob ) ∈ RI }| ≤ 1} awake she is hungry. The conventional symbols of Descrip-
(#R > 1)I = {oa ∈ >I | |{ob | (oa , ob ) ∈ RI }| > 1} tion Logic are not much fun to read or write, so here is an
(R ⊆ S)I = {oa ∈ >I | ∀ob .((oa , ob ) ∈ RI → (oa , ob ) ∈ S I )} equivalent program in the concrete syntax of our interpreter.
(R ◦ S)I = {(oa , ob ) ∈ (>I × >I ) | (Dog and (not Awake or Hungry)) (fred)
I I
∃oc .((oa , oc ) ∈ R ∧ (oc , ob ) ∈ S )} The sense in which this is a description of a domain of
objects is given by the descriptive semantics. For a given
situation that you can conceive of as a set of objects (come
An interpretation I satisfies a program K iff there exists to the author’s house and look around for example), that
an assignment function ·A from a superset of V(K) to the situation is described by the program if you can match up
elements of >I such that the following constraints are met an object to the instance variable fred such that you judge
for every sentence p ∈ K dependent on the form of p. the object to be a dog that either is not awake or is hungry
(or possibly both, but not neither). Note that due to the
p∈K Constraint
open-world nature of the language, lots of possible situations
C(a) aA ∈ C I might be described by the same program: maybe next door
R(a, b) (aA , bA ) ∈ RI has a hungry dog also – note the name of variable (and hence
the dog) should be irrelevant to our thinking about what is
¬R(a, b) (aA , bA ) 6∈ RI
described, only the concepts are significant. Note also that
a 6= b aA 6= bA in OO terms, the subprogram for fred (namely all of the
sentences involving the fred instance variable, in this case
If an interpretation I satisfies a program L then infor- the single sentence making up the whole program) can be
mally we state that the domain >I conforms to K, or alter- thought of as either an object (representing Fred the dog
natively that K describes the domain. We freely interchange specifically) or a class, because if we went to a home for
the terms domain and interpretation when discussing the ob- stray dogs it would be described by the program even if it
jects that a program might describe, on the basis that there contained multiple hungry dogs. We would just have to pick
is normally a reason for judging that some real or imaginary one and say ‘that is fred’.
objects (the domain) participate in certain concepts (the in- In what sense is this a program? Suppose that at runtime
terpretation). For example, the author’s dog can be consid- more information about Fred’s status is supplied as input
ered to participate in some concept Dog because she is a in the form of an additional fact, Awake (fred). Now the
dog. subprogram for fred is as below.
Given two programs K and L we state that K entails L,
denoted K |= L iff for every interpretation I then I satisfies (Dog and (not Awake or Hungry)) (fred)
Awake (fred)
K iff I satisfies L.
A program K is inconsistent if it contains a sentence We can reasonably expect an interpreter for ALP to do
⊥(ai ) or entails a program L containing such a sentence. some work for us at this point. We actually want to know
all about Fred in a convenient form. The subprogram above into intersections (u) during parsing, with braces to control
gives everything we know about Fred, but not very clearly. precedence.
Is Fred hungry or not? We might expect the interpreter to ComputerScientist
reformulate the subprogram into the following: some owns {
Dog (fred) Dog
Hungry (fred) Female
Awake (fred) }

This is computation in the same sense that another lan- We had some conceptual modelling choices to make
guage might calculate from the expression 1 + 2 the value 3 when writing this program. We have chosen to represent
yielding a result equal to the original but more explicit. What Fred’s doghood by an atomic concept, but could equally
it means to be explicit in the context of ALP is discussed in have expressed it in terms of her relationship to the author,
more detail in the next section, but note that achieving it in i.e. she is his dog.
this case requires some non-trivial work on the part of the ComputerScientist
interpreter – in particular the possibility that Fred is simul- some dog Female
taneously both awake and not awake must be investigated,
Now we have lost the concept of ownership from the
found to be inconsistent and discounted.
model. Maybe it was significant, in that everything the
Now let us look at a system of two objects – the author
author owns is shabby, including poor Fred. We can get
and his dog. We could use an extra variable james by adding
back the ownership role for fred using a role-value mapping
a role assertion owner(james, fred) to the program for this
dog ⊆ owns, which in the concrete syntax is represented us-
purpose, but instead we will shift the focus of the program
ing a colon, and may be interpreted as ‘the author’s dogs are
to the author.
things he owns’. The rule about the condition of the things
(ComputerScientist and the author owns can be stated using a value restriction (∀).
some owns (Dog and Female)) (james)
all owns Shabby
Here some owns (Dog and Female) is the concrete syntax some dog Female
equivalent of ∃owns.(Dog u Female). Note that the instance dog : owns
variable fred has disappeared, and Fred’s existence is merely Here dog : owns is acting a bit like a type declaration for
implied by the description of james. But we will expect a field in a traditional OO language, or alternatively like the
the interpreter to make Fred’s existence explicit again by statement that the class of dogs of the author is a subclass of
inventing an instance variable to represent Fred and using the things he owns. The value restriction works like a class
it in sentences that describe Fred directly. We will come to definition, in that it gives at least part of the nature of what he
refer to each subprogram calculated as an output, so this owns without stating that he owns anything. The subprogram
program will have two as follows. . . for the dog will now look like this on output:
ComputerScientist (james) Shabby (a 2)
owns(james, a 2) Female (a 2)
. . . and. . . dog(a 1, a 2)
owns(a 1, a 2)
Dog (a 2)
Female (a 2) Multiple value restrictions may be applied to an instance
owns(james, a 2) across any and each of several roles. Perhaps the author
adopts the policy of only owning female dogs. If we express
Fred is now represented by the automatically generated
this rule using a value restriction, then it is only necessary
variable a 2 – but as we have stated the choice of variable
to state that he owns a dog, with no more information given
name is not meaningful. During execution the processing of
about it. Here something represents the top concept >.
the existential quantification (∃) will act a bit like the new
operator in an object-oriented program, causing something all owns Shabby
that we know must exist to occupy some space in working all dog Female
memory. Since we can always use this trick (and others) to some dog something
dog : owns
generate multiple objects, our interpreter only accepts a sin-
gle (usually complex) concept as input, which it assumes ap- This demonstrates a pleasing compositional nature for
plies to an instance a 1. Programs may therefore be written ALP programs. If we discover more facts about the enti-
using only the concept language of ALP not the sentential ties being described, they can be added providing they are
forms, although these will appear in output. We would pre- consistent with what has already been stated. For example,
fer to give the program above as follows, taking advantage maybe the author does not care to bathe dogs. We could ap-
of some syntactic sugar that groups consecutive concepts pend all dog Dirty to the above program and then Dirty (a 2)
would form part of the output. This hints at possible uses for be qualified as a dog, giving rise to a subprogram a 4 for her
this kind of language in software engineering by refinement puppies eventually.
of specification. This program now models a dog dynasty extending in-
Although we expect the interpreter to generate a subpro- finitely into the future – among other possibilities, such as a
gram to represent Fred, having stated she exists, in fact the dog that is her own mother – and it may not be reasonable
above program states that the author has at least one dog, and to expect execution of it to terminate. It demonstrates where
therefore also describes situations in which he has more than a lot of the expressive power of ALP comes from, beyond
one (provided they are all shabby and female). This could propositional reasoning about individual instances. The con-
be corrected by a number restriction #dog <= 1, although cept dog.puppy : dog results in a composite role being rela-
this in no way globally restricts the total number of dogs, belled to an atomic one, fetching a new member of the clo-
only the relationship between owner and dog; the description sure of the relationship puppy back into a direct relationship
would still apply to other owners of of other dogs, provided dog with a 1, which then qualifies it with a description that
they each owned only one. Hence number restrictions do not again extends the graph of instances.
eliminate the class/object duality for subprograms, although Leaving dogs behind, can we now write more useful
the role dog now identifies one object from the perspective programs? Unfortunately ALP has no direct support for
of any object conforming to a 1. arithmetic, so conventional data processing is inconvenient.
Consider the following program, in which fred is now a But it is not impossible. In the following we define two
role rather than a variable. three digit numbers with the intention that each digit will be
#fred <= 1
described by a distinct subprogram, linked by the next role
some fred Female identifying the next more significant digit. The numbers are
fred : dog x = 210, y = 102.
#lassie <= 1 some x {
some lassie something Zero some next {
lassie : dog One some next {
Two all next nothing }}}
Now it seems reasonable enough to assume that the au-
some y {
thor has two dogs, Fred and Lassie, and instance variables, Two some next {
say a 2 and a 3 will be introduced to stand for them. And Zero some next {
such a scenario is described by the above program, but it One all next nothing }}}
also describes a situation in which the author has only one
dog that may be referred to as Fred or Lassie, and even one in Note the use of all next nothing to deny the existence of
which the author considers himself to be a dog and refers to more significant digits, with nothing representing the bottom
himself by those names. This because no logical reason has concept ⊥ that contains no objects. Now we will try to
yet been given for any objects to be distinct in the domain. add these two numbers together. To structure the algorithm
If necessary the program could be made somewhat less am- we will model things with the ability to add two digits
biguous by asserting #dog <= 1, forcing facts about Fred together, and other things that can recursively add two lists
and Lassie to be unified into a single subprogram, or alterna- of digits together, handling carry in from the addition of less
tively all all lassie not Female forcing them to remain apart. significant digits if necessary, and making use of the first lot
Here is a way to get a lot of dogs: of things. By analogy to digital electronics we will call these
half adders and full adders respectively. Here is a definition
all dog { for the half adders.
Female all ternary half adder {
some puppy something
} ({ all a Zero ({ all b Zero some r Zero some c Zero } or
dog.puppy : dog ({ all b One some r One some c Zero } or
some dog something { all b Two some r Two some c Zero }))} or
({ all a One ({ all b Zero some r One some c Zero } or
A reasonable execution strategy would be to invent a ({ all b One some r Two some c Zero } or
dog a 2 in relation dog(a 1, a 2) to the first object a 1, which { all b Two some r Zero some c One }))} or
now perhaps stands for the author or maybe just the situation { all a Two ({ all b Zero some r Two some c Zero } or
under discussion. This will then be qualified by the value re- ({ all b One some r Zero some c One } or
striction, resulting eventually in some puppy something(a 2) { all b Two some r One some c One }))}))
which will then yield puppy(a 2, a 3). Now because the }
role assertions dog (a 1, a 2) and puppy(a 2, a 3) hold then Apparently we are dealing with ternary (base 3) numbers.
dog.puppy(a 1, a 3) also holds and so the role-value map- We could now try to add the first digits of x and y together
ping can be applied to determine dog(a 1, a 3). Now a 3 can as follows. . .
#a half adder <= 1 next.r : r.next
a half adder : ternary half adder } or
x : a half adder.a {
y : a half adder.b // Or we are done and the carry is the msd
all a.next nothing
Here we do not need to say some a half adder something. all input adder.c all next nothing
This is because qualifying x with the role a half adder.a must input adder.c : r.next
result in an intermediate object, the half adder, being hy- })
pothesised. Subsequently we would expect the result to be }
given by a half adder.r with any carry out referred to by
a half adder.c. But in this case we would be disappointed. In full adder.next : full adder
fact, what would result are nine alternatives representing ev- adder : full adder
ery possible sum. This is because we have not yet stated that all adder some c in Zero
Zero, One, and Two are mutually exclusive concepts. What For simplicity this adder assumes its parameters have the
is needed is some type information for our numbers. same number of digits, but places no limit on what that
all ternary number { length might be. The first carry in is wired to Zero in the
definition of adder. Interestingly this is a generic adder – it
({ Zero not One not Two } or will add numbers with any natural base, but it needs to be
({ not Zero One not Two } or specialised with an appropriate half adder. This is another
{ not Zero not One Two })) example of the flexibility of abstractions in ALP.
#next <= 1
} ternary adder : adder
ternary number.next : ternary number ternary adder.half adder : ternary half adder

Now let us define z to be the result of adding x and y.


ternary half adder.a : ternary number
ternary half adder.b : ternary number #add x and y <= 1
ternary half adder.r : ternary number add x and y : ternary adder
ternary half adder.c : ternary number x : add x and y.a
y : add x and y.b
Equipped with half-adders we can can construct an adder add x and y.r : z
for any number of digits as follows.
The outputs of one possible execution of the above code
all full adder { (in fact that accomplished by our interpreter) are plotted
in Figure 1. The figure was generated from output of the
#c in <= 1 #a <= 1 #b <= 1 #r <= 1 #next <= 1
interpreter using dot [5] with some manual reformatting and
// Add the inputs removal of roles for clarity.
input adder : half adder
#input adder <= 1 4. Requirements for executions
a : input adder.a 4.1 Make required categories of objects explicit
b : input adder.b
We were vague in the previous section about what results an
// Add the carry in interpreter for ALP should produce from a program. Here
carry adder : half adder we look at that question more closely.
#carry adder <= 1 We assume that the programmer produces a description
input adder.r : carry adder.a of a domain of objects, using ALP or a derived language,
c in : carry adder.b with the intent that the results that it1 is interested in will be
exhibited in the common characteristics of the sets of real
// Result is the result of the carry adder
or imaginary objects that may be considered to conform to
carry adder.r : r
its description. By real objects we mean objects in the real
({ world that are being described, like the author. By imaginary
// Either there are more digits to process objects we refer to objects that are invented for the conve-
some a.next something nience of the programmer, like the half and full adders in the
// Next adder uses the same kind of half adder previous section.
next.half adder : half adder As we have seen the semantics of ALP do not constrain
a.next : next.a the identities of the objects in any domain that conforms to
b.next : next.b
input adder.c : next.c in 1 he, she, etc.
an ALP program. Therefore if any non-empty domain con-
a_1
forms then an unlimited number may be considered to do
add_x_and_y so, formed by the substitution of objects with different iden-
ternary_number ternary_number adder
x y full_adder tities but participating in the same concepts and roles. There-
ternary_adder
fore we must assume that whatever results the programmer
a_2 a_3
a_8
requires can always be stated in terms of the required cat-
Zero Two
egories of objects that a program plus its input entails, i.e.
a b
half_adder those categories of objects for which members can be found
input_adder
ternary_number in all domains conforming to the program. A category of
z
a_10 c_in objects can be identified by a set of criteria X (not neces-
carry_adder
sarily expressed in ALP) that we can match objects against,
r
half_adder such that to belong to the category an object must meet ev-
a_14 a_26
ery criterion in the set. For example, the author’s dog is in a
next next next
Two Zero
category X = {is a dog, is female}. If we avoid specifying
a b equivalent criteria, we can make the category more specific
by adding a criterion to the the set, is shabby, for example,
c a_20
a_18
Zero and more general by removing one.
Why focus only on required categories of objects and
c r
their common characteristics and not on objects and their
a_4 a_6
a_28
a_19 characteristics that might be present in some domains of
One Zero Two
objects conforming to a description but not others? Given
a b
half_adder a conforming domain for an ALP program we can add
input_adder
unrelated objects or indeed involve objects and their relatives
a_36 c_in in irrelevant concepts and relationships without affecting the
domain’s ability to satisfy the program, so since the program
carry_adder
r
half_adder doesn’t make these details relevant we must assume that they
a_51 a_17
are irrelevant.
next next next next
One Zero ALP programs must contain at least one sentence that
a b
must involve at least one instance variable, so every consis-
tent program requires at least one object in any conforming
c a_66
a_40
Zero
domain (to be assigned to the variable), and therefore defines
at least one required category of objects. Probably the least
c r interesting ALP program possible is {>(a)}, which only
a_5 a_7 a_65
establishes that in conforming domains a minimum of one
a_84
Two One One
object must exist, without saying any more about it. More
half_adder specific programs can also be written, for example {A(a)},
a b
input_adder
as can programs implying more than one required category,
a_90 c_in for example {A(a), ¬A(b)}.
The objective of executing such a program is therefore to
carry_adder
r help the programmer – or a subsequent automated system
half_adder

that relies on the output of execution – to understand clearly


a_95 a_52
next
Zero Zero what it is that they want to know in relation to the required
categories of objects implied by a program plus its input,
a b
which we assume is provided at runtime in the form of
c a_115 additional sentences. As we saw in Section 3 this might
c a_92
Zero
require some reformulation, but into what form?
r We assume that the programmer would prefer as output
a_112
statements enumerating the required categories of objects
Zero implied by a program and itemising the criteria identifying
next
those categories. We justify this assumption somewhat by ar-
guing that results will be more understandable in this form.
a_96 The required categories should be enumerated so none will
One
be overlooked, nor any spurious categories assumed. Each
Figure 1. Instances in the addition of two ternary numbers. criterion should be given in a clear way in relation to a puta-
tive member of a category (see below). Once a program plus it, by writing a program the output of which models a stream
its input is in this form there will be a straightforward proce- of symbols, for example.
dure for checking – or possibly constructing – a domain for
conformance: for each required category, identify the pres- 4.2 Avoid redundant output
ence in the domain of a conforming object; and to ensure an Sometimes execution should forego outputting a required
object conforms just ensure that it meets each of the criteria category of objects. Since any category identified by n cri-
identifying the category. teria has at least 2n − 1 generalisations (before we consider
We expect that the programmer will prefer the criteria how further generalisations could be produced by reformu-
used to identify the outputs to be decomposed into a few lating the criteria) we do not want to waste time describing
short general statements. Considering two statements p and results in a manner that is more general than the programmer
q each giving a criterion that an object should meet to be intended.
considered a member of a category, p is more general than If we have two categories of objects, identified by sets of
q iff q describes a subset of the objects that p does. In so criteria X and Y , and X is a generalisation of Y because a
far as more general criteria constrain objects less and hence proper subset of Y , then X should not be output according to
convey less information than more specific constraints, we the following argument. If there is not a category of objects
expect that p is easier to understand than q. For example in all conforming domains that are members of X but not
A(a) is a more general constraint over objects assignable to also Y , then X need not be output on the basis that it merely
a than (A u B)(a). It is also shorter and easier to understand. omits detail, and what it does contain will be given by the
If in fact {(A u B)(a)} held then we would prefer to output output of Y in any case. If in every conforming domain there
{A(a), B(a)}. The hoped-for advantage of this policy is that are some objects in X but not in Y then the more general
the more general statements should individually be more category X seems to have some significance. But these other
easily understood, and once apprehended individually, their objects form a second more specific category Z such that Y
effect in combination can then be understood – and that and Z partition X, and the additional criterion in Z is that
this leads to an understanding of a result more readily than at least one criterion from Y is not satisfied. As required
attempting to instead digest the implications of fewer more categories, Y and Z must both be output (assuming they
complex statements. themselves cannot be made more specific). Should we then
Shorter statements have the advantage over longer ones describe the more general category X? It would be a waste
that they require less effort (individually) to parse, and for of time to do so, since the details of its criteria are a subset
this reason we would also prefer output to be shorter where of those already given for Y and Z, and no object identified
possible. Similarly if there is a choice between larger or by X has an existence independent of its membership of
smaller sets of statements, the smaller set should be pre- either Y or Z. We will overlook for now the possibility of
ferred. There is clearly a tension in our requirements. Pre- outputting X in order to simplify the presentation of Y and
ferring multiple short, general statements means accepting Z.
that more statements will need to be output. A balance must Thus it is more accurately the task of execution to iden-
be struck bearing in mind that the overall objective is to con- tify all, and preferably only (but see below), the maximally
vey the results in a manner that is easy to understand, and specific required categories of objects – those at the lowest
perhaps also further process. possible level of abstraction. If the programmer is in fact in-
Therefore the activity of executing a program of this terested in some generalisation of these then outputting their
kind will be characterised by the occasional emission of criteria will provide a superset of what was desired.
statements to the effect that a distinct required category of
4.3 Deliver results when ready
objects has been identified, and what criteria identify the
category. Execution can conclude only once descriptions of Programs might run for a long time, but often to be useful
all such categories implied by the program and its input have should deliver some results before they terminate. For ex-
been produced. The conclusion of execution thus permits ample, this is the case for interactive programs, which must
the inference that any category that has not been output is alternate outputs with the receipt and processing of input.
not required by the program. This general characterisation of This raises several challenges for programming in the man-
execution requires several qualifications to be fully practical, ner that we are considering. First, interesting domains of ob-
dealt with in the next few sections. jects will usually consist of collections of related objects. If
It is reasonable to suggest that the job of a computer pro- every object in a category X must be related to an object in
gram is to produce exactly the output that the programmer category Y , then a full description of X must include one
requires in whatever language of symbols it prefers, and that of two things: either a full description of the criteria gov-
outputting descriptions of objects falls short of this. How- erning Y , so that when presented with a putative member of
ever it should be clear that this more general kind of output X we can check that it is related to an appropriate object; or
could be obtained from execution as we have characterised alternatively the criteria in X must make reference to the cat-
egory Y for the same reason, but now to determine whether
an object is in X we must refer to the criteria reported for Y However, in the face of these negative general results we
as well. can look for special cases that we can handle well never-
The latter option must be preferred. If we chose the for- theless, and relax our requirements somewhat. An impor-
mer it would be impossible to output X until the criteria tant special case is that when an output depends on facts
governing Y had been fully calculated. Since all objects de- that are obviously inconsistent, because they contain an ex-
scribed by a program will be in the service of some overall plicit statement indicating a contradiction for example, then
system we anticipate that all required categories of objects it should clearly not be emitted, and in fact execution should
in typical programs will tend to be related to all others tran- cease for that line of reasoning since no good outputs will
sitively, so unless cross-references are used then no output subsequently be found.
could be produced until execution had completed. When might it be clear that an output can be safely emit-
A second consideration is that if the criteria identifying ted, without a contradiction subsequently being discovered?
a category will be output before execution terminates then For many outputs the answer may well be only on conclu-
ideally it will be with the guarantee that subsequent execu- sion of execution, since once an output is ready the remain-
tion will not find a refinement of this category, and more- ing program may have a sophisticated task to perform and
over that the program will not be found to be inconsistent. determining that no contradiction will subsequently arise is
In the former case the criteria should not be output yet, since essentially the same problem as verifying the program over-
the category will subsequently be replaced by a more spe- all, which as we prove above is impossible in general.
cific one. In the latter case the criteria should not be output However, we can argue that the requirement is too strong.
at all since the program can have no results, there being no Suppose that a required category of objects X has been cal-
domains that can conform to the impossible description pro- culated from a program K, but subsequently some other re-
vided by the program. Noting that we want our language to quired category Y is found that is identified by contradictory
be Turing complete, to avoid restricting the functions that criteria, and so can contain no objects. Now it is known that
can be calculated, neither of these decisions can be made in there is no domain satisfying K. But what is invalid about
general according to the following pair of theorems. the category of objects described by X may only be that
they are required to coexist with the impossible objects in
Theorem 1. Given a program K written in a Turing-
Y . So it does not seem unreasonable that the execution of K
complete DL, and a set of criteria X that identifies a re-
might output X on a tentative basis prior to calculating Y ,
quired category of objects in domains conforming to K,
and this might even be useful, provided that the programmer
there is no way in general to decide if K is consistent before
understands that later the overall description of the domain
outputting X.
may prove to be illogical. Programs can do useful work even
though they subsequently crash.
Proof. Suppose we could tell whether K were consistent What remains is determining whether X is ready in
before outputting X. The language is Turing-complete, so the sense that it will not be subsequently refined. Here
given an arbitrary Turing Machine (TM), M , we could pro- we weaken the requirement that execution finds only the
duce a program modelling M , adapted so that if M enters maximally-specific required categories of objects providing
a halting state then the program is inconsistent. The criteria it still finds all of them and not too many surplus gener-
for X will also be given literally in the program, so an early alisations. And assuming that execution has decided that a
action on executing the program would be to output X, pro- required category of objects X exists and has started ac-
vided only that the TM will not halt. Otherwise, execution cumulating its identifying criteria then X should be output
would continue without outputting X. But then, by observ- once no more criteria will be found for it. Any determination
ing whether X is output or execution continues we could tell that this point has been reached must be based on an anal-
whether M would halt, and hence have a means to answer ysis of how pending processing might come to modify the
the halting problem. But the halting problem is undecidable category, and once these possibilities have been discounted
in general, so there can be no general mechanism for deter- then the category can be output.
mining whether K is consistent before outputting X.
4.4 Dealing with alternatives
Theorem 2. Given a program K written in a Turing- An ALP program can, through the use of unions, specify
complete DL, and a set of criteria X that identifies a re- several alternative possible structures for a conforming do-
quired category of objects in domains conforming to K, main, in terms of what required categories of objects are
there is no way in general to tell if X will subsequently be present and their interrelationships. For example, the pro-
refined before outputting X. gram {((A u ∃R.B) t C)(a)} describes either domains con-
taining objects related by R and participating in concepts
Proof. The proof is as above, except that in K, if the TM A and B or singletons participating in C. On the one hand,
enters a halting state then instead of an inconsistency arising, it seems like neither of these alternatives can be regarded
a criterion is added to X. as required since the other might hold. However, the pro-
gram nevertheless establishes maximally specific required brought to bear to write programs that will do useful work
categories of objects, expressible disjunctively, since in any on a conventional modern computer. There are at least three
conforming domain there must be a category of objects de- important aspects to this. First, for any well-understood al-
scribed by either {A(a), R(a, b)} or {C(a)} and another gorithm a theoretically equivalent implementation should be
given by either {B(b), R(a, b)} or {C(b)}. These categories available in the language, in terms of both functionality and
are formed by pairing up criteria for categories from each limits on time and space utilisation as functions of some
alternative domain according to the following intuition: if measures of the input. Usually a claim that an algorithm has
we do not see an object from a category required in the first O(f (x)) time complexity and O(g(x)) space complexity is
alternative, then the second alternative must hold so we will based on a machine model featuring random access mem-
see an object from one of its categories – and vice versa. ory and the ability to perform certain arithmetic functions in
This presents a problem, since the number of maximally constant time within bounds [16]. So a possible theoretical
specific required categories for the program overall hence demonstration of this property for our language would be a
grows in proportion to the product of the number of cat- proof that it could simulate such a machine, in time propor-
egories in each alternative. There will therefore often be tional to the number of instructions executed, and space pro-
impractically many maximally specific required categories portional to the number of memory locations accessed. Since
where a program describes domains of several different most modern computers are random access machines this
structures. would also be a demonstration that the language was able
One answer to this problem is to require the programmer to utilise the hardware on which it was interpreted some-
to keep the number of results within bounds. One way to what effectively. It would also have the effect of proving the
achieve this is not to specify alternatives, or if they are weaker property of Turing completeness.
specified to ensure that one turns out to be inconsistent. Second, the overheads in such a demonstration need to
For example in the program {(A t B)(a), ¬B(a)} if B(a) is not only be constantly bounded (or nearly) per step or mem-
assumed then a contradiction is quickly discovered. This is a ory location, but affordable. For ALP or any high-level lan-
mechanism for achieving conditional computation in ALP, guage this depends not only on how efficiently results can
which we saw used in examples in Section 3. be calculated, both in theory and in terms of the quality of
In other cases both alternatives will remain open and the implementation of an interpreter, but also on the amount
the programmer may be legitimately concerned with the of performance overhead that the programmer is prepared to
details of both. In this case we expect that the program- accept in return for the advantages of writing its program in
mer will be prepared to accept descriptions of the cate- this way rather than some other, directly in machine code for
gories in each alternative, rather than all combinations of example. But if a language will hardly ever be used because
these. For our original example, one set of output might its programs run too slowly, that is clearly not good enough.
be {{A(a), R(a, b)}, {R(a, b), B(b)}} under the assump- And finally, notwithstanding that an equivalent imple-
tion (A u ∃R.B)(a); and the other set of output would be mentation, and even a fast one, might be available for any
{{C(a)}} under the assumption C(a). algorithm in the language, it should also be fairly obvious
In fact, execution generally will not be able to tell at the how to translate the description of the algorithm to obtain
point that an output is ready whether an alternative will re- such an implementation. We hope that this will be the case
main consistent or not, for reasons discussed above. So two for the kind of language that we are discussing, because im-
modes of execution are possible depending on what the pro- plementing the algorithm should be a matter of modelling
grammer wants: either results can be output immediately la- the entities and relationships given in the description of the
belled with the assumptions upon which they depend, in case algorithm, however presented. We saw this in the adder ex-
those assumptions later prove to be inconsistent in which ample in Section 3 where the structure of the algorithm was
case execution should signal this fact; or alternatively out- straightforwardly derived from domain knowledge of elec-
puts should be deferred until their assumptions are vindi- tronic adders and half adders. There is a sense in which the
cated when all corresponding alternatives are discovered to extent to which this property is established for a program-
be inconsistent. Other possibilities deserving future investi- ming language is a measure of its overall amenity for pro-
gation would be the ability to aggregate information where gramming, and evaluating this for ALP will go beyond what
several alternatives remain open (like some Prolog meta- we can accomplish in this paper.
predicates such as findall) or to select a main line of rea-
soning in preference to others (like Prolog’s ‘cut’ operator), 5. Executing ALP programs
but both of these would require a more expressive language.
5.1 Constructing semantic tableaux
4.5 Permit efficient implementations of Each instance variable in an ALP program establishes a
well-understood algorithms required category of objects, namely those that may be as-
A practical programming language should permit the body signed to it, and a set of criteria that those objects must meet,
of computer science knowledge relating to algorithms to be namely the semantic constraints corresponding to the sen-
¬>(a) C(a), ¬C(a) and retain that binding in the conclusion specification be-
M⊥1 M⊥2 low the line to yield conclusion sentences. Each conclusion
⊥(a) ⊥(a)
leaf for an M-rule is then the union of the conclusions with
R(a, b), ¬R(a, b) a 6= a the premise leaf (the M in the names of these rules stands
M⊥3 M⊥4
⊥(a) ⊥(a) for monotonic). In the rule Mt1 two leaves are formed con-
taining alternative conclusions shown separated by a bar (|).
(C u D)(a) ¬(C u D)(a) The conclusion for R#≤1 indicates that all occurrences of
Mu1 Mu2
C(a), D(a) (¬C t ¬D)(a) the variable c in the premise leaf are replaced with b. The
premise p for the rule M◦2 must be one of the following
(C t D)(a) ¬(C t D)(a)
Mt1 Mt2 sentences: ∀Q.C(a), Q ⊆ U (a), ¬Q(a, d), #Q ≤ 1(a),
C(a) | D(a) (¬C u ¬D)(a) ∃Q.C(a), where Q = R ◦ S or Q = R ◦ S ◦ T , referred to as
∃R.C(a) ¬∃R.C(a) the guard for the rule. In the rules M∃1 , M#>1 , M⊆2 and M◦1
M∃1 M∃2 that have instance variables in their conclusions that do not
R(a, b), C(b) ∀R.¬C(a)
appear in their premises, the new variables must be bound to
∀R.C(a), R(a, b) ¬∀R.C(a) literal instance variables that are not used in any sentence in
M∀1 M∀2 the premise leaf.
C(b) ∃R.¬C(a)
A rule may only be applied for a given binding of
#R ≤ 1(a), R(a, b), R(a, c) ¬#R ≤ 1(a) premises it is not then also possible to bind the conclusions
R#≤1 M#≤2
b/c #R > 1(a) to the premise leaf (matching bound variables and binding
any yet unbound) before the binding of new instance vari-
#R > 1(a) ¬#R > 1(a)
M#>1 M#>2 ables; i.e. a deduction should introduce new sentences, and
R(a, b), R(a, c), b 6= c #R ≤ 1(a) not just by creating new variables in the same roles as exist-
R ⊆ S(a), R(a, b) ¬R ⊆ S(a)
ing ones. A leaf is said to be closed iff it contains a sentence
M⊆1 M⊆2 of the form ⊥(a). No rule can be applied to a closed leaf,
S(a, b) R(a, b), ¬S(a, b) since it represents a contradiction that no interpretation can
R ◦ S(a, b) p, R(a, b), S(b, c) satisfy, so further reasoning would be futile. Otherwise a leaf
M◦1 M◦2 is open.
R(a, c), S(c, b) R ◦ S(a, c)
Within a particular sequence of tableaux if a leaf Li is a
¬¬C(a) conclusion of a rule applied to a leaf Li−1 then we say that

C(a) Li is a descendant of Li−1 (which we will now be happy to
call a node when the sequence of tableaux are considered as
Figure 2. Deductive rules for executing ALP a whole). If for a sequence of nodes L1 , . . . Ln each Li is
the descendant of Li−1 where 1 < i ≤ n then Ln is also
a descendant of L1 , and we call such a sequence a line of
tences in the subprogram for the variable. So subprograms reasoning. If Lj is a descendant of Li then Li is an ancestor
offer an obvious vehicle for the calculation and communi- of Lj .
cation of results. What is needed is an algorithm that refor- At each step, a number of rules may be applicable to a
mulates the initial program, plus input in the form of extra number of leaves. In this section we only assume that the
sentences, into an explicit form, introducing additional sub- procedure is fair for the program K in that it guarantees that
programs where necessary to capture required categories, if a rule is applicable to a leaf Li in a tableau derived from
and decomposing complex criteria into more general ones. K then after a finite number of further deductions the rule
A tableau algorithm can do this. will no longer be applicable to any descendant Lj of Li .
Execution will proceed by constructing a sequence of The first tableau in any sequence for a program K is {K}.
semantic tableaux. Each tableau in the sequence consists of Execution terminates when no rule can be applied to any
a list of programs {L1 , . . . , Lm }. We will call each program leaf in the current tableau, either because all are closed, or
in the list a leaf, and treat it as a set. The next tableau in the because all rules are inapplicable.
sequence is calculated by applying one of the deductive rules
shown in Figure 2 to the current tableau. 5.2 Properties of fair executions
The name of each rule is shown on its right-hand side. Our main concern with functionality of the algorithm is that
Each deduction targets a leaf of the current tableau called either it discovers that the program is inconsistent or that
the premise leaf. All other leaves appear in the subsequent each maximally specific required category of results in each
tableau unmodified. However, the premise leaf is replaced viable alternative – namely those lines of reasoning remain-
by one or two conclusion leaves. The rules each give a ing open on termination – has at some point during the exe-
premise specification above the line, the variables in which cution a subprogram expressing its constraints in full, a prop-
bind to parts of literal sentences present in the premise leaf, erty that we will refer to as explicitness. A proof of this prop-
erty can be obtained by first proving some more conventional Proof.
properties for this kind of algorithm: that it is sound, i.e. the
set of domains represented by the leaves in the latest tableau 1. a leaf is complete iff it is closed or no rule can be applied;
does not change as execution progresses, or in other words 2. a tableau is complete iff all of its leaves are complete;
the meaning of the original program is retained; and that it 3. if an open leaf L is complete but not closed then it is
is complete in the sense that if K is inconsistent then this satisfiable (it may be infinitely large). This is proven by
will surely be discovered after a finite number of deductions. Theorem 7 below;
The proof of soundness is needed for the proof of complete-
4. soundness: in every tableau generated for K, an interpre-
ness. Completeness is a necessary condition for explicitness
tation satisfies some branch L iff it satisfies K. This is
as we have defined it. But our proof of completeness also
proven by Theorem 5 above;
proceeds by showing that when no more rules can be applied
5. if all branches in a tableau for K are complete and there is
to an open leaf it is satisfiable, and this is done by showing
an open leaf L then by 3 and 4, K is satisfiable; otherwise
that it can be satisfied by a carefully constructed domain that
K is not satisfiable;
we call the canonical interpretation for a program. The spe-
cial property of the canonical domain, that it contains only 6. for any program K there is a fair procedure for choos-
enough objects to assign to each variable, leads directly to a ing what deduction to apply next during execution that
proof of explicitness, since these objects must be members will generate a complete tableau via a finite or infinite
of maximally specific required categories whilst only satis- sequence of deductions. This is proven by Theorem 8 be-
fying subprogram constraints. This observation is the main low;
theoretical innovation in this section. 7. if a closed leaf is derived then this occurs a finite number
of deductions after execution started, see Theorem 8;
5.2.1 Soundness 8. assume K is unsatisfiable. By 6 execution will in a finite
Soundness is proven by considering each rule in turn and en- or infinite sequence of deductions produce a complete
suring that the premises entail the conclusions. For example, tableaux starting from {K}. Assume at least one leaf
here is the proof for M¬ . in this tableau is open. Then that branch is satisfiable
by 4, but then K is satisfiable by 5. Therefore either K
Theorem 3. L |= L ∪ {C(a)} if ¬¬C(a) ∈ L. is satisfiable or all leaves in the completed tableau are
Proof. Consider I satisfying L. Since I satisfies ¬¬C(a) closed;
there is an assignment A such that aA ∈ >I \ (>I \ C I ). 9. since for an unsatisfiable program all leaves in the com-
Since C I ⊆ >I it is the case that >I \ (>I \ C I ) = plete tableau are closed by 8, and all closed leaves are
C I . Hence I also satisfies C(a) with assignment A and derived after a finite number of deductions by 7, the to-
so satisfies L ∪ {C(a)}. Conversely if ¬¬C(a) ∈ L and I tal number of deductions applied to construct the com-
satisfies L ∪ {C(a)} then clearly I must satisfy all sentences plete tableau must be finite. This is by considering the
in L. Therefore L |= {C(a)}. tree of nodes defined by the descendant relationship. It
is finitely branching, with each node having one or two
The soundness property to be proven for Mt1 is a little successors. All branches are terminated by a closed leaf,
different, as the set of interpretations that satisfy the premise the ancestors of which represent the sequence of deduc-
may be split between the conclusions. tions required to derive a contradiction. The length of
Theorem 4. If {(C t D)(a) ∈ L} then an interpretation each branch is therefore bounded above by the number
I satisfies L iff it satisfies one or both of L ∪ {C(a)} and of deductions that had occurred in total when its leaf
L ∪ {D(a)} . was derived, which is finite. Hence all branches are of
finite length. Hence by König’s lemma (for trees) [8] the
The rule R#≤1 is also an interesting case as it applies tree contains a finite number of nodes in total. Since each
renaming to the premise, but we must omit the details here. node might be the conclusion of at most one deduction,
Armed with soundness results for all rules, the soundness the total number of deductions to construct the tree and
of the algorithm overall can be proven straightforwardly by hence the final tableau must be finite.
induction over the sequence of deductions.
Theorem 5 (Soundness). For every interpretation I and ev-
Theorem 7. If a branch L is complete in a tableau and L is
ery tableau θ constructed starting from {K}, then I satisfies
open then L is satisfiable.
K iff there is a leaf L in θ such that I satisfies L.
A full proof of this theorem is not difficult but too long to
5.2.2 Completeness be given here. It proceeds as follows: Let IC be the canonical
Theorem 6. If a program K is unsatisfiable then the execu- interpretation for L as follows. Let the domain be >IC =
tion of K will generate a tableau in which all branches are {oa | a ∈ V(L)}, i.e. containing one element {oa , ob , . . .}
closed, and hence halt, in a finite number of steps. corresponding to each instance variable {a, b, . . .} = V(L).
A satisfactory assignment for the canonical interpretation roles is determined solely by statements such as A(a) and
will be given by aA = oa for all variables a ∈ V(L). R(a, b) in L(a) giving the corresponding instance variable’s
Now let the interpretation of any atomic concept in IC participation in atomic roles and concepts, with participation
be those objects that correspond to instances stated to par- in complex concepts and roles following according to the se-
ticipate in that concept by an instance assertion of the form mantic rules. Therefore oa participates in a required category
A(a) ∈ L, namely AIC = {oa | A(a) ∈ L}. Also, let the of objects governed only by constraints present in L(a).
interpretation of any atomic role be those pairs of objects Moreover in the canonical domain there are exactly as
corresponding to instances asserted to participate in the role, many objects as there are subprograms. Therefore the same
namely P IC = {(oa , ob ) | P (a, b) ∈ L}. The interpretation can be stated of any object oi : that it participates in a required
of complex concepts follows by the semantic rules. category of objects the criteria for which are given by L(i).
The remaining part of the proof proceeds by proving Now suppose there were a maximally specific required
that IC satisfies L. This involves considering each senten- category of objects X implied by L that has identifying char-
tial form. Inequalities are the most straightforward given the acteristics not equivalent to those expressed by any L(i) ⊆
construction of the canonical interpretation. Role assertions L. Since X is a required category of objects it will have at
and denials take more work because we must also prove that least one member in the canonical domain also, say oj . But
composite role assertions are constructed by the rule M◦2 oj only need meet the criteria given by L(j), so X cannot be
where needed to detect contradictions. Instance assertions more specific than L(j). But if X is not equivalent to L(j)
proceed by strong induction over the complexity of the con- then it must be more general than L(j) in which case it is not
cept being asserted for the instance (according to a ranking maximally specific. This is a contradiction, therefore there is
function) usually on the basis that if a complex concept is no such category X.
asserted then corresponding simpler sentences will also be
present in L, because a deductive rule has surely been ap- 6. Generating output and garbage collection
plied, and they can be assumed by the inductive hypothesis
6.1 Subprogram readiness
to be satisfied.
Suppose that when executing a program K some open leaf
Theorem 8. There is a fair procedure for executing any L is produced containing the subprogram L(a) for some
ALP program, and this will generate a complete tableau instance variable a. Given that L(a) is non-empty, if L(a)
in a finite or infinite sequence of deductions. must be the same in any complete, open descendant of L,
Proof of this theorem is accomplished by exhibiting a assuming only that the execution procedure is fair, then we
fair procedure for picking deductions to apply, and proving state that L(a) is ready, and can be output.
that it is fair. One possibility is to queue the deductions: Subprograms change due to the application of deductive
initially and at any point thereafter there will be finitely rules. Clearly for a rule r to be applied to a leaf Li , deriving
many possible, so finitely many ahead of any new ones that Li+1 such that Li+1 (a) 6= Li (a), r must first have been ap-
become possible. plicable in Li , in that Li had premises for r that would result
Now note that given that K is finite we can number the in new conclusions. If a rule r is applicable to a particular set
initial sentences and any subsequently deduced in an ascend- of premise sentences in Li , but was not applicable to them
ing sequence. Notwithstanding the fact that execution may in the immediate ancestor of Li (say Li−1 ), we state that r
continue indefinitely, no rule produces an infinite number of has been activated for those premises in Li .
conclusions in a single deduction, so any sentence derived For a given node Li we state that a subprogram Li (a) is
will have a finite number in the sequence. Therefore if any progressing iff a deductive rule is applicable in Li to modify
leaf closes by the derivation of ⊥(a) it will do so after a fi- the sentences in the subprogram for a in a descendant of
nite number of deductions. Similarly after an infinite number Li , say Li+1 such that Li+1 (a) 6= Li (a); otherwise it is
of deductions have been applied all open leaves will be com- standing.
plete since the last premise to be derived to activate any rule Note that if a subprogram Li (a) is progressing and hence
would be finitely numbered and fairly the rule would then a rule r might change the subprogram, then within a finite
have been applied a finite number of deductions later. number of deductions all descendants of Li will either close
(in which case the subprogram will become irrelevant) or
5.2.3 Explicitness the rule will have been applied, hence modifying the sub-
Theorem 9. In an open and complete program L, there is a program. This is proven by Theorem 8. Therefore if a sub-
subprogram identifying the criteria for every maximally spe- program Li (a) is progressing it is obviously not ready since
cific required category of objects in a conforming domain. it will necessarily change in all descendants of Li that re-
main open. So if a subprogram is ready then it must be stand-
Proof. A canonical domain can be constructed for an open ing. Unfortunately the reverse does not necessarily hold be-
and complete program according to Theorem 7. The criteria cause a subprogram might go from standing to progressing
governing the participation of an object oa in concepts and depending on changes to other subprograms.
All of the deductive rules given in Figure 2 require as subprogram is ready when all subprograms for instances in
premises sentences from one or more subprograms. We state its neighbourhood are standing – but we omit further formal
that a subprogram Li (b) is relevant to a subprogram Li (a) proofs from this discussion.
if a deductive rule could be applied taking as a premise Unfortunately, as discussed in Section 4.3 for many or
any sentence in Li (b) (possibly in combination with some even most programs this point will not come sooner than
other sentences) to derive the conclusion leaf Li+1 such that when all execution has been completed, since commonly
Li+1 (a) 6= Li (a). Now consider the following result: all instances are related transitively. We must apply some
further analysis to determine when referrers or referents may
Theorem 10. If a subprogram Li (a) is standing in Li but in
progress but no longer have the potential to cause a related
progress in a direct descendant Li+1 of Li , then it is because
subprogram to progress.
the deduction that formed Li+1 from Li added at least one
sentence p to Li (b) (i.e. p ∈ Li+1 (b) \ Li (b)) such that 6.1.1 Irrelevant referents
R(a, b) ∈ Li or R(b, a) ∈ Li .
The proof of Theorem 10 shows that only four rules can
Proof. It must be that Li+1 (a) = Li (a) since Li (a) is not cause a subprogram Li (a) to progress as a result of a change
progressing. The rule that becomes applicable in Li+1 there- in a related subprogram Li (b). Of these only M◦2 will cause
fore cannot be one for which all premises are members of Li (a) to progress if Li (b) is a referent of Li (a).
Li (a) – e.g. Mu1 , Mu2 , . . . – unless it becomes active by the The rule M◦2 combines role relationships into composite
removal of a conclusion rather than the addition of a premise. role relationships, given that a guard sentence p is present
But the former is not possible. Sentences are only removed indicating that knowledge of referents via a composite role
by renaming so given that Li (a) will not be renamed in one is relevant to an instance. Note that the guard sentence p be-
step (because then it would be progressing) only M∃1 , M⊆2 , longs to Li (a). It is the extension to the original role S(b, c)
and M#>1 could be activated this way. But either matching that might be added to Li+1 (b) to make Li+1 (b) relevant
conclusions were absent in Li so the rules were already ap- to Li+1 (a) given that Li (a) is standing. When will this not
plicable, meaning that Li (a) was progressing, or the rules happen? If none of the guard sentences are present for any
would already have been applied resulting in subprograms extension S to R in Li (a), then whatever happens to the sub-
related to Li (a) by a sentence in Li (a), e.g. R(a, b). This program of b will be of no concern to that for a, assuming
could only be removed by renaming though the application that Li (a) does not progress due to a referrer. Indeed it is to
of R#≤1 but for this to be possible Li (a) would again would obtain this independence that the guard sentences are speci-
need to be progressing. fied for the rule.
Therefore the rule that becomes applicable must take Given that L(a) is standing if R(a, b) ∈ Li and there
sentences from several subprograms as its premises. The is an appropriate guard sentence in Li (a) involving the role
possibilities are M∀1 , R#≤1 , M⊆1 , and M◦2 . We can verify R ◦ S then we will state that Li (a) is open to R ◦ S via
that these rules will again not be activated as a result of Li (b), and we would prefer Li (a) to be closed to all roles
renaming since a will not be renamed (because Li (a) is via its referents as a prerequisite for readiness. In fact we
not progressing) and the naming of the other variables is can judge that Li (a) is closed to roles from a referent even
irrelevant to whether a will progress. So given that one in the presence of guard sentences by also checking whether
of these rules has become applicable it is because of the Li (b) has the potential to add the extension role S(b, c). See
addition of at least one sentence p ∈ Li+1 , p 6∈ Li+1 (a). the next subsection.
Furthermore, the rules all require as premises role assertions 6.1.2 Irrelevant referrers
linking the instances appearing in the rule. Therefore, if p
has been derived to make r applicable to some new premises We also need to consider whether a referent can be output
and hence Li+1 (a) to be in progress then R(a, b) ∈ Li+1 even though its referrer might change. This is often needed
or R(b, a) ∈ Li+1 . But these statements would form part when a single referrer remains unready for a long time to
of Li+1 (a) so cannot have been newly added to Li+1 , since supply value restrictions (via M∀1 ) to a large number of
Li+1 (a) = Li (a), so p 6= R(a, b) and p 6= R(b, a). referents. See Section 8 for an example of this happening.
The referrer needs to be able to obtain new referents, but we
Therefore it is characteristic of this set of rules that if a need to be sure that this activity will not cause the referrer to
subprogram for a resumes progress after a period of standing modify its older referents so they can be output and removed
it is due to some fact having been added to a subprogram from memory.
for b with which a relationship has already been established. Suppose that Li (b) is now the referrer and Li (a) the refer-
Given that Li contains two subprograms Li (a) and Li (b), ent due to the assertion R(b, a) ∈ Li . Considering the rules
then if R(a, b) ∈ Li then we state that Li (a) is a referrer for M∀1 , R#≤1 , Mv1 , and M◦2 that may be activated to cause
Li (b). Conversely Li (b) is a referent of Li (a). Suppose we a subprogram to progress, all may be activated by a change
define the neighbourhood of a in Li as the graph of instances in Li (b) causing Li (a) to progress. And application of these
connected by role assertions. Then it is easy to prove that a rules can have a profound effect on a referent. For exam-
ple, it may be that M∀1 will be applied to ∀R.C(b) to derive closure of its referrers are currently objective. Objectivity
C(a), a completely new instance assertion concerning a. Or is so called because an objective subprogram will never
if R(b, c) were derived in Li+1 (b) and #R ≤ 1(b) held then change as a result of changes in its referrers, and remains
the application of R#≤1 could eliminate the subprogram for only processing referents. Since this means that only role
a, or combine it with that for c. assertions (or possibly a contradiction) will be added to
However, in the scenario described above we must do bet- the subprogram, it means in particular that no new guard
ter than wait until all referrers transitively are ready before sentences will be added to the subprogram. This makes it
declaring Li (a) ready. The intuition behind the following easier to assess which roles it remains open to. Once an
analysis is that referrers will have their most powerful effect objective subprogram becomes closed to all roles it is ready.
on referents early in the lifetime of the referent, and after
that the effects may be more limited. 6.2 Garbage collection
Suppose therefore that in a particular execution the effect The execution algorithm has a number of opportunities to
on Li (b) (the referrer) of its referrers has already been cal- discard information as it progresses. Probably the most ob-
culated, so it is not going to change much itself. Its initial vious is that prior tableaux can be discarded (or updated)
implications for Li (a) have also been calculated, so Li (b) as execution progresses. Also clear is that closed leaves will
is not currently relevant to Li (a). What happens after this? play no further part in computation and can be removed from
Li (b), if it will change at all, will next change due to the the latest tableau. Having taken these measures, memory us-
application of M◦2 , as discussed in the previous subsection. age will be dominated by the subprograms retained in open
Suppose this has just added the new relationship R ◦ S(b, c) lines of reasoning. It is therefore important to discard those
to Li (b). What rules may be activated as a result? The rules that will play no further part in computation.
that could take the new sentence as a premise are M∀1 , M◦1 , A ready subprogram will never again change. Crucially
M◦2 , M⊥3 , R#≤1 and M⊆1 , and the possible results of ap- this means that it can have no more new neighbours. There-
plying these are that a contradiction is derived, a value re- fore at some point thereafter all deductions involving the
striction is applied to the new referent c, two referents of subprogram and modifying its neighbours will have been
Li (b) are combined by renaming, another new referent role applied. At this point we state that the subprogram is ex-
assertion is added to Li (b) by generalisation, or a new refer- hausted. The sentences of an exhausted subprogram may be
ent is derived for some referrer of Li (b). Note two important removed, provided they are not also sentences in another
facts about these possibilities: only the second is any imme- subprogram also. Some precautions must be taken so that
diate concern in relation to the readiness of Li (a), the others rules like M∀1 do not become applicable again when sen-
cannot possibly effect it in one deduction, or alternatively a tences are removed. This can be achieved by replacing the
contradiction is found so the entire line of reasoning can be instance variable with a special token in any role assertions
discontinued; also, Li (b), assuming the line of reasoning re- from the subprogram that are retained by its neighbours.
mains open, will only change immediately by the addition A further refinement to the execution algorithm is possi-
of yet another referent relationship, which could only cause ble that reduces its memory footprint while improving the
some of the same rules to be activated again. quality of results produced. Many of the rules that operate
In light of the second observation, if Li (b) is progressing, on a single subprogram reformulate a sentence into a better
but only a subset of the above rules are active, we state that but equivalent form, e.g. Mu1 . But then the original sentence
Li (b) is only processing referents. This condition of the sub- is no longer desirable in the subprogram, and in fact is re-
program for b will persist until one of its referrers becomes dundant, so should be removed. Therefore a number of the
relevant. Now suppose that Li (b) is only processing refer- monotonic rules originally presented can be replaced with
ents. The only rule that can be activated that might cause discharging rules such as Du1 in which the conclusions re-
Li+1 (a) to progress is R#≤1 . But we can be quite specific place the premises in the conclusion node, rather than join-
about when this will not happen. If Li (b) contains no value ing them.
restriction #R ≤ 1(b) or is not open to the role R then as
long as it continues to be only processing referents the rule
will not be activated. If Li (b) does contain #R ≤ 1(b) and
7. Further theoretical considerations
is open to R then we will call it an aggregator for Li (a). So Three important areas remain to be addressed in order to
if Li (b) is only processing referents and is not an aggregator prove in theory that this kind of programming is practical.
for Li (a) then we can be assured that Li (a) will not imme- First, although the discussions in the previous two section
diately begin to progress as a result of a change in Li (b). We establish the possibility that the desired results can be gen-
state that Li (b) has passed Li (a) if these conditions are met. erated and output at some point before termination, it is
Now let us state that Li (a) is currently objective if all not clear that any algorithm can accomplish this efficiently.
its referrers have passed it. Now we will state that Li (a) is In future work we will exhibit one. For now we will offer
objective if it and all of the subprograms in the transitive the following arguments. First, the cost of applying rules
is mainly in finding matching premises for rules, and then
checking whether the conclusions have previously been gen- Here it is again as a DL sentence:
erated. Indexing sentences based first on subprogram, then
sentence type, then atoms involved tends to reduce this to (∀traffic light.
O(log(n)) where n is the number of sentences in memory at (green ⊆ next ◦ yellow u
any one time.
The analysis of an algorithm to assess readiness is much (yellow ⊆ next ◦ red u
more difficult, and performance will depend on the structure red ⊆ next ◦ green)) u
of the graph of subprograms currently in memory, and hence (traffic light ◦ next ⊆ traffic light u
the program being executed. Objectivity may be expensive ∃traffic light ◦ green.>))(a1 )
to assess if any subprogram has a long list of referrers that
are not obviously objective themselves, as when progressing Under our execution algorithm the program is non-
subprograms form circular lists for example. But objectiv- terminating. A trace execution of the program, up to a point,
ity is cheap to assess in other situations, because if a sub- generated with the aid of our interpreter for ALP, is shown
program only has objective referrers and these have passed in Figure 3, and proceeds as follows. Note that some of the
it (or more obviously are all standing) then it is objective. deductions are discharging but have the same premises and
Subjectivity is also useful in that a subprogram is subjective conclusions as their monotonic counterparts. The initial con-
if it has any subjective referrers, so we can potentially avoid cept is asserted for a1 . It is a right-associating conjunction
checking large parts of the subprogram graph on the basis with three parts, so initially Mu1 is applied twice to dis-
that a subjective referrer means that all within must be sub- member it into shorter instance assertions. These establish
jective. The cost of assessing readiness should then mainly the general rules for traffic lights related to a1 (2), the rule
depend on the number of objective subprograms in memory, that the next thing of a traffic light is also a traffic light (4),
of which the ready subprograms will be a subset. However, and the fact that there is something that is the green of a
the bulk of the working data of the program will be subjec- traffic light (5).
tive, because progressing subprograms with work to do will Next the application of D∃1 hypothesises a new category
refer to it. of objects a2 related to a1 by traffic light ◦ green, a com-
The second thing we have not considered is what order posite role (7). The rule M◦1 then adds an intermediate in-
the rules should best be applied in, beyond being fairly ap- stance a3 related to a1 by the role traffic light (8) and to a2
plied. In theory, some programs can be written such that the by green (9). We can interpret a3 as describing the first state
order is determined logically, i.e. only one rule is applicable of the traffic light, a1 as describing the scenario in total, and
at a time, although perhaps not all algorithms can be imple- a2 , which has an slightly unusual role in this program, as
mented efficiently this way; and certainly not clearly. It is corresponding to the light shining from the traffic light. See
more natural to write non-deterministic programs but then Figure 4 for a graph of subprograms in the execution gener-
some fair executions take a long time while others are ef- ated from output from the interpreter.
ficient. Schemes that avoid these problems are not hard to Having completed this initial setup, execution now set-
come up with, for example maintaining a queue of premises. tles into the cyclical behaviour of calculating next states for
But ultimately we want something that also reflects the pro- the traffic light. First any instance related to a1 by the role
grammer’s intuition about what should happen next and ad- traffic light – a3 in the first iteration – has the value re-
mits some non-determinism to allow interpreters to take ad- striction applied by rule M∀1 defining its nature as a traf-
vantage of opportunities for parallelisation. fic light (10). The concept for this restriction is again a
Finally as mentioned in the requirements, it would be de- conjunction with three parts, one for each possible current
sirable, equipped with results in the above areas, to show colour of the traffic light, and this will be dismembered into
that ALP, or more likely an enhancement of it with sup- instance assertions for the subprogram. One of these role-
port for arithmetic, could simulate a random access machine value mappings will then be applicable by M⊆1 to map the
efficiently. This is future work. role for its colour to a composite role next ◦ Colour where
Colour is the appropriate illumination in the next state (13).
We call the application of this rule generalisation. The new
8. Worked example composite role is again decomposed to add an intermedi-
The following program simulates a traffic light. ate object, a4 say (16), representing the next state of traf-
fic light. The final steps in the cycle are the application
all traffic light {
green : next.yellow
of the rule M◦1 due to the presence of the guard sentence
yellow : next.red traffic light ◦ next ⊆ traffic light(a1 ) to establish a compos-
red : next.green ite role traffic light ◦ next(a1 , a4 ) (18 - we call this fetching)
} and the generalisation of this role back to traffic light (19)
traffic light.next : traffic light so the value restriction can be applied to a4 in the next cycle
some traffic light.green something (20).
1. (∀traffic light.(green ⊆ next ◦ yellow . . . Assumed.
2. ∀traffic light.(green ⊆ next ◦ yellow u . . . Du1 (1)
a_1
3. (traffic light ◦ next ⊆ traffic light u . . .
4. traffic light ◦ next ⊆ traffic light(a1 ) Du1 (3) traffic_light
5. ∃traffic light ◦ green.>(a1 )
6. >(a2 ) D∃1 (5) a_3 traffic_light

7. traffic light ◦ green(a1 , a2 )


next traffic_light
8. traffic light(a1 , a3 ) M◦1 (7)
9. green(a3 , a2 ) a_4 traffic_light

10. (green ⊆ next ◦ yellow u (yellow ⊆ next . . . M∀1 (8, 2)


next traffic_light
11. green ⊆ next ◦ yellow(a3 ) Du1 (10)
12. (yellow ⊆ next ◦ red u red ⊆ next ◦ green . . . a_5

13. next ◦ yellow(a3 , a2 ) M⊆1 (11, 9)


green next
14. yellow ⊆ next ◦ red(a3 ) Du1 (12)
15. red ⊆ next ◦ green(a3 ) yellow a_6
16. next(a3 , a4 ) M◦1 (13)
red next
17. yellow(a4 , a2 )
18. traffic light ◦ next(a1 , a4 ) M◦2 (16, 4, 8) green a_7
Instance a3 ready and exhausted.
19. traffic light(a1 , a4 ) M⊆1 (18, 4) yellow next

20. (green ⊆ next ◦ yellow u (yellow ⊆ next . . . M∀1 (19, 2) a_2 a_8
21. green ⊆ next ◦ yellow(a4 ) Du1 (20)
22. (yellow ⊆ next ◦ red u red ⊆ next ◦ green . . .
23. yellow ⊆ next ◦ red(a4 ) Du1 (22) Figure 4. Eight instances from the traffic-light example.
24. red ⊆ next ◦ green(a4 )
25. next ◦ red(a4 , a2 ) M⊆1 (23, 17)
26. next(a4 , a5 ) M◦1 (25)
a1 has passed it. The subprograms for the states contain
no guard sentences, so are never open to roles, so become
27. red(a5 , a2 )
ready once objective and standing, and shortly thereafter
28. traffic light ◦ next(a1 , a5 ) M◦2 (26, 4, 19) exhausted. The subprograms for a1 and a2 never become
Instance a4 ready and exhausted. ready, the former because it always remains open to the role
traffic light ◦ next so that it can apply its value restriction,
Figure 3. Initial execution of the traffic-light example. and the latter because it always has a subjective referrer,
i.e. the subprogram for the next state currently being cal-
As execution progresses the subprograms for each state of culated. The order and timing in which subprograms for
the traffic light become available for output and subsequent states are output and cleared from memory can vary depend-
garbage collection. Here are the sentences that will be output ing on the order in which deductions are applied, due to a
for a3 : race between Mu1 and M⊆1 in the processing of the state
for green, but provided neither of these rules is systemati-
cally deferred the subprograms will be output promptly and
8. traffic light(a1 , a3 )
in order. The memory footprint of the program is hence con-
9. green(a3 , a2 )
stantly bounded with at most two states in memory at once.
11. green ⊆ next ◦ yellow(a3 ) With such a small memory footprint this program is ac-
13. next ◦ yellow(a3 , a2 ) tually not a good benchmark for the interpreter, since hav-
14. yellow ⊆ next ◦ red(a3 ) ing large numbers of facts to process is the principal chal-
15. red ⊆ next ◦ green(a3 ) lenge for algorithms that apply the deductive rules and cal-
culate readiness. Nevertheless we note that our implementa-
16. next(a3 , a4 )
tion, written in Prolog and executed using SWIProlog on an
Intel I7 PC running at 2.7 GHz (with one core being utilised)
Note that a1 swiftly becomes objective, having no ref- will output ∼440 state subprograms per CPU second, corre-
erents of its own. Then each state becomes objective once sponding to ∼4400 deductions per second. This is obviously
very slow when we consider how a simple implementation gramming languages, e.g. the example in Section 3 in which
of the same simulation written in machine-code would run. the dogs of the author are a type of thing he owns.
But on the other hand it suggests that execution of ALP Other constructors were also selected in part for their con-
programs is not beyond the bounds of practicality. ceptual modelling appeal and similarity to OO languages –
value restrictions for example, are a bit like classes; negation
is obviously desirable for denying bad properties; unions fol-
low inevitably if you want negation and intersection and to
9. Related work
avoid artificial constraints on the way that concepts are com-
ALP introduces no new constructors or sentential forms to bined – and in part from experience writing programs – max-
the field of Description Logic. All have been considered be- imum number restrictions have a role in achieving efficient
fore, and with the exception of role-value maps, frequently. calculation since they allow two subprograms in the same
Tableau algorithms are also the usual approach for reason- role to be merged avoiding repeated calculations, provided
ing with expressive DLs [2], and our proof of completeness R#≤1 is promptly applied.
follows a typical pattern. However they are usually used to Another point of difference from other DL work is our
find contradictions in order to establish the validity of some focus on instance and role assertions as the main senten-
complementary fact, for example proving the subsumption tial forms rather than terminological axioms, which describe
of one concept by another by disproving the existence of an subsumption relationships between the membership of con-
object asserted to be a member of the former but not the lat- cepts as a whole. So with a terminological axiom it would
ter. Explicitness is hence not usually proven, but is no doubt be possible to assert that all dogs are female, for example.
a property of most such algorithms. It seems clear that the ALP programs can give general rules for the dogs of the
method works to find contradictions by first making argu- author say, but not for all dogs. This limitation is intended
ments explicit. to avoid two potential software engineering problems: first
What is perhaps novel about ALP is the particular set combining ALP programs will hopefully be less problem-
of choices that it embodies. Most DLs are not, by virtue atic due to conflicting uses of the same terminology, since
of the constructors chosen, Turing complete, because this the meaning of some name only applies within a local col-
would make the decision procedures desired in their appli- lection of connected subprograms (although more work on
cations undecidable. But we want Turing completeness so as modularity is also needed); second, programs, regarded as
not to restrict the set of algorithms that can be implemented models of part or all of some system containing elements
in the language. The (logical) completeness result of Theo- of problem and solution domains, need not also define the
rem 6 establishes the semi-decidability of ALP. If we were boundary of the system domain, which would be required
to also show that ALP could simulate any TM, and hope- to make statements such as all dogs are female make sense,
fully the examples we have shown suggest that this is a re- since all dogs are manifestly not female.
alistic prospect, then it would be clear that ALP is also un- The other notable fragment of FOL that has been used
decidable, and this is essentially due in ALP as in TMs to as a basis for programming is Horn clauses, which under-
the halting problem, as illustrated by Theorem 1. However, pins the semantics of Prolog, the best-known logic program-
thanks to the results presented in Section 6, ALP programs ming language [9]. The Closed World Assumption (CWA)
do not have to terminate to produce useful output in finite informs the semantics of Prolog such that if a fact is not
time. a consequence of a Prolog program K then it is denied.
Role-value maps contribute profoundly to the expressive- For example given the program thing a(A). the queries
ness of ALP. We have seen that they allow programs to ?- thing a(a(1)), ?- thing a(a(2)), . . . succeed but
progress by repeatedly qualifying newly discovered mem- ?- thing b(b(1)) fails. Note that if we take the world of
bers of the closure of a relationship. Role-value maps are the program to be the set of terms satisfying the rule then
considered so undesirable from a computational perspec- this program has an infinite world, which is closed only in
tive that the standard nomenclature for DLs, which com- terms of the kinds of things it can contain.
bines the letters AL with a suffix consisting of letters indi- This is clearly not the case for the semantics of ALP as
cating the additional concept constructors does not include we have presented them. Suppose K = {A(a)}, then K 6|=
one for them [1]. However, if we represent role-value maps B(b) but in any interpretation satisfying K there may be an
with R then the language would be called ALUCEFR◦ . object participating in B or not. So we state that ALP is
Notwithstanding that this might be shortened by consider- designed according to the Open World Assumption (OWA).
ing equivalences between some of the constructors, we find This seems to us to be preferable for the following reason at
this unwieldy, hence our use of ALP which may be con- least: if the abstractions presented in a program also model
sidered to stand for attributive language for programming. the problem domain, then the CWA is problematic, because
Role-value maps are for us a convenient and natural way additional detail is denied. At whatever level of detail the au-
to obtain the repetition needed in most algorithms, and they thor models his dog in Prolog you can still claim that his Pro-
also closely resemble type declarations in conventional pro-
log program does not represent her by identifying something more conventionally object-oriented than Alloy or ALP,
true about her that he has not stated, and pointing out that namely structural type information in the form of classes, in-
his program denies that fact. There is a sense in which ALP heritance relationships, fields and/or associations with mul-
is also more open-world than FOL. In FOL we can make tiplicity constraints, and some other constraints such as vis-
statements such as ∀x.(Dog(x) → Female(x)), which is the ibility, ordering and containment. OCL adds the ability to
equivalent to the terminological axiom discussed above, and define object invariants and pre- and post-conditions for
has the effect of closing the domain against all male dogs. methods. These elements match closely the specification el-
Description logic has been combined with logic program- ements available from programming languages such as C++
ming with Horn clauses in several works. In [6] a restricted and Java, which embody the structural elements in their type
DL is translated into Horn clauses. In [3] the Prolog environ- systems and support the specification of invariants and pre-
ment can transfer control to a DL reasoner to check special and post-conditions by means of assertions. Hence specifi-
predicates. Both works are aiming to provide execution plat- cation elements find use in static or runtime checking, with
forms for semantic web languages that specify rules and on- type information also useful for generating objects or code.
tologies. The DLs considered are less expressive than ALP In contrast in ALP the line between type information and
and control is due to the rules. object-invariant is blurred because every subprogram gives a
Another relevant fragment of FOL is relational logic, description of a non-empty category of immutable objects
which underpins the semantics of the model finder Alloy [7]. at some level of abstraction, making distinctions between
Alloy generates and visualises possible satisfying domains, type and value information somewhat arbitrary. For exam-
up to some limit on the number of objects present, to help ple, we can state Number(a1 ) or Three(a1 ) using the same
the programmer to verify that a specification indeed mod- kinds of concepts and sentences, in this case atomic concepts
els the domains it expects. By making some possible do- and instance assertions. And of course in ALP there is no
mains explicit Alloy achieves something similar to our ex- distinction between this kind of structural information and
ecution algorithm, relying on the resolution-based model- commands that advance the state of the computation.
finder KodKod [15] rather than a tableau method. Alloy’s A recent work to attempt executable OO specifications
results are delivered as examples rather than descriptions of is [10], which integrates Kodkod into Java, transferring con-
required categories of objects, so where ALP might output trol to the model finder to accomplish some calculations,
two subprograms related by a role Alloy would deliver a set but this can only be used to implement steps in long run-
of pairs of some finite cardinality; this supports the checking ning executions. This work uses a specification language that
of more complex constraints on the cardinality of a relation supports in syntax the notion that objects may change state,
than ALP can express, but it happens whether those con- whereas again Alloy and ALP must model state changes
straints are present or not. where necessary using more generic kinds of relationships
Alloy’s language is more expressive than ALP in other between immutable objects.
ways too, however it has not been intended for programming
so the Alloy interpreter currently only attempts to realise fi-
nite domains in a non-interactive manner. However, since
10. Conclusion
Alloy preceded this work and has a similar perspective on The intent of this paper is to establish some initial credibility
declarative OO specification to our own, would it or rela- for the use of Description Logic as a programming language.
tional logics have been better places for us to start looking We have only shown a language that captures the semantics
for a programming language than DLs? Perhaps, but the sim- of objects for our purposes. Although this is almost certainly
plicity of ALP has certainly been an advantage in showing enough for Turing completeness for practical purposes and
that explicitness and output prior to termination can be ac- to harness the power of modern computing platforms a more
complished, and perhaps these properties can now be sought expressive language, including innate support for arithmetic,
for more expressive logics and systems. Moreover, in com- string manipulation, etc. will need to be built on these foun-
parison to DLs there is not for us such a compelling rela- dations.
tionship between the semantics of relational logic, given in Alan Perlis’s 54th Epigram of Programming is Beware of
terms of tuples of atoms, and the problem domain; and the the Turing tar-pit in which everything is possible but nothing
mapping from Alloy’s syntax to relational logic is also not of interest is easy [14]. Will DLs prove to be a tar-pit or
simple. It is not so obvious what the procedure is for deter- tar sands, newly ripe for exploitation? We believe that any
mining whether a real world situation conforms to an Alloy programming language will stand or fall depending on how
specification. the structures that it offers align with how the programmer
UML class diagrams in tandem with the Object Con- wants to think about its problems and solutions. In other
straint Language (OCL) [12] form another expressive spec- words, how intuitive the provided building blocks are. In
ification language the uses of which fall short of full exe- this respect DLs seem to have considerable potential due
cutability. The specification elements in class diagrams are to their ability to directly model a problem domain, and
in a way that can then be put into operation to generate
useful results, as we have seen in the examples presented [6] B. N. Grosof, I. Horrocks, R. Volz, and S. Decker. Description
in this paper. The fact that tableau algorithms can generate logic programs: Combining logic programs with description
concise explicit descriptions of domains of objects from an logic. In Proceedings of the 12th International Conference on
open-world logical language – while taking account of the World Wide Web, WWW ’03, pages 48–57. ACM, 2003.
structure of the domain to deliver results in a piecemeal [7] D. Jackson. Software Abstractions: Logic, Language, and
fashion and manage memory usage – seems like too good Analysis. The MIT Press, 2006.
a prospect to ignore. [8] D. E. Knuth. The Art of Computer Programming, Volume 1
(3rd Ed.): Fundamental Algorithms. Addison Wesley, 1997.
Acknowledgments [9] R. Kowalski. Predicate logic as programming language.
Some of this work was accomplished while the author was Information Processing Letters, 74:569 – 574, 1974.
employed at Auckland University, first as a visiting fellow [10] A. Milicevic, D. Rayside, K. Yessenov, and D. Jackson.
and then funded by the New Zealand Foundation for Re- Unifying execution of imperative and declarative code. In
search, Science and Technology (grant UOAX0903), which Proceedings of the 33rd International Conference on Software
Engineering, ICSE ’11, pages 511–520. ACM, 2011.
became part of the Ministry for Research, Science and Tech-
nology in 2011. Thanks for support to both these institutions, [11] D. Nardi and R. J. Brachman. An introduction to description
in addition to AUT, the author’s current employer. The exam- logics. In F. Baader, D. Calvanese, D. L. McGuinness,
D. Nardi, and P. F. Patel-Schneider, editors, The Description
ple of the author’s dog was inspired by the novel Spurious by
Logic Handbook, pages 1 – 44. Cambridge, second edition,
Lars Iyer. 2007.
[12] Object Constraint Language – OMG Available Specification
References
– Version 2.0. The Object Management Group (OMG),
[1] F. Baader. A. description logic terminology. In F. Baader, formal/2006-05-01 edition, May 2005.
D. Calvanese, D. L. McGuinness, D. Nardi, and P. F. Patel-
[13] OMG Unified Modeling Language (OMG UML), Superstruc-
Schneider, editors, The Description Logic Handbook, pages
ture – Version 2.4.1. The Object Management Group (OMG),
525 – 536. Cambridge, second edition, 2007.
formal/2011-08-06 edition, 2011.
[2] F. Baader and U. Sattler. An overview of tableau algorithms
[14] A. J. Perlis. Epigrams on programming. SIGPLAN Notices,
for description logics. Studia Logica, 69(1):5–40, 2001.
17(9):7–13, 1982.
[3] T. Eiter, G. Ianni, T. Lukasiewicz, and R. Schindlauer. Well-
[15] E. Torlak. A Constraint Solver for Software Engineering:
founded semantics for description logic programs in the
Finding Models and Cores of Large Relational Specifications.
semantic web. ACM Transactions on Computational Logic
PhD thesis, Massachusetts Institute of Technology, 2009.
(TOCL), 12(2):1 – 41, Jan. 2011.
[16] P. van Emde Boas. Machine models and simulation. In
[4] D. Frankel. Model Driven Architecture - Applying MDA to
J. van Leeuwen, editor, Handbook of Theoretical Computer
Enterprise Computing. OMG Press. Wiley Publishing, Inc.,
Science, Volume A: Algorithms and Complexity (A), pages
2003.
1–66. Elsevier, 1990.
[5] E. R. Gansner and S. C. North. An open graph visualization
system and its applications to software engineering. Software
- Practice and Experience, 30(11):1203–1233, 2000.

View publication stats

You might also like