Optimized Compilation of Multiset Rewriting with Comprehensions

  • Edmund Soon Lee Lam
  • Iliano Cervesato
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8858)


We extend the rule-based, multiset rewriting language CHR with multiset comprehension patterns. Multiset comprehension provides the programmer with the ability to write multiset rewriting rules that can match a variable number of entities in the state. This enables implementing algorithms that coordinate large amounts of data or require aggregate operations in a declarative way, and results in code that is more concise and readable than with pure CHR. We call this extension CHR cp . In this paper, we formalize the operational semantics of CHR cp and define a low-level optimizing compilation scheme based on join ordering for the efficient execution of programs. We provide preliminary empirical results that demonstrate the scalability and effectiveness of this approach.


Operational Semantic Abstract Machine Indexing Directive Abstract State Machine Constraint Store 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Batory, D.: The LEAPS Algorithm. Technical report, University of Texas at Austin (1994)Google Scholar
  2. 2.
    Cruz, F., Rocha, R., Copen Goldstein, S., Pfenning, F.: A linear logic programming language for concurrent programming over graph structures. CoRR, abs/1405.3556 (2014)Google Scholar
  3. 3.
    De Koninck, L., Schrijvers, T., Demoen, B.: User-definable rule priorities for chr. In: PPDP 2007, pp. 25–36. ACM, New York (2007)Google Scholar
  4. 4.
    De Koninck, L., Sneyers, J.: Join ordering for constraint handling rules. In: CHR (2007)Google Scholar
  5. 5.
    Duck, G.J., Stuckey, P.J., García de la Banda, M., Holzbaur, C.: The Refined Operational Semantics of Constraint Handling Rules. In: Demoen, B., Lifschitz, V. (eds.) ICLP 2004. LNCS, vol. 3132, pp. 90–104. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  6. 6.
    Holzbaur, C., de la Banda, M.G., Stuckey, P.J., Duck, G.J.: Optimizing compilation of constraint handling rules in HAL. CoRR, cs.PL/0408025 (2004)Google Scholar
  7. 7.
    Lam, E.S.L., Cervesato, I.: Constraint Handling Rules with Multiset Comprehension Patterns. In: CHR 2014 (2014)Google Scholar
  8. 8.
    Lam, E.S.L., Cervesato, I.: Optimized Compilation of Multiset Rewriting with Comprehensions (Full-Version). Technical Report CMU-CS-14-119, Carnegie Mellon (June 2014)Google Scholar
  9. 9.
    Lam, E.S.L., Cervesato, I.: Reasoning about Set Comprehension. In: SMT 2014 (2014)Google Scholar
  10. 10.
    Lam, E.S.L., Cervesato, I.: Decentralized Execution of Constraint Handling Rules for Ensembles. In: PPDP 2013, Madrid, Spain, pp. 205–216 (2013)Google Scholar
  11. 11.
    Sneyers, J., Van Weert, P., Schrijvers, T., Demoen, B.: Aggregates in Constraint Handling Rules. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 446–448. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  12. 12.
    Triossi, A., Orlando, S., Raffaetà, A., Frühwirth, T.W.: Compiling CHR to parallel hardware. In: PPDP 2012, pp. 173–184 (2012)Google Scholar
  13. 13.
    Van Weert, P., Schrijvers, T., Demoen, B., Leuven, K.U.: JCHR: A user-friendly, flexible and efficient CHR system for Java. In: CHR 2005, pp. 47–62 (2005)Google Scholar
  14. 14.
    Weert, P.V., Sneyers, J., Schrijvers, T., Demoen, B.: Extending CHR with Negation as Absence. In: CHR 2006, pp. 125–140 (2006)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Edmund Soon Lee Lam
    • 1
  • Iliano Cervesato
    • 1
  1. 1.Carnegie Mellon UniversityDohaQatar

Personalised recommendations