default reasoning about actions and change using logic and answer set programming


draculasp is a system for representing and inferring knowledge about dynamic domains. Its name portends to the system's usage for non-monotonic reasoning about action theories, the semantics of the supported input fragments of the action language D being defined in terms of logic (more specifically default logic) and the actual reasoning being done via answer set programming.

The draculasp system is written in ECLiPSe Prolog and implements the translation from action domains to answer set programs outlined in this paper. It takes as input an action domain specification and instance information for that domain and transforms it into an answer set program with variables. This ASP can then be queried by invoking an external ASP solver.


draculasp is distributed under the GNU General Public License. It has been developed and should run under ECLiPSe Prolog 6.0 on ubuntu 11.04 using clingo as underlying ASP solver. You can download a package containing the source code along with some example domains.

More Information

Action domain information is stored in text files with a special syntax. The figure below shows the representation of the swipe card domain. The objective of this domain is to open an electronically locked door using a swipe card. If the agent has a card, it can swipe the card to unlock the door; if the door is unlocked and not jammed, it can be pushed open. Normally, the door is not jammed. The corresponding action domain specification swipecard.ads is as follows:

sort action: swipe, push.
sort fluent: hasCard, locked, open, jammed.

precondition swipe: hasCard.
precondition push: and(not(locked), not(jammed)).

effects swipe: not(locked).
effects push: open.

normally not(jammed).
The first two statements define the domain signature. (Subsorts are not used in this domain, but draculasp also understands statements of the form “s1 extends s2” expressing that s1 is a subsort of s2.) Next, action preconditions, action effects and state defaults are specified, where action effects are grouped by actions.

Information about a specific domain configuration is specified in an action domain instance file. Each such file refers to a general domain description. Below we can see a particular branching-time instance of the swipe card domain.

instance of "swipecard.ads".

time structure: situations.

term depth: 3.

initially hasCard.
The first line refers to the domain of which the file defines an instance. The next lines declare time structure and term depth, and the last three lines characterise the initial situation.

All instance files share the reference to the domain, and declaration of time structure and term depth. Depending on the time structure, they additionally state an initial situation or a narrative. Below is the action domain instance file swipecard2.adi for swipecard.ads using linear time.

instance of "swipecard.ads".

time structure: linear time 0..3.

term depth: 2.

        holds(hasCard, 0),
        occurs(swipe, 0, 1),
        occurs(push, 1, 2).
The second line expresses that the domain of the time sort is the set { 0, ..., 3 }, the third line defines the term depth. The block at the end specifies a narrative in which the initial time point is as in swipecard1.adi and the door is unlocked from 0 to 1 before being pushed from 1 to 2.

To provide you with some intuition on the look-and-feel of the program, we show an example run of draculasp's user interface. After starting the program we get to see the recognised commands and can list the domains available for loading:

$ draculasp
Available commands:
        help -- print this screen
        quit -- quit
        exit -- quit
        show -- print the current domain in text format
        write -- write the current answer set program to a file
        report -- create and display a pdf report
        domains -- list domains that are available for loading
        scep -- compute sceptical consequences
        test -- run regression tests
        load <domain> -- load an action domain instance
        ask <query> -- ask a query to the answer set program
}:-> domains                           
Available domains:
Available instances:
0.01s CPU
We can now choose an available domain instance and load it (and its domain). This applies the transformation of the previous section.
}:-> load swipecard1.adi
Successfully compiled.
0.05s CPU
With the transformed answer set program at our disposal, we can now do reasoning; for example, compute all sceptical consequences of the compiled program.
swipecard1.adi}:-> scep
        holds(hasCard, s0).
        -holds(jammed, s0).
        poss(swipe, s0, does(swipe, s0)).
        holds(hasCard, does(swipe, s0)).
        -holds(locked, does(swipe, s0)).
        -holds(jammed, does(swipe, s0)).
        poss(push, does(swipe, s0), does(push, does(swipe, s0))).
        holds(open, does(push, does(swipe, s0))).
        holds(hasCard, does(push, does(swipe, s0))).
        -holds(jammed, does(push, does(swipe, s0))).
        -holds(locked, does(push, does(swipe, s0))).
0.0s CPU
So, for example, according to the program above, the door is initially not jammed by default. This persists through swiping the card, thereby enabling the agent to push the door open. Note that there is no information whether the door was initially open. Reasoning is of course restricted to the term depth specified in the instance file. For the informed user that wishes to inspect the intermediate quantifier-free action default theory from which the answer set program is created, draculasp offers to create a pdf file with the default theory in a human-readable format.
swipecard1.adi}:-> report                          
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
Calling viewer, xpdf swipecard1.adi.pdf & ...
0.01s CPU
Finally, we can also instruct draculasp to write out the produced answer set program.
swipecard1.adi}:-> write
Writing swipecard1.adi.asp ...
0.0s CPU


draculasp is maintained by Hannes Strass. Feel free to contact him with any questions, comments or feedback.