I'm trying to use a PROLOG script file with Rules
in Batch mode, (not interactive mode).
Using swi-prolog in Ubuntu Linux,
it works well in Prolog's interactive mode.
But how to run prolog in Batch mode? (not interactive mode).
So, the objective is to call swipl with a query argument
and see the results
as output in Terminal.
Ideally,
to also see in the Terminal output,
which Rule(s) are "true" for each input query.
My prolog db.pl file:
likes(john,jane).
likes(jane,john).
likes(jack,jane).
% and a single Rule below:
friends(X,Y) :- likes(X,Y) , likes(Y, X).
I tried to run in Terminal:
swipl -s db.pl -t friends(X,Y)
where:
friends(X,Y)
is the goal/query I want to evaluate via the Rule in db.pl.
Expected result:
john,jane
Ideal output with "true" Rule numbers:
john,jane,Rule01
Actual result:
bash: syntax error near unexpected token `('
Can not find a simple code example
on how to accomplish this objective in prolog...