The Prolog CHR compiler exploits user:term_expansion/6 rules to translate the constraint handling rules to plain Prolog. These rules are loaded from library(chr). They are activated after finding a declaration of the format:

:- chr_constraint …

It is advised to define CHR rules in a module-file, where the module declaration is immediately followed by loading library(chr) as exemplified below:

:- module(zebra, [ zebra/0 ]).
:- use_module(library(chr)).

:- chr_constraint …

Send feedback on this subject.