Papers
Topics
Authors
Recent
Search
2000 character limit reached

Logically Constrained Simply-Typed TRS

Updated 13 January 2026
  • 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 SS of base sorts, with a subset SS\mathcal{S} \subseteq S designated as "theory sorts" (e.g., int, bool). Simple types are generated inductively as T::=AS(T1T2)T ::= A \in S \mid (T_1 \to T_2), using right-associative arrows (Guo et al., 2024).
  • Signature: Function symbols FF, with a subset FF\mathcal{F} \subset F of theory symbols. Each symbol fFf \in F is assigned a unique simple type, and variables VV 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 F(V)F(V); ground terms are variable-free.
  • Constraints and Theory: Logical constraints are closed theory terms of type bool, interpreted in a background domain (XA)(X_A) for each theory sort AA via interpretation \llbracket\cdot\rrbracket. Subsets of "value" symbols carry result sort ASA \in \mathcal{S} and represent interpreted constants.
  • Rewrite Rules: Each rule r[φ]\ell \to r [\varphi] satisfies: ,r\ell, r have equal simple type; \ell is a pattern with fFFf \in F \setminus \mathcal{F} at the head; φ\varphi is a constraint, with all variables having theory sorts; variables in r(φ)r \setminus (\ell \cup \varphi) have theory sorts; a substitution σ\sigma "respects" the rule if σ(φ)=1\sigma(\varphi) = 1 under \llbracket\cdot\rrbracket and theory-sorted variables map to ground values (Guo et al., 2023).

The rewrite relation R\to_R consists of

  1. context reductions σrσ\ell\sigma \to r\sigma under respecting substitutions,
  2. theory calculations f(v1,,vn)vf(v_1,\ldots,v_n)\to v' if fFf\in\mathcal{F} and vv' is the unique theory value computed by the background interpretation.

Termination is defined as the well-foundedness of R\to_R 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 fDf \in D (those that occur at the head of some left-hand side), introduce a marked symbol ff^\sharp (input-types as ff, result sort dp\mathrm{dp}, a new sort).
  • Static Dependency Pairs (SDPs): An SDP is a quadruple st[φ] Ls^\sharp \to t^\sharp [\varphi] \ L, where both sides are dp\mathrm{dp}-typed, φ\varphi is a constraint, LL contains all theory-sorted variables in φ\varphi (Guo et al., 2024).
  • Extraction: For each rule f(s1,,sm)r[φ]f(s_1,\ldots,s_m)\to r[\varphi], extract pairs f(x1,,xm)g(t1,,tn)[φ]f^\sharp(x_1,\ldots,x_m) \to g^\sharp(t_1,\ldots,t_n) [\varphi] for each full application g(t1,,tn)g(t_1,\ldots,t_n) within rr, gDg \in D.
  • Chains and Termination:
    • A (P,R)(P, R)–chain is a sequence ((siti[φi],Li,σi))i0((s_i^\sharp \to t_i^\sharp[\varphi_i], L_i, \sigma_i))_{i\ge0} with each σi\sigma_i respecting the SDP and tiσiRsi+1σi+1t_i^\sharp\sigma_i \to_R^* s_{i+1}^\sharp\sigma_{i+1}.
    • Only computable chains are considered: all intermediate terms and accessible subterms are reducibility-candidate computable (Tait–Girard).
    • Theorem: An AFP LCSTRS RR is terminating if and only if it admits no infinite computable (SDP(R),R)(SDP(R), R)–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 >ι>_\iota on ground theory values for each base sort ι\iota.
    • Relations: Constrained pairs (φL,φL)(\succeq_\varphi^L, \succ_\varphi^L) defined recursively.
    • Weak monotonicity is enforced: only \succeq needs to be context-monotonic, not \succ.
    • Theory Clauses: Constraints φ\varphi are woven into the ordering (e.g., if s,ts, t are theory-terms, Var(s)Var(t)LVar(s) \cup Var(t) \subseteq L, and φsιt\varphi \vdash s \geq_\iota t, then sφLts \succeq_\varphi^L t).
  • HORPO for LCSTRSs (Guo et al., 2023):
    • Handles partial application, simply-typed terms, and theory constraints.
    • Strict and weak orders φ,φ\succ_\varphi, \succeq_\varphi 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 R1R_1 of R0R_0 adds new rules without redefining symbols from R0R_0, using a compatible theory-symbol interpretation.
    • A public extension R1R_1 is further forbidden from mentioning “hidden” symbols from R0R_0.
    • A term tR0t \in R_0 is universally computable if for every extension R1R_1, tt is computable in R0R1R_0 \cup R_1.
    • Public computability restricts the quantification to public extensions.
  • SDP Characterization:
    • R0R_0 is (publicly) computable if and only if, for each public extension R1R_1, there is no infinite public computable (SDP(R0),R0R1)(SDP(R_0), R_0 \cup R_1)–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 PP eventually reaches QQ 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: intint, boolbool, K=intintK = int \to int, fact:intKintfact : int \to K \to int, comp:K(intint)Kcomp : K \to (int \to int) \to K, :intintint* : int \to int \to int.
  • Rules:
    • fact(n,k)k(1) [n0]fact(n, k) \to k(1) \ [n \leq 0]
    • fact(n,k)fact(n1,comp k (λx.xn)) [n>0]fact(n, k) \to fact(n-1, comp\ k\ (\lambda x. x*n)) \ [n > 0]
    • comp(g,f)(x)g(f(x))comp(g, f)(x) \to g(f(x))

Extracted SDPs:

SDP Constraint
fact(n,k)fact(n1,comp k (λx.xn))fact^\sharp(n,k) \to fact^\sharp(n-1, comp\ k\ (\lambda x. x*n)) n>0n > 0
fact(n,k)k(1)fact^\sharp(n,k) \to k^\sharp(1) n0n \leq 0
comp(g,f,x)g(f(x))comp^\sharp(g,f,x) \to g^\sharp(f(x)) 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:

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Logically Constrained Simply-typed Term Rewriting Systems (LCSTRSs).