ychr-0.1.0.0: examples/leq.chr
% The canonical CHR example: a less-or-equal solver.
%
% Four rules cover the structural properties of a partial order:
% - reflexivity: leq(X, X) is trivially true.
% - antisymmetry: leq(X, Y) and leq(Y, X) force X = Y.
% - idempotence: two copies of leq(X, Y) collapse to one
% (simpagation: keep the left, remove the right).
% - transitivity: leq(X, Y) and leq(Y, Z) propagate leq(X, Z).
%
% Used by docs/tutorials/02-chr-primer.md as the worked example for
% all three rule kinds (simplification, simpagation, propagation).
:- module(order, [leq/2]).
:- chr_constraint leq/2.
reflexivity @ leq(X, X) <=> true.
antisymmetry @ leq(X, Y), leq(Y, X) <=> X = Y.
idempotence @ leq(X, Y) \ leq(X, Y) <=> true.
transitivity @ leq(X, Y), leq(Y, Z) ==> leq(X, Z).