NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Semantics of higher-order probabilistic programs with conditioning

Fredrik Dahlqvist, Dexter KozenProceedings of the ACM on Programming Languages 2019

TL;DR

This paper introduces a novel denotational semantics for higher-order probabilistic programming languages. By leveraging the mathematical framework of ordered Banach spaces and their tensor products, the authors provide a robust foundation for reasoning about programs that involve sampling, conditioning, and Bayesian inference, treating randomness as a linear resource.

What Problem Does This Paper Address?

Probabilistic programming languages (PPLs) have gained significant traction for their ability to model complex probabilistic systems, particularly in machine learning and statistical inference. However, providing sound semantic foundations for these languages, especially those supporting higher-order functions and advanced features like conditioning and Bayesian inference, remains a challenge. Existing approaches often rely on specialized mathematical structures that may not seamlessly integrate with classical denotational semantics or may not adequately capture the "resource-like" nature of randomness. This paper aims to bridge this gap by developing a semantics rooted in established functional analysis concepts, making it accessible to both computer scientists and mathematicians.

Methods

The core of the paper's contribution lies in its use of ordered Banach spaces and their tensor products to construct a symmetric monoidal closed category called RoBan. This category serves as the semantic universe for higher-order probabilistic programs.

  • Ordered Banach Spaces: These are Banach spaces equipped with a compatible partial order. They are particularly well-suited for representing probabilistic measures and operators.
  • Tensor Products: The paper utilizes the positive projective tensor product to handle higher-order functions and to model the composition of probabilistic operations. This choice is crucial as it allows for a "resource-sensitive" interpretation of randomness, meaning that sampling operations consume randomness and cannot be trivially copied.
  • Bayesian Types: To explicitly support conditioning and Bayesian inference, the authors introduce "Bayesian types." These types decorate values with a prior distribution, and their semantics is modeled using the concept of disintegration and adjoint operators. Bayesian inference is elegantly captured by computing the adjoint of a linear operator.
  • Monoidal Closed Category: RoBan is a symmetric monoidal closed category. This structure is essential for modeling higher-order functions (via internal homs) and for composing operations in a way that respects the linearity of probabilistic resources.

Datasets

Not discussed in the paper.

Key Insights and Ideas

  • Randomness as a Linear Resource: By using a monoidal closed category instead of a Cartesian closed category, the semantics naturally treats randomness as a resource that is consumed rather than copied. This has implications for reasoning about program efficiency and correctness, particularly in probabilistic settings.
  • Elegant Semantics for Bayesian Inference: The paper provides a mathematically elegant way to model Bayesian inference by leveraging the concept of the adjoint of a linear operator. This connects directly to the idea of "reversing" a probabilistic computation to infer posterior distributions from observations.
  • Bridging Theoretical Computer Science and Functional Analysis: The authors successfully integrate concepts from functional analysis (Banach spaces, tensor products) with denotational semantics, making the framework accessible to a broader audience and potentially simplifying the validation of stochastic machine learning algorithms.
  • Type System for Probabilistic Reasoning: The proposed type system, including Bayesian types and order-complete types, is designed to support sophisticated probabilistic reasoning, including conditioning and higher-order operations.

Key Results

The paper presents a formal denotational semantics for a higher-order probabilistic programming language. While specific quantitative results are not the primary focus, the key findings are theoretical:

  • The establishment of a sound semantic framework based on ordered Banach spaces and tensor products.
  • The demonstration that Bayesian inference can be modeled as computing the adjoint of a linear operator.
  • The development of a type system that supports probabilistic programming features like sampling, conditioning, and higher-order functions.
  • The paper provides proofs for several theorems establishing the properties of the semantic structures, such as the regularity of operators and the order-completeness of certain spaces.

Limitations and Future Work

  • Order-Completeness and Tensor Products: The paper notes that while Banach lattices are order-complete, their internal homs are not always order-complete. Similarly, order-complete spaces are not always closed under positive projective tensor products. These are technical limitations that influence the design of the type system (e.g., the need for order-complete types).
  • "Pointless" Semantics: The authors highlight that their semantics, by using the Köthe dual for observe statements, is more general than approaches relying on disintegrations, as it doesn't require the existence of disintegrations for all measurable spaces. This offers robustness.
  • Future Work: The paper suggests that further exploration of the "pointless" perspective and the connection to quantum computation (via linear logic) are promising directions. They also mention the potential for extending the framework to handle more complex probabilistic models and algorithms.

Summary updated

BibTeX
@inproceedings{dahlqvist2019semantics,
  author = {Fredrik Dahlqvist and Dexter Kozen},
  title = {{Semantics of higher-order probabilistic programs with conditioning}},
  booktitle = {Proceedings of the ACM on Programming Languages},
  year = {2019},
  doi = {10.1145/3371125},
}

Loading related content...

Figure