Skip to main content

Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms

  • Conference paper
  • First Online:
Logic-Based Program Synthesis and Transformation (LOPSTR 2017)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 10855))

Abstract

We present a straightforward source-to-source transformation that introduces justifications for user-defined constraints into the CHR programming language. Then a scheme of two rules suffices to allow for logical retraction (deletion, removal) of constraints during computation. Without the need to recompute from scratch, these rules remove not only the constraint but also undo all consequences of the rule applications that involved the constraint. We prove a confluence result concerning the rule scheme and show its correctness.

When algorithms are written in CHR, constraints represent both data and operations. CHR is already incremental by nature, i.e. constraints can be added at runtime. Logical retraction adds decrementality. Hence any algorithm written in CHR with justifications will become fully dynamic. Operations can be undone and data can be removed at any point in the computation without compromising the correctness of the result.

We present two classical examples of dynamic algorithms, written in our prototype implementation of CHR with justifications that is available online: maintaining the minimum of a changing set of numbers and shortest paths in a graph whose edges change.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Dynamic algorithms for dynamic problems should not be confused with dynamic programming.

  2. 2.

    A variant (renaming) of an expression is obtained by uniformly replacing its variables by fresh variables.

  3. 3.

    For a related strip function, see the proof of Theorem 3.

  4. 4.

    More precisely, a simplification rule is generated if there are no kept constraints and a propagation rule is generated if there are no removed constraints.

References

  1. Abdennadher, S.: Operational semantics and confluence of constraint propagation rules. In: Smolka, G. (ed.) CP 1997. LNCS, vol. 1330, pp. 252–266. Springer, Heidelberg (1997). https://doi.org/10.1007/BFb0017444

    Chapter  Google Scholar 

  2. Abdennadher, S., Frühwirth, T., Meuss, H.: Confluence and semantics of constraint simplification rules. Constraints 4(2), 133–165 (1999)

    Article  MathSciNet  Google Scholar 

  3. Betz, H.: A Unified Analytical Foundation for Constraint Handling Rules. BoD, Norderstedt (2014)

    Google Scholar 

  4. Brown, K.N., Miguel, I.: Uncertainty and change. In: Rossi, F., Van Beek, P., Walsh, T. (eds.) Handbook of Constraint Programming, Chap. 21, pp. 731–760. Elsevier, Amsterdam (2006)

    Chapter  Google Scholar 

  5. De Koninck, L., Schrijvers, T., Demoen, B.: A flexible search framework for CHR. In: Schrijvers, T., Frühwirth, T. (eds.) Constraint Handling Rules. LNCS (LNAI), vol. 5388, pp. 16–47. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-92243-8_2

    Chapter  Google Scholar 

  6. Duck, G.J.: SMCHR: Satisfiability modulo constraint handling rules. Theory Pract. Logic Programm. 12(4–5), 601–618 (2012)

    Article  MathSciNet  Google Scholar 

  7. Frühwirth, T., Raiser, F. (eds.): Constraint Handling Rules - Compilation, Execution, and Analysis. BOD (2018). ISBN 9783746069050

    Google Scholar 

  8. Frühwirth, T.: Constraint Handling Rules. Cambridge University Press, Cambridge (2009)

    Book  Google Scholar 

  9. Frühwirth, T.: Constraint handling rules - what else? In: Bassiliades, N., Gottlob, G., Sadri, F., Paschke, A., Roman, D. (eds.) RuleML 2015. LNCS, vol. 9202, pp. 13–34. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21542-6_2

    Chapter  Google Scholar 

  10. Fruehwirth, T.: Implementation of logical retraction in constraint handling rules with justifications. In: 21st International Conference on Applications of Declarative Programming and Knowledge Management (INAP 2017), September 2017

    Google Scholar 

  11. McAllester, D.A.: Truth maintenance. In: AAAI, vol. 90, pp. 1109–1116 (1990)

    Google Scholar 

  12. Raiser, F., Betz, H., Frühwirth, T.: Equivalence of CHR states revisited. In: Raiser, F., Sneyers, J. (eds.) CHR 2009, pp. 33–48. Technical report CW 555, Deparment of Computer Science, KU Leuven, July 2009

    Google Scholar 

  13. Stuckey, P.J., Sulzmann, M., Wazny, J.: Interactive type debugging in Haskell. In: Proceedings of the 2003 ACM SIGPLAN workshop on Haskell, pp. 72–83. ACM (2003)

    Google Scholar 

  14. Wolf, A., Gruenhagen, T., Geske, U.: On the incremental adaptation of CHR derivations. Appl. Artif. Intell. 14(4), 389–416 (2000)

    Article  Google Scholar 

  15. Wolf, A.: Adaptive constraint handling with CHR in Java. In: Walsh, T. (ed.) CP 2001. LNCS, vol. 2239, pp. 256–270. Springer, Heidelberg (2001). https://doi.org/10.1007/3-540-45578-7_18

    Chapter  Google Scholar 

  16. Wolf, A.: Intelligent search strategies based on adaptive constraint handling rules. Theory Pract. Logic Program. 5(4–5), 567–594 (2005)

    Article  Google Scholar 

Download references

Acknowledgements

We thank Daniel Gall for implementing the online transformation tool for CHR\(^{\mathcal J}\). We also thank the anonymous reviewers for their helpful suggestions on how to improve the paper.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Thom Frühwirth .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG, part of Springer Nature

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Frühwirth, T. (2018). Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms. In: Fioravanti, F., Gallagher, J. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2017. Lecture Notes in Computer Science(), vol 10855. Springer, Cham. https://doi.org/10.1007/978-3-319-94460-9_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-94460-9_9

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-94459-3

  • Online ISBN: 978-3-319-94460-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics