It would be nice to have a library of predicate assert-checking:
:- expect_det(p/a).
:- expect_true(p/a). % This predicate should never be false.
:- expect_number(p/a, 2). % arg2 should be a number
:- expect_grounded(p/a, 2). % arg2 should always be grounded
....
Or better, have these assumptions formally (and optionally) part of the language syntax:
p(X:grounded, Y:number) : det, true :-
...
or, perhaps just:
:- constraints( p(grounded, number), [det, true] )
...
Do such tools exist?
Mercury has something similar, but I think it breaks compatibility with standard Prolog, which is a shame.