I’ve been looking at using s(CASP) inside SWI-Prolog for the purpose of doing encodings of statutes and regulations.
I created a little toy library with code like the following:
#pred add(X,Y,Z) :: "the sum of @(X) and @(Y) is @(Z)".
add(X,Y,Z) :-
Z is X + Y.
This just adds explanations for mathematical calculations to s(CASP)'s justifications and models, but that’s an important feature if we are encoding benefit laws, for example.
What I would like is to do something similar with dates and times. I’m aware SWI-Prolog has its own library for dates, but I understand it isn’t available inside s(CASP). s(CASP)'s implementation also does not seem to have any ability to deal with timestamps built-in.
I’m thinking it would be possible to take the existing SWI-Prolog date library, for example, and re-implement it as an s(CASP) library.
I’m wondering if that’s feasible, and if there is another, easier way to get where I need to go. I know there has been some discussion about being able to call Prolog from inside s(CASP) code. Is that something we’re expecting to see soon? Would that work smoothly with s(CASP)'s other capabilities? In particular, I’d like to be able to take advantage of how s(CASP) treats constraints, have it deal with constraints expressed as numerical time stamps, and then translate those back to dates, etc., for the purpose of explaining the conclusions to the user. I’m worried that if the date calculations are happening outside of s(CASP), s(CASP) won’t have access to that information when generating explanations, and the explanations would need to be post-processed to convert timestamps back into dates, or what have you.
For context, I’m not an experienced Prolog software developer. I’ve mostly done legal knowledge representation work in various declarative logic languages. I did write a date-subtract predicate for Flora-2 last year, to be able to add that feature to Blawx.com. So it wouldn’t be the first time I have touched date math in a Prolog-like language. But converting an entire library, especially considering how weird dates are, might be a heavy lift.
I appreciate everyone’s thoughts.