:- use_module(library(chr)). :- chr_constraint rich/1, prof/1, has/2. prof(X), rich(X) ==> fail. happy(X):- rich(X). happy(X):- prof(X), has(X,nice_students).