Forward Debugging

Ports related to event handling will be displayed differently during query debugging and ancestor inspection. The delta computation of a fact F/A is carried out by a predicate F/A+1. The port name and the goal of a delta computing predicate are adapted as follows. During query debugging the ‘call’ and ‘fail’ port have been replaced by a ‘post’ and ‘done’ port that will show the newly arrived fact.


Figure 1: Forward Debugging Ports

Further the ‘exit’ and ‘redo’ port have been replaced by a ‘diff’ and ‘more’ port that will show the delta. The deltas consist of the insert sets only. Delete sets will be marked by the (-)/1 and shown during the initial trace of the forward clause. Finally during ancestor inspection the ‘goal’ pseudo port has been replaced by a ‘fact’ pseudo port that will show the newly arrived fact.

Forward rules that contain delete sets are internally translated into delta computation clauses that work with delayed deletes and/or clause references. The port cosmetics will hide the details of these translations and show the insert set together with the delete set. Here are some forward clauses with a delete set from the little solver example:

+bound(X, C) <= =domain(X, [C]), !.
[...]
+domain(X, F) <= =domain(X, D), -domain(X, E), intersection(D, E, F).

These forward clauses will be translated as follows:

domain(X, [C], A) :- !,
sys_unify_notrace(A, sys_drop(+bound(X,C),unit)).
domain(X, D, B) :-
sys_capture(sys_clause_expose(domain(X,E), true, A)),
intersection(D, E, F),
sys_unify_notrace(B, sys_drop(+domain(X,F),A)).

Since in both forward clauses the incoming fact is deleted the translations make use of delayed deletes via the sys_drop/2 result. The forward fact that caused the sys_drop/2 will not be shown during a call, instead it will be shown as a delete element inside the delta separated by the forward clause operator (<=)/2.

When we trace the first forward clause we do see the delete element in the delta:

?- <= +domain(x,[1]).
    0 Post domain(x, [1]) ?
    0 Diff + bound(x, 1) <= - domain(x, [1]) ?
Etc..

When we trace the second forward clause we do see the first delete element in a call and the second delete element in the delta:

?- <= +domain(x,[1,2,3]), <= +domain(x,[2,3,4]).
[...]
    1 Call - domain(x, _B) ?
    1 Exit - domain(x, [1,2,3]) ?
    1 Call intersection([1,2,3], [2,3,4], _D) ?s
 >  1 Exit intersection([1,2,3], [2,3,4], [2,3]) ?
    0 Diff + domain(x, [2,3]) <= - domain(x, [2,3,4]) ?
Etc..

Last but not least the forward debugging inherits all properties of the default debugger. For example it will not yet eliminate unnecessary choice points for deterministic executions. The forward debugging also inherits all commands of the default debugger. This includes spy points commands, goal skipping commands and the various inspection commands.

Comments