What is the unify port used for?

I want to give a definitive yes or no to that but I can’t. In general I would say yes.

In the following a head is either a head of a clause which has a head and body, or a fact with is a head without a body.

If I yes then I am thinking if one has the source code and knows that the order of the code decides the order of trying the unifications then you can infer which heads failed, but without the source code there is not enough detail in a trace to know a rule was tried and failed. This is what I like about the Prolog Visualizer. Another thing you have to remember is that with indexing the procedure to find the next head to check changes because with indexing you can index into a subset of the heads to check. I am not sure if that is why they call in indexing but the analogy works for me.

If I say no, then I am sure I could create a very simple example that did not need any additional info.

A few other things you have to be aware of when understanding a gtrace/0 are the icon such as builtin, dynamic, foreign, meta, etc. They are listed in the personal notes of this post.

Also note that with trace/0, ^ is for transparent predicates as noted here. I don’t have enough experience with SWI-Prolog to explain them. And with trace the numbers in parenthesis are referring to new frames, think recursion.


I did not know the details of those flags Jan W. gave in this answer until I read it.


My plan to write documentation for trace/0 and gtrace/0 was by starting at the source code and understanding every line, a bottom up approach, and why I took the time to find the location of the gtrace/0 icons. I knew if I had the locations of the source code with the icons that I was neck deep in the code used for debugging.