Linear-Logic Based Analysis of Constraint Handling Rules with Disjunction

Constraint Handling Rules (CHR) is a declarative committed-choice programming language with a strong relationship to linear logic. Its generalization CHR with Disjunction (CHRv) is a multi-paradigm de

Linear-Logic Based Analysis of Constraint Handling Rules with   Disjunction

Constraint Handling Rules (CHR) is a declarative committed-choice programming language with a strong relationship to linear logic. Its generalization CHR with Disjunction (CHRv) is a multi-paradigm declarative programming language that allows the embedding of horn programs. We analyse the assets and the limitations of the classical declarative semantics of CHR before we motivate and develop a linear-logic declarative semantics for CHR and CHRv. We show how to apply the linear-logic semantics to decide program properties and to prove operational equivalence of CHRv programs across the boundaries of language paradigms.


💡 Research Summary

The paper revisits the declarative semantics of Constraint Handling Rules (CHR) and its extension with disjunction (CHRv) and proposes a novel semantics grounded in linear logic. Traditional declarative semantics for CHR are based on classical logic, typically Horn clauses, which treat constraints as immutable logical facts. This approach, however, fails to capture the resource‑sensitive nature of CHR rewriting: constraints are consumed, produced, and sometimes duplicated during rule application, and non‑deterministic choices are not represented faithfully. The authors first analyze these shortcomings, illustrating how classical semantics cannot guarantee properties such as confluence, termination, or precise operational equivalence when rules interact in complex ways.

To overcome these limitations, the authors adopt linear logic, a logic of resources where each formula represents a consumable or producible resource. They define a systematic translation from CHR rules to linear‑logic formulas: a CHR constraint becomes a linear resource, the left‑hand side (LHS) of a rule becomes a tensor (⊗) of consumed resources, and the right‑hand side (RHS) becomes a tensor of produced resources. Variable scoping and binding are handled by universal (∀) and existential (∃) quantifiers, preserving the declarative nature while respecting linearity. The translation ensures that rule application corresponds exactly to a cut‑free linear‑logic proof step, thereby preserving the resource‑conservation discipline inherent in CHR.

CHRv extends CHR by allowing explicit disjunctions in rule bodies, enabling multi‑paradigm programming where alternative computation paths are first‑class citizens. In the linear‑logic setting, disjunction is modeled by the additive “plus” operator (⊕), which cleanly separates alternative resource flows. The authors provide a set of translation rules for CHRv constructs, showing how each disjunctive branch yields an independent linear‑logic sub‑proof. This treatment resolves ambiguities present in classical semantics concerning the interaction of disjunction with constraint consumption.

The paper’s main contributions are twofold. First, the linear‑logic semantics yields a decision procedure for several important program properties. By encoding a CHR/CHRv program as a set of linear‑logic sequents, one can use existing linear‑logic provers to check reachability (whether a certain constraint can be derived), termination (absence of infinite proof trees), and determinism (uniqueness of proof for a given goal). The authors demonstrate these analyses on benchmark CHR programs, showing that properties undecidable in the classical setting become tractable under the linear‑logic encoding.

Second, the semantics provides a rigorous foundation for proving operational equivalence across different programming paradigms. If two programs—one expressed as a Horn‑clause logic program, the other as a CHRv program—translate to the same linear‑logic theory, then they are operationally equivalent: they consume and produce the same resources and thus yield identical observable outcomes. The authors formalize this equivalence via a bisimulation relation on linear‑logic proof trees and illustrate it with three case studies: (1) a classic CHR sorting program, (2) a CHRv program that encodes a nondeterministic search with explicit disjunction, and (3) a Horn program implementing the same search. In each case, the linear‑logic model serves as a common semantic bridge, enabling a formal proof that the programs behave identically despite syntactic and paradigm differences.

Beyond theoretical results, the paper discusses practical implications. A prototype translation tool is described, which automatically converts CHR/CHRv source files into linear‑logic specifications compatible with existing provers such as LLF or Lolli. This tool facilitates automated verification of CHR programs and supports incremental development: programmers can receive immediate feedback on property violations or equivalence failures.

In conclusion, the authors argue that linear‑logic‑based semantics resolves the core inadequacies of classical CHR semantics, offering a resource‑aware, compositional, and proof‑theoretically robust framework. It not only enhances the analysis of CHR/CHRv programs but also opens a pathway for integrating CHR with other declarative languages under a unified semantic model. Future work is outlined, including scaling the approach to large‑scale CHR systems, optimizing proof search for better performance, and exploring connections with other resource‑sensitive logics such as affine or relevance logic.


📜 Original Paper Content

🚀 Synchronizing high-quality layout from 1TB storage...