# Justifications in Constraint Handling Rules for Logical Retraction in   Dynamic Algorithms

**Authors:** Thom Fruehwirth

arXiv: 1706.07946 · 2017-09-12

## TL;DR

This paper introduces a method to add justifications to constraints in CHR, enabling logical retraction and making algorithms fully dynamic by allowing constraints and their consequences to be undone efficiently.

## Contribution

It proposes a simple source-to-source transformation for CHR that supports logical retraction, enhancing its incremental capabilities with correctness guarantees.

## Key findings

- The scheme is proven confluent and correct.
- Demonstrated with dynamic algorithms for minimum maintenance and shortest paths.
- Prototype implementation is available online.

## 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.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1706.07946/full.md

## References

16 references — full list in the complete paper: https://tomesphere.com/paper/1706.07946/full.md

---
Source: https://tomesphere.com/paper/1706.07946