Module asp

This module provides some choice operators for answer set programming via forward chaining [10]. Since we use the (:-)/2 operator already for backward chaining rules, the operator (<=)/2 from the module "delta" needs to be used to write answer set programming rules. Take this example:

Example:
:- p, q, r.
{p,r}.
{q} :- p.
{r} :- p.

This would need to be written as follows. For answer set programming constraints a forward chaining rule with a fail action is suggested. Further answer set programming ordinary facts and disjunctive facts need a start condition such as "init", which can then be used to produce an answer set:

Example:
fail <= posted('p'), posted('q'), posted('r').
choose(['p','r']) <= posted(init).
choose(['q']) <= posted('p').
choose(['r']) <= posted('p').
?- post(init).

Our approach to answer set programming allows explicit mixing of forward chaining and backward chaining in that a forward chaining rule allows backward chaining goals in its condition part. The only predicate that this module currently provides is a choose/1 operator that allows satisfiability search.

The following answer set programming predicates are provided:

choose(L):
choose(L, G):
If a positive literal from L is already satisfied, the construct does nothing before further solving. Otherwise, the construct posts each positive literal from L via backtracking before further solving.
random_choose(L):
random_choose(L, G):
If a positive literal from L is already satisfied, the construct does nothing before further solving. Otherwise, the construct posts each positive literal from L in random order before further solving.
min_choose(N, L):
min_choose(N, L, G):
If N positive literals from L are already satisfied, the construct does nothing before further solving. Otherwise, the construct posts N positive literals from L in input order before further solving.
random_min_choose(N, L):
random_min_choose(N, L, G):
If N positive literal from L are already satisfied, the construct does nothing before fur-her solving. Otherwise, the construct posts N positive literals from L in random order before further solving.

Kommentare