You want call(Formula, P, Q)
, not call([Formula, P, Q])
. Simply remove the square brackets. Try this to make it more clear what the error is:
?- write_canonical(call([Formula, P, Q])).
call('.'(_,'.'(_,'.'(_,[]))))
true.
I.e. with the square brackets, you are calling a (.)/2
predicate, which you (likely) don't define. But the high-order predicate that you want to call is call/3
, whose arguments are call(Closure, Arg1, Arg2)
. E.g. call(formula_0, true, false)
will call formula_0(true, false)
.