Module delta

This module provides a couple of operators and predicates to define forward chaining clauses. A forward chaining clause is recognized by the (<=)/2 operator. A forward chaining clause has the form "Action <= Condition" where the action part can be arbitrary Prolog goals. A forward chaining clause will be rewritten into multiple delta computation rules.

Action <= Condition     % Forward Chaining Clause.

The module provides a new hypothetical reasoning verbs post/1. This verb first invokes the delta computation rules to determine a new agenda, then uses assumez/1 to assume the given fact and finally continues with the new agenda. By delete set inclusion the delta computation can also yield counter factual reasoning.

:- forward q/2.
post(q(X)) <= posted(p(X)).

?- post(p(a)), q(X).
X = a

The delta computation has functor F/N+1 for an arriving fact with a functor F/N. Each literal in the body of a forward chaining clause has to be annotated either for delete set inclusion phaseout/1, for delta computation posted/1 or for both phaseout_posted/1. Non-annotated lit-erals are condition goals that are executed in backward chaining fashion.

The following delta computation predicates are provided:
forward P, ...:
The predicate sets the predicate P to discontiguous, sys_notrace and static.
post(F, G):
The fact F is not directly assumed. Instead, it is first treated as a new fact for delta computation.

The following forward chaining condition goals are recognized:

The condition succeeds when F is an old fact and it then gets included for deletion.
The condition reacts if F is a new fact.
The condition reacts if F is a new fact and it then gets included for deletion.
A, B:
The condition reacts when A or B react, and the other succeeds, or both react.
A; B:
The condition reacts when A or B react.
Whenever P succeeds in backward chaining the condition succeeds.

The following forward chaining rule term expansion is recognized:

A <= C:
The construct defines a forward chaining clause with action A and condition C. The forward chaining clause is rewritten into delta computations.