Probabilistic Lambda Calculi and Program Equivalence
Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.
Consider two closed programs that each produce a bit. The first flips a fair coin; the second flips a coin that falls on 0 once in three times. Write them, for the moment informally, as 𝖼𝗈𝗂𝗇(1/2) and 𝖼𝗈𝗂𝗇(1/3), and let a transition relation ⟶ record which results are possible: 𝖼𝗈𝗂𝗇(1/2)⟶――0,𝖼𝗈𝗂𝗇(1/2)⟶――1,𝖼𝗈𝗂𝗇(1/3)⟶――0,𝖼𝗈𝗂𝗇(1/3)⟶――1. The two programs have the same reachable set {――0,――1}, so every equivalence defined from the reachable set identifies them. A gambler who is paid one euro when the result is ――0 does not identify them. The quantity that separates them — the probability that the program returns ――0 — is not a set of successor states but a number, and the relation ⟶ does not carry it.
Three things must therefore be built, and the chapter builds them in this order. The operational semantics must assign to each pair of terms the probability of a transition, and must accumulate those probabilities along possibly infinite reduction sequences into a subprobability distribution over results; a diverging program then contributes missing mass rather than a default value. The program equivalence must observe those numbers through arbitrary program contexts. Finally, a denotational model must compute the same numbers compositionally, and must do so exactly: an inequality between the model and the operational probabilities is not enough to decide the equivalence, and a model that identifies more terms than contexts do would answer the wrong question. The invariant that organizes the whole chapter is the equality between an operational convergence probability and a coefficient of a power series, first for ground results and then, through a family of testing programs, for every type.
pPCF is the calculus of Ehrhard–Pagani–Tasson with one ground type 𝜄 of natural numbers, ordinary function types, a call-by-name 𝖿𝗂𝗑, a value-passing conditional, and one probabilistic constructor. Types and terms are 𝜎,𝜏::=𝜄∣𝜎⟶𝜏,𝑀,𝑁::=――𝑛∣𝑥∣𝗌𝗎𝖼𝖼(𝑀)∣𝗂𝖿(𝑀,𝑃,𝑧⋅𝑅)∣𝜆𝑥𝜎.𝑀∣𝑀𝑁∣𝖼𝗈𝗂𝗇(𝑝)∣𝖿𝗂𝗑(𝑀), where 𝑛 ranges over ℕ, the numeral ――𝑛 is the constant naming 𝑛, and 𝑝 ranges over the rational numbers in [0,1]. In 𝗂𝖿(𝑀,𝑃,𝑧⋅𝑅) the variable 𝑧 is bound in 𝑅 and in no other subterm. Terms are identified up to renaming of bound variables, and 𝑀[𝑁/𝑥] is capture-avoiding substitution. A typing context Γ=(𝑥1:𝜎1,…,𝑥𝑘:𝜎𝑘) has pairwise distinct variables, and the typing rules are
Γ⊢――𝑛:𝜄
Num
Γ,𝑥:𝜎⊢𝑥:𝜎
Var
Γ⊢𝑀:𝜄
Γ⊢𝗌𝗎𝖼𝖼(𝑀):𝜄
Succ
𝑝∈[0,1]∩ℚ
Γ⊢𝖼𝗈𝗂𝗇(𝑝):𝜄
Coin
Γ⊢𝑀:𝜄Γ⊢𝑃:𝜎Γ,𝑧:𝜄⊢𝑅:𝜎
Γ⊢𝗂𝖿(𝑀,𝑃,𝑧⋅𝑅):𝜎
If
Γ,𝑥:𝜎⊢𝑀:𝜏
Γ⊢𝜆𝑥𝜎.𝑀:𝜎⟶𝜏
Lam
Γ⊢𝑀:𝜎⟶𝜏Γ⊢𝑁:𝜎
Γ⊢𝑀𝑁:𝜏
App
Γ⊢𝑀:𝜎⟶𝜎
Γ⊢𝖿𝗂𝗑(𝑀):𝜎
Fix
Write Λ𝜎Γ for the set of terms 𝑀 with Γ⊢𝑀:𝜎, and Λ𝜎0 when Γ is empty. This card is frozen: no continuous distribution, no scoring or conditioning construct, and no reference or exception belongs to pPCF, and no theorem proved below is claimed for a calculus with those constructs.
Two features of the card do work that a reader of an ordinary call-by-name PCF should notice at once.
The conditional binds its scrutinee’s value. In PCF one writes 𝗂𝖿(𝑀,𝑃,𝑄) and, in the branch taken when 𝑀 is nonzero, recovers the value of 𝑀 by evaluating 𝑀 again. Under a probabilistic semantics that second evaluation is a second experiment: it need not return what the first returned. The pPCF conditional therefore passes the predecessor of the scrutinee to the branch through the bound variable 𝑧, so that the outcome of the single experiment performed on 𝑀 is available without repeating it.
The bound variable makes the predecessor definable, which is where the mechanism is easiest to see: 𝗉𝗋𝖾𝖽=𝜆𝑥𝜄.𝗂𝖿(𝑥,――0,𝑧⋅𝑧).
The relation 𝑀⇝0𝑀′ on pPCF terms is generated by (𝜆𝑥𝜎.𝑀)𝑁⇝0𝑀[𝑁/𝑥],𝖿𝗂𝗑(𝑀)⇝0𝑀𝖿𝗂𝗑(𝑀),𝗌𝗎𝖼𝖼(――𝑛)⇝0――――𝑛+1,𝗂𝖿(――0,𝑃,𝑧⋅𝑅)⇝0𝑃,𝗂𝖿(――――𝑛+1,𝑃,𝑧⋅𝑅)⇝0𝑅[――𝑛/𝑧]. These are root contractions: no clause reduces a proper subterm.
The relation 𝑀⟶𝑝𝑀′, read “𝑀 reduces in one step to 𝑀′ with probability 𝑝”, is generated by
𝑀⇝0𝑀′
𝑀⟶1𝑀′
Det
𝖼𝗈𝗂𝗇(𝑝)⟶𝑝――0
Coin-0
𝖼𝗈𝗂𝗇(𝑝)⟶1−𝑝――1
Coin-1
𝑀⟶𝑝𝑀′
𝑀𝑁⟶𝑝𝑀′𝑁
Ctx-App
𝑀⟶𝑝𝑀′
𝗌𝗎𝖼𝖼(𝑀)⟶𝑝𝗌𝗎𝖼𝖼(𝑀′)
Ctx-Succ
𝑀⟶𝑝𝑀′
𝗂𝖿(𝑀,𝑃,𝑧⋅𝑅)⟶𝑝𝗂𝖿(𝑀′,𝑃,𝑧⋅𝑅)
Ctx-If
A term 𝑀 is weak-normal when there are no 𝑝 and 𝑀′ with 𝑀⟶𝑝𝑀′. The three context rules descend only into the leftmost outermost position, so no rule reduces under a 𝜆, inside the branches of a conditional, or in the argument of an application.
The closed weak-normal terms of type 𝜄 are exactly the numerals, and the closed weak-normal terms of type 𝜎⟶𝜏 are exactly the abstractions. Both facts are read off the rules: every other closed term has a leftmost outermost redex.
For 𝑝=1/3 the rules give exactly two steps from 𝖼𝗈𝗂𝗇(1/3), namely 𝖼𝗈𝗂𝗇(1/3)⟶1/3――0 and 𝖼𝗈𝗂𝗇(1/3)⟶2/3――1, while 𝖼𝗈𝗂𝗇(1/2)⟶1/2――0 and 𝖼𝗈𝗂𝗇(1/2)⟶1/2――1. Erasing the labels erases the distinction between the two programs; keeping them is the whole content of definition 171.3.
Let 𝐺=𝖿𝗂𝗑(𝜆𝑔𝜄.𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅𝗌𝗎𝖼𝖼(𝑔))),⋅⊢𝐺:𝜄. Its first two steps are deterministic: 𝐺𝐷𝑒𝑡⟶(𝜆𝑔𝜄.𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅𝗌𝗎𝖼𝖼(𝑔)))𝐺𝐷𝑒𝑡⟶𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅𝗌𝗎𝖼𝖼(𝐺)). From there the coin is the leftmost outermost redex, so Ctx-If applies and the computation splits: 𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅𝗌𝗎𝖼𝖼(𝐺))⟶1/2𝗂𝖿(――0,――0,𝑧⋅𝗌𝗎𝖼𝖼(𝐺))𝐷𝑒𝑡⟶――0,𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅𝗌𝗎𝖼𝖼(𝐺))⟶1/2𝗂𝖿(――1,――0,𝑧⋅𝗌𝗎𝖼𝖼(𝐺))𝐷𝑒𝑡⟶𝗌𝗎𝖼𝖼(𝐺). The second branch reproduces 𝐺 under one 𝗌𝗎𝖼𝖼. Iterating, the program reaches the numeral ――𝑛 exactly along the single reduction path that answers “1” 𝑛 times and then “0”, and the product of the labels along that path is 2−(𝑛+1). The chapter’s operational semantics must therefore assign to 𝐺 the distribution 𝑛↦2−(𝑛+1) on ℕ, whose total mass is 1.
★☆☆ Using definition 171.2, definition 171.3, write the complete reduction of 𝗉𝗋𝖾𝖽――3, labelling every step with the rule that produces it, and state which rule fails to apply to 𝗉𝗋𝖾𝖽𝖼𝗈𝗂𝗇(1/2) at its first step.
★★☆ Let 𝐷=𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅𝑧),𝐷′=𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧′⋅𝑧′)). Compute, for each of the two terms and each 𝑛∈{0,1}, the sum of the products of the labels along every reduction path ending at ――𝑛. Conclude that a conditional which re-evaluates its scrutinee instead of binding its value does not define the same program.
Example 171.5 multiplied labels along a path and summed over paths. That informal recipe must become a definition that also survives infinitely many paths, and the following device — reduction as a stochastic matrix — makes the sum a supremum of finite approximations.
Let Γ be a typing context and 𝜎 a type. Define Red(Γ,𝜎)∈[0,1]Λ𝜎Γ×Λ𝜎Γ by Red(Γ,𝜎)𝑀,𝑀′=⎧{
{
{⎨{
{
{⎩𝑝if𝑀⟶𝑝𝑀′,1if𝑀isweak-normaland𝑀′=𝑀,0otherwise. Write Red(𝜎) when Γ is empty. The matrix product is (𝑆𝑇)𝑀,𝑀″=∑𝑀′𝑆𝑀,𝑀′𝑇𝑀′,𝑀″, and 𝑆𝑘 is the 𝑘-fold product.
The first clause is unambiguous because a non-weak-normal term has exactly one leftmost outermost redex, and that redex is either deterministic — giving one successor with label 1 — or a coin, giving two successors with labels summing to 1. Hence every row of Red(Γ,𝜎) sums to 1: the matrix is stochastic, and a weak-normal term is a state that only steps to itself.
Let 𝑆 be a stochastic matrix indexed by a countable set 𝐼, and let 𝐼1={𝑖∈𝐼∣𝑆𝑖,𝑖=1}. For 𝑖∈𝐼 and 𝑗∈𝐼1 the sequence 𝑘↦(𝑆𝑘)𝑖,𝑗 is nondecreasing, and the matrix (𝑆∞)𝑖,𝑗={sup𝑘∈ℕ(𝑆𝑘)𝑖,𝑗if𝑗∈𝐼1,0otherwise satisfies ∑𝑗∈𝐼(𝑆∞)𝑖,𝑗≤1 for every 𝑖.
Proof. Fix 𝑖∈𝐼 and 𝑗∈𝐼1. Then (𝑆𝑘+1)𝑖,𝑗=∑𝑙∈𝐼(𝑆𝑘)𝑖,𝑙𝑆𝑙,𝑗≥(𝑆𝑘)𝑖,𝑗𝑆𝑗,𝑗𝑗∈𝐼1=(𝑆𝑘)𝑖,𝑗, where the inequality drops all summands except 𝑙=𝑗, each of which is nonnegative. So the sequence is nondecreasing and its supremum exists in [0,1]. For the mass bound, exchange a supremum of a nondecreasing sequence with a countable sum of nonnegative terms: ∑𝑗∈𝐼(𝑆∞)𝑖,𝑗=∑𝑗∈𝐼1sup𝑘(𝑆𝑘)𝑖,𝑗𝑚𝑜𝑛𝑜𝑡𝑜𝑛𝑒𝑐𝑜𝑛𝑣𝑒𝑟𝑔𝑒𝑛𝑐𝑒=sup𝑘∑𝑗∈𝐼1(𝑆𝑘)𝑖,𝑗≤sup𝑘∑𝑗∈𝐼(𝑆𝑘)𝑖,𝑗=1. The last equality holds because a product of stochastic matrices is stochastic. ◻
For 𝑀,𝑀′∈Λ𝜎Γ with 𝑀′ weak-normal, write 𝑀⇓𝑝𝑀′ for 𝑝=Red(Γ,𝜎)∞𝑀,𝑀′. For a closed 𝑀∈Λ𝜄0, the family (Red(𝜄)∞𝑀,――𝑛)𝑛∈ℕ is the result distribution of 𝑀; by lemma 171.7 its total mass is at most 1, and the missing mass 1−∑𝑛Red(𝜄)∞𝑀,――𝑛 is the probability of divergence.
Let 𝑆 be stochastic on 𝐼, let 𝑖∈𝐼 and 𝑗∈𝐼1. Call a sequence 𝑤=(𝑖1,…,𝑖𝑘) with 𝑘≥1 a path from 𝑖 to 𝑗 when 𝑖1=𝑖, 𝑖𝑘=𝑗, and 𝑖𝑘≠𝑖𝑙 for 1≤𝑙<𝑘; its weight is wt(𝑤)=∏𝑘−1𝑙=1𝑆𝑖𝑙,𝑖𝑙+1. Then (𝑆∞)𝑖,𝑗=∑𝑤wt(𝑤), the sum ranging over all paths from 𝑖 to 𝑗.
Proof. Because 𝑗 is stationary, for each 𝑘 the number (𝑆𝑘)𝑖,𝑗 is the sum of the weights of all length-𝑘 sequences from 𝑖 to 𝑗; grouping such a sequence by the first index at which it reaches 𝑗 and using 𝑆𝑗,𝑗=1 for the remaining steps, (𝑆𝑘)𝑖,𝑗 is the sum of wt(𝑤) over paths 𝑤 of length at most 𝑘. The paths form a countable set of nonnegative summands, so the supremum over 𝑘 of these partial sums is the total sum. The requirement that 𝑗 occurs only at the end of a path is what prevents a path from being counted twice. ◻
Continue example 171.5. Exactly one path leads from 𝐺 to ――𝑛: it performs two deterministic steps, then 𝑛 times the pair “coin answers 1, conditional selects the branch”, then the coin answers 0, then the remaining deterministic steps that turn 𝗌𝗎𝖼𝖼𝑛(――0) into ――𝑛. Its weight is the product of its labels, in which every deterministic step contributes 1: Red(𝜄)∞𝐺,――𝑛𝑙𝑒𝑚𝑚𝑎171.9=12⋯12⏟𝑛⋅12=2−(𝑛+1),∑𝑛∈ℕ2−(𝑛+1)=1. The program terminates with probability 1 although it has an infinite reduction path, namely the one on which the coin always answers 1. That path has weight 0 in the limit and contributes nothing.
Delete the second clause of definition 171.6 and the row of a weak-normal term becomes zero, so (𝑆𝑘)𝑖,𝑗 is the probability of reaching 𝑗 in exactly𝑘 steps. That sequence is not monotone — for 𝐺 above it is 0 at every 𝑘 except the one length at which ――𝑛 is reached — so no supremum computes the accumulated probability. Making results stationary converts “reached at step 𝑘” into “reached within 𝑘 steps”, which is the monotone quantity.
★★☆ Let 𝐻=𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅Ω𝜄) with Ω𝜄 as in exercise 171.2. Compute the result distribution of 𝐻 and its total mass, and identify the reduction paths that carry the missing mass.
★★☆ Give a closed term 𝐾 of type 𝜄 whose result distribution has total mass 1/2 and is supported on {――0}, and a closed term whose result distribution has infinite support and total mass 1/2. Prove the mass claims by lemma 171.9.
A single number, the probability of returning ――0, is enough to separate 𝖼𝗈𝗂𝗇(1/2) from 𝖼𝗈𝗂𝗇(1/3). Terms of higher type produce no number by themselves; they must first be placed in a program that consumes them. The definition therefore quantifies over contexts.
Observation contexts are generated by the term formers of convention 171.1 together with a hole symbol []Δ⊢𝜏. Their typing judgment Γ⊢𝐶Δ⊢𝜏:𝜎 is generated by the rules of convention 171.1 read as rules for contexts, together with
Γ,Δ⊢[]Δ⊢𝜏:𝜏
Hole
Filling every hole with a term 𝑀 such that Δ⊢𝑀:𝜏 produces the term 𝐶[𝑀]; free variables of 𝑀 may be captured by abstractions of 𝐶, which is the point of recording Δ in the hole. If Γ⊢𝐶Δ⊢𝜏:𝜎 and Δ⊢𝑀:𝜏 then Γ⊢𝐶[𝑀]:𝜎, by induction on the derivation of the context judgment.
Only the probability of the single result ――0 is compared. This is no restriction, because the family of tests below moves any other result into that position.
Proof. Induction on 𝑘. For 𝑘=0: the term 𝗉𝗋𝗈𝖻0𝑀 contracts in one deterministic step to 𝗂𝖿(𝑀,――0,𝑧⋅Ω𝜄), and by Ctx-If every reduction of 𝑀 is copied inside the conditional with the same label. A path from 𝗉𝗋𝗈𝖻0𝑀 to ――0 therefore consists of that first step, a path of 𝑀 to some numeral ――𝑛, and then the contraction of 𝗂𝖿(――𝑛,――0,𝑧⋅Ω𝜄). The last contraction reaches ――0 when 𝑛=0 and reaches Ω𝜄[――――𝑛−1/𝑧]=Ω𝜄 when 𝑛>0; no path from Ω𝜄 reaches a weak-normal term by exercise 171.2. Summing weights by lemma 171.9 leaves exactly the paths of 𝑀 to ――0.
For 𝑘+1: the same analysis leaves the paths of 𝑀 to numerals ――――𝑛+1, each continued by 𝗉𝗋𝗈𝖻𝑘――𝑛, and the induction hypothesis gives Red(𝜄)∞𝗉𝗋𝗈𝖻𝑘――𝑛,――0=Red(𝜄)∞――𝑛,――𝑘, which is 1 when 𝑛=𝑘 and 0 otherwise. Hence the total weight is Red(𝜄)∞𝑀,―――𝑘+1. ◻
Let 𝑀=𝖼𝗈𝗂𝗇(1/2),𝑁=𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅――1). Both are closed of type 𝜄. Their result distributions coincide: Red(𝜄)∞𝑀,――0=12,Red(𝜄)∞𝑀,――1=12,Red(𝜄)∞𝑁,――0𝐶𝑜𝑖𝑛−0,𝐷𝑒𝑡=12,Red(𝜄)∞𝑁,――1𝐶𝑜𝑖𝑛−1,𝐷𝑒𝑡=12, the second line because 𝑁⟶1/2𝗂𝖿(――0,――0,𝑧⋅――1)⇝0――0 and 𝑁⟶1/2𝗂𝖿(――1,――0,𝑧⋅――1)⇝0――1[――0/𝑧]=――1. With the two contexts 𝐶0=𝗉𝗋𝗈𝖻0[] and 𝐶1=𝗉𝗋𝗈𝖻1[], lemma 171.15 turns those four numbers into the four observations Red(𝜄)∞𝐶0[𝑀],――0=Red(𝜄)∞𝐶1[𝑀],――0=Red(𝜄)∞𝐶0[𝑁],――0=Red(𝜄)∞𝐶1[𝑁],――0=12. These two contexts do not separate 𝑀 and 𝑁. They cannot: the quantification in definition 171.13 is over all contexts, and no finite table of contexts decides it. Deciding it is the work of the model.
★★☆ Prove that ⋅≈⋅ is an equivalence relation and that it is preserved by every term former: if 𝑀≈𝑀′ then 𝐷[𝑀]≈𝐷[𝑀′] for every observation context 𝐷 of the appropriate typing. (Compose contexts; two lines.)
The equivalence of definition 171.13 quantifies over infinitely many contexts, so it cannot be decided by running programs. A model is wanted whose elements are the numbers the contexts measure. For the ground type the answer is forced: an element must be a subprobability distribution on ℕ. The question is what an element of a function type is, and the requirement that settles it is that a program of type 𝜄⟶𝜄 transforms subprobability distributions into subprobability distributions by a rule that is stable under composition and under limits of increasing chains.
Proof. The first two claims are immediate from the definition. For the third, apply the second to X⟂ to get X⟂⊆X⟂⟂⟂, and apply the first to X⊆X⟂⟂ to get X⟂⟂⟂⊆X⟂. ◻
Clause (i) is a closure condition; clauses (ii) and (iii) say that no web point is unusable and that no coordinate is unbounded. Both are used below: (iii) bounds the coefficients of the power series to come, and (ii), sharpened in lemma 171.25, provides the arguments at which those series are compared.
Let 𝑋 be a probabilistic coherence space. If 𝑢≤𝑣 coordinatewise and 𝑣∈𝑃𝑋, then 𝑢∈𝑃𝑋; in particular 0∈𝑃𝑋. If 𝑢(0)≤𝑢(1)≤⋯ all lie in 𝑃𝑋, then their coordinatewise supremum lies in 𝑃𝑋.
Proof of Lemma 171.20 — Downward closure and increasing limits
Proof. For 𝑢′∈𝑃𝑋⟂ we have ⟨𝑢,𝑢′⟩≤⟨𝑣,𝑢′⟩≤1, so 𝑢∈𝑃𝑋⟂⟂=𝑃𝑋. Taking 𝑣∈𝑃𝑋 — one exists by (ii) — and 𝑢=0 gives 0∈𝑃𝑋. For the supremum 𝑤=sup𝑘𝑢(𝑘) and 𝑢′∈𝑃𝑋⟂, ⟨𝑤,𝑢′⟩=∑𝑎(sup𝑘𝑢(𝑘)𝑎)𝑢′𝑎𝑚𝑜𝑛𝑜𝑡𝑜𝑛𝑒𝑐𝑜𝑛𝑣𝑒𝑟𝑔𝑒𝑛𝑐𝑒=sup𝑘⟨𝑢(𝑘),𝑢′⟩≤1, so 𝑤∈𝑃𝑋⟂⟂=𝑃𝑋. ◻
Let 𝑁=(ℕ,𝑃𝑁) with 𝑃𝑁={𝑢∈(ℝ+)ℕ∣∑𝑛𝑢𝑛≤1}, the set of subprobability distributions on ℕ. Then 𝑃𝑁⟂=[0,1]ℕ: if 𝑢′𝑛≤1 for all 𝑛 then ⟨𝑢,𝑢′⟩≤∑𝑛𝑢𝑛≤1 for 𝑢∈𝑃𝑁; conversely 𝑒𝑛∈𝑃𝑁, where (𝑒𝑛)𝑚=1 when 𝑚=𝑛 and 0 otherwise, and ⟨𝑒𝑛,𝑢′⟩=𝑢′𝑛≤1. Applying ⟂ again, 𝑃𝑁⟂⟂={𝑢∣∀𝑢′∈[0,1]ℕ∑𝑛𝑢𝑛𝑢′𝑛≤1}=𝑃𝑁, the second equality because taking 𝑢′ with 𝑢′𝑛=1 for 𝑛≤𝑘 and 0 beyond gives ∑𝑛≤𝑘𝑢𝑛≤1 for every 𝑘. Clause (ii) holds with 𝑢=𝑒𝑎 and clause (iii) with 𝐴𝑎=1. So 𝑁 is a probabilistic coherence space, and its elements are exactly the result distributions permitted by definition 171.8.
A morphism must send 𝑃𝑋 to 𝑃𝑌, preserve increasing limits, and compose. Power series with nonnegative coefficients do all three, and the exponents are recorded by finite multisets.
A finite multiset over a set 𝐼 is a function 𝜇:𝐼→ℕ with finite support supp(𝜇)={𝑎∣𝜇(𝑎)>0}; write Mfin(𝐼) for the set of these and #𝜇=∑𝑎𝜇(𝑎) for the cardinality. For 𝑢∈(ℝ+)𝐼 put 𝑢𝜇=∏𝑎∈supp(𝜇)𝑢𝜇(𝑎)𝑎, with 𝑢𝜇=1 when 𝜇 is empty.
Let 𝑋,𝑌 be probabilistic coherence spaces. For 𝑡∈(ℝ+)Mfin(|𝑋|)×|𝑌| define ˆ𝑡(𝑢)𝑏=∑𝜇∈Mfin(|𝑋|)𝑡𝜇,𝑏𝑢𝜇(𝑢∈(ℝ+)|𝑋|,𝑏∈|𝑌|), a sum of nonnegative terms, hence a well-defined element of (ℝ+∪{∞})|𝑌|. Set 𝑋⟶𝑌=(Mfin(|𝑋|)×|𝑌|,𝑃(𝑋⟶𝑌)),𝑃(𝑋⟶𝑌)={𝑡∣∀𝑢∈𝑃𝑋ˆ𝑡(𝑢)∈𝑃𝑌}.
Let 𝑋 and 𝑌 be probabilistic coherence spaces such that, for every finite 𝐹⊆|𝑋| and every finite 𝐹′⊆|𝑌|, there are 𝜀>0 and 𝜀′>0 with 𝜀1𝐹∈𝑃𝑋 and 𝜀′1𝐹′∈𝑃𝑌, where 1𝐹 is the indicator vector of 𝐹. Then 𝑋⟶𝑌 is a probabilistic coherence space, and it satisfies the same finite-support condition: for every finite 𝐺⊆Mfin(|𝑋|)×|𝑌| there is 𝜂>0 with 𝜂1𝐺∈𝑃(𝑋⟶𝑌).
Proof of Proposition 171.24 — The arrow is a probabilistic coherence space
Proof.Closure. For 𝑢∈(ℝ+)|𝑋| and 𝑣′∈(ℝ+)|𝑌| let 𝑢⊗𝑣′ be the vector on the web of 𝑋⟶𝑌 with (𝑢⊗𝑣′)(𝜇,𝑏)=𝑢𝜇𝑣′𝑏. Then ⟨𝑡,𝑢⊗𝑣′⟩=∑𝜇,𝑏𝑡𝜇,𝑏𝑢𝜇𝑣′𝑏=∑𝑏(∑𝜇𝑡𝜇,𝑏𝑢𝜇)𝑣′𝑏=⟨ˆ𝑡(𝑢),𝑣′⟩, the middle step by rearranging a double sum of nonnegative terms. Hence ˆ𝑡(𝑢)∈𝑃𝑌=𝑃𝑌⟂⟂ for all 𝑢∈𝑃𝑋 if and only if ⟨𝑡,𝑢⊗𝑣′⟩≤1 for all 𝑢∈𝑃𝑋 and 𝑣′∈𝑃𝑌⟂, that is, if and only if 𝑡∈Z⟂ for Z={𝑢⊗𝑣′∣𝑢∈𝑃𝑋,𝑣′∈𝑃𝑌⟂}. So 𝑃(𝑋⟶𝑌)=Z⟂, which is biorthogonally closed by lemma 171.18.
Clause (ii). Fix (𝜇,𝑏). By clause (iii) for 𝑋, put 𝐶𝜇=∏𝑎∈supp(𝜇)𝐴𝜇(𝑎)𝑎>0, so that 𝑢𝜇≤𝐶𝜇 for every 𝑢∈𝑃𝑋. By hypothesis choose 𝜀′>0 with 𝜀′𝑒𝑏∈𝑃𝑌, and set 𝑡=(𝜀′/𝐶𝜇)𝑒(𝜇,𝑏). Then ˆ𝑡(𝑢)=(𝜀′/𝐶𝜇)𝑢𝜇𝑒𝑏≤𝜀′𝑒𝑏, which lies in 𝑃𝑌 by lemma 171.20; and 𝑡𝜇,𝑏>0.
Clause (iii). Fix (𝜇,𝑏) and let 𝐹=supp(𝜇). By hypothesis choose 𝛿>0 with 𝑢∗=𝛿1𝐹∈𝑃𝑋. For any 𝑡∈𝑃(𝑋⟶𝑌), dropping all summands but one, ˆ𝑡(𝑢∗)𝑏≥𝑡𝜇,𝑏(𝑢∗)𝜇=𝑡𝜇,𝑏𝛿#𝜇, while ˆ𝑡(𝑢∗)𝑏≤𝐴𝑏 by clause (iii) for 𝑌. Hence 𝑡𝜇,𝑏≤𝐴𝑏𝛿−#𝜇, a bound depending only on (𝜇,𝑏).
Finite supports. Let 𝐺 be finite, let 𝐺2={𝑏∣∃𝜇(𝜇,𝑏)∈𝐺}, and let 𝐶=max{𝐶𝜇∣(𝜇,𝑏)∈𝐺} with 𝐶𝜇 as above. Choose 𝜀′>0 with 𝜀′1𝐺2∈𝑃𝑌 and put 𝜂=𝜀′/(|𝐺|𝐶). For 𝑢∈𝑃𝑋, ̂𝜂1𝐺(𝑢)𝑏=𝜂∑𝜇:(𝜇,𝑏)∈𝐺𝑢𝜇≤𝜂|𝐺|𝐶=𝜀′ for 𝑏∈𝐺2 and 0 otherwise, so ̂𝜂1𝐺(𝑢)≤𝜀′1𝐺2∈𝑃𝑌, and lemma 171.20 finishes. ◻
Define [[𝜄]]=𝑁 and [[𝜎⟶𝜏]]=[[𝜎]]⟶[[𝜏]]. Then for every type 𝜎, the pair [[𝜎]] is a probabilistic coherence space, and for every finite 𝐹⊆|[[𝜎]]| there is 𝜀>0 with 𝜀1𝐹∈𝑃[[𝜎]].
Proof of Lemma 171.25 — The invariants of the interpreted types
Proof. Induction on 𝜎. For 𝜄, example 171.21 gives the space, and 𝜀=1/|𝐹| makes 𝜀1𝐹 a subprobability distribution. For 𝜎⟶𝜏 the induction hypothesis supplies both components of the hypothesis of proposition 171.24, whose conclusion is exactly the claim. ◻
The next theorem is the reason the model can decide an equivalence. It says that a morphism is recoverable from the function it induces, so that two programs with different matrices differ at some argument — and, as the proof shows, at an argument with rational coordinates and finite support, which is the kind of argument a pPCF program can produce.
Let 𝐼 be a finite set, 𝐴>0, and let (𝑐𝜈)𝜈∈Mfin(𝐼) and (𝑐′𝜈)𝜈 be families of nonnegative reals such that 𝑓(𝑥)=∑𝜈𝑐𝜈𝑥𝜈 and 𝑓′(𝑥)=∑𝜈𝑐′𝜈𝑥𝜈 are finite for all 𝑥∈[0,𝐴]𝐼. If 𝑓=𝑓′ on [0,𝐴]𝐼 then 𝑐𝜈=𝑐′𝜈 for every 𝜈.
Proof. Induction on |𝐼|. If 𝐼=∅ both sums have the single term 𝑐∅=𝑓=𝑓′=𝑐′∅.
Let |𝐼|=𝑘+1 and fix 𝑎∈𝐼, writing 𝐼′=𝐼∖{𝑎} and 𝑥=(𝑥𝑎,𝑥′). Grouping the terms by the exponent of 𝑥𝑎, 𝑓(𝑥𝑎,𝑥′)=∞∑𝑚=0𝑔𝑚(𝑥′)𝑥𝑚𝑎,𝑔𝑚(𝑥′)=∑𝜈′:𝜈′∈Mfin(𝐼′)𝑐𝜈′+𝑚⋅𝑎(𝑥′)𝜈′, where 𝜈′+𝑚⋅𝑎 is the multiset 𝜈′ extended by 𝑚 copies of 𝑎; the rearrangement is legitimate because all terms are nonnegative and the total sum is finite. Fix 𝑥′∈[0,𝐴]𝐼′. Then 𝑥𝑎↦𝑓(𝑥𝑎,𝑥′) is a power series in one variable with nonnegative coefficients 𝑔𝑚(𝑥′), convergent on [0,𝐴]; inside its interval of convergence it may be differentiated term by term, so 𝑔𝑚(𝑥′)=1𝑚!𝜕𝑚𝑥𝑎𝑓(0,𝑥′). The same computation applies to 𝑓′, and 𝑓=𝑓′ gives 𝑔𝑚(𝑥′)=𝑔′𝑚(𝑥′) for every 𝑚 and every 𝑥′∈[0,𝐴]𝐼′. Each pair 𝑔𝑚,𝑔′𝑚 satisfies the hypotheses of the lemma on 𝐼′, so the induction hypothesis gives 𝑐𝜈′+𝑚⋅𝑎=𝑐′𝜈′+𝑚⋅𝑎 for all 𝜈′ and 𝑚. Every 𝜈∈Mfin(𝐼) has this form. ◻
Let 𝑋,𝑌 satisfy the hypotheses of proposition 171.24 and let 𝑡,𝑡′∈𝑃(𝑋⟶𝑌). Then 𝑡=𝑡′ as matrices if and only if ˆ𝑡=ˆ𝑡′ as functions 𝑃𝑋→𝑃𝑌. Moreover, if 𝑡≠𝑡′ then already ˆ𝑡(𝑢)≠ˆ𝑡′(𝑢) for some 𝑢∈𝑃𝑋 with finite support and rational coordinates.
Proof. One direction is trivial. For the other, suppose 𝑡𝜇,𝑏≠𝑡′𝜇,𝑏 for some (𝜇,𝑏), and let 𝐼=supp(𝜇), a finite set. By proposition 171.24 there is 𝛿>0 with 𝛿1𝐼∈𝑃𝑋, and by lemma 171.20 every 𝑢 supported in 𝐼 with coordinates at most 𝛿 lies in 𝑃𝑋. Consider 𝑓(𝑥)=ˆ𝑡(𝑥)𝑏=∑𝜈∈Mfin(𝐼)𝑡𝜈,𝑏𝑥𝜈,𝑓′(𝑥)=ˆ𝑡′(𝑥)𝑏,𝑥∈[0,𝛿]𝐼, where a vector 𝑥 on 𝐼 is read as the element of (ℝ+)|𝑋| that vanishes outside 𝐼; only multisets over 𝐼 contribute, since 𝑥𝜈=0 as soon as 𝜈 charges a point outside 𝐼. Both are finite on [0,𝛿]𝐼, being coordinates of elements of 𝑃𝑌, which are bounded by clause (iii). Their coefficients differ at 𝜇, so lemma 171.26 gives a point of [0,𝛿]𝐼 at which 𝑓≠𝑓′. Both are continuous on that closed box: with 𝑀𝜈=𝑡𝜈,𝑏𝛿#𝜈 one has |𝑡𝜈,𝑏𝑥𝜈|≤𝑀𝜈 for every 𝑥∈[0,𝛿]𝐼, and ∑𝜈𝑀𝜈=𝑓(𝛿,…,𝛿)<∞, so the series converges uniformly on the box and its partial sums are polynomials. Hence the set where 𝑓 and 𝑓′ differ is a nonempty relatively open subset of [0,𝛿]𝐼 and therefore contains a point with rational coordinates. That point is supported in the finite set 𝐼. ◻
Definition 171.19, Definition 171.23 are Ehrhard–Pagani–Tasson’s probabilistic coherence spaces and the function form of the Kleisli morphisms of the exponential comonad; their 𝑋⇒𝑌=!𝑋⊸𝑌 has the web and the elements printed above, and their Theorem 11 states the bijection between matrices and their function forms which theorem 171.27 proves here for the interpreted types. The following facts about that model are imported and used with no further appeal to linear logic: for each type 𝜎 the space [[𝜎]] of lemma 171.25 is their interpretation of 𝜎; for each typing derivation of Γ⊢𝑀:𝜎 there is a matrix [[𝑀]]Γ∈𝑃([[Γ]]⟶[[𝜎]]), where [[Γ]] is the space of tuples (𝑢1,…,𝑢𝑘) with 𝑢𝑖∈𝑃[[𝜎𝑖]], whose function form obeys the clauses of definition 171.29; and their Theorem 11 identifies equality of matrices with equality of function forms. Everything proved after definition 171.29 uses only those clauses, the invariants of lemma 171.25, and theorem 171.27.
For Γ⊢𝑀:𝜎 with Γ=(𝑥1:𝜎1,…,𝑥𝑘:𝜎𝑘), the function form of [[𝑀]]Γ is written [[𝑀]]Γ(⃗𝑢)∈𝑃[[𝜎]] for ⃗𝑢=(𝑢1,…,𝑢𝑘) with 𝑢𝑖∈𝑃[[𝜎𝑖]], and satisfies [[𝑥𝑖]]Γ(⃗𝑢)=𝑢𝑖,[[――𝑛]]Γ(⃗𝑢)=𝑒𝑛,[[𝖼𝗈𝗂𝗇(𝑝)]]Γ(⃗𝑢)=𝑝𝑒0+(1−𝑝)𝑒1,[[𝗌𝗎𝖼𝖼(𝑃)]]Γ(⃗𝑢)=∑𝑛∈ℕ[[𝑃]]Γ(⃗𝑢)𝑛𝑒𝑛+1,[[𝑃𝑄]]Γ(⃗𝑢)=̂[[𝑃]]Γ(⃗𝑢)([[𝑄]]Γ(⃗𝑢)),̂[[𝜆𝑥𝜎.𝑃]]Γ(⃗𝑢)(𝑣)=[[𝑃]]Γ,𝑥:𝜎(⃗𝑢,𝑣),[[𝗂𝖿(𝑃,𝑄,𝑧⋅𝑅)]]Γ(⃗𝑢)=[[𝑃]]Γ(⃗𝑢)0[[𝑄]]Γ(⃗𝑢)+∑𝑛∈ℕ[[𝑃]]Γ(⃗𝑢)𝑛+1[[𝑅]]Γ,𝑧:𝜄(⃗𝑢,𝑒𝑛),[[𝖿𝗂𝗑(𝑃)]]Γ(⃗𝑢)=sup𝑚∈ℕ𝑓𝑚(0),𝑓(𝑣)=̂[[𝑃]]Γ(⃗𝑢)(𝑣). In the clause for 𝖿𝗂𝗑 the sequence 𝑚↦𝑓𝑚(0) is nondecreasing because 𝑓 is monotone — its coefficients are nonnegative — and 0≤𝑓(0); its supremum lies in 𝑃[[𝜎]] by lemma 171.20.
Continue example 171.5. Write 𝑃=𝜆𝑔𝜄.𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅𝗌𝗎𝖼𝖼(𝑔)), so that 𝐺=𝖿𝗂𝗑(𝑃). For 𝑣∈𝑃𝑁 the clauses give 𝑓(𝑣)=̂[[𝑃]](𝑣)𝜆=[[𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅𝗌𝗎𝖼𝖼(𝑔))]]𝑔:𝜄(𝑣)𝗂𝖿,𝖼𝗈𝗂𝗇=12𝑒0+12∑𝑛𝑣𝑛𝑒𝑛+1, because [[𝖼𝗈𝗂𝗇(1/2)]]0=[[𝖼𝗈𝗂𝗇(1/2)]]1=1/2 and all further coefficients vanish, and because the branch 𝗌𝗎𝖼𝖼(𝑔) is interpreted at the single argument 𝑒0 supplied by the summand 𝑛=0. Iterating from 0, 𝑓1(0)=12𝑒0,𝑓2(0)=12𝑒0+14𝑒1,…,𝑓𝑚(0)=∑𝑛<𝑚2−(𝑛+1)𝑒𝑛, so [[𝐺]]=sup𝑚𝑓𝑚(0) has [[𝐺]]𝑛=2−(𝑛+1). This is the distribution computed operationally in example 171.10. The agreement is not an accident of this program; it is the adequacy theorem of section 171.5.
★★☆ Let 𝑔:[0,1]→[0,1] be 𝑔(𝑢)=0 for 𝑢≤1/2 and 𝑔(𝑢)=2𝑢−1 for 𝑢>1/2. Show that 𝑔 is monotone and preserves suprema of increasing sequences, and that there is no 𝑡∈𝑃(𝑁⟶𝑁) with ˆ𝑡(𝑢)0=𝑔(𝑢0) and ˆ𝑡(𝑢)𝑛=0 for 𝑛>0. (Use lemma 171.26 at the point 1/2.) Conclude that the model is not the model of all monotone continuous maps.
Example 171.30 computed the same distribution twice, once by summing path weights and once by iterating a power series. The two computations must agree for every closed term of ground type. One inequality follows from a single invariance equation; the other needs a logical relation, because a term of higher type has no result distribution of its own.
Proof. Induction on 𝑀. Variable case. For 𝑀=𝑥 both sides are [[𝑃]]Γ(⃗𝑢) by the variable clause; for 𝑀=𝑥𝑖 with 𝑥𝑖≠𝑥 both sides are 𝑢𝑖. Application case.[[(𝑀1𝑀2)[𝑃/𝑥]]]Γ(⃗𝑢)𝑠𝑢𝑏𝑠𝑡𝑖𝑡𝑢𝑡𝑖𝑜𝑛=[[𝑀1[𝑃/𝑥]𝑀2[𝑃/𝑥]]]Γ(⃗𝑢)𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛171.29=̂[[𝑀1[𝑃/𝑥]]]Γ(⃗𝑢)([[𝑀2[𝑃/𝑥]]]Γ(⃗𝑢))𝐼𝐻𝑡𝑤𝑖𝑐𝑒=̂[[𝑀1]]Γ,𝑥:𝜎(⃗𝑢,𝑤)([[𝑀2]]Γ,𝑥:𝜎(⃗𝑢,𝑤))𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛171.29=[[𝑀1𝑀2]]Γ,𝑥:𝜎(⃗𝑢,𝑤), writing 𝑤=[[𝑃]]Γ(⃗𝑢). Binder case. For 𝑀=𝜆𝑦𝜌.𝑀1 with 𝑦 chosen outside FV(𝑃)∪{𝑥}∪dom(Γ), the abstraction clause evaluates both sides at an arbitrary 𝑣∈𝑃[[𝜌]] and the induction hypothesis for 𝑀1 in the context Γ,𝑦:𝜌 applies; the two function forms agree at every 𝑣, hence the two matrices agree by theorem 171.27. The remaining formers — numerals, coins, 𝗌𝗎𝖼𝖼, 𝗂𝖿, 𝖿𝗂𝗑 — are treated as the application case: each clause is built from the interpretations of the immediate subterms by an operation not depending on the substituted term, so the induction hypothesis may be applied to each subterm in turn. In the 𝗂𝖿 case the third subterm is interpreted in the context extended by 𝑧:𝜄, and the argument supplied for 𝑧 is 𝑒𝑛, which does not involve 𝑃. ◻
Proof of Theorem 171.32 — Invariance under one step
Proof. Induction on 𝑀. If 𝑀 is weak-normal the right-hand side is 1⋅[[𝑀]]Γ. There remain the terms with a leftmost outermost redex.
Coin.𝖼𝗈𝗂𝗇(𝑝)⟶𝑝――0 and 𝖼𝗈𝗂𝗇(𝑝)⟶1−𝑝――1, so the right-hand side is 𝑝𝑒0+(1−𝑝)𝑒1, which is [[𝖼𝗈𝗂𝗇(𝑝)]]Γ by definition 171.29.
Beta.(𝜆𝑥𝜎.𝑃)𝑁 has the unique successor 𝑃[𝑁/𝑥] with label 1, and [[(𝜆𝑥𝜎.𝑃)𝑁]]Γ(⃗𝑢)𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛171.29=̂[[𝜆𝑥𝜎.𝑃]]Γ(⃗𝑢)([[𝑁]]Γ(⃗𝑢))𝜆𝑐𝑙𝑎𝑢𝑠𝑒=[[𝑃]]Γ,𝑥:𝜎(⃗𝑢,[[𝑁]]Γ(⃗𝑢))𝑙𝑒𝑚𝑚𝑎171.31=[[𝑃[𝑁/𝑥]]]Γ(⃗𝑢).
Fixed point.𝖿𝗂𝗑(𝑃) has the unique successor 𝑃𝖿𝗂𝗑(𝑃) with label 1. With 𝑓=̂[[𝑃]]Γ(⃗𝑢), [[𝑃𝖿𝗂𝗑(𝑃)]]Γ(⃗𝑢)𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛171.29=𝑓(sup𝑚𝑓𝑚(0))𝑚𝑜𝑛𝑜𝑡𝑜𝑛𝑒𝑐𝑜𝑛𝑣𝑒𝑟𝑔𝑒𝑛𝑐𝑒=sup𝑚𝑓𝑚+1(0)𝑓0(0)=0=sup𝑚𝑓𝑚(0)𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛171.29=[[𝖿𝗂𝗑(𝑃)]]Γ(⃗𝑢), where the second step holds because each coefficient of 𝑓(𝑣) is a sum of nonnegative monomials in the coordinates of 𝑣, and such a sum commutes with the supremum of a nondecreasing sequence.
Successor at a numeral, conditional at a numeral.𝗌𝗎𝖼𝖼(――𝑛) has successor ――――𝑛+1, and [[𝗌𝗎𝖼𝖼(――𝑛)]]Γ=𝑒𝑛+1 by the 𝗌𝗎𝖼𝖼 clause applied to 𝑒𝑛. For 𝗂𝖿(――0,𝑃,𝑧⋅𝑅) the successor is 𝑃, and the 𝗂𝖿 clause at [[――0]]=𝑒0 leaves the single summand [[𝑃]]Γ. For 𝗂𝖿(――――𝑛+1,𝑃,𝑧⋅𝑅) the successor is 𝑅[――𝑛/𝑧], and the same clause at 𝑒𝑛+1 leaves [[𝑅]]Γ,𝑧:𝜄(⃗𝑢,𝑒𝑛), which is [[𝑅[――𝑛/𝑧]]]Γ(⃗𝑢) by lemma 171.31.
Context cases. Let 𝑀 be one of 𝑀1𝑁, 𝗌𝗎𝖼𝖼(𝑀1), 𝗂𝖿(𝑀1,𝑃,𝑧⋅𝑅) with 𝑀1 not weak-normal. Then 𝑀 is not weak-normal, its successors are obtained from those of 𝑀1 by the same construction, and the labels are unchanged, so Red𝑀,𝑀′=Red(Γ,𝜄)𝑀1,𝑀′1 for the matching successor 𝑀′. In each of the three clauses the interpretation of 𝑀 is obtained from the matrix[[𝑀1]]Γ by an operation that is linear in it: for the successor and the conditional this is visible in the displayed formulas, and for the application it is the identity ̂(∑𝑖𝜆𝑖𝑡𝑖)(𝑣)=∑𝑖𝜆𝑖ˆ𝑡𝑖(𝑣), which holds because ˆ𝑡(𝑣)𝑏=∑𝜇𝑡𝜇,𝑏𝑣𝜇 is linear in 𝑡. Applying that linear operation to the induction hypothesis for 𝑀1 gives the claim for 𝑀. ◻
Proof of Theorem 171.33 — The model dominates the operational semantics
Proof. Iterating theorem 171.32𝑘 times gives [[𝑀]]=∑𝑀′Red(𝜄)𝑘𝑀,𝑀′[[𝑀′]]. All summands are nonnegative, so keeping only 𝑀′=――𝑛 and reading the coordinate 𝑛, for which [[――𝑛]]𝑛=1, gives [[𝑀]]𝑛≥Red(𝜄)𝑘𝑀,――𝑛. Take the supremum over 𝑘; by definition 171.8 it is Red(𝜄)∞𝑀,――𝑛. ◻
The converse inequality cannot be proved by the same route: iterating an equation produces upper bounds on operational quantities, not lower bounds, and a term of type 𝜎⟶𝜏 has no operational quantity at all until it is applied. The standard repair is a relation, defined by induction on types, that says at ground type “the model underestimates the operational probabilities” and at higher type “the term maps related arguments to related results”.
Proof. Induction on 𝜎. At 𝜄 the first claim is 0≤Red(𝜄)∞𝑀,――𝑛 and the second is the statement that a supremum of numbers each bounded by Red(𝜄)∞𝑀,――𝑛 is bounded by it. At 𝜎⟶𝜏: for the first claim, ˆ0(𝑢)=0 and the induction hypothesis at 𝜏 gives 𝑀𝑃𝑅𝜏0. For the second, let 𝑃𝑅𝜎𝑢; then ̂sup𝑖𝑡(𝑖)(𝑢)=sup𝑖̂𝑡(𝑖)(𝑢), because each coefficient is a sum of nonnegative terms and commutes with the supremum of a nondecreasing sequence, and the induction hypothesis at 𝜏 applies to the sequence ̂𝑡(𝑖)(𝑢). ◻
Let ⋅⊢𝑀:𝜄, ⋅⊢𝑃:𝜎 and 𝑧:𝜄⊢𝑄:𝜎 with 𝜎=𝜎1⟶⋯⟶𝜎ℎ⟶𝜄, and let ⋅⊢𝑁𝑗:𝜎𝑗 for 𝑗=1,…,ℎ. Then for every 𝑛∈ℕ, Red(𝜄)∞𝗂𝖿(𝑀,𝑃,𝑧⋅𝑄)𝑁1⋯𝑁ℎ,――𝑛=Red(𝜄)∞𝑀,――0Red(𝜄)∞𝑃𝑁1⋯𝑁ℎ,――𝑛+∑𝑘∈ℕRed(𝜄)∞𝑀,―――𝑘+1Red(𝜄)∞𝑄[――𝑘/𝑧]𝑁1⋯𝑁ℎ,――𝑛.
Proof of Lemma 171.36 — Convergence through a conditional
Proof. Write 𝐸[⋅] for the evaluation context [⋅]𝑁1⋯𝑁ℎ. By Ctx-App and Ctx-If, every step of 𝐸[𝗂𝖿(𝑀,𝑃,𝑧⋅𝑄)] is either a step of 𝑀 copied with the same label, or — once 𝑀 has become a numeral — the contraction of the conditional. A path from 𝐸[𝗂𝖿(𝑀,𝑃,𝑧⋅𝑄)] to ――𝑛 therefore factors uniquely as a path of 𝑀 to some numeral ――𝑚, the contraction of the conditional, and a path from 𝐸[𝑃] (if 𝑚=0) or from 𝐸[𝑄[――――𝑚−1/𝑧]] (if 𝑚>0) to ――𝑛. The weight of the composite path is the product of the weights of the factors, so summing over all paths by lemma 171.9 and grouping by 𝑚 gives the displayed equation. ◻
Proof. Induction on 𝜎. Ground case. Let 𝜎=𝜄 and 𝑛∈ℕ. Because ――𝑛 is weak-normal, Red(𝜄)∞𝑀,――𝑛=∑𝑀″Red(𝜄)𝑀,𝑀″Red(𝜄)∞𝑀″,――𝑛, all terms being nonnegative; keeping the summand 𝑀″=𝑀′ and using 𝑢𝑛≤Red(𝜄)∞𝑀′,――𝑛 gives Red(𝜄)𝑀,𝑀′𝑢𝑛≤Red(𝜄)∞𝑀,――𝑛, which is the claim.
Arrow case. Let 𝜎=𝜏⟶𝜑. If 𝑀 is weak-normal, then either 𝑀′=𝑀 and Red(𝜎)𝑀,𝑀′=1, so the hypothesis is the conclusion; or 𝑀′≠𝑀 and Red(𝜎)𝑀,𝑀′=0, so the conclusion is 𝑀𝑅𝜎0, which is lemma 171.35. Assume 𝑀 is not weak-normal and let 𝑃𝑅𝜏𝑣. Since the leftmost outermost redex of 𝑀𝑃 is that of 𝑀, the rule Ctx-App gives Red(𝜑)𝑀𝑃,𝑀′𝑃=Red(𝜎)𝑀,𝑀′. By hypothesis 𝑀′𝑃𝑅𝜑ˆ𝑢(𝑣), so the induction hypothesis at 𝜑 gives 𝑀𝑃𝑅𝜑Red(𝜎)𝑀,𝑀′ˆ𝑢(𝑣), and Red(𝜎)𝑀,𝑀′ˆ𝑢(𝑣)=̂(Red(𝜎)𝑀,𝑀′𝑢)(𝑣) by linearity of 𝑡↦ˆ𝑡(𝑣). ◻
Proof. Induction on the typing derivation. Write 𝜃 for the substitution [𝑃1/𝑥1,…,𝑃𝑙/𝑥𝑙] and assume 𝑃𝑖𝑅𝜎𝑖𝑢𝑖 throughout.
Variables and numerals.𝑥𝑖𝜃=𝑃𝑖 and [[𝑥𝑖]]Γ(⃗𝑢)=𝑢𝑖. For ――𝑛, [[――𝑛]]Γ(⃗𝑢)=𝑒𝑛 and Red(𝜄)∞――𝑛,――𝑛=1.
Coin.𝖼𝗈𝗂𝗇(𝑝)𝜃=𝖼𝗈𝗂𝗇(𝑝) and its result distribution is 𝑝 at ――0, 1−𝑝 at ――1, and 0 elsewhere, which is exactly [[𝖼𝗈𝗂𝗇(𝑝)]]Γ(⃗𝑢).
Successor. By the induction hypothesis [[𝑃]]Γ(⃗𝑢)𝑛≤Red(𝜄)∞𝑃𝜃,――𝑛 for all 𝑛. Every path of 𝑃𝜃 to ――𝑛 yields, under Ctx-Succ followed by the contraction 𝗌𝗎𝖼𝖼(――𝑛)⇝0――――𝑛+1, a path of 𝗌𝗎𝖼𝖼(𝑃𝜃) to ――――𝑛+1 of the same weight, so [[𝗌𝗎𝖼𝖼(𝑃)]]Γ(⃗𝑢)𝑛+1≤Red(𝜄)∞𝗌𝗎𝖼𝖼(𝑃𝜃),―――𝑛+1; at index 0 the left-hand side is 0.
Conditional. Let 𝑀=𝗂𝖿(𝑃,𝑄,𝑧⋅𝑅) at type 𝜎=𝜎′1⟶⋯⟶𝜎′ℎ⟶𝜄. The induction hypothesis gives [[𝑃]]Γ(⃗𝑢)𝑚≤Red(𝜄)∞𝑃𝜃,――𝑚(𝑚∈ℕ),𝑄𝜃𝑅𝜎[[𝑄]]Γ(⃗𝑢),𝑅𝜃[――𝑘/𝑧]𝑅𝜎[[𝑅]]Γ,𝑧:𝜄(⃗𝑢,𝑒𝑘), the third by applying the induction hypothesis in the context Γ,𝑧:𝜄 with the pair ――𝑘𝑅𝜄𝑒𝑘. Let 𝑁𝑗𝑅𝜎′𝑗𝑣𝑗 for 𝑗≤ℎ and let 𝑛∈ℕ. Lemma 171.36 expands Red(𝜄)∞𝑀𝜃𝑁1⋯𝑁ℎ,――𝑛 into the two groups of summands displayed there; bounding each factor from below by the corresponding denotational quantity, and using the definition of 𝑅𝜎 for 𝑄𝜃 and for each 𝑅𝜃[――𝑘/𝑧], gives Red(𝜄)∞𝑀𝜃𝑁1⋯𝑁ℎ,――𝑛≥([[𝑃]]Γ(⃗𝑢)0[[𝑄]]Γ(⃗𝑢)+∑𝑘[[𝑃]]Γ(⃗𝑢)𝑘+1[[𝑅]]Γ,𝑧:𝜄(⃗𝑢,𝑒𝑘))̂(𝑣1)⋯(𝑣ℎ)𝑛, whose right-hand side is [[𝑀]]Γ(⃗𝑢)̂(𝑣1)⋯(𝑣ℎ)𝑛 by the 𝗂𝖿 clause. This is the definition of 𝑀𝜃𝑅𝜎[[𝑀]]Γ(⃗𝑢).
Application. For 𝑀=𝑃𝑄, the induction hypothesis gives 𝑃𝜃𝑅𝜏⟶𝜎[[𝑃]]Γ(⃗𝑢) and 𝑄𝜃𝑅𝜏[[𝑄]]Γ(⃗𝑢); the definition of 𝑅 at the arrow type applied to this pair gives 𝑃𝜃𝑄𝜃𝑅𝜎̂[[𝑃]]Γ(⃗𝑢)([[𝑄]]Γ(⃗𝑢)), and the right-hand side is [[𝑃𝑄]]Γ(⃗𝑢).
Abstraction. For 𝑀=𝜆𝑥𝜏.𝑃 at type 𝜏⟶𝜑, let 𝑡=[[𝑀]]Γ(⃗𝑢) and let 𝑄𝑅𝜏𝑣. Since (𝜆𝑥𝜏.𝑃𝜃)𝑄⇝0𝑃𝜃[𝑄/𝑥] with label 1, lemma 171.37 reduces the goal (𝜆𝑥𝜏.𝑃𝜃)𝑄𝑅𝜑ˆ𝑡(𝑣) to 𝑃𝜃[𝑄/𝑥]𝑅𝜑ˆ𝑡(𝑣), and ˆ𝑡(𝑣)=[[𝑃]]Γ,𝑥:𝜏(⃗𝑢,𝑣) by the abstraction clause, so the induction hypothesis in the extended context finishes the case.
Fixed point. For 𝑀=𝖿𝗂𝗑(𝑃) let 𝑡=[[𝑃]]Γ(⃗𝑢) and 𝑓=ˆ𝑡. By lemma 171.35 it suffices to prove 𝖿𝗂𝗑(𝑃𝜃)𝑅𝜎𝑓𝑚(0) for every 𝑚, and this is an induction on 𝑚. The case 𝑚=0 is lemma 171.35. Assume 𝖿𝗂𝗑(𝑃𝜃)𝑅𝜎𝑓𝑚(0). Since 𝖿𝗂𝗑(𝑃𝜃)⇝0𝑃𝜃𝖿𝗂𝗑(𝑃𝜃) with label 1, lemma 171.37 reduces the goal at 𝑚+1 to 𝑃𝜃𝖿𝗂𝗑(𝑃𝜃)𝑅𝜎𝑓𝑚+1(0). The outer induction hypothesis gives 𝑃𝜃𝑅𝜎⟶𝜎𝑡, which applied to the pair 𝖿𝗂𝗑(𝑃𝜃)𝑅𝜎𝑓𝑚(0) yields exactly 𝑃𝜃𝖿𝗂𝗑(𝑃𝜃)𝑅𝜎𝑓(𝑓𝑚(0)). ◻
Proof of Lemma 171.40 — Contexts act on denotations
Proof. Induction on the derivation of Γ⊢𝐶Δ⊢𝜏:𝜎. For the hole, 𝐶=[]Δ⊢𝜏 and 𝐶[𝑀]=𝑀 with Γ=Γ′,Δ; take 𝑓𝐶 to be the map that reads [[𝑀]]Δ and returns the interpretation of 𝑀 in the larger context, which the clauses of definition 171.29 obtain by ignoring the extra coordinates. For every other rule, 𝐶 is a term former applied to smaller contexts 𝐶1,…,𝐶𝑟 and possibly to terms not containing the hole; the corresponding clause of definition 171.29 expresses [[𝐶[𝑀]]]Γ as an operation applied to [[𝐶𝑖[𝑀]]]Γ and to interpretations of hole-free subterms, and composing that operation with the functions 𝑓𝐶𝑖 given by the induction hypothesis produces 𝑓𝐶. ◻
Proof of Theorem 171.41 — Denotational equality implies observational equivalence
Proof. Let 𝐶Γ⊢𝜎 be an observation context with ⋅⊢𝐶Γ⊢𝜎:𝜄. Then Red(𝜄)∞𝐶[𝑀],――0𝑡ℎ𝑒𝑜𝑟𝑒𝑚171.39=[[𝐶[𝑀]]]0𝑙𝑒𝑚𝑚𝑎171.40=𝑓𝐶([[𝑀]]Γ)0ℎ𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑠=𝑓𝐶([[𝑀′]]Γ)0𝑙𝑒𝑚𝑚𝑎171.40=[[𝐶[𝑀′]]]0𝑡ℎ𝑒𝑜𝑟𝑒𝑚171.39=Red(𝜄)∞𝐶[𝑀′],――0. ◻
★★☆ Deduce from theorem 171.39 that the probability that a closed 𝑀:𝜄 converges to some numeral equals ∑𝑛[[𝑀]]𝑛, and compute that number for 𝐻 of exercise 171.5.
★★☆ In the context cases of theorem 171.32, the application case used linearity of 𝑡↦ˆ𝑡(𝑣) in the matrix 𝑡. Show by example that the map 𝑡↦ˆ𝑡 is not linear in the argument: exhibit 𝑡∈𝑃(𝑁⟶𝑁) and 𝑢,𝑣∈𝑃𝑁 with ˆ𝑡(12𝑢+12𝑣)≠12ˆ𝑡(𝑢)+12ˆ𝑡(𝑣).
Theorem 171.41 settles one implication. Its converse — if no context separates 𝑀 from 𝑀′, then their denotations are equal — is what makes the model an answer to the original question rather than an approximation to it. Its proof must, from a single web point 𝑎 at which two elements 𝑤,𝑤′∈𝑃[[𝜎]] differ, manufacture a pPCF program that observes the difference.
Two obstructions stand in the way, and the construction is determined by removing them.
First, the coefficient 𝑤𝑎 is not the value of any definable map at any argument. A closed term 𝐹 of type 𝜎⟶𝜄 has ̂[[𝐹]](𝑤)0=∑𝜇𝑡𝜇,0𝑤𝜇, a sum of monomials in the coordinates of 𝑤; no such sum is the single coordinate 𝑤𝑎. The repair is not to read 𝑤𝑎 off but to expose it as a coefficient: build a family of programs, indexed by a supply of randomness 𝑢∈𝑃𝑁, whose observation is a power series in 𝑢 in which the coefficient of one designated monomial is exactly 𝑤𝑎. Lemma 171.26 then converts a difference of coefficients into a difference of values at a rational argument, and ran below turns a rational argument into a program.
Second, the designated monomial must be multilinear, 𝑢0𝑢1⋯𝑢𝑛−1, with each parameter used once. A parameter consumed twice would contribute 𝑢2𝑖 and land in a different coefficient. Since a web point of an arrow type carries several subtests — one for each element of the multiset in its domain component, and one for its codomain component — each subtest must read a block of parameters disjoint from every other block. That constraint determines the whole shape of the construction: a counter |𝑎|± that records how many parameters a test consumes, and a shift operator that moves a test onto its own block.
Define closed terms and record their denotations, each computed from definition 171.29 by induction on the index: 𝗌𝗁𝗂𝖿𝗍0=𝜆𝑥𝜄.𝑥,𝗌𝗁𝗂𝖿𝗍𝑘+1=𝜆𝑥𝜄.𝗌𝗎𝖼𝖼(𝗌𝗁𝗂𝖿𝗍𝑘𝑥),̂[[𝗌𝗁𝗂𝖿𝗍𝑘]](𝑢)=∑𝑛𝑢𝑛𝑒𝑛+𝑘;𝗉𝗋𝗈𝖽0=――0,𝗉𝗋𝗈𝖽𝑘+1=𝜆𝑥𝜄.𝗂𝖿(𝑥,𝗉𝗋𝗈𝖽𝑘,𝑧⋅Ω),̂[[𝗉𝗋𝗈𝖽𝑘]](𝑢1)⋯(𝑢𝑘)=(∏𝑘𝑖=1𝑢𝑖0)𝑒0𝖼𝗁𝗈𝗈𝗌𝖾0=𝜆𝜉𝜄.Ω𝜎,𝖼𝗁𝗈𝗈𝗌𝖾𝑘+1=𝜆𝜉𝜄.𝜆𝑥𝜎1.⋯𝜆𝑥𝜎𝑘+1.𝗂𝖿(𝜉,𝑥1,𝜁⋅𝖼𝗁𝗈𝗈𝗌𝖾𝑘𝜁𝑥2⋯𝑥𝑘+1), with ̂[[𝖼𝗁𝗈𝗈𝗌𝖾𝑘]](𝑢)(𝑤1)⋯(𝑤𝑘)=∑𝑘−1𝑖=0𝑢𝑖𝑤𝑖+1, where ⋅⊢𝗌𝗁𝗂𝖿𝗍𝑘:𝜄⟶𝜄, ⋅⊢𝗉𝗋𝗈𝖽𝑘:𝜄⟶⋯⟶𝜄⟶𝜄 with 𝑘 arguments, and ⋅⊢𝖼𝗁𝗈𝗈𝗌𝖾𝑘:𝜄⟶𝜎⟶⋯⟶𝜎⟶𝜎 with 𝑘 arguments of type 𝜎. Finally, for rationals 𝑝0,…,𝑝𝑛∈[0,1] with 𝑝0+⋯+𝑝𝑛≤1, define ran(𝑝0,…,𝑝𝑛)=⎧{
{
{⎨{
{
{⎩――0if𝑝0=1,𝗂𝖿(𝖼𝗈𝗂𝗇(𝑝0),――0,𝑧⋅Ω𝜄)if𝑛=0,𝗂𝖿(𝖼𝗈𝗂𝗇(𝑝0),――0,𝑧⋅𝗌𝗎𝖼𝖼(ran(⃗𝑝′)))otherwise, where ⃗𝑝′=(𝑝11−𝑝0,…,𝑝𝑛1−𝑝0), so that [[ran(𝑝0,…,𝑝𝑛)]]=∑𝑛𝑖=0𝑝𝑖𝑒𝑖.
Verification of the four denotations. For 𝗌𝗁𝗂𝖿𝗍𝑘: at 𝑘=0 the abstraction clause gives the identity function; at 𝑘+1 the 𝗌𝗎𝖼𝖼 clause shifts the induction hypothesis by one index. For 𝗉𝗋𝗈𝖽𝑘: at 𝑘=0 the value is 𝑒0, the empty product; at 𝑘+1 the 𝗂𝖿 clause selects 𝑢10 times the interpretation of 𝗉𝗋𝗈𝖽𝑘 and discards the diverging branch, since [[Ω]]=0 by exercise 171.11. For 𝖼𝗁𝗈𝗈𝗌𝖾𝑘: at 𝑘=0 the value is 0; at 𝑘+1 the 𝗂𝖿 clause contributes 𝑢0𝑤1 from the zero branch and, from the summand indexed 𝑚+1, the value 𝑢𝑚+1 times the interpretation of 𝖼𝗁𝗈𝗈𝗌𝖾𝑘――𝑚𝑤2⋯, which the induction hypothesis evaluates to 𝑤𝑚+2 for 𝑚+1≤𝑘. For ran: the first clause is immediate, the second gives 𝑝0𝑒0, and in the third the coin contributes 𝑝0𝑒0 from the zero branch and (1−𝑝0) times the shifted interpretation of the recursive call from the other, which is (1−𝑝0)∑𝑖≥1𝑝𝑖1−𝑝0𝑒𝑖. ◻
For a type 𝜎 and 𝑎∈|[[𝜎]]| define natural numbers |𝑎|+,|𝑎|− and closed terms 𝑎+,𝑎− with ⋅⊢𝑎+:𝜄⟶𝜎 and ⋅⊢𝑎−:𝜄⟶𝜎⟶𝜄, by mutual induction on 𝜎.
At 𝜎=𝜄 a web point is a natural number 𝑚, and |𝑚|+=|𝑚|−=0,𝑚+=𝜆𝜉𝜄.――𝑚,𝑚−=𝜆𝜉𝜄.𝗉𝗋𝗈𝖻𝑚. At 𝜎=𝜑⟶𝜓 a web point is a pair 𝑎=([𝑏1,…,𝑏𝑘],𝑐) with 𝑏𝑖∈|[[𝜑]]| and 𝑐∈|[[𝜓]]|, and |𝑎|+=|𝑐|++𝑘∑𝑖=1|𝑏𝑖|−,|𝑎|−=|𝑐|−+𝑘+𝑘∑𝑖=1|𝑏𝑖|+. Writing 𝛽𝑖=∑𝑗<𝑖|𝑏𝑗|− and 𝛾𝑖=𝑘+∑𝑗<𝑖|𝑏𝑗|+, 𝑎+=𝜆𝜉𝜄.𝜆𝑥𝜑.𝗂𝖿(𝗉𝗋𝗈𝖽𝑘(𝑏−1𝜉𝑥)(𝑏−2(𝗌𝗁𝗂𝖿𝗍𝛽2𝜉)𝑥)⋯(𝑏−𝑘(𝗌𝗁𝗂𝖿𝗍𝛽𝑘𝜉)𝑥),𝑐+(𝗌𝗁𝗂𝖿𝗍𝛽𝑘+1𝜉),𝑧⋅Ω𝜓),𝑎−=𝜆𝜉𝜄.𝜆𝑓𝜑⟶𝜓.𝑐−(𝗌𝗁𝗂𝖿𝗍𝛾𝑘+1𝜉)(𝑓(𝖼𝗁𝗈𝗈𝗌𝖾𝑘𝜉(𝑏+1(𝗌𝗁𝗂𝖿𝗍𝛾1𝜉))⋯(𝑏+𝑘(𝗌𝗁𝗂𝖿𝗍𝛾𝑘𝜉)))). Write 𝑢{𝑝} for the shifted supply, (𝑢{𝑝})𝑖=𝑢𝑖+𝑝. Reading the clauses of definition 171.29 through definition 171.42 gives, for 𝑢∈𝑃𝑁, 𝑤∈𝑃[[𝜑]] and 𝑡∈𝑃[[𝜑⟶𝜓]], ̂[[𝑎+]](𝑢)(𝑤)=𝑘∏𝑖=1̂[[𝑏−𝑖]](𝑢{𝛽𝑖})(𝑤)0⋅̂[[𝑐+]](𝑢{𝛽𝑘+1}),̂[[𝑎−]](𝑢)(𝑡)=̂[[𝑐−]](𝑢{𝛾𝑘+1})(ˆ𝑡(∑𝑘𝑖=1𝑢𝑖−1̂[[𝑏+𝑖]](𝑢{𝛾𝑖}))).
The two displays record where each block of parameters goes. The test 𝑎− spends its first 𝑘 parameters 𝑢0,…,𝑢𝑘−1 on 𝖼𝗁𝗈𝗈𝗌𝖾𝑘, which decides which of the 𝑘 arguments is offered to 𝑓; it then gives the 𝑖-th argument-builder 𝑏+𝑖 the block starting at 𝛾𝑖, and the codomain test 𝑐− the block starting at 𝛾𝑘+1. The blocks are consecutive and disjoint, which is what makes the designated monomial multilinear.
Say that a closed 𝐹 with ⋅⊢𝐹:𝜄⟶𝜌depends on at most 𝑛 parameters when ̂[[𝐹]](𝑢)=̂[[𝐹]](𝑢↾𝑛) for all 𝑢∈𝑃𝑁, where (𝑢↾𝑛)𝑖=𝑢𝑖 for 𝑖<𝑛 and 0 otherwise. Then 𝑎+ depends on at most |𝑎|+ parameters and 𝑎− on at most |𝑎|− parameters.
Proof. Induction on 𝜎. At 𝜄, the interpretations ̂[[𝑚+]](𝑢)=𝑒𝑚 and ̂[[𝑚−]](𝑢)(𝑤)=𝑤𝑚𝑒0 do not mention 𝑢, and |𝑚|±=0.
At 𝜑⟶𝜓, read the second display of definition 171.43. The coordinates of 𝑢 that occur are 𝑢0,…,𝑢𝑘−1; those occurring in ̂[[𝑏+𝑖]](𝑢{𝛾𝑖}), which by the induction hypothesis are among 𝑢𝛾𝑖,…,𝑢𝛾𝑖+|𝑏𝑖|+−1, that is among 𝑢𝛾𝑖,…,𝑢𝛾𝑖+1−1; and those occurring in ̂[[𝑐−]](𝑢{𝛾𝑘+1}), which are among 𝑢𝛾𝑘+1,…,𝑢𝛾𝑘+1+|𝑐|−−1. The union of these index sets is {0,…,|𝑎|−−1} because 𝛾𝑘+1+|𝑐|−=𝑘+∑𝑖|𝑏𝑖|++|𝑐|−=|𝑎|−. The argument for 𝑎+ is the same computation with 𝛽 in place of 𝛾 and |𝑎|+=𝛽𝑘+1+|𝑐|+. ◻
Let 𝜎=𝜄⟶𝜄 and 𝑎=([𝑚],𝑐), so 𝑘=1, |𝑏1|+=|𝑐|−=0 and |𝑎|−=1. The displays give, for 𝑡∈𝑃[[𝜎]], ̂[[𝑎−]](𝑢)(𝑡)𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛171.43=̂[[𝑐−]](𝑢{1})(ˆ𝑡(𝑢0𝑒𝑚))𝑔𝑟𝑜𝑢𝑛𝑑𝑐𝑎𝑠𝑒=ˆ𝑡(𝑢0𝑒𝑚)𝑐𝑒0𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛171.23=(∑𝑗≥0𝑡𝑗⋅[𝑚],𝑐𝑢𝑗0)𝑒0, where 𝑗⋅[𝑚] is the multiset with 𝑗 copies of 𝑚; every other multiset contributes 0 because (𝑢0𝑒𝑚)𝜇=0 unless supp(𝜇)⊆{𝑚}. The coefficient of the multilinear monomial 𝑢0 is 𝑡[𝑚],𝑐=𝑡𝑎. This is the pattern that the general lemma establishes at every type: the designated monomial reads off the designated coefficient.
The following is Ehrhard–Pagani–Tasson’s Lemma 26 together with the coefficient computation opening their §4.3.1, imported at exactly this signature. For every type 𝜎, every 𝑎∈|[[𝜎]]| with 𝑛=|𝑎|−, and every 𝑤∈𝑃[[𝜎]], the function 𝑢↦̂[[𝑎−]](𝑢)(𝑤)0 is, by lemma 171.44, a power series with nonnegative coefficients in 𝑢0,…,𝑢𝑛−1; the coefficient of the multilinear monomial 𝑢0𝑢1⋯𝑢𝑛−1 in that series equals 𝑤𝑎. What the source supplies is the combinatorial identification of that one coefficient, by an induction over 𝜎 that tracks how the multiset structure of 𝑎 is distributed over the parameter blocks; example 171.45 verifies its conclusion at 𝜎=𝜄⟶𝜄, and the ground case 𝑎=𝑚, 𝑛=0 is the identity ̂[[𝑚−]](𝑢)(𝑤)0=𝑤𝑚 with the empty monomial. Everything below is proved from the statement just displayed.
Let 𝜎 be a type, 𝑎∈|[[𝜎]]|, 𝑛=|𝑎|−, and let 𝑤,𝑤′∈𝑃[[𝜎]] satisfy 𝑤𝑎≠𝑤′𝑎. Then there are rationals 𝑞0,…,𝑞𝑛−1∈[0,1] with ∑𝑖𝑞𝑖≤1 such that, for 𝑢=∑𝑖<𝑛𝑞𝑖𝑒𝑖∈𝑃𝑁, ̂[[𝑎−]](𝑢)(𝑤)≠̂[[𝑎−]](𝑢)(𝑤′).
Proof. Put 𝜑(𝑥)=̂[[𝑎−]](𝑥)(𝑤)0 and 𝜑′(𝑥)=̂[[𝑎−]](𝑥)(𝑤′)0 for 𝑥 ranging over the box 𝐵=[0,1/𝑛]{0,…,𝑛−1}, each such 𝑥 being read as the element of (ℝ+)ℕ that vanishes from index 𝑛 on. Every such 𝑥 lies in 𝑃𝑁, since ∑𝑖<𝑛𝑥𝑖≤𝑛⋅1𝑛=1. By lemma 171.44 both functions are power series in 𝑥0,…,𝑥𝑛−1 with nonnegative coefficients, and both are finite on 𝐵, being coordinates of elements of 𝑃𝑁. By convention 171.46 their coefficients at the monomial 𝑥0⋯𝑥𝑛−1 are 𝑤𝑎 and 𝑤′𝑎, which differ. By lemma 171.26 the two functions are not equal on 𝐵.
Both are continuous on 𝐵: with 𝛿=1/𝑛, the series ∑𝜈𝑐𝜈𝛿#𝜈 converges, so the series converges uniformly on 𝐵 by comparison, and each partial sum is a polynomial. Hence {𝑥∈𝐵∣𝜑(𝑥)≠𝜑′(𝑥)} is a nonempty relatively open subset of 𝐵, and therefore contains a point 𝑞 all of whose coordinates are rational. For that point, ̂[[𝑎−]](𝑞)(𝑤)0≠̂[[𝑎−]](𝑞)(𝑤′)0, which is stronger than the stated inequality. Finally ∑𝑖<𝑛𝑞𝑖≤1 because 𝑞∈𝐵. ◻
Proof of Theorem 171.48 — Observational equivalence implies denotational equality
Proof. Contrapositive. Assume [[𝑀]]Γ≠[[𝑀′]]Γ with Γ=(𝑥1:𝜎1,…,𝑥𝑙:𝜎𝑙). Close both terms: 𝑁=𝜆𝑥𝜎11.⋯𝜆𝑥𝜎𝑙𝑙.𝑀 and 𝑁′=𝜆𝑥𝜎11.⋯𝜆𝑥𝜎𝑙𝑙.𝑀′, both closed of type 𝜏=𝜎1⟶⋯⟶𝜎𝑙⟶𝜎. By the abstraction clause of definition 171.29 and theorem 171.27, 𝑤=[[𝑁]] and 𝑤′=[[𝑁′]] differ, so 𝑤𝑎≠𝑤′𝑎 for some 𝑎∈|[[𝜏]]|. Let 𝑛=|𝑎|− and let 𝑞0,…,𝑞𝑛−1 be the rationals given by theorem 171.47, so that with 𝑢=∑𝑖<𝑛𝑞𝑖𝑒𝑖, ̂[[𝑎−]](𝑢)(𝑤)0≠̂[[𝑎−]](𝑢)(𝑤′)0. By definition 171.42, 𝑢=[[ran(𝑞0,…,𝑞𝑛−1)]]. Take the observation context 𝐶Γ⊢𝜎=𝑎−ran(𝑞0,…,𝑞𝑛−1)(𝜆𝑥𝜎11.⋯𝜆𝑥𝜎𝑙𝑙.[]Γ⊢𝜎), which satisfies ⋅⊢𝐶Γ⊢𝜎:𝜄. Its two fillings have, by definition 171.29, [[𝐶[𝑀]]]=̂[[𝑎−]](𝑢)(𝑤) and [[𝐶[𝑀′]]]=̂[[𝑎−]](𝑢)(𝑤′). Hence Red(𝜄)∞𝐶[𝑀],――0𝑡ℎ𝑒𝑜𝑟𝑒𝑚171.39=[[𝐶[𝑀]]]0≠[[𝐶[𝑀′]]]0𝑡ℎ𝑒𝑜𝑟𝑒𝑚171.39=Red(𝜄)∞𝐶[𝑀′],――0, so 𝑀 and 𝑀′ are not observationally equivalent. ◻
Corollary 171.49 is an equality of equivalences, not of orders, and it is proved for the frozen calculus of convention 171.1. Both restrictions are real.
Let 𝑀1=𝜆𝑥𝜄.𝗂𝖿(𝑥,――0,𝑧⋅Ω𝜄),𝑀2=𝜆𝑥𝜄.𝗂𝖿(𝑥,𝗂𝖿(𝑥,――0,𝑧′⋅Ω𝜄),𝑧⋅Ω𝜄). Then ̂[[𝑀1]](𝑢)=𝑢0𝑒0 and ̂[[𝑀2]](𝑢)=𝑢20𝑒0 for every 𝑢∈𝑃𝑁, so ̂[[𝑀2]](𝑢)≤̂[[𝑀1]](𝑢) at every argument, while the matrices [[𝑀1]] and [[𝑀2]] are incomparable: the first has the entry 1 at ([0],0) and 0 at ([0,0],0), and the second the reverse.
Proof of Proposition 171.50 — The matrix order is finer than the pointwise order
Proof. The 𝗂𝖿 clause of definition 171.29 applied to [[𝑥]]𝑥:𝜄(𝑢)=𝑢 gives ̂[[𝑀1]](𝑢)=𝑢0𝑒0+∑𝑛𝑢𝑛+1⋅0=𝑢0𝑒0, and applying it twice gives ̂[[𝑀2]](𝑢)=𝑢0⋅(𝑢0𝑒0). Since 𝑢0≤1 we have 𝑢20≤𝑢0. The entries are read off definition 171.23: 𝑢0=𝑢[0] and 𝑢20=𝑢[0,0]. ◻
Write 𝑀≲𝑀′ for the observational preorder: for every closed 𝐶 with ⋅⊢𝐶:𝜎⟶𝜄, Red(𝜄)∞𝐶𝑀,――0≤Red(𝜄)∞𝐶𝑀′,――0. The argument of theorem 171.41 shows that [[𝑀]]≤[[𝑀′]] as matrices implies 𝑀≲𝑀′. Ehrhard–Pagani–Tasson state that the converse fails, and that the two terms of proposition 171.50 witness the failure with 𝑀2≲𝑀1; they prove no inequational full-abstraction theorem, and neither does this chapter. Proposition 171.50 records what is proved here: the order that corollary 171.49 does not characterize is already visible in the model, because pointwise domination of function forms does not imply domination of matrices.
Every theorem of this chapter is stated for convention 171.1. Three extensions change the mathematics rather than the notation. A continuous sampler makes the space of results uncountable, so the web of definition 171.19 — a countable set — no longer indexes it, and the coefficient-extraction argument of theorem 171.47 has nothing to extract. A scoring or conditioning construct produces unnormalized weights above 1, so 𝑃𝑁 is no longer the space of results and the mass bound of lemma 171.7 fails. A dependent or effectful successor calculus changes the typing judgment on which every induction in this chapter is performed. No theorem proved here is claimed for such a calculus without a translation proved to preserve the operational quantity Red(𝜄)∞−,――0.
★☆☆ Take 𝜎=𝜄 and 𝑎=𝑚. Write out theorem 171.47 in this case, and check that the separating observation context produced by the proof of theorem 171.48 is 𝗉𝗋𝗈𝖻𝑚[].
★★☆ Modify definition 171.43 by deleting every 𝗌𝗁𝗂𝖿𝗍, so that all subtests read the same parameters. Recompute example 171.45 for 𝑎=([𝑚,𝑚′],𝑐) with 𝑚≠𝑚′ and exhibit two distinct web points whose designated coefficients then collide in the same monomial. State which step of the proof of theorem 171.47 the modification breaks.
★☆☆ For the two terms of example 171.16 and the two contexts 𝐶0=𝗉𝗋𝗈𝖻0[] and 𝐶1=𝗉𝗋𝗈𝖻1[], write the four complete reduction trees, label every edge with its probability, and confirm the four numbers 1/2 by lemma 171.9.
★★☆ Write in full the case 𝑀=𝗂𝖿(𝑃,𝑄,𝑧⋅𝑅) of theorem 171.38 for ℎ=1, displaying the instance of lemma 171.36 used, the three consequences of the induction hypothesis, and the final inequality. State where the hypothesis ――𝑘𝑅𝜄𝑒𝑘 is used.
★★☆ Let 𝐺𝑝 be the program of example 171.5 with 𝖼𝗈𝗂𝗇(1/2) replaced by 𝖼𝗈𝗂𝗇(𝑝) for a rational 𝑝∈(0,1). Compute its result distribution operationally and its denotation, and determine for which pairs 𝑝≠𝑝′ the observation context 𝗉𝗋𝗈𝖻0[] separates 𝐺𝑝 from 𝐺𝑝′.
★★☆ Exhibit a closed 𝑀:𝜄 with [[𝑀]]=0 that is not Ω𝜄, prove 𝑀≈Ω𝜄 using theorem 171.41, and explain why no finite set of observation contexts establishes this equivalence.
★★★ Reconstruct the proof of theorem 171.47 for 𝜎=𝜄⟶𝜄 without appealing to convention 171.46: compute ̂[[𝑎−]](𝑢)(𝑡) for a general 𝑎=([𝑏1,…,𝑏𝑘],𝑐) at this type, identify the coefficient of 𝑢0⋯𝑢𝑘−1 directly, and carry out the analytic argument. State exactly which part of the general induction the computation replaces.
★★★Practical project.ppcf-exact-enumerator Build an exact enumerator for the recursion-free fragment of convention 171.1: numerals, variables, 𝗌𝗎𝖼𝖼, 𝖼𝗈𝗂𝗇(𝑝) with 𝑝 a reduced rational, 𝗂𝖿, abstraction, and application, extended by the closed terms 𝗉𝗋𝗈𝖻0 and 𝗉𝗋𝗈𝖻1 of definition 171.14 with Ω𝜄 represented as an explicit divergent constant. The program has three parts: a weak-reduction stepper implementing Det, Coin-0, Coin-1, Ctx-App, Ctx-Succ and Ctx-If with capture-avoiding substitution; an enumerator that accumulates path weights into a finite map from numerals to exact rationals, following lemma 171.9; and a stream-driven tracer that consumes a fixed list of bits and prints one line per draw, conditional and return.
The invariant to maintain is that the accumulated weights of a term never exceed 1 and that a term with no applicable rule contributes its own weight to the divergence mass rather than to any numeral. The concrete result is the pair of exact rational tables for 𝑀=𝖼𝗈𝗂𝗇(1/2) and 𝑁=𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅――1) together with the four context probabilities of example 171.16.
The acceptance test is decidable and exact: the tables for 𝑀 and for 𝑁 must both be {――0↦1/2,――1↦1/2}; each of the four terms 𝐶0[𝑀], 𝐶1[𝑀], 𝐶0[𝑁], 𝐶1[𝑁] must have Red(𝜄)∞−,――0=1/2; the trace on the bit stream beginning with 0 must be 𝚍𝚛𝚊𝚠𝟶, 𝚌𝚘𝚗𝚍𝟶, 𝚛𝚎𝚝𝚞𝚛𝚗𝟶 for 𝑁, and the trace on the stream beginning with 1 must be 𝚍𝚛𝚊𝚠𝟷, 𝚌𝚘𝚗𝚍𝟷, 𝚛𝚎𝚝𝚞𝚛𝚗𝟷; and the enumerator must report divergence mass 1/2 for 𝗂𝖿(𝖼𝗈𝗂𝗇(1/2),――0,𝑧⋅Ω𝜄). All arithmetic is on reduced rationals; a frequency obtained by sampling is not an accepted answer, and the rational tables decide equality of result distributions only, not the universal quantification over contexts in definition 171.13.