I’m curious because I’ve seen a kanren implementation.
Can you make such an operator in Prolog? I’m aware there’s an implementation of it,
- That requires the goal to be tabled.
- casp seems to require a dialect(?) to be loaded and I’m not sure you can even use it in regular Prolog since the interpreter would complain about not being overwritten.
cnot(G) :- G =.. [Name|Args],
bagof(Args, G, L),
process_list(L, Args).
process_list(...) :- ... %applies diff on list
It’s easy to collect the answers to a predicate with bagof and then to apply dif. This almost works up to step 3, and then I’d need a bagof that displays inequality?