Formal Aspects of Computing

, Volume 29, Issue 1, pp 57–95 | Cite as

On proving confluence modulo equivalence for Constraint Handling Rules

Original Article


Previous results on proving confluence for Constraint Handling Rules are extended in two ways in order to allow a larger and more realistic class of CHR programs to be considered confluent. Firstly, we introduce the relaxed notion of confluence modulo equivalence into the context of CHR: while confluence for a terminating program means that all alternative derivations for a query lead to the exact same final state, confluence modulo equivalence only requires the final states to be equivalent with respect to an equivalence relation tailored for the given program. Secondly, we allow non-logical built-in predicates such as var/1 and incomplete ones such as is/2, that are ignored in previous work on confluence.

To this end, a new operational semantics for CHR is developed which includes such predicates. In addition, this semantics differs from earlier approaches by its simplicity without loss of generality, and it may also be recommended for future studies of CHR.

For the purely logical subset of CHR, proofs can be expressed in first-order logic, that we show is not sufficient in the present case. We have introduced a formal meta-language that allows reasoning about abstract states and derivations with meta-level restrictions that reflect the non-logical and incomplete predicates. This language represents subproofs as diagrams, which facilitates a systematic enumeration of proof cases, pointing forward to a mechanical support for such proofs.

The Project is supported by The DanishCouncil for IndependentResearch, Natural Sciences, Grant No. DFF4181-00442. The second author’s contribution received funding from the European Union Seventh Framework Programme (FP7/2007-2013) under Grant Agreement No. 318337, ENTRA—Whole-Systems Energy Transparency.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. Abd97.
    Abdennadher S (1997) Operational semantics and confluence of constraint propagation rules. In: Smolka G (ed) CP, Constraint Programming, Lecture Notes in Computer Science, vol 1330. Springer, New York, pp 252–266Google Scholar
  2. AF03.
    Abdennadher S, Frühwirth TW (2003) Integration and optimization of rule-based constraint solvers. In: Bruynooghe M (ed) Logic Based Program Synthesis and Transformation, 13th International Symposium LOPSTR 2003, Uppsala, Sweden, August 25–27, 2003, Revised Selected Papers, Lecture Notes in Computer Science, vol 3018. Springer, New York, pp 198–213Google Scholar
  3. AFM96.
    Abdennadher S, Frühwirth TW, Meuss H (1996) On confluence of Constraint Handling Rules. In: Freuder EC (ed) CP, Lecture Notes in Computer Science, vol 1118. Springer, New York, pp 1–15Google Scholar
  4. AFM99.
    Abdennadher S, Frühwirth TW, Meuss H (1999) Confluence and semantics of constraint simplification rules. Constraints 4(2): 133–165MathSciNetCrossRefMATHGoogle Scholar
  5. AMP94.
    Aho AV, Sethi R, Ullman JD (1972) Code optimization and finite Church-Rosser systems. In: Rustin R (ed) Design and Optimization of Compilers. Prentice-Hall, USA, pp 89–106Google Scholar
  6. ASU72.
    Aiken A, Widom J, Hellerstein JM (1992) Behavior of database production rules: Termination, confluence, and observable determinism. In: Stonebraker M (ed) Proceedings of the 1992 ACM SIGMOD International Conference on Management of Data, San Diego, California. ACM Press, USA, pp 59–68Google Scholar
  7. AWH92.
    Apt KR, Marchiori E, Palamidessi C (1994) A declarative approach for first-order built-in’s of Prolog. Appl Algebra Eng Commun Comput 5: 159–191MathSciNetCrossRefMATHGoogle Scholar
  8. BN99.
    Baader F, Nipkow T (1999) Term rewriting and all that. Cambridge University Press, CambridgeMATHGoogle Scholar
  9. BRF10.
    Betz H, Raiser F, Frühwirth TW (2010) A complete and terminating execution model for constraint handling rules. TPLP 10(4–6): 597–610MathSciNetMATHGoogle Scholar
  10. CHLP10.
    Christiansen H (2005) CHR Grammars. Int J Theory Pract Logic Program 5(4–5): 467–501MathSciNetCrossRefMATHGoogle Scholar
  11. Chr05.
    Christiansen H, Have CT, Lassen OT, Petit M (2010) The Viterbi algorithm expressed in Constraint Handling Rules. In: Van Weert P, De Koninck L (eds) Proceedings of the 7th International Workshop on Constraint Handling Rules, Report CW 588. Katholieke Universiteit Leuven, Belgium, pp 17–24Google Scholar
  12. CK14.
    Christiansen H, Kirkeby MH (2010) Confluence modulo equivalence in Constraint Handling Rules. In: Proietti M, Seki H (eds) Logic-Based Program Synthesis and Transformation—24th International Symposium, LOPSTR 2014, Canterbury, UK, September 9–11, 2014. Revised Selected Papers, Lecture Notes in Computer Science, vol 8981. Springer, New York, pp 41–58Google Scholar
  13. DEKM99.
    Drabent W (1997) A Floyd-Hoare method for Prolog. Tech. Rep. 2(13), Linköping Electronic Articles in Computer and Information ScienceGoogle Scholar
  14. Dra97.
    Duck GJ, Stuckey PJ, De la Banda MJG, Holzbaur C (2004) The refined operational semantics of Constraint Handling Rules. In: Demoen B, Lifschitz V (eds) Proc. Logic Programming, 20th International Conference, ICLP 2004, Lecture Notes in Computer Science, vol 3132. Springer, New York, pp 90–104Google Scholar
  15. DSGlBH04.
    Duck GJ, Stuckey PJ, Sulzmann M (2007) Observable confluence for Constraint Handling Rules. In: Dahl V, Niemelä I (eds) ICLP, Lecture Notes in Computer Science, vol 4670. Springer, New York, pp 224–239Google Scholar
  16. DSS07.
    Durbin R, Eddy S, Krogh A, Mitchison G (1999) Biological Sequence Analysis: Probabilistic Models of Proteins and Nucleic Acids. Cambridge University Press, CambridgeMATHGoogle Scholar
  17. FGMP97.
    Falaschi M, Gabbrielli M, Marriott K, Palamidessi C (1997) Confluence in concurrent constraint programming. Theor Comput Sci 183(2): 281–315MathSciNetCrossRefMATHGoogle Scholar
  18. FR11.
    Frühwirth T, Raiser F (eds) (2011) Constraint Handling Rules, Compilation, Execution, and Analysis. Books on Demand GmbH. NorderstedtGoogle Scholar
  19. Frü93.
    Frühwirth TW (1993) User-defined constraint handling. In: Warren DS (ed) Logic Programming, Proceedings of the Tenth International Conference on Logic Programming. MIT Press, Budapest, Hungary, pp 837–838Google Scholar
  20. Frü94.
    Frühwirth TW (1994) Constraint Handling Rules. In: Podelski A (ed) Constraint Programming: Basics and Trends, Châtillon Spring School, Châtillon-sur-Seine, France, May 16–20, 1994, Selected Papers, Lecture Notes in Computer Science, vol 910. Springer, New York, pp 90–107Google Scholar
  21. Frü98.
    Frühwirth TW (1998) Theory and practice of Constraint Handling Rules. J Logic Program 37(1–3): 95–138MathSciNetCrossRefMATHGoogle Scholar
  22. Frü09.
    Frühwirth TW (2009) Constraint Handling Rules. Cambridge University Press, CambridgeCrossRefMATHGoogle Scholar
  23. Hae12.
    Haemmerlé R (2012) Diagrammatic confluence for Constraint Handling Rules. TPLP 12(4–5): 737–753MathSciNetMATHGoogle Scholar
  24. HF00.
    Hill, P.; Gallagher, J.: Meta-programming in logic programming. In: Handbook of Logic in Artificial Intelligence and Logic Programming. Oxford Science Publications, Oxford University Press, Oxford, pp 421–497Google Scholar
  25. HG94.
    Holzbaur C, Frühwirth TW (2000) A PROLOG Constraint Handling Rules compiler and runtime system. Appl Artif Intell 14(4): 369–388CrossRefGoogle Scholar
  26. Hue80.
    Huet GP (1980) Confluent reductions: Abstract properties and applications to Knuth systems: abstract properties and applications to Term Rewriting Systems. J ACM 27(4): 797–821MathSciNetCrossRefMATHGoogle Scholar
  27. KB70.
    Knuth D, Bendix P (1970) Simple word problems in universal algebras. In: Leech J (ed) Computational Problems in Universal Algebras. Pergamon Press, Oxford, pp 263–297Google Scholar
  28. LRF10.
    Langbein J, Raiser F, Frühwirth TW (2010) A state equivalence and confluence checker for CHRs. In: Weert PV, Koninck LD (eds) Proceedings of the 7th International Workshop on Constraint Handling Rules, Report CW 588. Katholieke Universiteit Leuven, Belgium, pp 1–8Google Scholar
  29. MN98.
    Mayr R, Nipkow T (1998) Higher-order rewrite systems and their confluence. Theor Comput Sci 192(1): 3–29MathSciNetCrossRefMATHGoogle Scholar
  30. New42.
    Newman M (1942) On theories with a combinatorial definition of “equivalence”. Ann Math 43(2): 223–243MathSciNetCrossRefMATHGoogle Scholar
  31. Nie00.
    Niehren J (2000) Uniform confluence in concurrent computation. J Funct Program 10(5): 453–499MathSciNetCrossRefMATHGoogle Scholar
  32. NS94.
    Niehren J, Smolka G (1994) A confluent relational calculus for higher-order programming with constraints. In: Jouannaud J (ed) Constraints in Computational Logics, First International Conference, CCL’94, Munich, Germant, September 7–9, 1994, Lecture Notes in Computer Science, vol 845. Springer, New York, pp 89–104Google Scholar
  33. RBF09.
    Raiser F, Betz H, Frühwirth TW (2009) Equivalence of CHR states revisited. In: Raiser F, Sneyers J (eds) Proc. 6th International Workshop on Constraint Handling Rules, Report CW 555. Katholieke Universiteit Leuven, Belgium, pp 33–48Google Scholar
  34. RT07.
    Raiser F, Tacchella P (2007) On confluence of non-terminating CHR programs. In: Djelloul K, Duck GJ, Sulzmann M (eds) Constraint Handling Rules, 4th Workshop, CHR 2007. Porto, Portugal, pp 63–76Google Scholar
  35. Sch16.
    Personal communication with Tom Schrijvers (2016)Google Scholar
  36. SD04.
    Schrijvers T, Demoen B (2004) The K.U.Leuven CHR system: implementation and application. In: Frühwirth T, Meister M (eds) First Workshop on Constraint Handling Rules: Selected Contributions. Ulmer Informatik-Berichte, Nr. 2004-01, pp 1–5Google Scholar
  37. Set74.
    Schrijvers T, Frühwirth TW (eds) (2008) Constraint Handling Rules, Current Research Topics, Lecture Notes in Computer Science, vol 5388. Springer, New YorkGoogle Scholar
  38. SF08.
    Sethi R (1974) Testing for the Church-Rosser property. J ACM 21(4): 671–679MathSciNetCrossRefMATHGoogle Scholar
  39. SWSK10.
    Sneyers J, Weert PV, Schrijvers T, Koninck LD (2010) As time goes by: Constraint Handling Rules. TPLP 10(1): 1–47MathSciNetMATHGoogle Scholar
  40. TvL84.
    Tarjan RE, Van Leeuwen J (1984) Worst-case analysis of set union algorithms. J ACM 31(2): 245–281MathSciNetCrossRefMATHGoogle Scholar
  41. Vit67.
    Viterbi AJ (1967) Error bounds for convolutional codes and an asymptotically optimum decoding algorithm. IEEE Trans Inf Theory 13: 260–269CrossRefMATHGoogle Scholar

Copyright information

© British Computer Society 2016

Authors and Affiliations

  1. 1.Research group PLIS: Programming, Logic and Intelligent Systems, Department of People and TechnologyRoskilde UniversityRoskildeDenmark

Personalised recommendations