Constraint Handlers

The CHR library comes with plenty of constraint handlers written in CHR. The most recent versions of these are maintained at http://www.pst.informatik.uni-muenchen.de/~fruehwir/chr-solver.html


arc.pl
classical arc-consistency over finite domains
bool.pl
simple Boolean constraints
cft.pl
feature term constraints according to the CFT theory
domain.pl
finite domains over arbitrary ground terms and interval domains over integers and reals, but without arithmetic functions
gcd.pl
elegant two-liner for the greatest common divisor
interval.pl
straightforward interval domains over integers and reals, with arithmetic functions
kl-one.pl
terminological reasoning similar to KL-ONE or feature trees
leq.pl
standard introductory CHR example handler for less-than-or-equal
list.pl
equality constraints over concatenations of lists (or strings)
listdom.pl
a straightforward finite enumeration list domains over integers, similar to interval.pl
math-elim.pl
solves linear polynomial equations and inequations using variable elimination, several variations possible
math-fougau.pl
solves linear polynomial equations and inequations by combining variable elimination for equations with Fourier's algorithm for inequations, several variations possible
math-fourier.pl
a straightforward Fouriers algorithm to solve polynomial inequations over the real or rational numbers
math-gauss.pl
a straightforward, elegant implementation of variable elimination for equations in one rule
minmax.pl
simple less-than and less-than-or-equal ordering constraints together with minimum and maximum constraints
modelgenerator.pl
example of how to use CHR for model generation in theorem proving
monkey.pl
classical monkey and banana problem, illustrates how CHR can be used as a fairly efficient production rule system
osf.pl
constraints over order sorted feature terms according to the OSF theory
oztype.pl
rational trees with disequality and OZ type constraint with intersection
pathc.pl
the most simple example of a handler for path consistency--two rules
primes.pl
elegant implementations of the sieve of Eratosthenes reminiscent of the chemical abstract machine model, also illustrates use of CHR as a general purpose concurrent constraint language
scheduling.pl
simple classical constraint logic programming scheduling example on building a house
tarski.pl
most of Tarski's axiomatization of geometry as constraint system
term.pl
Prolog term manipulation built-in predicates functor/3, arg/3, =../2 as constraints
time-pc.pl
grand generic handler for path-consistency over arbitrary constraints, load via time.pl to get a powerful solver for temporal constraints based on Meiri's unifying framework. time-rnd.pl contains a generator for random test problems.
time-point.pl
quantitative temporal constraints over time points using path-consistency
tree.pl
equality and disequality over finite and infinite trees (terms)
type.pl
equalities and type constraints over finite and infinite trees (terms)

You can consult or compile a constraint handler from the CHR library using e.g.:

     | ?- [library('chr/examples/gcd')].
     | ?- compile(library('chr/examples/gcd')).
     
If you want to learn more about the handlers, look at their documented source code.

In addition, there are files with example queries for some handlers, their file name starts with examples- and the file extension indicates the handler, e.g. .bool:

     examples-adder.bool
     examples-benchmark.math
     examples-deussen.bool
     examples-diaz.bool
     examples-fourier.math
     examples-holzbaur.math
     examples-lim1.math
     examples-lim2.math
     examples-lim3.math
     examples-puzzle.bool
     examples-queens.bool
     examples-queens.domain
     examples-stuckey.math
     examples-thom.math