A Reasoner for Simple Conceptual Logic Programs under the Open Answer Set Semantics
Prolog Perl
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


oasp-r: A Reasoner for Simple Conceptual Programs under the Open Answer Set Semantics

General information

The theory behind this reasoner has been written down in a RR 2009 paper.


The reasoner is written in Prolog, in particular BProlog. The code has been tested with B-Prolog Version 7.8, All rights reserved, (C) Afany Software 1994-2012, namely the version for Mac Os X (Darwin Kernel Version 11.4.0: Mon Apr 9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64). If you have issues with newer/older versions of BProlog, please drop me a line.

Installation and Runnng the Code

  • Go to the directory containing the file main.pl (top directory)

  • Start BProlog:


  • Compile and load main.pl (this will compile and load any other necessary files)

    | ?- cl('main.pl').

    You should see something like this:

    compiled in 2 milliseconds
    compiled in 5 milliseconds
    compiled in 1 milliseconds
    compiled in 1 milliseconds
    compiled in 7 milliseconds
    compiled in 0 milliseconds
    compiled in 2 milliseconds
  • Essentially we will be checking satisfiability of a predicate w.r.t. a logic program under the open answer set semantics. You can get this yes or no answer by trying for example:


    where a is the predicate you are checking for satisfiability and the 2nd argument is the file containing the program (more about the syntax of programs below).

  • Alternatively, you can obtain in addition to yes/no answer a graph that indicates a tree model together with which nodes are blocking which other ones (see the paper RR 2009). Try:


    This will produce a file TEMP.graph in the current directory in Graphviz dot format.

Format of the Logic Programs

We follow a home-made syntax for expressing conceptual logic programs. Take for example the rule

a(X) :- d(X), not e(X), f(X,Y), b(Y), g(X,Z), not b(Z).

This results in the following program:

rule( r1, a, [ d, n(e)  ], [ [f, b ], [ g, n(b)] ]).

unary( a ).
unary( b ).
unary( d ).
unary( e ).
binary( f ).
binary( g ).

free( f ).
free( b ).
free( g ).

Note rule/4. The first argument r1 is the name of the rule. The second argument a is the head predicate of the rule. The third argument is the predicates corresponding to the root X in the body. Thus d(X) becomes d and not e(X) becomes n(e). The final argument is a list of lists. Each list in that list corresponds to the predicates for a successor in the body of the rule. Thus, f(X,Y), b(Y) is represented by the list [f,b], and g(X,Z), not b(Z) is represented by [g,n(b)].

Finally, we indicate for each and every predicate whether it is unary or binary (note that because of how we encode the rule itself, this is necessary), and we indicate which of the predicates are free.

License Information