- The paper introduces a novel weighted relational semantics for linear logic that enables compositional and decidable verification of termination in probabilistic higher-order recursion schemes.
- The methodology leverages generating functions to encode termination probabilities and expected reduction steps, reducing verification to solving finite algebraic systems.
- The framework unifies syntactic and semantic approaches, paving the way for scalable tools for probabilistic program verification with bounded resource policies.
Higher-Order Probabilistic Verification via Weighted Relational Semantics of Linear Logic
Introduction and Motivation
The termination and quantitative analysis of randomized higher-order programs constitutes a long-standing challenge in program verification and semantics. While termination and reachability for higher-order recursion schemes (HORS) are decidable, introducing probabilistic choice—as in probabilistic HORS (PHORS)—fundamentally alters the landscape, immediately raising the arithmetic complexity of almost sure termination (AST) and rendering the problem Π20​-complete or undecidable at order two. This paper addresses the central verification problems for PHORS by importing techniques from combinatorics and linear logic, and, crucially, showing that a broad class of PHORS admit effective and compositional probabilistic verification via algebraic generating functions extracted through the weighted relational model of linear logic (2604.27986).
Probabilistic λ-Calculus, Termination, and Generating Functions
The approach investigates the termination behavior of PHORS by leveraging their correspondence with the simply-typed λ-calculus extended with fixpoints and probabilistic choice. The operational semantics computes, for a closed PHORS, the probability P(G) of terminating and the expected steps E(G). The key technical observation is that, by associating suitable generating functions to terms—encoding the weighted count of reduction steps—both P(G) and E(G) correspond to evaluations and derivatives of these analytic objects. The generating function aG​(z)=∑an​zn encodes the probability an​ that reduction terminates in exactly n steps; aG​(1)=P(G) and λ0.
A core question is when and how these generating functions and their termination probabilities can be computed, given the infinitary structural and operational behaviors of higher-order systems.
The synthesis of weighted relational semantics of linear logic with probabilistic program analysis is central to this contribution. This semantics maps PHORS to families of formal power series over a continuous semiring λ1, encoding not just the control flow but the detailed use of resources and probabilistic branching. The semantics is compositional: e.g., probabilistic choice with bias λ2 is modeled as λ3 in the power series, with λ4 tracking reductions. For every PHORS, the corresponding family of series is obtained as the least solution to a (possibly countably infinite) system of polynomial equations, generalized through fixpoint constructions of the relational model. Crucially, these techniques generalize classic methods in formal language combinatorics (Chomsky-Schützenberger, algebraic power series), but now in the context of higher-order recursion with probabilistic branching.
Algebraic and Finitary Classes: Characterization and Decidability
A significant result of the paper is the identification of broad fragments of PHORS—going beyond earlier affine restrictions—where the associated generating functions are always algebraic, and thus amenable to effective computation.
Finitely Bounded PHORS (PBHORS): By supplementing the type system with graded exponentials from linear logic (types of the form λ5), the authors define a class of PHORS wherein each input is used at most a statically bounded number of times. For PBHORS, the support of reduction sequences is semilinear, and the infinite family of equations induced by the program’s semantics collapses to a finite algebraic system. The fixpoint semantics thus reduces to a FAS (fixpoint algebraic system) over the reals or rationals, and the main program generating function is algebraic.
Key technical claim: For every PBHORS, both AST and PAST are decidable, via explicit reduction to the existential theory of the reals (ETR) (2604.27986). For a PBHORS λ6 of size λ7, order λ8, and maximal grade λ9, the state-space of the semantic system is bounded (by P(G)0), and the requisite polynomial equations can be constructed and solved in time exponential in P(G)1 and P(G)2 and polynomial in P(G)3.
Extension to (Parametric) Bounded PHORS: The analysis is further generalized by considering open parameters, supporting unbounded resource usage via P(G)4 typing, but only in a strictly controlled parametric context. Through the composability of formal power series, the bounded PHORS class is shown to be closed under composition, and every closed P(G)5 can be translated into an algebraic parametric PBHORS, preserving language and generating function semantics.
Linearization: Every PBHORS can be transformed into an equivalent affine PHORS (PAHORS) with an exponential blowup, ensuring that the tractable class is robust with respect to both automata-theoretic and algebraic-combinatorial approaches.
Implications, Contrasts, and Theoretical Impact
Main theoretical contributions include:
- Unified framework: The weighted relational semantics unifies earlier syntactic and automata-theoretic accounts of probabilistic program verification under a general algebraic/combinatorial lens.
- Decidability separation: Whereas general PHORS have undecidable AST for order P(G)6, the PBHORS class (extending earlier affine restrictions) preserves decidability, showing that bounded resource policies suffice to keep the analysis in the algebraic/finitary regime.
- Algebraic characterization: For PBHORS and their parametrically composed extensions, not only are AST and PAST decidable, but the full termination probability generating function is algebraic, facilitating further asymptotic and analytic reasoning.
- Compositionality: The framework supports a modular analysis of higher-order probabilistic recursion schemes through parametric semantics and composition.
Strong and notable claims:
- For every PBHORS, the set of termination step counts is semilinear, and the corresponding generating function is algebraic over the rationals.
- AST and PAST can be determined by constructing and solving a finite system of polynomial equations, reducing to a decision problem in the existential theory of the reals.
Contrasts and advancements:
- The results strictly generalize prior work (e.g., affine-only PHORS in [DBLP:conf/lics/LiMO22]) by handling non-linear cases under bounded duplication discipline, and do so via analytic and semantic—not solely automata-theoretic—means.
- The approach generalizes techniques from the theory of context-free and indexed languages to higher-order, probabilistic recursion schemes, capturing both syntactic and semantic resource usages.
Practical and Theoretical Outlook
On the practical side, this work paves the way for new probabilistic verification tools capable of handling higher-order functional programs with bounded randomness and recursion. The analytic characterization of generating functions enables not just decidable qualitative verification but quantitative and asymptotic analysis. The parametric and compositional semantics suggest scalability to modular reasoning and possible integration with higher-order probabilistic languages and formal tools.
At the theoretical level, the synthesis of linear logic semantics and analytic combinatorics offers new avenues for studying the expressiveness, complexity, and boundaries of probabilistic higher-order computation. Open directions highlighted include:
- Identifying whether larger classes of PHORS can be characterized by D-finite (as opposed to algebraic) generating functions, connecting to the theory of linear differential equations for power series.
- Leveraging analytic combinatorics for asymptotic and fine-grained quantitative analysis in the probabilistic higher-order setting.
- Sharpening the understanding of the precise computational complexity of AST for various subclasses, possibly locating the exact threshold where undecidability emerges.
Conclusion
The paper establishes that probabilistic higher-order recursion schemes can be verified by mapping them into the weighted relational semantics of linear logic, extracting algebraic generating functions whose properties precisely capture almost sure and positive termination. The broad PBHORS class is shown to be decidable for AST and PAST and closed under parametric and modular operations. This approach connects probabilistic program verification, linear logic, and analytic combinatorics, providing new conceptual and technical tools for both the theory of higher-order computation and the design of probabilistic programming systems (2604.27986).