Constraint Handling Rules at


January 18, 2016 10:07 AM
Constraint Handling Rules (CHR) is both an effective concurrent declarative constraint-based programming language and a versatile computational formalism.

While conceptually simple, CHR is distinguished by a remarkable combination of desirable features:

  • a semantic foundation in classical and linear logic,
  • an efficient sequential and parallel execution model,
  • guaranteed properties like the anytime online algorithm properties,
  • powerful analysis methods for deciding essential program properties.

For example, the following rule computes prime numbers:

prime(X) \ prime(Y) <=> Y mod X == 0 | true.

It takes two prime candidates X and Y and removes Y if the number is a multiple of X. Given the integers from 2 to n, then after exhaustive application of the rule, only prime numbers up to n remain in the end.

Playground

This example and others can be tried online, e.g. at http://chrjs.net/playground (choose example "primes" in the Playground pull-down menu).

Implementations and free downloads of CHR

 

Implementations and free downloads of CHR can be found in most Prolog systems, in Java, JavaScript and Haskell.

 

For a quick overview of CHR, look at the slides of the CHR keynote talk at RuleML 2015: http://www.informatik.uni-ulm.de/pm/mitarbeiter/fruehwirth/drafts/CHR-ruleml-keynote-online-2015r.pdf

For more information, you may start at the CHR book webpage: http://constraint-handling-rules.org/

In 2016, the annual CHR workshop will take place as special track of the conference: http://2016.ruleml.org/calls/constraint-handling-rules-track

So, submit and see you,
Thom Fruehwirth