Abstract
Constraint Handling Rules (CHR) is a high-level rule-based programming language which is increasingly used for general-purpose programming. We introduce the CHR machine, a model of computation based on the operational semantics of CHR. Its computational power and time complexity properties are compared to those of the well-understood Turing machine and Random Access Memory machine. This allows us to prove the interesting result that every algorithm can be implemented in CHR with the best known time and space complexity. We also investigate the practical relevance of this result and the constant factors involved. Finally we expand the scope of the discussion to other (declarative) programming languages.
- Adelson-Velsky, G. M. and Landis, E. M. 1962. An algorithm for the organization of information. Doklady Akademii Nauk SSSR 146, 263--266.Google Scholar
- Aho, A. V., Hopcroft, J. E., and Ullman, J. D. 1975. The Design and Analysis of Computer Algorithms. Addison-Wesley Longman, Boston. Google Scholar
Digital Library
- Cherkassky, B. V., Goldberg, A. V., and Radzik, T. 1996. Shortest paths algorithms: Theory and experimental evaluation. Math. Program. 73, 129--174.Google Scholar
Cross Ref
- Clavel, M., Durán, F., Eker, S., Lincoln, P., et al. 2002. Maude: Specification and programming in rewriting logic. Theor. Comput. Sci. 285, 2, 187--243. Google Scholar
Digital Library
- Clocksin, W. F. and Mellish, C. S. 1984. Programming in Prolog. Springer. Google Scholar
Digital Library
- De Koninck, L., Schrijvers, T., and Demoen, B. 2007. The correspondence between the Logical Algorithms language and CHR. In Proceedings of the 23rd International Conference on Logic Programming (ICLP'07), V. Dahl and I. Niemelä, Eds. Lecture Notes in Computer Science, vol. 4670. Springer, 209--223.Google Scholar
- Dijkstra, E. W. 1959. A note on two problems in connexion with graphs. Numerische Math. 1, 4, 269--271.Google Scholar
Digital Library
- Duck, G. J. 2005. Compilation of Constraint Handling Rules. Ph.D. thesis, University of Melbourne, Victoria, Australia.Google Scholar
- Duck, G. J. and Schrijvers, T. 2005. Accurate functional dependency analysis for Constraint Handling Rules. In Proceedings of the 2nd Workshop on Constraint Handling Rules (CHR'05), T. Schrijvers and T. Frühwirth, Eds., 109--124.Google Scholar
- Duck, G. J., Stuckey, P. J., García de la Banda, M., and Holzbaur, C. 2004. The refined operational semantics of Constraint Handling Rules. In Proceedings of the 20th International Conference on Logic Programming (ICLP'04), B. Demoen and V. Lifschitz, Eds. Lecture Notes in Computer Science, vol. 3132, 90--104.Google Scholar
- Duck, G. J., Stuckey, P. J., and Sulzmann, M. 2006. Observable confluence for Constraint Handling Rules. In Proceedings of the 3rd Workshop on Constraint Handling Rules (CHR'06), T. Schrijvers and T. Frühwirth, Eds., 61--76.Google Scholar
- Eker, S. 2003. Associative-Commutative rewriting on large terms. In Proceedings of the Rewriting Techniques and Applications (RTA'03), R. Nieuwenhuis, Ed. Lecture Notes in Computer Science, vol. 2706. Springer, 14--29.Google Scholar
Cross Ref
- Forgy, C. L. 1982. Rete: A fast algorithm for the many pattern/many object pattern match problem. Artif. Intell. 19, 1, 17--37.Google Scholar
Digital Library
- Fredman, M. L. and Tarjan, R. E. 1987. Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM 34, 3, 596--615. Google Scholar
Digital Library
- Friedman-Hill, E. 2003. Jess in Action: Java Rule-Based Systems. Manning Publications. Google Scholar
Digital Library
- Frühwirth, T. 1992. Constraint simplification rules. Tech. rep. ECRC-92-18, European Computer-Industry Research Centre, Munich, Germany. July.Google Scholar
- Frühwirth, T. 1998. Theory and practice of Constraint Handling Rules. J. Logic Program. 37, 1--3, 95--138.Google Scholar
Cross Ref
- Frühwirth, T. 2001. As time goes by II: More automatic complexity analysis of concurrent rule programs. In Proceedings of the Quantitative Aspects of Programming Languages (QAPL'01), A. D. Pierro and H. Wiklicky, Eds. Electronic Notes in Theoretical Computer Science, vol. 59, 3. Elsevier, 185--206.Google Scholar
- Frühwirth, T. 2002. As time goes by: Automatic complexity analysis of concurrent rule programs. In Proceedings of the 8th International Conference on Principles of Knowledge Representation and Reasoning (KR'02), D. Fensel et al., Eds. Morgan Kaufmann, 547--557.Google Scholar
- Fr&uhuml;wirth, T. 2009. Constraint Handling Rules. Cambridge University Press. To appear.Google Scholar
- Frühwirth, T. and Abdennadher, S. 2003. Essentials of Constraint Programming. Cognitive Technologies. Springer. Google Scholar
Digital Library
- Ganzinger, H. and McAllester, D. A. 2002. Logical algorithms. In Proceedings of the 18th International Conference on Logic Programming (ICLP'02). Lecture Notes in Computer Science, vol. 2401. Springer 209--223. Google Scholar
Digital Library
- Giarratano, J. C. and Riley, G. 1994. Expert Systems: Principles and Programming. PWS Publishing, Boston, MA. Google Scholar
Digital Library
- Hartmanis, J. and Stearns, R. E. 1965. On the computational complexity of algorithms. Trans. Amer. Math. Soc. 117, 285--306.Google Scholar
Cross Ref
- Holzbaur, C. and Frühwirth, T. 1998. CHR reference manual. Tech. rep. TR-98-01, Österreichisches Forschungsinstitut für Artificial Intelligence, Vienna, Austria.Google Scholar
- Holzbaur, C. and Frühwirth, T. 1999. Compiling constraint candling rules into prolog with attributed variables. In Proceedings of the 1st International Conference on Principles and Practice of Declarative Programming (PPDP'99), G. Nadathur, Ed. Lecture Notes in Computer Science, vol. 1702. Springer, 117--133. Google Scholar
Digital Library
- Holzbaur, C., García de la Banda, M., Stuckey, P. J., and Duck, G. J. 2005. Optimizing compilation of constraint handling rules in HAL. Theory Pract. Logic Program. SI Constraint Handling Rules 5, 4-5, 503--531. Google Scholar
Digital Library
- Hopcroft, J. E., Motwani, R., and Ullman, J. D. 2001. Introduction to Automata Theory, Languages, and Computation. Addison-Wesley Longman, Boston, MA. Google Scholar
Digital Library
- Hudak, P., Hughes, J., Jones, S. P., and Wadler, P. 2007. A history of Haskell: Being lazy with class. In Proceedings of the 3rd ACM SIGPLAN Conference on History of Programming Languages (HOPL-III). ACM Press, 1--55. Google Scholar
Digital Library
- Marriott, K. and Stuckey, P. J. 1998. Programming with Constraints: An Introduction. MIT Press, Cambridge, MA.Google Scholar
Cross Ref
- Mazur, N. 2004. Compile-Time garbage collection for the declarative language Mercury. Ph.D. thesis, K. U. Leuven, Leuven, Belgium.Google Scholar
- Miranker, D. P., Brant, D. A., Lofaso, B., and Gadbois, D. 1990. On the performance of lazy matching in production systems. In Proceedings of the 8th National Conference on Artificial Intelligence (AAAI'90), T. Dietterich and W. Swartout, Eds. MIT Press, Boston, MA, 685--692.Google Scholar
- Morrison, D. R. 1968. PATRICIA—Practical algorithm to retrieve information coded in alphanumeric. J. ACM 15, 4, 514--534. Google Scholar
Digital Library
- Okasaki, C. and Gill, A. 1998. Fast mergeable integer maps. In Proceedings of the Workshop on ML, 77--86.Google Scholar
- Savage, J. E. 1998. Models of Computation. Addison-Wesley Longman, Boston, MA.Google Scholar
- Savitch, W. J. 1978. The influence of the machine model on computational complexity. In Interfaces between Computer Science and Operations Research, J. Lenstra et al., Eds. Mathematical Centre Tracts, vol. 99. Centre for Mathematics and Computer Science, Amsterdam, 1--32.Google Scholar
- Schrijvers, T. 2005. Analyses, optimizations and extensions of constraint handling rules. Ph.D. thesis, K. U. Leuven, Leuven, Belgium.Google Scholar
- Schrijvers, T. and Demoen, B. 2004. The K. U. Leuven CHR system: Implementation and application. In Proceedings of the 1st Workshop on Constraint Handling Rules (CHR'04), Selected Contributions, T. Frühwirth and M. Meister, Eds. Ulm, Germany.Google Scholar
- Schrijvers, T. and Frühwirth, T. 2006. Optimal union-find in constraint handling rules. Theory Pract. Logic Program. 6, 1--2. Google Scholar
Digital Library
- Sneyers, J. 2008. Turing-complete subclasses of CHR. In Proceedings of the 24th International Conference on Logic Programming (ICLP'08), M. García de la Banda and E. Pontelli, Eds. Lecture Notes in Computer Science, vol. 5366. Springer, 759--763. Google Scholar
Digital Library
- Sneyers, J. and Frühwirth, T. 2008. Generalized CHR machines. In Proceedings of the 5th Workshop on Constraint Handling Rules (CHR'08), T. Schrijvers et al., Eds.Google Scholar
- Sneyers, J., Schrijvers, T., and Demoen, B. 2006a. Dijkstra's algorithm with Fibonacci heaps: An executable description in CHR. In Proceedings of the 20th Workshop on Logic Programming (WLP'06).Google Scholar
- Sneyers, J., Schrijvers, T., and Demoen, B. 2006b. Memory reuse for CHR. In Proceedings of the 22nd International Conference on Logic Programming (ICLP'06), S. Etalle and M. Truszczynski, Eds. Lecture Notes in Computer Science, vol. 4079. Springer, 72--86.Google Scholar
- Sneyers, J., Van Weert, P., De Koninck, L., and Schrijvers, T. 2009. As time goes by: Constraint handling rules—A survey of CHR research between 1998 and 2007. Theory Pract. Logic Program. Submitted.Google Scholar
- Somogyi, Z., Henderson, F., and Conway, T. 1996. The execution algorithm of Mercury, An efficient purely declarative logic programming language. J. Logic Program. 29, 1-3, 17--64.Google Scholar
Cross Ref
- Tarjan, R. E. and van Leeuwen, J. 1984. Worst-Case analysis of set union algorithms. J. ACM 31, 2, 245--281. Google Scholar
Digital Library
- Turing, A. M. 1936. On computable numbers, with an application to the Entscheidungsproblem. Proc. London Math. Soc. 2, 42, 230--265.Google Scholar
- van Emde Boas, P. 1990. Machine models and simulations. In Handbook of Theoretical Computer Science, Volume A: Algorithms and Complexity, J. van Leeuwen, Ed. Elsevier. Google Scholar
Digital Library
- Van Weert, P., Schrijvers, T., and Demoen, B. 2005. K. U. Leuven JCHR: A user-friendly, flexible and efficient CHR system for Java. In Proceedings of the 2nd Workshop on Constraint Handling Rules (CHR'05), T. Schrijvers and T. Frühwirth, Eds., 47--62.Google Scholar
- Van Weert, P., Sneyers, J., Schrijvers, T., and Demoen, B. 2006. Extending CHR with negation as absence. In Proceedings of the 3rd Workshop on Constraint Handling Rules (CHR'06), T. Schrijvers and T. Frühwirth, Eds. K. U. Leuven, Department of Computer Science. Venice, Italy, 125--140.Google Scholar
- Wuille, P., Schrijvers, T., and Demoen, B. 2007. CCHR: The fastest CHR implementation, in C. In Proceedings of the 4th Workshop on Constraint Handling Rules (CHR'07), K. Djelloul et al., Eds., 123--137.Google Scholar
Index Terms
The computational power and complexity of constraint handling rules
Recommendations
Optimizing compilation of constraint handling rules in HAL
In this paper we discuss the optimizing compilation of Constraint Handling Rules (CHRs). CHRs are a multi-headed committed choice constraint language, commonly applied for writing incremental constraint solvers. CHRs are usually implemented as a ...
Extending arbitrary solvers with constraint handling rules
PPDP '03: Proceedings of the 5th ACM SIGPLAN international conference on Principles and practice of declaritive programmingConstraint Handling Rules (CHRs) are a high-level committed choice programming language commonly used to write constraint solvers. While the semantic basis of CHRs allows them to extend arbitrary underlying constraint solvers, in practice, all current ...
Optimal union-find in Constraint Handling Rules
Constraint Handling Rules (CHR) is a committed-choice rule-based language that was originally intended for writing constraint solvers. In this paper we show that it is also possible to write the classic union-find algorithm and variants in CHR. The ...






Comments