My apologies in advance, I’m unfamiliar with this area. I have been ruminating on what I would like a really powerful educational debugger for Prolog to look like, and to do what I’m imagining it would need to be aware of the source, aware of the trace, and aware of how they are linked.
I’m not sure how to achieve that last part. I understand that the trace will show a “call” for a clause that unifies for the parent goal, but how can one tell from the trace output what file or line number that clause was found on? I don’t remember ever seeing that info in a trace output.
My idea is essentially a visualized tree of trees. If you have ever played go or chess online you may be familiar with a variation tree, where you can rewind a game, make a different move, and a new branch is created in the game history tree at the bottom of the interface.
I’m imagining an interface like that, where nodes in the bottom tree represent calls, and branching represents a redo. Instead of each node displaying a board position, it displays a tree representing the justification tree that would be generated by the current position in the trace, illustrating what had been unified with what so far. Successful search routes would be highlighted green in the outer tree. Each green leaf node would be an answer, and would display the trace for just that answer. Green branches would represent the points at which two partially similar answers diverged.
What I would like is for the justification tree for a given node to show the source code that the call came from, to understand what subgoals are being added at that point, and why. Potentially with any immediately preceding comments, or other meta-data about the clause, like the file name, etc.
I feel like this would make trace output a lot easier to process, because the navigation tree represents the search path that was followed, but each node displays the cumulative effects of that and all previous successful nodes. So you are seeing the incremental and the cumulative effect at the same time. And you could watch it generate, which would illustrate how resolution happens, and you could also rewind it, to understand specific steps.
So two questions: does that seem like something worth trying, and where would I find the meta-data for the clause being used in a given call?