Skip to main content
QUICK REVIEW

[Paper Review] Deriving Probability Density Functions from Probabilistic Functional Programs

Sooraj Bhat, Johannes Borgström|arXiv (Cornell University)|Apr 4, 2017
Bayesian Modeling and Causal InferenceComputer Science6 citations
TL;DR

This paper presents a sound density compiler that automatically derives probability density functions (PDFs) from probabilistic functional programs, supporting discrete and continuous distributions with failure. By extending a functional language with integration primitives and proving type safety and correctness, the approach enables efficient inference via MCMC and other methods, significantly reducing manual derivation effort in scientific modeling applications.

ABSTRACT

The probability density function of a probability distribution is a fundamental concept in probability theory and a key ingredient in various widely used machine learning methods. However, the necessary framework for compiling probabilistic functional programs to density functions has only recently been developed. In this work, we present a density compiler for a probabilistic language with failure and both discrete and continuous distributions, and provide a proof of its soundness. The compiler greatly reduces the development effort of domain experts, which we demonstrate by solving inference problems from various scientific applications, such as modelling the global carbon cycle, using a standard Markov chain Monte Carlo framework.

Motivation & Objective

  • To close the gap between probabilistic functional programming and the need for probability density functions (PDFs) in statistical inference.
  • To formally define and prove the correctness of a compilation process from probabilistic programs to PDFs in a rich language with continuous and discrete distributions.
  • To enable domain experts to specify models declaratively and automatically obtain PDFs for use in MCMC, maximum likelihood, and other inference techniques.
  • To support failure and complex control flow in probabilistic programs while ensuring the derived PDF remains mathematically sound.

Proposed method

  • Extend a probabilistic functional language with a new integration construct ∫tλ(x₁,…,xn).E to represent the integration of a function over a product type, enabling PDF computation.
  • Define a type system for the target language ∫un with a typing rule for integration that ensures well-formedness of PDF expressions.
  • Provide a denotational semantics using the identity monad to interpret programs and compute PDF values as real numbers.
  • Prove key type system properties: substitution, weakening, and strengthening, ensuring type safety of the compilation process.
  • Integrate the compiler into a standard MCMC pipeline, demonstrating end-to-end inference on real-world scientific models.
  • Use symbolic and numerical integration to compute PDFs from program syntax, preserving correctness under complex control structures.

Experimental results

Research questions

  • RQ1Can a probabilistic functional program with continuous and discrete distributions be systematically compiled into its corresponding probability density function?
  • RQ2How can failure and complex control flow in probabilistic programs be handled while preserving the correctness of the derived PDF?
  • RQ3What formal guarantees can be provided for the soundness of a density compiler in the presence of mixed discrete-continuous distributions?
  • RQ4To what extent does automatic PDF derivation reduce the development burden in scientific modeling applications?

Key findings

  • The density compiler correctly derives PDFs for a broad class of probabilistic programs, including those with failure, discrete, and continuous distributions.
  • The formal type system and semantics ensure that the compiled PDFs are mathematically sound and well-typed.
  • The approach enables seamless integration with standard MCMC inference frameworks, as demonstrated on a global carbon cycle model.
  • The method supports non-trivial program structures such as conditionals and nested bindings, with PDFs derived via symbolic and numerical integration.
  • The compiler reduces manual derivation effort in scientific applications, enabling domain experts to focus on modeling rather than calculus.

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.