:- use_module(library(clpfd)).

% Factorial relation with FD constraints so that it is itself a constraint.
fac(0,1).
fac(N,F) :- N #> 0, N1 #= N-1, F #= N*F1, fac(N1,F1).
