opera(D) :- not home(D). % A day D, Bob either goes to the opera...
home(D) :- not opera(D). % ... or stays home.
home(monday). % On Monday, Bob stays at home.
false :- baby(D), opera(D). % When Bob's best friend comes with her baby, it is
% not a good idea to take the baby to the opera.
baby(tuesday). % They come on Tuesday.```
and the answer to the following query:
scasp(opera(D),[model(Model)])
Model = [
not baby(_16270),
baby(tuesday),
not home(D),
home(tuesday),
opera(D),
not opera(tuesday)
],
Dâ[monday, tuesday],
_15292â[tuesday]
I do not understand why we have _16270 and _15292. Why donât we have the same variable?
Unfortunately Iâm not the one to help debug Windows issues! Iâm guessing youâve already installed as per this page, and were able to create scasp.exe? I guess I would attempt to follow the directions exactly, by starting swipl interactively, and running pack_install(.) at the prompt.
Again I donât know anything about Windows installation, but the "." issue looks like it could easily be caused by some setup that happens when swipl is run interactively, but not the way youâve done it above. That could also be a complete red herring.
Looks like an old version of SWI-Prolog that doesnât yet give variables names before printing the answer.
You get the same if you use the scasp application. When embedding into Prolog you end up with a model in Prolog where variable may have constraints. These are represented and printed following the normal Prolog toplevel conventions.
Interesting, thanks. Iâve always been a bit confused about the interaction between these pieces of software. Are my two outputs above just two different representations of the same result? Or are they actually derived differently? The way _A â [tuesday] and D \= monday complement each other makes me think one is using the âdual programâ?
I think both are represented by the somewhat (too) simple s(CASP) inequality constraint. Embedded into Prolog the toplevel prints the constraint such that it can be executed as a goal. s(CASP) defines â/2. \=/2 is an existing Prolog builtin predicate, so we cannot use that.
Just noted that â/2 is not exported from library(scasp). Pushed a patch to export this. So, now we can do this, making it all consistent.
?- [library(scasp)].
true.
?- A â [2].
A â [2].
?- A â [2], A = 2.
false.