@jan, I was trying to do the same.
So far I find sCASP extremely useful, whereas WFS leaves a lot to be desired. Taking the moth example: “something is a moth if it does not fly during daylight”. Let’s say we have incomplete knowledge. Let’s try to code it with sCASP and WFS:
% First sCASP :- use_module('../../prolog/scasp/embed'). :- use_module('../../prolog/scasp/human'). % something is a moth if it does not fly during daylight. % :- begin_scasp(moth, [moth_scasp/1]). moth_scasp(X) :- not flies_during_day(X). flies_during_day(B) :- bird(B). bird(eagle). bird(hummingbird). bird(bluejay). :- end_scasp. % Now WFS moth_wfs(X) :- tnot(flies_during_day_wfs(X)). :- table flies_during_day_wfs/1. flies_during_day_wfs(B) :- bird_wfs(B). bird_wfs(eagle). bird_wfs(hummingbird). bird_wfs(bluejay).
Now let’s try it with WFS:
5 ?- moth_wfs(X). false.
Uhh? This is useless. In WFS negation is not really handled the way a human would expect.
Now let’s look at the beauty of sCASP:
4 ?- moth_scasp(X). sCASP model: [not bird(X),not flies_during_day(X),moth_scasp(X)], sCASP justification query ← moth_scasp(X) ← not flies_during_day(X) ← not bird(X) ∧ o_nmr_check, X ∉ [bluejay,eagle,hummingbird] ; false.
WOW! It told me X could be a moth if it is not a bluejay or eagle or hummingbird. Much more useful! It uses all the information I gave in the code. Notice the “could be”.
Not only that, but it told me why: because something is a moth if it doesn’t fly during the day. And it also told me that something doesn’t fly during the day if it is not a bird, even though I never said this explicitly in the code
This is quite amazing, and I can see that it solves the negation problem in a satisfactory manner (of course the issue now is performance).
I am trying to figure out what ‘o_nmr_check’ means, could you explain it?
EDIT: just for the sake of completeness, we can add the following line to the scasp code above an it will give us the ‘closed world model’ answer that
moth_wfs(X) gives us: