I have a piece of code that works properly in s(CASP) when using the prev_forall
forall algorithm, and doesn’t work in the c_forall
algorithm, which I think is the default.
If you’re interested in seeing the specific code, there is an example here. If you un-comment the last line (which should be irrelevant), the query ? legally_holds(A,B).
no longer works.
As a workaround I could change the flag to use prev_forall
for everything, but I’m worried that’s going to cause unpredictable problems, and I understand from @Xuaco that it will likely also not work if the code uses constraints. Is that so in the SWI-Prolog version, also?
I could just detect if the query I’m executing is with regard to the effected code, and if so change the options in the scasp call, but that would change the forall used for both the particular goal and all the sub-goals in the rest of the code.
I’m using s(CASP) as a library inside SWI-Prolog, and I know that the forall option exists for calling s(CASP), so I’m thinking there might be some way that I could use prev_forall
for one portion of my code, and use the default algorithm for the rest. My current use-case is with regard to this bug, but I anticipate there might be other reasons I want to use particular algorithms with particular modules in future, too.
Is this something that I could accomplish by pre-compiling a file with the relevant code, and then integrating that with the rest of my s(CASP) source? Would it be possible to have a compiler directive that sets the forall algorithm by file, or by predicate?
Is there some other approach I could try?
Thanks very much.