A probabilistic program may sample a real number, and it may pass a function around. Combining the two is immediate in syntax: 𝗉𝗋𝗂𝗈𝗋=𝑠←𝗇𝗈𝗋𝗆𝖺𝗅(0,3);𝑏←𝗇𝗈𝗋𝗆𝖺𝗅(0,3);𝗋𝖾𝗍𝗎𝗋𝗇 (𝜆𝑥.𝑠⋅𝑥+𝑏), a program of type 𝖣𝗂𝗌𝗍(ℝ ⟶ℝ) that draws a random line. To interpret it in the vocabulary of chapter 172, the type ℝ ⟶ℝ must denote a measurable space in which the sampled line is a measurable function of the two draws, and applying the sampled line to an argument must again be measurable. Both requirements are about one map, evaluation.
They cannot both be met. Theorem 174.3 shows that the first 𝜎-algebra a reader would try — the one generated by point evaluations — makes evaluation nonmeasurable, and Aumann’s theorem, recorded after it, shows that no 𝜎-algebra succeeds. The obstruction is not a missing construction but a property of 𝜎-algebras: membership in a product 𝜎-algebra is decided by countably many generators, while evaluation consults uncountably many points.
The repair keeps the maps and discards the 𝜎-algebras. A space will be a set together with a declared collection of random elements — maps from the real line into the set — closed under the operations that random variables must be closed under. Function spaces then exist, because a random element of a function space is exactly a jointly random family, and the monad of measures built on top of this notion inherits its laws from the kernels of convention 172.27. The chapter ends by adding recursion, where a measure on a space of computations must also be a limit of finite unfoldings, and states the contextual-soundness theorem that the resulting model satisfies.
This chapter uses the frozen export 𝖯𝖬𝖪 of convention 172.27, and specifically the groups 𝖯𝖬𝖪-map and 𝖯𝖬𝖪-bind: measurable spaces and maps, subprobability and probability measures, Dirac measures, pushforward and its functoriality, the change-of-variables formula theorem 172.14, products and Tonelli, kernels with ret and bind, lemma 172.19, and the monad laws theorem 172.20. It does not use the conditioning results of chapter 173, and adds only the structure that the developments below force.
Referenced from 2 locations
The exponential obstruction
Let G ⊆P(𝑍). Every 𝐴 ∈𝜎(G) lies in 𝜎(G0) for some countable G0 ⊆G. Consequently, for measurable spaces 𝐹 and 𝑌, every 𝐴 ∈Σ𝐹 ⊗Σ𝑌 lies in 𝜎({𝐶 ×𝐵 ∣𝐶 ∈C, 𝐵 ∈Σ𝑌}) for some countable C ⊆Σ𝐹.
Referenced from 4 locations
Proof of Lemma 174.2 — Countable dependence
Proof. Let H =⋃{𝜎(G0) ∣G0 ⊆G countable}. Then G ⊆H, and H is a 𝜎-algebra: it contains 𝑍; it is closed under complement, since 𝜎(G0) is; and if 𝐴𝑛 ∈𝜎(G0,𝑛) for each 𝑛, then ⋃𝑛𝐴𝑛 ∈𝜎(⋃𝑛G0,𝑛), a countable union of countable families. Hence 𝜎(G) ⊆H. The second claim is the first applied to the generating family of rectangles, followed by collecting the countably many first components that occur. ◻
Let 𝐹 =Meas(ℝ,ℝ) be the set of Borel measurable functions and let Σev =𝜎({{𝑓 ∣𝑓(𝑟) ∈𝐵} ∣𝑟 ∈ℝ, 𝐵 Borel}) be the 𝜎-algebra generated by the point evaluations. Then ev :𝐹 ×ℝ →ℝ, ev(𝑓,𝑟) =𝑓(𝑟), is not measurable with respect to Σev ⊗B(ℝ).
Referenced from 5 locations
Proof of Theorem 174.3 — The evaluation σ -algebra fails
Proof. Suppose it were. Then 𝐸 =ev−1((0,∞)) ={(𝑓,𝑟) ∣𝑓(𝑟) >0} lies in Σev ⊗B(ℝ), so by lemma 174.2 there is a countable C ⊆Σev with 𝐸 ∈𝜎({𝐶 ×𝐵 ∣𝐶 ∈C, 𝐵 ∈B(ℝ)}). Applying lemma 174.2 once more to each 𝐶 ∈C, which lies in the 𝜎-algebra generated by point evaluations, produces a countable set 𝑅0 ⊆ℝ such that every 𝐶 ∈C lies in 𝜎({{𝑓 ∣𝑓(𝑟) ∈𝐵} ∣𝑟 ∈𝑅0, 𝐵 Borel}).
Two functions agreeing on 𝑅0 therefore lie in exactly the same members of C, hence in the same members of the generated 𝜎-algebra; so for such 𝑓,𝑔 and every 𝑟, (𝑓,𝑟) ∈𝐸 if and only if (𝑔,𝑟) ∈𝐸. Now let 𝑟1 ∉𝑅0, which exists because 𝑅0 is countable, and take 𝑓 =0 and 𝑔 =1{𝑟1}. Both are Borel measurable and agree on 𝑅0, yet (𝑓,𝑟1) ∉𝐸 while (𝑔,𝑟1) ∈𝐸. ◻
In 𝗉𝗋𝗂𝗈𝗋 the sampled object is the function 𝛼(𝑠,𝑏) =𝜆𝑥. 𝑠 ⋅𝑥 +𝑏, and the program’s use of it is ev(𝛼(𝑠,𝑏),𝑥) =𝑠 ⋅𝑥 +𝑏, a jointly measurable function of (𝑠,𝑏,𝑥). Nothing is wrong with the program; what fails is the demand that the intermediate set {𝜆𝑥. 𝑠𝑥 +𝑏 ∣𝑠,𝑏 ∈ℝ} carry a 𝜎-algebra through which that joint measurability factors. The repair below keeps the joint measurability as the primitive datum and never asks for the intermediate 𝜎-algebra.
Referenced from 3 locations
Quasi-Borel spaces
A quasi-Borel space is a set 𝑋 together with a set 𝑀𝑋 ⊆[ℝ →𝑋] of random elements such that
𝛼 ∘𝑓 ∈𝑀𝑋 whenever 𝛼 ∈𝑀𝑋 and 𝑓 :ℝ →ℝ is measurable;
every constant function ℝ →𝑋 is in 𝑀𝑋;
if ℝ =⨄𝑖∈ℕ𝑆𝑖 with each 𝑆𝑖 Borel and 𝛼𝑖 ∈𝑀𝑋 for each 𝑖, then 𝛽 ∈𝑀𝑋, where 𝛽(𝑟) =𝛼𝑖(𝑟) for 𝑟 ∈𝑆𝑖.
A morphism (𝑋,𝑀𝑋) →(𝑌,𝑀𝑌) is a function 𝑔 :𝑋 →𝑌 with 𝑔 ∘𝛼 ∈𝑀𝑌 for every 𝛼 ∈𝑀𝑋. Write QBS(𝑋,𝑌) for the set of morphisms.
Referenced from 9 locations
The three clauses are the closure properties that random variables have: a random element may be reparameterized by a measurable change of the sample point, a constant is a random element, and a countable measurable case distinction between random elements is a random element. Since 𝑀ℝ contains exactly the measurable functions in the example below, clause (i) says that 𝑀𝑋 is closed under precomposition and clause (iii) is what makes coproducts work.
For a measurable space (𝑋,Σ𝑋) put 𝑀Σ𝑋 ={𝛼 :ℝ →𝑋 ∣𝛼 measurable}. The three clauses hold: composition of measurable maps is measurable, constants are measurable, and a countable measurable gluing of measurable maps is measurable because 𝛽−1(𝐴) =⨄𝑖(𝑆𝑖 ∩𝛼−1𝑖(𝐴)). In the other direction, a quasi-Borel space (𝑋,𝑀𝑋) determines the 𝜎-algebra Σ𝑀𝑋={𝑈⊆𝑋∣∀𝛼∈𝑀𝑋. 𝛼−1(𝑈)∈B(ℝ)}, which is a 𝜎-algebra because preimage commutes with complement and countable union. Every morphism (𝑋,𝑀𝑋) →(𝑌,𝑀𝑌) is measurable (𝑋,Σ𝑀𝑋) →(𝑌,Σ𝑀𝑌): for 𝑈 ∈Σ𝑀𝑌 and 𝛼 ∈𝑀𝑋, 𝛼−1(𝑔−1𝑈) =(𝑔 ∘𝛼)−1(𝑈) is Borel because 𝑔 ∘𝛼 ∈𝑀𝑌. The converse fails in general, and section 174.3 needs the difference.
Referenced from 3 locations
Let (𝑋𝑖,𝑀𝑋𝑖)𝑖∈𝐼 be quasi-Borel spaces indexed by a set 𝐼. Then (∏𝑖𝑋𝑖,𝑀∏𝑖𝑋𝑖) with 𝑀∏𝑖𝑋𝑖={𝑓:ℝ→∏𝑖𝑋𝑖∣∀𝑖. 𝜋𝑖∘𝑓∈𝑀𝑋𝑖} is a quasi-Borel space, the projections are morphisms, and it is the product in QBS.
Referenced from 7 locations
Proof of Proposition 174.8 — Products
Proof. Each clause of definition 174.6 is checked coordinatewise: for (i), 𝜋𝑖 ∘(𝑓 ∘𝑔) =(𝜋𝑖 ∘𝑓) ∘𝑔 ∈𝑀𝑋𝑖; for (ii), a constant into the product is coordinatewise constant; for (iii), the glued function has 𝜋𝑖 ∘𝛽 equal to the gluing of 𝜋𝑖 ∘𝛼𝑗, which lies in 𝑀𝑋𝑖. The projections are morphisms by the definition of 𝑀∏𝑖𝑋𝑖. For the universal property, given morphisms 𝑔𝑖 :𝑍 →𝑋𝑖, the pairing ⟨𝑔𝑖⟩𝑖 satisfies 𝜋𝑖 ∘⟨𝑔𝑖⟩𝑖 ∘𝛾 =𝑔𝑖 ∘𝛾 ∈𝑀𝑋𝑖 for 𝛾 ∈𝑀𝑍, so it is a morphism, and it is the unique such function. ◻
Let (𝑋𝑖,𝑀𝑋𝑖)𝑖∈𝐼 be quasi-Borel spaces with 𝐼 countable and discrete. Then (∐𝑖𝑋𝑖,𝑀∐𝑖𝑋𝑖) with 𝑀∐𝑖𝑋𝑖={𝜆𝑟.(𝑓(𝑟),𝛼𝑓(𝑟)(𝑟)) ∣ 𝑓:ℝ→𝐼 measurable,(𝛼𝑖∈𝑀𝑋𝑖)𝑖∈image(𝑓)} is a quasi-Borel space and is the coproduct in QBS.
Referenced from 5 locations
Proof of Proposition 174.9 — Countable coproducts
Proof. Clause (i): precomposing with a measurable 𝑔 replaces 𝑓 by 𝑓 ∘𝑔 and 𝛼𝑖 by 𝛼𝑖 ∘𝑔. Clause (ii): a constant is obtained with constant 𝑓. Clause (iii): given a Borel partition ℝ =⨄𝑗𝑆𝑗 and elements 𝛽𝑗 of the displayed form with data (𝑓𝑗,𝛼𝑗𝑖), define 𝑓 by 𝑓(𝑟) =𝑓𝑗(𝑟) for 𝑟 ∈𝑆𝑗, measurable since 𝐼 is countable and discrete, and define 𝛼𝑖 by gluing the 𝛼𝑗𝑖 over the partition, which lies in 𝑀𝑋𝑖 by clause (iii) for 𝑋𝑖. For the universal property, let 𝑔𝑖 :𝑋𝑖 →𝑍 be morphisms and let 𝛾 =𝜆𝑟. (𝑓(𝑟),𝛼𝑓(𝑟)(𝑟)) be a random element of the coproduct. Then [𝑔𝑖]𝑖 ∘𝛾 is the gluing over the Borel partition ℝ =⨄𝑖𝑓−1({𝑖}) of the maps 𝑔𝑖 ∘𝛼𝑖 ∈𝑀𝑍, hence lies in 𝑀𝑍 by clause (iii) for 𝑍. This is the step for which clause (iii) exists. ◻
Let (𝑋,𝑀𝑋) and (𝑌,𝑀𝑌) be quasi-Borel spaces. Then 𝑌𝑋 =QBS(𝑋,𝑌) with 𝑀𝑌𝑋={𝛼:ℝ→𝑌𝑋∣uncurry(𝛼)∈QBS(ℝ×𝑋,𝑌)} is a quasi-Borel space, evaluation ev :𝑌𝑋 ×𝑋 →𝑌 is a morphism, and QBS is cartesian closed.
Referenced from 9 locations
Proof of Proposition 174.10 — Function spaces
Proof. Here ℝ carries 𝑀Σℝ, the measurable functions ℝ →ℝ, and ℝ ×𝑋 the product structure of proposition 174.8.
Clause (i). If uncurry(𝛼) is a morphism and 𝑔 :ℝ →ℝ is measurable, then uncurry(𝛼 ∘𝑔) =uncurry(𝛼) ∘(𝑔 ×id), a composite of morphisms.
Clause (ii). For a constant 𝛼 =𝜆𝑟. ℎ with ℎ a morphism, the uncurried map sends (𝑟,𝑥) to ℎ(𝑥), so it sends a random element of ℝ ×𝑋 with second component 𝜒 to ℎ ∘𝜒, which lies in 𝑀𝑌.
Clause (iii). Let ℝ =⨄𝑖𝑆𝑖 be Borel and 𝛼𝑖 ∈𝑀𝑌𝑋, and let 𝛽 glue them. Let ⟨𝜌,𝜒⟩ ∈𝑀ℝ×𝑋. Then uncurry(𝛽)∘⟨𝜌,𝜒⟩= the gluing over the Borel partition (𝜌−1(𝑆𝑖))𝑖of uncurry(𝛼𝑖)∘⟨𝜌,𝜒⟩, each of which lies in 𝑀𝑌; the partition is Borel because 𝜌 is measurable, so clause (iii) for 𝑌 gives uncurry(𝛽) ∘⟨𝜌,𝜒⟩ ∈𝑀𝑌. This is where the countable gluing of proposition 174.9 is used in disguise.
Evaluation and the universal property. Let ⟨𝛼,𝜒⟩ ∈𝑀𝑌𝑋×𝑋. Then ev ∘⟨𝛼,𝜒⟩ =uncurry(𝛼) ∘⟨id,𝜒⟩ ∈𝑀𝑌, so ev is a morphism. For ℎ :𝑍 ×𝑋 →𝑌 a morphism, its curry Λℎ :𝑍 →𝑌𝑋 satisfies, for 𝛾 ∈𝑀𝑍, uncurry(Λℎ ∘𝛾) =ℎ ∘(𝛾 ×id), a morphism; so Λℎ is a morphism, and it is the unique function with ev ∘(Λℎ ×id) =ℎ. ◻
In QBS the map 𝛼 :ℝ ×ℝ →ℝℝ of example 174.5, sending (𝑠,𝑏) to 𝜆𝑥. 𝑠 ⋅𝑥 +𝑏, is a morphism: its uncurrying (𝑠,𝑏,𝑥) ↦𝑠 ⋅𝑥 +𝑏 is jointly measurable, hence a morphism ℝ ×ℝ ×ℝ →ℝ, and proposition 174.10 converts that into a morphism into the function space. No 𝜎-algebra on ℝℝ was chosen; the joint measurability that the program already had is precisely the datum that 𝑀ℝℝ records.
Referenced from 3 locations
★☆☆ For a set 𝑋, verify that 𝑀𝑅𝑋 =[ℝ →𝑋] and the set 𝑀𝐿𝑋 of functions constant on the parts of a countable Borel partition pulled back along a measurable map both satisfy definition 174.6, and show that the identity is a morphism (𝑋,𝑀𝐿𝑋) →(𝑋,𝑀𝑅𝑋) but not conversely for 𝑋 =ℝ.
Referenced from 2 locations
★★☆ Give quasi-Borel spaces 𝑋,𝑌 and a function 𝑋 →𝑌 that is measurable for Σ𝑀𝑋,Σ𝑀𝑌 but is not a morphism, so that the passage of example 174.7 loses information.
Referenced from 2 locations
★★☆ Delete clause (iii) from definition 174.6 and show that the copairing in proposition 174.9 then need not be a morphism, by exhibiting two morphisms out of the summands whose copairing fails.
Referenced from 2 locations
The probability monad on quasi-Borel spaces
A measure on a quasi-Borel space cannot be defined as a set function, because the space has no primitive 𝜎-algebra. It is instead defined the way a probabilist produces measures in practice: push a measure on the sample line forward along a random element. Two such presentations describe the same measure exactly when the pushforwards agree.
A probability measure on (𝑋,𝑀𝑋) is a pair (𝛼,𝜇) with 𝛼 ∈𝑀𝑋 and 𝜇 a probability measure on ℝ. Two pairs are equivalent, (𝛼,𝜇) ∼(𝛽,𝜈), when 𝛼∗𝜇 =𝛽∗𝜈 as measures on (𝑋,Σ𝑀𝑋). Write [𝛼,𝜇] for the equivalence class and 𝑃(𝑋)={(𝛼,𝜇)}/∼,𝑀𝑃(𝑋)={𝛽:ℝ→𝑃(𝑋)∣∃𝛼∈𝑀𝑋, ∃𝑔 a kernel,∀𝑟. 𝛽(𝑟)=[𝛼,𝑔(𝑟)]}, where a kernel means one from ℝ to ℝ in the sense of definition 172.16. For a morphism ℎ :𝑋 →𝑌, integration of ℎ against [𝛼,𝜇] is ∫ℎ 𝑑[𝛼,𝜇] =∫(ℎ ∘𝛼) 𝑑𝜇, well defined by theorem 172.14 and independent of the representative.
Referenced from 10 locations
𝑀𝑃(𝑋) satisfies the three clauses of definition 174.6.
Referenced from 2 locations
Proof of Lemma 174.13 — P(X) is a quasi-Borel space
Proof. Clause (i): if 𝛽(𝑟) =[𝛼,𝑔(𝑟)] and 𝑓 is measurable, then 𝛽(𝑓(𝑟)) =[𝛼,(𝑔 ∘𝑓)(𝑟)] and 𝑔 ∘𝑓 is a kernel by proposition 172.18 applied to ret composed with 𝑓, or directly because 𝑟 ↦𝑔(𝑓(𝑟))(𝐴) is a composite of measurable maps. Clause (ii): a constant [𝛼,𝜇] is obtained with the constant kernel 𝑔(𝑟) =𝜇. Clause (iii): let ℝ =⨄𝑖𝑆𝑖 be Borel with 𝛽𝑖(𝑟) =[𝛼𝑖,𝑔𝑖(𝑟)]. Choose a Borel partition ℝ =⨄𝑖𝑇𝑖 into uncountable Borel pieces together with Borel isomorphisms 𝜑𝑖 :ℝ →𝑇𝑖, and let 𝜓𝑖 :ℝ →ℝ be a measurable map restricting to 𝜑−1𝑖 on 𝑇𝑖. Each 𝛼𝑖 ∘𝜓𝑖 lies in 𝑀𝑋 by clause (i), so their gluing 𝛼 along (𝑇𝑖)𝑖 lies in 𝑀𝑋 by clause (iii) for 𝑋, and 𝛼 ∘𝜑𝑖 =𝛼𝑖. Setting 𝑔(𝑟) =(𝜑𝑖)∗𝑔𝑖(𝑟) for 𝑟 ∈𝑆𝑖 defines a kernel, and 𝛼∗𝑔(𝑟)=𝛼∗(𝜑𝑖)∗𝑔𝑖(𝑟)𝑙𝑒𝑚𝑚𝑎172.11=(𝛼∘𝜑𝑖)∗𝑔𝑖(𝑟)=(𝛼𝑖)∗𝑔𝑖(𝑟), so [𝛼,𝑔(𝑟)] =[𝛼𝑖,𝑔𝑖(𝑟)] =𝛽𝑖(𝑟) for 𝑟 ∈𝑆𝑖. ◻
For 𝑥 ∈𝑋 put 𝜂(𝑥) =[𝜆𝑟. 𝑥,𝜇] for an arbitrary probability measure 𝜇 on ℝ; the class does not depend on 𝜇, since (𝜆𝑟. 𝑥)∗𝜇 =𝛿𝑥 for every 𝜇. For a morphism 𝑓 :𝑋 →𝑃(𝑌) and [𝛼,𝜇] ∈𝑃(𝑋), choose by definition 174.12 a 𝛽 ∈𝑀𝑌 and a kernel 𝑔 :ℝ ⇝ℝ with (𝑓 ∘𝛼)(𝑟) =[𝛽,𝑔(𝑟)] for all 𝑟, and set [𝛼,𝜇]≫=𝑓=[𝛽, 𝜇≫=𝑔], the inner bind being that of definition 172.16.
Referenced from 5 locations
The class [𝛽,𝜇 ≫ =𝑔] depends neither on the representative (𝛼,𝜇) nor on the choice of (𝛽,𝑔), and it satisfies 𝑙𝑌([𝛼,𝜇]≫=𝑓)=𝑙𝑋([𝛼,𝜇])≫=(𝑥↦𝑙𝑌(𝑓(𝑥))),𝑙𝑋([𝛼,𝜇])=𝛼∗𝜇, an equation between measures on (𝑌,Σ𝑀𝑌).
Referenced from 6 locations
Proof of Lemma 174.15 — Bind is well defined
Proof. Compute the underlying measure of the right-hand side. For 𝑈 ∈Σ𝑀𝑌, (𝛼∗𝜇≫=(𝑥↦𝑙𝑌(𝑓(𝑥))))(𝑈)𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛172.16=∫𝑙𝑌(𝑓(𝑥))(𝑈)𝑑(𝛼∗𝜇)(𝑥)𝑡ℎ𝑒𝑜𝑟𝑒𝑚172.14=∫𝑙𝑌(𝑓(𝛼(𝑟)))(𝑈)𝑑𝜇(𝑟)𝑐ℎ𝑜𝑖𝑐𝑒𝑜𝑓(𝛽,𝑔)=∫𝛽∗𝑔(𝑟)(𝑈)𝑑𝜇(𝑟)𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛172.10=∫𝑔(𝑟)(𝛽−1𝑈)𝑑𝜇(𝑟)𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛172.16=(𝜇≫=𝑔)(𝛽−1𝑈)=𝛽∗(𝜇≫=𝑔)(𝑈). So the underlying measure of [𝛽,𝜇 ≫ =𝑔] equals the displayed right-hand side, which mentions neither (𝛽,𝑔) nor the representative 𝛼 except through 𝛼∗𝜇. Since the equivalence of definition 174.12 is exactly equality of underlying measures, the class is determined. ◻
(𝑃,𝜂, ≫ =) is a monad on QBS: for 𝑥 ∈𝑋, 𝑝 ∈𝑃(𝑋), and morphisms 𝑓 :𝑋 →𝑃(𝑌), ℎ :𝑌 →𝑃(𝑍), 𝜂(𝑥)≫=𝑓=𝑓(𝑥),𝑝≫=𝜂=𝑝,(𝑝≫=𝑓)≫=ℎ=𝑝≫=(𝑥↦𝑓(𝑥)≫=ℎ). Its functorial action is 𝑃(𝑔)[𝛼,𝜇] =[𝑔 ∘𝛼,𝜇], and it is strong.
Referenced from 8 locations
Proof of Theorem 174.16 — The probability monad
Proof. By lemma 174.15 the underlying measure of each side may be computed, and two elements of 𝑃(𝑋) with the same underlying measure are equal by definition 174.12. Transporting the three equations through 𝑙 turns them into the three equations of theorem 172.20 for the kernels 𝑥 ↦𝑙𝑌(𝑓(𝑥)) and 𝑦 ↦𝑙𝑍(ℎ(𝑦)), with 𝑙𝑋(𝜂(𝑥)) =𝛿𝑥. For the functorial action, 𝑙𝑌(𝑃(𝑔)[𝛼,𝜇]) =(𝑔 ∘𝛼)∗𝜇 =𝑔∗(𝛼∗𝜇) by lemma 172.11, which is the pushforward of the underlying measure, and this coincides with [𝛼,𝜇] ≫ =(𝜂 ∘𝑔) by lemma 172.22. Strength is the statement that ≫ = is itself a morphism 𝑃(𝑌)𝑋 →𝑃(𝑌)𝑃(𝑋); by proposition 174.10 this amounts to the joint claim that (𝛼,𝑓) ↦[𝛼,𝜇] ≫ =𝑓 sends random elements to random elements, which the construction of (𝛽,𝑔) in definition 174.14 produces uniformly in a random element of the function space. ◻
Let 𝑝 ∈𝑃(𝑋), 𝑞 ∈𝑃(𝑌), and let 𝑓 :𝑋 ×𝑌 →𝑃(𝑍) be a morphism. Then 𝑝≫=𝜆𝑥.𝑞≫=𝜆𝑦.𝑓(𝑥,𝑦)=𝑞≫=𝜆𝑦.𝑝≫=𝜆𝑥.𝑓(𝑥,𝑦).
Referenced from 12 locations
Proof of Proposition 174.17 — Commutativity
Proof. Write 𝑝 =[𝛼,𝜇], 𝑞 =[𝛾,𝜈], and apply 𝑙𝑍 to both sides. By lemma 174.15 and theorem 172.14, the left-hand side becomes ∫∫𝑙𝑍(𝑓(𝛼(𝑟),𝛾(𝑠)))(𝑈)𝑑𝜈(𝑠)𝑑𝜇(𝑟), and the right-hand side is the same double integral in the opposite order. The integrand is nonnegative and jointly measurable, because 𝑓 is a morphism and the pair of projections composed with 𝛼 and 𝛾 is a random element of 𝑋 ×𝑌. Both 𝜇 and 𝜈 are probability measures, hence 𝜎-finite, so Tonelli’s theorem exchanges the two integrations by convention 172.12. ◻
The program 𝗉𝗋𝗂𝗈𝗋 denotes [𝛼,𝜈 ⊗𝜈] ∈𝑃(ℝℝ), where 𝜈 is the normal measure with mean 0 and standard deviation 3 on ℝ and 𝛼(𝑠,𝑏) =𝜆𝑥. 𝑠 ⋅𝑥 +𝑏, which is a morphism by example 174.11; the pair (ℝ2,𝜈 ⊗𝜈) is transported to the sample line by any Borel isomorphism ℝ →ℝ2, and the class [𝛼,𝜈 ⊗𝜈] does not depend on which one, because two choices differ by a measurable reparameterization and pushforward composes. Evaluating the sampled line at 𝑥0 is the morphism ev( −,𝑥0), and 𝑃(ev( −,𝑥0))[𝛼,𝜈 ⊗𝜈] =[𝜆(𝑠,𝑏). 𝑠𝑥0 +𝑏,𝜈 ⊗𝜈], the normal measure with mean 0 and variance 9(𝑥20 +1). The obstruction of section 174.1 has been removed without approximating anything.
Referenced from 2 locations
Proposition 174.8, Proposition 174.9, Proposition 174.10, theorem 174.16 and proposition 174.17 are the reconstructions of Heunen–Kammar–Staton–Yang’s Propositions 16, 17 and 18, their Theorem 21 and their Proposition 22, at their signatures: products over an arbitrary index set, coproducts over a countable discrete index set, exponentials of arbitrary quasi-Borel spaces, a strong monad 𝑃, and its functorial action and commutativity. Their statement of Proposition 22 also records that 𝑃 restricted along the embedding of standard Borel spaces agrees with the Giry monad; that agreement is the equation of lemma 174.15. This card is about QBS only. It does not include recursion, and nothing on it is transported to the 𝜔-quasi-Borel card below without the proved restriction stated there.
Referenced from 4 locations
Adding recursion: the 𝜔-quasi-Borel card
A language with a fixed-point operator interprets a recursive definition as the supremum of its finite unfoldings, so both the spaces and the measures must carry an order in which those suprema exist. The following card is frozen; the chapter proves nothing about it beyond restating what is imported.
An 𝜔-quasi-Borel space is a quasi-Borel space equipped with an 𝜔-cpo structure whose random elements are compatible with the order, and 𝜔Qbs is the resulting category; 𝐽 is the monad of measures on it and 𝑇, the statistical powerdomain, is the submonad generated by the two operations sample :1 →𝑇ℝ, the uniform measure on [0,1], and score :ℝ →𝑇1, which multiplies the current weight by |𝑟|. The language SFPC is call-by-value with sums, products, function types, recursive types 𝜇𝛼.𝜎, term-level recursion, real arithmetic, sample and score; its operational semantics is a big-step relation whose induced map ⇓ :Trm⊢𝜏 →𝑇 Val⊢𝜏 is an s-finite kernel, and 𝑡 ⪯𝑠 denotes contextual approximation: for every context 𝐶[ −] of type ℝ, the weight of 𝐶[𝑡] ⇓ is at most that of 𝐶[𝑠] ⇓; 𝑡 ≈𝑠 is approximation in both directions.
Referenced from 5 locations
The following are imported at exactly these signatures and are the only statements about convention 174.20 used in this book.
Their Theorem 4.3: the unit and bind of 𝐽 restrict to 𝑇, and the factorisation of the expectation operator 𝑅𝑋 →𝑇𝑋 →𝐽𝑋 into a densely strong epi followed by a full mono preserves the monad structures.
Their Theorem 4.6: 𝑇 equips 𝜔Qbs with a measure-category structure — a cartesian closed category with countable limits and coproducts together with a commutative monad whose canonical maps 𝑇0 →1 and 𝑇∑𝑖𝑋𝑖 →∏𝑗𝑇𝑋𝑗 are invertible — with the countable semiring of scalars given by the weights 𝑇1.
Their Lemma 6.6, computational soundness: for every closed ⊢𝑡 :𝜏, [[𝑡]] ≥[[𝑡 ⇓]]𝑇𝑣.
Their Lemma 6.8, the fundamental lemma of their logical relation: for every 𝑤 ∈ValΓ⊢𝜏 and 𝑠 ∈TrmΓ⊢𝜏, [[𝑤]]𝑣𝐸𝑣Γ⊢𝜏𝑤 and [[𝑠]]𝐸𝑐Γ⊢𝜏𝑠, whence [[𝑡]] ≤[[𝑡 ⇓]]𝑇𝑣 for closed 𝑡.
Their Theorem 6.9: for all SFPC types 𝜏 and closed 𝑡,𝑠 ∈Trm⊢𝜏, [[𝑡]] ≤[[𝑠]] implies 𝑡 ⪯𝑠; in particular [[𝑡]] =[[𝑠]] implies 𝑡 ≈𝑠.
Referenced from 5 locations
Consider the recursion-free program 𝗌𝖾𝗇𝗌𝗈𝗋=𝑥←𝗎𝗇𝗂𝖿𝗈𝗋𝗆(0,1);𝗌𝖼𝗈𝗋𝖾(𝗂𝖿 𝑥<12 𝗍𝗁𝖾𝗇 2 𝖾𝗅𝗌𝖾 1);𝗋𝖾𝗍𝗎𝗋𝗇 (𝑥<12). Operationally, the run whose first sampled real is 1/4 performs 𝚜𝚊𝚖𝚙𝚕𝚎 1/4, 𝚜𝚌𝚘𝚛𝚎 2, 𝚛𝚎𝚝𝚞𝚛𝚗 𝗍𝗍, and carries weight 2. Denotationally, the unnormalized measure on {𝗍𝗍,𝖿𝖿} is ∫10(2⋅1[0,1/2)(𝑥)𝛿𝗍𝗍+1⋅1[1/2,1](𝑥)𝛿𝖿𝖿)𝑑𝑥=2⋅12𝛿𝗍𝗍+1⋅12𝛿𝖿𝖿=𝛿𝗍𝗍+12𝛿𝖿𝖿, of total weight 3/2; normalizing gives {𝗍𝗍 ↦2/3, 𝖿𝖿 ↦1/3}. Replacing the uniform draw by 𝖼𝗈𝗂𝗇(1/2) and the test 𝑥 <1/2 by the drawn Boolean produces exactly the same three numbers by a finite rational computation, which is what the practical project checks.
Referenced from 4 locations
★☆☆ Prove directly from definition 174.12 that [𝜆𝑟. 𝑥,𝜇] does not depend on 𝜇, and compute 𝑙𝑋(𝜂(𝑥)).
Referenced from 2 locations
★★☆ Let 𝑋 =𝑌 =ℝ, 𝛼 =id, 𝜇 the uniform measure on [0,1], and 𝑓(𝑥) =𝜂(2𝑥). Exhibit a pair (𝛽,𝑔) as required by definition 174.14, compute [𝛼,𝜇] ≫ =𝑓, and verify the equation of lemma 174.15 for the Borel set [0,1].
Referenced from 2 locations
★★☆ Give a monad on a cartesian closed category, other than 𝑃, for which the equation of proposition 174.17 fails, and identify which hypothesis of the proof it violates.
Referenced from 2 locations
Suggested first pass.
None of these problems is a prerequisite for a later chapter. Begin with exercise 174.7, then exercise 174.8, then the practical project exercise 174.11.
★★☆ Reconstruct theorem 174.3 with (0,∞) replaced by an arbitrary Borel set 𝐵 with 0 ∉𝐵 and 1 ∈𝐵, and state the two properties of the pair 𝑓 =0, 𝑔 =1{𝑟1} that the argument uses.
Referenced from 3 locations
★★☆ Write out the proof of clause (iii) in proposition 174.10 for the special case 𝑋 =𝑌 =ℝ and a partition into two Borel pieces, displaying the random element of ℝ ×𝑋 that is used.
Referenced from 3 locations
★★☆ Prove the right unit law of theorem 174.16 without transporting through 𝑙: work with representatives, choose (𝛽,𝑔) explicitly for 𝑓 =𝜂, and identify the resulting class.
Referenced from 2 locations
★★☆ State precisely which parts of convention 174.19 are claimed for the 𝜔-quasi-Borel setting of convention 174.20, and give an example of a statement about 𝑃 that is not claimed for 𝑇.
Referenced from 2 locations
★★★ Practical project.qbs-weighted-interpreter Build a two-back-end interpreter for the recursion-free weighted fragment with terms 𝖼𝗈𝗂𝗇(𝑝), 𝗌𝖼𝗈𝗋𝖾(𝑤) for a positive rational weight, 𝗋𝖾𝗍𝗎𝗋𝗇, 𝗂𝖿, and bind. The first back end is an exact enumerator producing an unnormalized rational table together with the total weight; the second is a stream-driven tracer that consumes an explicit list of drawn values and prints one line per event: 𝚜𝚊𝚖𝚙𝚕𝚎 𝑣, 𝚜𝚌𝚘𝚛𝚎 𝑤, 𝚛𝚎𝚝𝚞𝚛𝚗 𝑣, and a final 𝚠𝚎𝚒𝚐𝚑𝚝 𝑤.
The invariant to maintain is that the tracer’s final weight equals the product of the scores encountered on the traced run, and that the enumerator’s total weight equals the sum over runs of that product; both are computed in exact rational arithmetic.
The concrete result is the pair of outputs for the finite analogue of example 174.23, namely 𝑏 ←𝖼𝗈𝗂𝗇(1/2); 𝗌𝖼𝗈𝗋𝖾(𝗂𝖿 𝑏 𝗍𝗁𝖾𝗇 2 𝖾𝗅𝗌𝖾 1); 𝗋𝖾𝗍𝗎𝗋𝗇 𝑏, and for the traced run of example 174.23 itself with the drawn real 1/4 supplied explicitly.
The acceptance test is decidable and exact: the enumerator must print the unnormalized table {𝗍𝗍 ↦1, 𝖿𝖿 ↦1/2}, the normalizer 3/2, and the posterior {𝗍𝗍 ↦2/3, 𝖿𝖿 ↦1/3}; the tracer on the supplied value 1/4 must print exactly 𝚜𝚊𝚖𝚙𝚕𝚎 1/4; 𝚜𝚌𝚘𝚛𝚎 2; 𝚛𝚎𝚝𝚞𝚛𝚗 𝗍𝗍; 𝚠𝚎𝚒𝚐𝚑𝚝 2; and the checker must confirm that the enumerator’s total weight equals the sum of the two traced weights 2 ⋅12 and 1 ⋅12. Sampling frequencies may be displayed but are not an accepted answer, and this finite agreement illustrates convention 174.21 without proving any part of it.
Referenced from 3 locations