Skip to main content
QUICK REVIEW

[Paper Review] Semantics for probabilistic programming: higher-order functions, continuous distributions, and soft constraints

Sam Staton, Hongseok Yang|arXiv (Cornell University)|Jan 19, 2016
Logic, Reasoning, and KnowledgeComputer Science31 references40 citations
TL;DR

This paper presents a formal semantics for higher-order probabilistic programming languages supporting continuous distributions and soft constraints, using a functor category to resolve the category-theoretic challenges of function spaces in measure theory. It establishes sound, adequate, and terminating operational and denotational semantics, enabling formal verification of inference algorithms like sequential Monte Carlo and compiler optimizations.

ABSTRACT

We study the semantic foundation of expressive probabilistic programming languages, that support higher-order functions, continuous distributions, and soft constraints (such as Anglican, Church, and Venture). We define a metalanguage (an idealised version of Anglican) for probabilistic computation with the above features, develop both operational and denotational semantics, and prove soundness, adequacy, and termination. They involve measure theory, stochastic labelled transition systems, and functor categories, but admit intuitive computational readings, one of which views sampled random variables as dynamically allocated read-only variables. We apply our semantics to validate nontrivial equations underlying the correctness of certain compiler optimisations and inference algorithms such as sequential Monte Carlo simulation. The language enables defining probability distributions on higher-order functions, and we study their properties.

Motivation & Objective

  • To provide a formal, mathematically rigorous foundation for expressive probabilistic programming languages that support higher-order functions, continuous distributions, and soft constraints.
  • To resolve the foundational issue that measurable spaces do not support function spaces under standard category theory, which blocks higher-order semantics in probability theory.
  • To develop both operational and denotational semantics that are sound and adequate with respect to each other, ensuring computational and logical consistency.
  • To enable formal reasoning about correctness of inference algorithms—such as sequential Monte Carlo—and compiler optimizations in probabilistic programs.

Proposed method

  • Introduce a metalanguage (based on Anglican) that supports higher-order functions, continuous distributions, and soft constraints via `sample`, `score`, and `norm` primitives.
  • Model operational semantics using stochastic labelled transition systems over measurable configurations, extending discrete probabilistic transitions to continuous cases.
  • Use a functor category over measurable spaces to construct well-behaved function spaces, overcoming the failure of measurable spaces to form a Cartesian closed category.
  • Lift the Giry monad to the functor category to interpret continuous distributions and probability measures in a higher-order setting.
  • Incorporate density types `D(D)` for continuous probability densities, with evaluation and distribution functions that preserve measurability.
  • Establish soundness and adequacy of the denotational semantics with respect to the operational semantics, enabling equational reasoning about programs.

Experimental results

Research questions

  • RQ1How can higher-order functions be meaningfully interpreted in a probabilistic setting where measurable spaces do not support function spaces?
  • RQ2What is a sound and adequate operational semantics for probabilistic programs with continuous distributions and soft constraints?
  • RQ3How can the denotational semantics of higher-order probabilistic programs be constructed using category theory to support function types and continuous measures?
  • RQ4Can key program equations—such as those underlying sequential Monte Carlo simulation—be formally verified using the proposed semantics?
  • RQ5How can soft constraints based on probability densities be formally integrated into the semantics without requiring full higher-order machinery?

Key findings

  • The paper successfully constructs a denotational semantics for higher-order probabilistic programs using a functor category, which resolves the foundational issue that measurable spaces do not form a Cartesian closed category.
  • The denotational semantics is proven sound and adequate with respect to the operational semantics, enabling formal reasoning about program equivalence and correctness.
  • The semantics supports the formal verification of a key equation for sequential Monte Carlo simulation, validating its correctness in the model.
  • Soft constraints based on probability densities can be encoded using density types `D(D)` and the evaluation function `ev`, without requiring the full higher-order categorical machinery.
  • The semantics accommodates nested queries and normalization via `norm`, enabling posterior inference in a principled way.
  • The model supports both discrete and continuous distributions, including Dirac measures (e.g., `norm(return(42.0))`), and handles cases where the posterior lacks a continuous density.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.