"Steadfast" comparison of terms?

Is there a way of comparing terms that is “steadfast”, in the sense that there doesn’t exist an instantiation of any of the variables that will change the result. For example:

X @< Y        % not steadfast if X=2,Y=1
p(X) @< p(Y)  % not steadfast if X=2,Y=1
p(X) @< p(2)  % not steadfast if X=3
p(X) @< q(Y)  % steadfast

I think that this will do it, raising an assertion error if the comparison isn’t steadfast (and similarly for (@<)/2 et al; am I correct?

steadfast_compare(Order, Term1, Term2) :-
    compare(Order, Term1, Term2),
    (  Order = '='
    -> true
    ;   assertion( ?=(Term1,Term2) )