Scasp expected behaviour

Hi all,

I have currently got the following which I don’t understand.

I’m using: scasp on swish.

My code looks like this:

https://swish.swi-prolog.org/p/scasp_error.pl

% s(CASP) Programming
:- use_module(library(scasp)).

% Your program goes here

false :-q,r(1).

q.
r(2).
r(1).

thing:-q,r(1).

p(X):- X #>2.

/** <examples> Your example queries go here, e.g.
?- ? q.
?- ? r(1).
?- ? thing.
?- ? p(X).
*/

I try the following queries:

?- ? q.
false
?- ? r(1).
false
?- ? thing.
s(CASP) model
q holds
thing holds
r holds for 1
?- ? p(X).
scasp_just_html:clpq/5: Deterministic procedure scasp_swish:to_html/3 failed

But I expected :

?- ? thing.
false.

?- ? p(X).
X#>2.

That is not your fault :slight_smile: Both now work as you expected them. Constraints of the binding are printed in native clp(q) notation. I’m not sure that can be avoided in SWISH.

Thanks for reporting!

Using the link provided by Sam https://swish.swi-prolog.org/p/scasp_error.pl

% s(CASP) Programming
:- use_module(library(scasp)).

% Your program goes here

false :-q,r(1).

q.
r(2).
r(1).

thing:-q,r(1).

p(X):- X #>2.

for thing. the result is true. Sam was expecting false.

Just noting in case someone wants a sanity check on what someone else sees.


Current results I see

?- q.
false

?- r(1).
false

?- thing.
true

?- p(X).
procedure `A #> B' does not exist
Reachable from:
	  p(A)

EDIT

As Jan W. notes below I did not use ? with the query. I know if I am making this mistake so are others.

Here is the right way.

image

You need to run ? thing. to get sCASP semantics. Otherwise you have Prolog semantics.

1 Like

Thanks again Jan.
I also at first missed the ? syntax, maybe try and make that more clear in the example scasp page with first a call to scasp/1 then the same call with the short hand ? explicitly pointed out.

Good point. Done. Note that you can save the notebook as a normal user notebook, edit it and send me the link :slight_smile:

1 Like