We solve this problem by designing an ASP-specification.
We start by defining in ASP the predicates
prec(
,
), precneq(
,
),
and equiv(
,
),
to render the relators
,
, and
, resp.
Moreover, the fact of ``being an event'' (i.e. a member of
) is stated through the
monadic predicate event(
).
Auxiliary predicates/functions are used to render
set-theoretical construcs, such as
,
, and
,
whose implementations rely on user-defined C-libraries.
The characterization of potential legal answer sets is done by asserting properties
of prec(
,
), precneq(
,
),
and equiv(
,
), as follows:
prec(A,B) :- event(A;B), equiv(A,B).
prec(B,A) :- event(A;B), equiv(A,B).
:- precneq(A,B), event(A;B), equiv(A,B).
prec(A,B) :- event(A;B), precneq(A,B).
equiv(A,B) :- event(A;B), prec(B,A), prec(A,B).
Also axioms (A1')-(A3') must be imposed.
For instance (A3') is rendered by
weeding out all answer sets where
holds for some events
and
:
Consider now one of the axioms, say (B'), for simplicity. To test its satisfaction, we use a rule of the form:
failsB1 :- event(X;Y;Z;W), subset(X,Y), X!=Y, subset(Z,W),
Z!=W, subset(W,Y), W!=Y, subset((W
Z),(Y
X)),
equiv(X,Y), precneq(Z,W).
Having in mind (B'), this clause is of immediate reading: the fact failsB1 is true (i.e. belongs to the answer set) whenever there exist events falsifying (B'). All other axioms have been treated similarly.
When smodels is fed with such program and a description of an input preference relation, different outcomes may be obtained: