Constraint handling rules specify howallowed torewriting rewriteor theaddition of constraints in the constraint store. The programmer can use these rules to specify that some new constraints are equivalent or follows from other constraints, allowing for a rewriting or addition of new constraints in the store. The following are example rules:
A(X) <==> B(X) | C(X)
Line 101:
Equivalence allows for simplifying the constraint store. In particular, if the third constraint is <code>true</code>, and the second constraint is entailed, the first constraint is removed from the constraint store. Inference allows for the addition of new constraints, which may lead to proving inconsistency of the constraint store, and may generally reduce the amount of search needed to establish its satisfiability.
ALogic specificprogramming methodclauses forin establishingconjunction satisfiabilitywith ofconstraint constraintshandling rules can be definedused usingto differentspecify how to establish the satisfiability of the constraint store. Different clauses forare implementingused to implement the different choices of the satisfiability method, and; the constraint handling rules forare specifyingused how tofor rewriterewriting the constraint store during execution. As an example, one can implement backtracking with [[unit propagation]] this way. Let <code>holds(L)</code> represents a propositional clause, in which the literals in the list <code>L</code> are in the same order as they are evaluated. The algorithm can be implemented using clauses for the choice of assigning a literal to true or false, and constraint handling rules to specify propagation. In particular, theseThese rules specify that <code>holds([l|L])</code> can be removed if <code>l=true</code> follows from the store, and it can be rewritten as <code>holds(L)</code> if <code>l=false</code> follows from the store.