Logically Constrained Simply-Typed TRS
- LCSTRSs are higher-order rewriting systems that combine simply-typed λ-calculus with first-order logical constraints from background theories.
- They employ advanced techniques like constrained dependency pairs and higher-order orderings to ensure termination and formal reasoning about program behavior.
- Applications include program verification, coinductive reachability analysis, and inductive equivalence proofs, with tools like Cora supporting these methods.
Logically Constrained Simply-typed Term Rewriting Systems (LCSTRSs) are a class of higher-order rewriting systems distinguished by the integration of simply-typed λ-calculus structures and first-order logical constraints rooted in background theories such as integer arithmetic or Boolean algebras. Their development enables formal reasoning about both functional and imperative programs, especially where built-in data types and constraints on execution paths are crucial. In LCSTRSs, termination, program equivalence, and reachability analysis benefit from advanced techniques such as constrained dependency pairs, higher-order path orderings, and bounded induction schemes.
1. Formal Structure of LCSTRSs
LCSTRSs are formulated over a simply-typed signature. The foundational ingredients are:
- Sorts and Types: A non-empty set of base sorts, with a subset designated as "theory sorts" (e.g., int, bool). Simple types are generated inductively as , using right-associative arrows (Guo et al., 2024).
- Signature: Function symbols , with a subset of theory symbols. Each symbol is assigned a unique simple type, and variables are infinitely many and similarly typed (Kanazawa et al., 2019).
- Terms: Pre-terms are constructed from function symbols, variables, and application. Well-typed pre-terms form the set ; ground terms are variable-free.
- Constraints and Theory: Logical constraints are closed theory terms of type bool, interpreted in a background domain for each theory sort via interpretation . Subsets of "value" symbols carry result sort and represent interpreted constants.
- Rewrite Rules: Each rule satisfies: have equal simple type; is a pattern with at the head; is a constraint, with all variables having theory sorts; variables in have theory sorts; a substitution "respects" the rule if under and theory-sorted variables map to ground values (Guo et al., 2023).
The rewrite relation consists of
- context reductions under respecting substitutions,
- theory calculations if and is the unique theory value computed by the background interpretation.
Termination is defined as the well-foundedness of on well-typed terms (Guo et al., 2024, Kop, 2016).
2. Static Dependency Pair Framework for LCSTRSs
The dependency pair (DP) method is a central technique for termination analysis:
- Marked Symbols: For each defined symbol (those that occur at the head of some left-hand side), introduce a marked symbol (input-types as , result sort , a new sort).
- Static Dependency Pairs (SDPs): An SDP is a quadruple , where both sides are -typed, is a constraint, contains all theory-sorted variables in (Guo et al., 2024).
- Extraction: For each rule , extract pairs for each full application within , .
- Chains and Termination:
- A –chain is a sequence with each respecting the SDP and .
- Only computable chains are considered: all intermediate terms and accessible subterms are reducibility-candidate computable (Tait–Girard).
- Theorem: An AFP LCSTRS is terminating if and only if it admits no infinite computable –chain (Guo et al., 2024, Kop, 2016).
This generalizes and refines classical first-order DP theory to the higher-order and constrained domain, supporting automated termination proofs for expressive program models.
3. Constrained Orderings: Higher-Order RPO and Reduction Pairs
Orderings suitable for LCSTRSs must combine semantic support for theory-sorted values with higher-order and constraint-aware structure.
- Weakly-Monotonic HORPO-Variant (Kop, 2024):
- Ingredients: Precedence on symbols, argument filter, and a well-founded order on ground theory values for each base sort .
- Relations: Constrained pairs defined recursively.
- Weak monotonicity is enforced: only needs to be context-monotonic, not .
- Theory Clauses: Constraints are woven into the ordering (e.g., if are theory-terms, , and , then ).
- HORPO for LCSTRSs (Guo et al., 2023):
- Handles partial application, simply-typed terms, and theory constraints.
- Strict and weak orders are defined, parameterized by logical constraints, ensuring well-foundedness and orientation of all rules.
These structures are necessary for soundness of the DP method under constraints and for orienting rules with built-in values and logical conditions.
4. Open-World Computability and Modular Termination
A foundational advance in LCSTRSs is the notion of universal and public computability, which generalize termination guarantees to modular and open-world contexts (Guo et al., 2024):
- Definitions:
- An extension of adds new rules without redefining symbols from , using a compatible theory-symbol interpretation.
- A public extension is further forbidden from mentioning “hidden” symbols from .
- A term is universally computable if for every extension , is computable in .
- Public computability restricts the quantification to public extensions.
- SDP Characterization:
- is (publicly) computable if and only if, for each public extension , there is no infinite public computable –chain starting from a non-hidden symbol.
- SDP processors that only inspect the SDP set (e.g., graph/SCC, subterm, integer-mapping, theory-argument processors) are directly applicable in this setting.
This framework enables the analysis of libraries or program fragments under arbitrary client linking, yielding robust guarantees analogous to open-world termination in software systems.
5. Applications in Program Reasoning and Verification
LCSTRSs and their methodologies have significant applications in software analysis:
- Verification of Imperative Programs:
- Transformation of imperative code with global variables and function calls into an LCSTRS involves representing execution environments, global state, and call stacks as term constructors, with side-conditions encoding program invariants and guards (Kanazawa et al., 2019).
- Correctness is ensured via simulation theorems demonstrating that rewriting sequences correspond exactly to operational steps in the program, including both big-step and small-step semantics.
- Coinductive Reachability Analysis:
- LCSTRSs provide a natural substrate for the coinductive proof system for constrained reachability, combining symbolic execution, guarded circularity, and sound/complete proof schemas for complex properties such as "every execution from eventually reaches or diverges" (Ciobâcă et al., 2018).
- Inductive Equivalence Proofs:
- Bounded rewriting induction leverages LCSTRSs as the language of induction, reducing termination obligations compared to classical rewriting induction (Hagens et al., 6 Jan 2026). Only local, instance-based well-foundedness is required when applying induction hypotheses, enabling automatic proofs even when global termination is unavailable.
6. Limitations, Open Problems, and Tooling
Current methodologies for LCSTRSs face several formal and practical restrictions:
- Orderings: Reduction pairs are, at present, restricted to a weakly-monotonic HORPO variant (Kop, 2024). More general algebraic or polynomial interpretations are not yet directly available for LCSTRSs, limiting the flexibility and power of automated termination analysis (Guo et al., 2024).
- Strategies: There is no direct treatment of innermost or call-by-value strategies, nor comprehensive handling of narrowing or theory-specific optimizations outside integers (Guo et al., 2024).
- Non-termination: Frameworks for non-termination (recurrence) remain under development. While ground confluence, counterexamples, and disproving equivalences are addressable, systematic non-termination technology is absent.
- Implementation: The Cora tool implements these methods and serves as a research platform for both termination and inductive theorem proving over LCSTRSs (Hagens et al., 6 Jan 2026, Guo et al., 2024).
7. Representative Example: Continuation-Passing Factorial
The factorial-in-CPS example illuminates the framework:
- Types: , , , , , .
- Rules:
Extracted SDPs:
| SDP | Constraint |
|---|---|
| true |
Termination is demonstrated by decomposing the graph, applying the subterm criterion and integer mappings. No infinite computable SDP chain can arise, establishing the system as terminating (Guo et al., 2024).
References:
- (Guo et al., 2024)
- (Takahata et al., 12 Jul 2025)
- (Kop, 2016)
- (Kop, 2024)
- (Guo et al., 2023)
- (Kanazawa et al., 2019)
- (Ciobâcă et al., 2018)
- (Hagens et al., 6 Jan 2026)