Quasi-Borel Spaces in Rocq

7 QBS–Kernel Bridge

This chapter bridges the QBS probability monad with the s-finite kernel infrastructure from mathcomp-analysis (the merged kernel hierarchy kernel.v, originally from PR #896). S-finite kernels provide the standard semantic foundation for first-order probabilistic programs (Staton, ESOP 2017): they are closed under composition, unlike \(\sigma \)-finite kernels. The bridge developed here shows that QBS probabilities induce s-finite measures and that QBS morphisms between standard Borel spaces lift to probability kernels, so kernel-based programs embed faithfully into the QBS world while gaining higher-order function types.

7.1 S-Finiteness of Probability Measures

Lemma 223 Probability Measures Are Finite

Every probability measure assigns a finite extended-real value to every measurable set.

Proof
Lemma 224 Probability Measures Are S-Finite
#

Every probability measure is s-finite, since it is finite (and hence \(\sigma \)-finite).

Proof
Lemma 225 QBS Probabilities Are S-Finite

For any QBS probability \(p : P(X)\) with \(X\) standard Borel, the induced measure \(\texttt{qbs\_ to\_ giry}(p)\) is s-finite.

Proof
Lemma 226 Pushforward of Probability

Pushforward of a probability measure along a measurable map is a probability measure.

Proof

7.2 Dirac Kernels and QBS Return

Lemma 227 Dirac Kernel Application
#

Pointwise: \(\mathrm{kdirac}(f)(x)(U) = \delta _{f(x)}(U)\).

Proof
Lemma 228 QBS Return Is Dirac

For standard Borel \(M\), transporting a Dirac measure through giry_to_qbs and back recovers the original Dirac measure.

Proof
Definition 229 Measurable Function as Kernel
#

Every measurable function \(f : M_1 \to M_2\) induces a Dirac probability kernel \(x \mapsto \delta _{f(x)}\).

Lemma 230 Measurable Function Kernel Is Probability

The Dirac kernel of a measurable function is a probability kernel (not just s-finite).

Proof

7.3 QBS Morphisms as Kernels

Lemma 231 QBS Morphisms Are Measurable

Every QBS morphism between standard Borel spaces is measurable (full faithfulness of the \(R\) functor).

Proof
Definition 232 QBS Morphism to Kernel

A QBS morphism between standard Borel spaces lifts to a Dirac probability kernel.

Lemma 233 QBS Morphism Kernel Is Probability

The Dirac kernel of a QBS morphism between standard Borel spaces is a probability kernel.

Proof

7.4 Constant Kernels and Equivalence

Definition 234 QBS Probability as Constant Kernel
#

Every QBS probability \(p\) on a standard Borel space induces a constant kernel: \(x \mapsto \texttt{qbs\_ to\_ giry}(p)\).

Lemma 235 Constant Kernel Is Measurable

The constant-kernel construction is a measurable family.

Proof
Lemma 236 Equivalence Yields Equal Giry Measures

Equivalent QBS probabilities (via qbs_prob_equiv) yield equal classical Giry probability measures.

Proof

7.5 Pushforward and Kernel Composition

Lemma 237 Pushforward Commutes with map

Applying qbs_to_giry to a mapped probability equals the pushforward of the original Giry measure.

Proof
Lemma 238 Giry Pushforward Identity
#

The pushforward through a QBS morphism agrees with the classical Giry pushforward.

Proof
Lemma 239 Dirac Composition (Pointwise)
#

Pointwise: \(\mathrm{kdirac}(g \circ f) = \mathrm{kdirac}(g) \circ _{\mathrm{ker}} f\).

Proof
Lemma 240 Functoriality of Dirac
#

Composition of Dirac kernels equals the Dirac kernel of the function composition (functoriality at the kernel level).

Proof
Lemma 241 Encode/Decode Kernel Round-Trip

The standard-Borel encode/decode round-trip lifts to the kernel level via kcomp.

Proof

7.6 Bind, Return, and Integration at the Kernel Level

Lemma 242 Bind-Return as Map

Binding the return of a function with \(f\) equals the return of the function (the monad law at the kernel level).

Proof
Lemma 243 Kernel Integration Bridge

The QBS integral against a probability \(p\) equals the Lebesgue integral against \(\texttt{qbs\_ to\_ giry}(p)\).

Proof
Lemma 244 Dirac Round-Trip
#

Sending a Dirac kernel through the QBS-Giry round-trip preserves it.

Proof
Lemma 245 Kernel Round-Trip
#

General kernel round-trip property via the QBS-Giry bridge.

Proof