I have a prolog file that classifies a given predicate bongard(A, X) with given background facts. Snippet of the rules:
bongard(A,[neg]) :- triangle(A,C), \+ in(A,C,D), !.
bongard(A,[neg]) :- \+ triangle(A,C), !.
...
I am executing this program like so: swipl -s file.pl -g "bongard(a, X), write(X)"
, to obtain the classification for this predicate.
Now I would also like to know which rule triggered and actually bounded the variable. Is there any neat way to do this? Right now I need to keep an additional n files for an original prolog file with n rules. File1 has the first rule, file2 has the first 2 rules.. You get the idea. This way if File2 classifies the rule, I know the second rule fired.
Does anyone have any better suggestions for this?
EDIT: What about giving the predicate a unique number "bongard(A, X, nr)" I could then both write(X) and write(Nr) so I know which predicate fired?