|Did you know ...||Search Documentation:|
|Packs (add-ons) for SWI-Prolog|
|Rating:||Not rated. Create the first rating!|
|Author:||Jan Wielemaker Liang <email@example.com>|
|Maintainer:||Jan Wielemaker Liang <firstname.lastname@example.org>|
|Packager:||Jan Wielemaker Liang <email@example.com>|
No reviews. Create the first review!.
This package implements half of the ideas from Włodzimierz Drabent described in On Feasibility of Declarative Diagnosis, presented at ICLP2023 as a poster.
With half, we mean it only implements the part for debugging wrong answers, not the scenario where no answer is produced.
I implemented this to access the feasibility to record the proof tree without program transformation by exploiting the hooks into the SWI-Prolog debugger. This requires the current GIT version or SWI-Prolog 9.1.12 or later.
The other question is whether this really produces a more productive debugging experience to find the root of wrong answers than classical debugging, i.e.,
git is installed on your machine, the following should work:
Else, download the code from https://github.com/JanWielemaker/ddebug.git, either using git or download as an archive and unpack. Next, enter the directory using Prolog and run
First, load the pack using
Now, to debug a goal, run e.g.,
mygoal(X,Y) while collecting the proof tree. On success
it displays the answer and provides an interactive browser for the
proof tree. Use
? to display help on the navigation command.
The proof tree is a nested tree of answers to (sub)goals that resulted in the current answer. A node is displayed as
It is presented as a clause, but without any control structure.
I.e., if the original clauses uses an (if->then;else) it will either
else depending on which branch was used to create
Possibly this is notably useful in the context of SWISH or the WASM based online version. The availability of HTML should make navigation, fold/unfold and showing details using tooltips much more intuitive.
Second, we must deal with incompleteness, notably lack of any answer. This requires a different approach to collecting the explored tree rather than the proof tree. This is described in the paper cited above.
Please discuss at the SWI-Prolog forum
Pack contains 6 files holding a total of 25.0K bytes.