Edinburgh Research Explorer Giry and the machine

We present a general method - the Machine - to analyse and characterise in ﬁnitary terms natural trans- formations between (iterates of) Giry-like functors in the category Pol of Polish spaces. The method relies on a detailed analysis of the structure of Pol and a small set of categorical conditions on the domain and codomain functors. We apply the Machine to transformations from the Giry and positive measures functors to combinations of the Vietoris, multiset, Giry and positive measures functors. The multiset functor is shown to be deﬁned in Pol and its properties established. We also show that for some combinations of these functors, there cannot exist more than one natural transformation between the functors, in particular the Giry monad has no natural transformations to itself apart from the identity. Finally we show how the Dirichlet and Poisson processes can be constructed with the Machine.


Introduction
Classical tools of probability theory are not geared towards compositionality, and especially not compositional approximation (Kozen,[13]). This has not prevented authors from developing powerful techniques (Chaput et al. [5], Kozen et al. [14]) based on structural approaches to probability theory (Giry, [9]). Here, we adopt a slightly different standpoint: we propose to tackle this tooling problem globally, by combining structural insights of Pol together with some classical tools of probability theory and topology put in functorial form. The outcome is the Machine, an axiomatic reconstruction in category-theoretic terms of developments carried out in [7]. Thus, we get a simpler and more conceptual proof of our previous results. We also obtain a much more comprehensive picture and prove that natural transformations between Giry-like functors are entirely characterised by their components on finite spaces. For instance, the monadic data of the Giry functor are easily obtained from the finite case (which is completely elementary) and applying the Machine. But the construction is not limited to probability functors: we deal similarly with the multiset and the Vietoris (the topological powerdomain of compact subsets) functors. This allows one to consider transformations mixing probabilistic and ordinary non-determinism, in a way which is reminiscent of (Keimel et al., [12]). Another byproduct of our Machine is that we reconstruct from finitary data classical objects of probability theory and statistics, namely the Poisson and Dirichlet processes. It is worth noting that Poisson, Dirichlet (and many other similar constructions obtained by recombining the basic ingredients differently) are obtained as natural and continuous maps: naturality expresses the stability of the "behaviour" in a change of granularity, and as such is a fundamental property of consistency, but continuity (which to our knowledge is proved here for the first time) expresses a no less important property, namely the robustness of the behaviour in changes in "parameters". This has potential implications in Bayesian learning.
The structure of the paper is as follows. In Sec. 3, we show that Pol is stratified into the subcategories Pol f , Pol cz Pol z of finite, compact zero-dimensional and zero-dimensional Polish spaces respectively and show how these subcategories are related. In Sec. 4, the Machine is introduced: we identify a small set of categorical conditions on functors F, G that guarantee that any natural transformation from F to G in Pol f can be extended step-by-step through the subcategories to a natural transformation on Pol. In Sec. 5, we illustrate the workings of the Machine on natural transformations connecting the Giry and positive measure functors to combinations of the Vietoris, multiset, Giry and positive measure functors. As far as we know, the multiset functor is defined in Pol for the first time and its properties are established. As a first application of the Machine, we develop in Sec. 6 general criteria under which there can exist at most one natural transformation from a functor F to the Giry functor. In particular, we show that there exists at most one natural transformation between the Vietoris, multiset, positive measure and Giry functor to the Giry functor. Lastly, we show in Sec. 7 how transformations of the type M + ⇒ GH where M + is the finite measure functor and H is either the multiset or the finite measure functor can be built in Pol f from a single generating morphism M + (1) → GH(1) and give criteria for this transformation to be natural. In particular, we show that the Dirichlet and Poisson distributions satisfy these criteria and use the Machine to build Dirichlet and Poisson processes.
To save space and ease reading, several proofs are given after the main text in appendices.

Notations
Most of our developments take place in the category Pol of Polish spaces and continuous maps. Pol is a full subcategory of the category Top of topological spaces and continuous maps. Pol has all countable limits and all countable coproducts (Bourbaki [4], IX). The functor mapping any space to the measurable space having the same underlying set and the Borel σ-algebra and interpreting continuous maps as measurable ones will be denoted by B : Pol → Meas, where Meas is the category of measurable spaces and measurable maps. A countable codirected diagram (ccd for short) is given by a countable directed partial order (DPO) I and a contravariant functor D : I op → Pol such that for all i ≤ I op j, D(i ≤ I op j) is surjective. We moreover assume that ccd s range over non-empty spaces. With that assumption, the categorical limit of a ccd D, which we denote by lim D, is always non-empty.

The structure of Pol
Pol can be decomposed according to the following diagram of inclusions: Here, Pol f is the full subcategory of finite (hence discrete) spaces, Pol cz is the full subcategory of compact zero-dimensional spaces and Pol z is the full subcategory of zero-dimensional spaces while I cz , I z and I p are the obvious inclusion functors. To this picture, we add categories of based spaces and base-preserving maps.

Definition 3.1 (Categories of based spaces)
A based space is a pair (X, F) of X ∈ Obj(Pol) and of a countable base F of the topology of X. A base-preserving map from (X, . One easily checks that this defines a category having based spaces as objects and base-preserving maps as morphisms. We denote this category by Pol . Similarly, a based zero-dimensional space is a pair (Z, F) where Z ∈ Obj(Pol z ) and F is a countable base of clopen sets which is also a boolean algebra. We denote by Pol z the category of based zero-dimensional spaces and base-preserving maps.
Of course, there exists for each such based category a (faithful, but not full!) forgetful functor, that we will denote by resp. U z and U p . The situation is summed up in the following commutative diagram in Cat: In the remainder of this section, we will unravel further relationships between these categories.
Pol f is a codense subcategory of Pol cz . Objects of Pol f are finite discrete spaces. Note that every subset of a discrete space is clopen; as a consequence, any map between two finite spaces is continuous. We will denote objects of Pol f by their cardinality m, n. The objects of Pol cz are the compact zero-dimensional (or profinite) spaces, a prime example being the Cantor space 2 N . These spaces are homeomorphic to limits of countable codirected diagrams (ccd s for short) taking values in Pol f . This is exactly captured by the concept of codensity (see [15], X.6).
Proof. Let X be a compact zero-dimensional space, and consider the comma category X ↓ I cz . We denote by D X : (X ↓ I cz ) → Pol f the diagram corresponding to the base of this cone. It is enough to prove that for all X ∈ Obj(Pol cz ), X ∼ = lim D X . Following (Mac Lane [15], IX.3), it is in turn enough to exhibit a diagram D : I op → Pol f verifying X ∼ = lim D and a cofinal ("initial" in [15]) functor c : I op → (X ↓ I cz ). Proposition 3.1 of [7] yields the existence of such a diagram D where I is the set of finite partitions of X taken in the boolean algebra of clopen sets of X (that we denote by Clo(X)), partially ordered by partition refinement and directed by partition intersection. Observe that any continuous map f : X → n induces a finite clopen partition of X by considering its fibres. Let us denote this partition by X/f . Let c be the functor mapping any finite partition n ∈ I op seen as an object of Pol f to the quotient map q n : X n, and any refinement m ≤ I op n to to the obvious map π mn such that q m = π mn • q n . For any f : X → n the partition X/f is mapped to c(X/f ) : X → X/f , and there trivially exists a map π : c(X/f ) → f . For any two f, f ∈ Obj(X ↓ I cz ), one can easily exhibit a partition i ∈ I of X such that there exists π : c(i) → f and π : Pol cz is a reflective subcategory of Pol z . Objects of Pol z are zero-dimensional spaces, i.e. spaces whose topology admits a (countable) base of clopen sets. Discrete spaces (such as N) are always zero-dimensional. A less trivial example is the Baire space N N . The bridge between Pol cz and Pol z is provided by compactifiying zerodimensional spaces, as explained in full length in ( [7], Sec. 3). Let us recall the underpinnings of this compactification. Let Z be some zero-dimensional space and F be a countable base of clopens of Z. One easily verifies that the boolean algebra generated by F, that we denote by Bool(F), still generates the same topology and is still countable. Therefore, one can witout loss of generality assume that the base F of Z is a countable Boolean algebra of clopen sets (that we call a boolean base for short). Let I F be the directed partial order of finite partitions of Z taken in F and let D F : I op F → Pol f be the diagram defined by D F (i ∈ I op F ) i on objects (seeing finite partitions of Z as finite discrete spaces) and D F (j ≤ I op F i) = q ij where q ij : j → i is the obvious quotient map. Proposition 3.3 (Wallman compactification ( [7], Prop. 3.12)) lim D F is a zero-dimensional compactification of Z that we denote by ω F (Z). We denote by η F : Z → ω F (Z) the canonical embedding of Z into its compactification.
Note that this compactification is not universal, in the sense that Pol cz is not a reflective subcategory of Pol z (see [15], IV.3 for a definition of reflective subcategory). However, we will show that Pol cz is a reflective subcategory of Pol z . In the following, recall that Clo(X) is the boolean algebra of clopen sets of a compact zero-dimensional space X. Proposition 3.4 Let I z be the operation that maps any compact zero-dimensional space X to the pair (X, Clo(X)) and which acts identically on maps between such spaces. I z is a full and faithful functor from Pol cz to Pol z .
Proof. For any space X ∈ Obj(Pol cz ), its boolean algebra of clopen sets Clo(X) is countable and therefore, (X, Clo(X)) is a based zero-dimensional space. By continuity, maps between such spaces are base-preserving. Functoriality, fullness and 4 faithfulness are trivial.
Proof. By construction of ω F (Z), any finite clopen partition of this space will induce through η F a finite partition of Z taken in F. Therefore, η F is base preserving. 2 The following proposition states the functoriality of compactification in this new setting, and the fact that Pol cz is a reflective subcategory of Pol z .
and it is left adjoint to the inclusion functor I z (the unit being given by η).
Proof. (i) This is Prop. 3.13 and Corollary 3.14 of [7]. Let us sketch the argument. As f is base-preserving, any finite clopen partition of Z taken in F will induce a unique finite clopen partition of Z taken in F. Using the notations of Prop. 3.3, we deduce that D F is a sub-diagram of D F . Therefore, there exists a unique mediating map (that we denote is a consequence of the uniqueness of factorisations in (i). According to (Mac Lane [15], IV.3), left adjointness of ω is a direct consequence of (i), as any map f : (Z, F) → I z (X) will factor uniquely through η F : (Z, F) → I z (ω F (Z)). 2 This reflection is summarised in the following diagram: Pol z is a coreflective subcategory of Pol . The penultimate step in our structural analysis of Pol is to relate Pol z and Pol . This is accomplished by associating zero-dimensional refinements to arbitrary spaces, in an operation called zerodimensionalisation. Let us define this operation. 2)) Let X be a space with underlying set U (X) and let F be a countable base of X. The topological space z F (X) (U (X), Bool(F) ) having as underlying set U (X) and whose topology is generated by the boolean algebra Bool(F) verifies the following properties: (iii) measurable sets are preserved: B(X) = B(z F (X)).
In a similar fashion to compactifications, this operation is better typed as a functor from Pol to Pol z . Let us make zero-dimensionalisation into a functor: is base-preserving in Pol z . We denote by z : Pol → Pol z the functor defined by z(X, F) = (z F (X), Bool(F)) on objects and acting identically on arrows.
Proof. It is sufficient to consider the case of an arbitrary finite union of literals . Continuity of f in Pol z is a direct consequence of base preservation. The fact that z is a functor is now trivial. 2 The following result now follows easily: Proposition 3.9 (z as a coreflector) z is right adjoint to the inclusion functor I p , i.e. Pol z is a coreflective subcategory of Pol .
Proof. Observe that for all (X, F) ∈ Obj(Pol ), the identity function F id : This indeed constitutes the counit of the coreflection: one easily verifies that for all f : This coreflection is summarised in the following diagram: Relating Pol and Pol. For all space X ∈ Obj(Pol), let us denote the set of countable bases of X, partially ordered by inclusion, by Bases(X). Observe that Bases(X) is directed by taking the union of the bases and closing under finite intersections. Accordingly, if F ⊆ G are two countable bases of X, the identity function id : (X, G) → (Y, F) is trivially base-preserving. This defines a codirected diagram B X : Bases(X) op → Pol mapping any base F to (X, F) and any pair F ⊆ G to the identity function. Recall that U p : Pol → Pol is the base-forgetting functor. The next definition and proposition provide a universal characterisation of Polish spaces in terms of their zero-dimensionalisation.
Definition 3.10 (Diagram of zero-dimensionals) We define the diagram of zero-dimensionals of X: We state without proof the following result, which is a category-theoretic reformulation of ( [7], Theorem 3.5): In more concrete terms, any space X has the final topology for the family of identity functions {id : z F (X) → X} F where F ranges over Bases(X). Let us conclude this section by summarising our structural decomposition of Pol in the following diagram:

The Machine
We will leverage the structural decomposition of Pol given in the previous section to characterise some "profinite" natural transformations, in the sense that their behaviour on arbitrary spaces is entirely determined by their behaviour on finite spaces. We proceed in a stepwise and modular fashion: the Machine is presented as a series of extension theorems giving sufficient conditions for a natural transformation to be uniquely extended from a subcategory to the ambient one ( The key result is the following: This isomorphism arises from the existence of a functor computing right Kan extension along I cz (see [15], X), denoted by Ran Icz in the following: Proof. In the following, for any X ∈ Obj(Pol cz ), D X : (X ↓ I cz ) → Pol f stands for the diagram verifying X ∼ = lim D X (see proof of Prop. 3.2). We first prove that any functor F : Pol f → Pol admits a right Kan extension Ran Icz F along I cz . Following (Mac Lane [15], X.3, Corollary 4) it is sufficient to prove that for all X ∈ Obj(Pol cz ), the diagram F • D X : (X ↓ I cz ) → Pol has a limit. By a cofinality argument similar to that used in the proof of Prop. 3.2, one can show that lim F • D X ∼ = lim F • D for a countable diagram D and since Pol is countably complete this limit exists, therefore F admits a right Kan extension. Let us prove that the extension is full and faithful. Since I cz is full and faithful, the universal arrow F : (Ran Icz F )I cz ⇒ F is an iso. Given F, G : Pol f → Pol cz and α : F ⇒ G, there exists a unique σ : II. From Pol cz to Pol z . As seen in Prop. 3.6, the Wallman compactification makes Pol cz into a reflective subcategory of Pol z . The extension of a natural transformation from Pol cz to Pol z can be framed componentwise as a restriction of the natural transformation to a space embedded into its compactification, that we construct using intersections.

Definition 4.4 (Intersections, preservation of intersections)
If j 1 : X → Z, j 2 : Y → Z are two embeddings, we define the intersection X ∩ Y → Z as the pullback of j 1 and j 2 (Eq. 5). We say that an endofunctor F : Pol → Pol preserves intersections if the diagram in Eq. 6 is an intersection.
The following Lemma characterises the topology of intersections in Pol.
Lemma 4.5 X ∩ Y is the Set-theoretic intersection of X, Y together with the subspace topology induced by Z.
Proof. The proof is routine. 2 Recall that if f : X → Y is a morphism in a category C, its cokernel pair (if it exists) is the pushout of f with itself (Mac Lane [15], III.3). In Top, there is a well-known characterisation of embeddings as limits of their cokernel pair (see e.g. (Adamek et al. [1], 7.56-7.58)). In Pol, we have the following: Proof. The proof is routine. 2 The following Lemma ensures that the pushout object of an embedding with range in Pol cz is still compact zero-dimensional.
Proof. The proof that Y + X Y is Polish is routine. It thus remains to see that it is compact and zero-dimensional. Since finite unions of compacts are compact, the coproduct Y + Y is compact. By universality of coproducts, the cokernel maps is easily seen to be surjective, and it follows that Y + X Y is the continuous image of a compact, i.e. is compact. To see that it is zero-dimensional, we use the fact that on compact Hausdorff spaces zero-dimensionality coincides with being totally disconnected. Let x ∈ Y + X Y and let U x be a subset such that x ∈ U x . We can assume w.l.o.g. that x is in the first copy of Y and that U x is included in this copy.
Since Y is totally disconnected, if U x = {x} it can be written as the union of two disjoint opens V 1 , V 2 in the subspace topology induced by Y and and thus also by Proof. In the interest of readability, we will elude the inclusion I z : Pol cz → Pol z . Let α : F | Polcz ⇒ G| Polcz be a natural transformation. We prove that (i) for all X ∈ Obj(Pol z ), α ω(X) : F (ω(X)) → G(ω(X)) restricts uniquely to a morphism α X : F (X) → G(X) such that α ω(X) • (F η) X = (Gη) X • α X , and (ii) this restriction uniquely extends α to a natural transformation from F to G.
(ii) Finally, we need to check that extending α to F | Pol z → G| Pol z in this way is natural. Let f : X → Y in Pol z and let η X , η y denote the embeddings of X and Y in their respective zero-dimensional compactifications. The corresponding diagram is depicted in Fig. 2. The top, bottom, front, back and right-hand square commute, and it follows that (Gη III. From Pol z to Pol. The last part of the Machine is a procedure to extend natural transformations from Pol z to Pol. We have seen in Prop. 3.11 that Polish spaces are the colimits of their "diagrams of zero-dimensionals". We will require functors in the domain of natural transformations to commute with these colimits.

Definition 4.9 (Z-cocontinuous functors)
Moreover, we will require these functors to be Z-stable, which means that the underlying sets of the spaces in the range of the considered functors are invariant by zero-dimensionalisation. As we will prove later, this is for instance the case of the Giry, multiset and list functors. Proof. Let α : F U p I p ⇒ GU p I p and X ∈ Obj(Pol) be given. By Z-cocontinuity, F (X) is the colimiting object of the diagram F Z X = F U p I p zB X : Bases(X) op → Pol (Def. 3.10). Applying α, we get a natural transformation αzB X : F Z X ⇒ GZ X . Composing with the counit : I p z → Id Pol yields a natural transformation (GU p )(αzB X ) : F Z X ⇒ GU p Id Pol B X . Note that GU p Id Pol B X is equal to the constant functor with value G(X). Therefore, we have constructed a cocone from F Z X to G(X). The situation above is summed up in the following diagram: By universality, there exists a unique map u X : . For all f : X → Y and for all base G of Y , there exists a base F of X such that f : (X, F) → (Y, G), is base-preserving, and by functoriality, so is z(f ) : Z X (F) → Z Y (G). We get the following diagram: In the above diagram, the left and right cells commute by naturality of while the top and bottom cells commute by construction of the arrows u X , u Y . Note that the arrow (F U p B X ) F is the image through F of the identity function F = id : Z X (F) → X. Since F is Z-stable, this arrow is surjective. We conclude that the central square commute, and we extend α by setting for all X α X = u X as constructed above.

Feeding the Machine
We now investigate the properties of some functors, with an eye on applying the Machine.
The Giry functor. For any space X, we denote by G(X) the space of Borel probability measures over X, endowed with the weak topology (Giry, [9]). This operation can be extended to a functor G : Pol → Pol which admits the Giry monad structure (G, δ, µ) (Giry, [9]). The action of G on maps f : X → Y is defined by The unit is given by the Dirac delta: δ X : X → G(X) while the multiplication is defined by averaging: µ X : G is a rather well-behaved functor: B be the corresponding embeddings and consider µ ∈ G(A), ν ∈ G(B) such that G(j 1 )(µ) = G(j 2 )(ν). It follows from (Kechris [11], Theorem 15.1) and the fact that p 1 is injective that whenever U is a Borel set of A ∩ B, p 1 [U ] is a Borel set of A, and similarly for p 2 . We can therefore define . To see that the equality on the right holds, note that since j 1 in injective , and thus This assignment from pairs (µ, ν) such that Gj 1 (µ) = Gj 2 (ν) to λ ∈ G(A ∩ B) is clearly injective, and it follows that G(A ∩ B) ∼ = GA ∩ GB as sets. Since G preserves embeddings, G(j 1 • p 1 ) = G(j 2 • p 2 ) is an embedding, and it follows that G(A ∩ B) and GA ∩ GB are in fact homeomorphic. 2 Example 5.2 Theorem 4.12 implies that the monadic data of the Giry monad is entirely determined on Pol z by its finite components. We conjecture this holds for arbitrary Polish spaces.
The non-zero finite measures functors. We will also consider functors closely related to G: we let M + be the functor mapping any space X to the space of nonzero positive finite measures over X with the weak topology, and acting on maps similarly as G. The functor of non-zero signed finite measures over X, denoted by M * , is defined similarly. See ( [7], Sec. 2) for more details. The following is trivial (consider the normalisation of a finite non-zero measure): As a consequence, M + and M * verify all the properties listed in Prop. 5.1. Note that for all finite space n, M + (n) is also homeomorphic to R n ≥0 \ {0}.
The multiset functor. We consider the multiset functor B : Pol → Pol. It is given explicitly by B(X) n∈N X n /S n where X n /S n is the quotient of X n under the obvious action of S n on tuples with the quotient topology, i.e. the final topology for the quotient map q : X n X n /S n . See Appendix A for a proof that B(X) is Polish. Its action on maps is given by setting for any f : X → Y and µ ∈ B(X), B(f )(µ) = y → x∈f −1 (y) µ(x). This is easily shown to be continuous. Observe also that for X finite, B(X) ∼ = N X . The multiset functor verifies the following properties: The Vietoris functor. As a non-probabilistic example, we will consider the Vietoris functor. We recall its definition.
Definition 5. 5 We denote by V : Pol → Pol the functor mapping any space X to the space of compact subsets of X topologised with the Hausdorff distance, and mapping any continuous function f : See (Kechris [11], 4.F) for a proof that V(X) is indeed Polish. V has the following properties:  Example 5.7 An interesting example is provided by the support of a measure. Usually, the support of p ∈ G(X) is defined to be the smallest closed subset of measure 1. On finite spaces, for p ∈ G(n), we define supp n (p) {x ∈ n | p(x) > 0}.
Let us check that this is natural: for f : m → n, we have that supp(G(f )(p)) = supp(p • f −1 ) = x ∈ n | f −1 (x) ∩ supp(p) = ∅ , i.e. supp(G(f )(p)) = f (supp(p)) = V(f )(supp(p)). Therefore, supp : G| Pol f ⇒ V| Pol f is a natural transformation. The Machine (Theorem 4.12) uniquely extends supp to a natural transformation supp : G ⇒ V. This type is rather unusual, as the support of a probability measure is closed but not generally compact.

Rigidity
The results presented in Sec. 4 allow to construct natural transformations from finitary specifications. In this section, we apply these results to exhibit striking rigidity properties of G and related functors.
Definition 6.1 A pair of functors F, G : C → D is called rigid, if there exists at most one natural transformation η : F ⇒ G. In particular, we will say that an endofunctor F : C → D is rigid if the identity natural transformation id : F ⇒ F is the only natural transformation that exists from F to itself.
For each finite space k and functor T : Pol → Pol, there exists a canonical action of S k , the permutation group over k elements, given by: We will call this action the canonical action. We will call an element x ∈ T (k) stabilised by the entire group S k under the canonical action an isotropic element. Isotropic elements will play a crucial role in our theorem. Pol → Pol be a functor such that (iv) for each finite Polish space k there exists a dense subset Q k ⊆ T (k) with the property that if x ∈ Q k there exists a finite Polish space k , a morphism f : k → k and an isotropic element x ∈ T (k ) such that T (f )(x ) = x. In these circumstances the pair (T, H) is rigid.
We prove this theorem in steps. But let us first show some example of functors satisfying the property above. Example 6.3 Let us show that the Vietoris functor V satisfies the condition (iv). Note first that for every k, the full set k ∈ V(k) is isotropic: for any π ∈ S k α(π, k) = Vπ(k) = k since π is bijective. Now take Q k = V(k) (which is trivially dense) and x = {x 1 , . . . , x n } ∈ V(k). Consider the full set n ∈ V(n) along with the map f : n → k, i → x i , it is clear that V(f (n)) = x, and n is isotropic.
Consider now Q k = ∆ k ∩ Q k , the rational probabilities on k elements. It is clearly dense in G(k). Any x ∈ Q k , can without loss of generality be written as p 1 n , . . . , pm n for a common denominator n. Now consider the projection map defined by It is easy to check from this definition that p 1 n , . . . , pm n = G(p) 1 n , . . . , 1 n , where 1 n , . . . , 1 n is isotropic. Example 6.5 Let M + , M * : Pol → Pol be the finite non-zero positive (resp. signed) measure functors, then M + (k) ∼ = G(k) × R >0 and M * (k) ∼ = G(k) × R * . These functors satisfy condition (iv): the isotropic elements are those of the shape ((1/k, . . . , 1/k), λ) for λ ∈ R * or R >0 . A dense subset is provided by (Q k ∩G(k))×R * and (Q k ∩ G(k)) × R >0 respectively and the same argument as in Example 6.4 shows that every element ((p 1 /n, . . . , p k /n), λ) is the image of ((1/n, . . . , 1/n), λ) by G(p) × id with p defined as in Example 6.4. Proof. Let ν : T ⇒ H be a natural transformation. We first show that if x ∈ T (k) is isotropic then where 1 k , . . . , 1 k denotes the uniform probability distribution on k. Fix i ∈ {1, . . . , k}, and consider the permutations (ij) ∈ S k , 1 ≤ j ≤ k sending i to j, j to i and leaving all other elements of k unchanged. We have Since this holds for every 1 ≤ j ≤ k we have k j=1 ν k (x)(j) = k j=1 ν k (x)(i) = kν k (x)(i) = 1 and thus ν k (x)(i) = 1 k for every 1 ≤ i ≤ k, i.e. ν k (x) = 1 k , . . . , 1 k . 14 Let us now consider an arbitrary x ∈ Q k , by assumption there exist f : k → k and an isotropic element x ∈ T (k ) such that T (f )(x ) = x. It follows that k (x is isotropic and (7)) Clearly, the same reasoning applies to any other natural transformation ρ : T ⇒ H.
We have thus shown that for each finite Polish set k, ν k is unique on a dense subset Q k of T (k). Since ν k is a morphism in Pol it is continuous, and since Polish spaces are complete, it is in fact Cauchy-continuous. It follows that the restriction of ν k to Q k has a unique extension to T (k). Since the restriction of ν k to Q k is unique, it follows that ν k is also unique. 2 Note that the entire group S k was necessary to show Lemma 6.7, i.e. a weaker notion of isotropic element would not be sufficient. Proof. Assume ν : T | Pol f ⇒ H| Pol f is given. By Lemma 6.7, ν is unique. Since H is Pol f -continuous, Theorem 4.2 applies and the proof is complete. Proof. It is enough to reuse the uniqueness part of the proof of Theorem 4.8. 2 We can finally prove Theorem 6.2.
Proof. (Theorem 6.2) Let α : T | Pol z ⇒ H| Pol z be given. By Lemma 6.9, α is the unique such transformation. Let β, β : T ⇒ H be given, extending α. For all X and F ∈ Bases(X), the identity function id : z F (X) → X is continuous. By the rigidity assumption, β z F (X) = β z F (X) . Using this equation and naturality, Example 6. 10 We have shown earlier that G satisfies all the conditions of Theorem 6.2. It follows that there can only exist a single natural transformation G ⇒ G, and since the identity transformation is natural, it follows that G is rigid.
Example 6.11 Let M + : Pol → Pol be the finite positive measure functor. We can check that the following transformation is natural: define ν : M + → G at a Polish space X by ν X (Q) A → Q(A) Q(X) for A a Borel set of X. This is well defined since 0 < Q(X) < ∞. It is also natural: if f : X → Y is a map in Pol, then for each Q in M + (X) and Borel set B of Y we have: Since M + satisfies (iv), it follows from Theorem 6.2, that the normalisation transformation ν we have just defined is the only natural transformation M + ⇒ G.

Applications
In previous work [7], we showed that a cornerstone of nonparametric Bayesian statistics, the Dirichlet process [8,10], is in fact a natural transformation from M + to G 2 . This result hinged on a non-axiomatic version of the Machine of Sec. 4. In order to validate our new developments we first give a short construction of the Dirichlet process in axiomatic form. The value of our general framework is then illustrated by constructing the Poisson process as a natural transformation. At the heart of these constructions are families of distributions which are stable by convolution (mistakenly taken to be infinitely divisible in [7]). Common examples include: the Γ distribution, the Gaussian distribution, the Poisson distribution, etc. What examples such as Dirichlet or Poisson processes have in common is that they can all be represented by natural transformations of the shape M + ⇒ GH where the functor H can be either B or M + . Since M + is Z-cocontinuous, since G and H are Pol fcontinuous, preserve injections, embeddings and intersections (see Appendix B) we can define a natural transformation of this type by restricting ourselves to Pol f and running the Machine.
In the cases which we have mentioned above, the natural transformation in Pol f can in fact be defined by a single map! The fundamental property which makes this possible is that both M + and B turn coproducts into products. When this is the case it is sometimes possible to define φ : M + ⇒ GH on Pol f from a map φ 1 : M + (1) → GH (1). For this we need a fundamental result which holds very generally in the category Meas of measurable spaces and measurable maps. We define the product measure natural transformation between the bifunctors π : G − ×G− → G(− × −) at each pair of measurable spaces ((X, Σ X ), (Y, Σ Y )) by π (X,Y ) (p, q) → p × q where p × q is the product measure defined on the product σ-algebra (Σ X ⊗ Σ Y ). Proof. The proof is routine. 2 Let us now fix a continuous map φ 1 : M + (1) → GH(1). For any n in Pol f we use the fact that n = n i=1 1 and the fact that M + and H turn coproducts into products to define φ n : M + (n) → GH(n) by where H(1) is the n-fold measure product at H(1). The maps φ n define the component of a transformation M + ⇒ GH. But when is it natural? A simple criterion is given in the following result.
Theorem 7.2 A transformation φ : M + → GH built as above is natural in Pol f iff the following diagrams commute: where e : 2 → 1 is the obvious unique epimorphism, (ij) : n → n is any permutation of two elements of n, and i 1 , i 2 : 1 → 2 are the two injections of 1 into 2 = 1 + 1.
Proof. Any map f : m → n between finite sets can be written as a permutation π : n → n followed by a monotone surjection q : n k followed by a monotone injection i : k n. Since every permutation of n can be written as a composition of permutation of two elements, repeated usage of Diagram (9) shows that GHπ •φ n = φ n • M + π. Monotone surjections q : m n can be written as a composition of maps of the shape id 1 + id 1 + . . . + e + id 1 + . . . + id : k → k − 1 For notational clarity let us consider the case e + id 1 : 3 2. The following square commutes: Indeed, the right-hand side square commutes by Theorem 7.1, whilst the left-hand side square commutes by assumption that Diagram 8 commutes. Monotone injections are treated in a similar way. 2 We will call a family of probability distributions φ n : M + (n) → GH(n) additive if (8) holds, exchangeable if (9) holds, and say that it admits zero parameters if (10) and (11) hold.
The Γ distribution Γ 1 M + (1) → GM + (1) maps any parameter λ ∈ M + (1) to a probability with density x → x λ−1 e −x Γ(λ) w.r.t. Lebesgue [3]. The family of probability distributions Γ n generated by Γ 1 is clearly exchangeable; it is also additive [7] and one can easily adapt the definition so that it admits zero parameters. It follows from Theorem 7.2 that Γ n : M + (n) → GM + (n) is a natural transformation on Pol f which extends to Pol. The Dirichlet process is then simply defined as D : M + ⇒ G 2 (Gν)Γ, where ν : M + ⇒ G is the normalisation natural transformation (unique, by rigidity!).
Similarly, if we define Π 1 : M + (1) → GB(1) ∼ = G(N) by Π 1 (λ)(k) = λ k e −λ k! , then it is well-known that the family Π n generated by Π 1 (similarly to the previous case) is additive. It is also clearly exchangeable. Finally to allow for zero parameters, we extend Π 1 : M ≥0 (1) → G(N) by putting Π 1 (0) = δ 0 , the Dirac delta at 0. It is clear that for any test function f : i.e. our extension is continuous for the weak topology. This fact is the exact analogue of Proposition 4.2 in [7]. The family Π n : M ≥0 (n) → GN n thus defines a natural transformation in Pol f by Theorem 7.2, and by applying the Machine we produce a natural transformation on Pol. The processes Π X : M + ≥0 (X) → GB(X) (for X in Pol) defined by this natural transformation are very well-known in probability theory, they are the (inhomogeneous) Poisson point processes on X parameterised by a measure on X.

Outlook
Our results allow the compositional and finitary approximation of a class of parameterised "stochastic" processes seen as natural transformations between probabilitylike functors satisfying some general axioms. It is worth noting that all the conditions on endofunctors that we require for the codomain of natural transformatins are preserved by composition (if we strengthen Pol f -continuity to commutation with all limits of ccd s). Indeed, we are confident that compositionality can be pushed further: following coalgebraic practice, we will investigate whether functors in e.g. the polynomial closure of Giry can be fed to the Machine. For this to happen, parts of the Machine have yet to be better understood, in particular the special role played by the requirement of Z-cocontinuity (commutation with diagrams of zerodimensional refinements). For instance, we ignore whether the Vietoris functor and the multiset functors are Z-cocontinuous, or whether Z-cocontinuity is preserved by composition.
Rigidity is an unexpected mathematical outcome of our structural decomposition of Pol. Where the Machine allows to prove existence of natural transformations, rigidity allows to prove unicity and is somewhat dual to the former. We expect that the notion of isotropic element will find applications beyond the scope of these developments.
On the applications side, we are confident that many processes beside Dirichlet and Poisson can be subject to the same treatment. Poisson-Dirichlet, Cox processes and some form of Gaussian processes seem to be easy targets. In the case of Dirich-let, we already know that the Machine allows to prove an asymptotic "learning" property. The work of (Culbertson et al, [6]) will provide a convenient setting where we will study how topological properties of Bayesian models such as continuity relate to asymptotic properties of Bayesian update. The finitary handle provided by the Machine might also be useful in deriving new computability or complexity results in the field of probability.
A Construction of the multiset functor B Proposition A.1 For X Polish, let B(X) n∈N X n /S n , where X n /S n is the quotient of X n under the obvious action of S n on tuples with the quotient topology, i.e. the final topology for the quotient map q : X n X n /S n . B(X) is Polish.
Proof. We first shown that if Q is dense in X, then Q n /S n is dense in X n /S n : let U be an open set of X n /S n , then q −1 (U ) is open in X n and intersects Q n , i.e. there exists (r 1 , . . . , r n ) ∈ Q n with (r 1 , . . . , r n ) ∈ q −1 (U ), but this means that q(r 1 , . . . , r n ) ∈ U and q(r 1 , . . . , r n ) ∈ Q n /S n . To see that it is completely metrisable, let d be a complete metric for X,and consider the metric on X n /S n given by: where [x], [y] represent the orbits of x, y ∈ X n respectively, and d n is the product metric given by for some 0 < p < ∞ (any choice of p generates an equivalent topology on X n ). Note that for any permutation π ∈ S n , d n (x, y) = d n (π(x), π(y)) since this simply amounts to re-arranging the summands in Eq. (A.1). It is not immediately clear that d q is well-defined or that it defines a metric. To see that it is well defined let x be another representative of [x], then by definition there exists ρ ∈ S n such that ρ(x) = x , and it follows that min π∈Sn d n (x , π(y)) = min π∈Sn d n (ρ(x), π(y)) = min π∈Sn d n (x, ρ −1 π(y)) = min π∈Sn d n (x, π(y)) It follows that d q is well-defined. Let us now check that it is a metric. For any x, y we clearly have d q ([x], [y]) ≥ 0 and d q ([x], [y]) = 0 means that there exists π ∈ S n such that d n (x, π(y)) = 0 i.e. x = π(y) since d n is a metric, and it follows that [x] = [y]. For the symmetry, note that d n is invariant under permutations of S n , i.e. d n (x, y) = d n (π(x), π(y)) since this simply rearranges the order of the summands in the product metric. It follows that Finally, we need to check the triangular inequality. Since d n satisfies the triangular inequality we have for any choice π 1 , π 2 ∈ S n that: d n (x, π 1 (y)) ≤ d n (x, π 1 (z)) + d n (π 2 (z), π(x)) ≤ d n (x, π 2 (z)) + d n (z, π −1 2 π 1 (x)) d n invariant under π −1 2 and it follows that ) since going through all the combinations π −1 2 π 1 will exhaust the entire group S n . The fact that (X n /S n , d q ) is complete follows from the fact that (X n , d n ) is. Let us prove that d q induces the topology of X n /S n . Let us take an open set U in X n /S n . By definition q −1 (U ) is open in X n , and can therefore be written as a union of open balls (for the metric since direct images commute with unions. It follows from the fact that each π is an homeomorphism that π∈Sn π(B d n (x i , i )) is open in X n . Moreover, π∈Sn π(B d n (x i , i )) is by construction invariant under permutation, so and therefore each q( π∈Sn π(B d n (x i , i )) is an open in X n /S n . We conclude by observing that q( π∈Sn π(B d n (x i , i )) = B dq (q(x i ), i ) and that q −1 (B dq (q(x i ), i )) = q −1 (q( π∈Sn π(B d n (x i , i ))) = π∈Sn π(B d n (x i , i )) is open in X n . Therefore, the balls B dq (q(x i ), i ) are open in X n /S n , and since direct images commute with unions it is not difficult to see that U = i B dq (q(x i ), i ) is a union of opens from the basis generated by the metric. Since each X n /S n is Polish and since Pol has countable coproducts, B(X) is Polish. Proof. Note first that B(i) is defined component-wise i.e. via B n (i) : B n /S n X n /S n injecting an equivalence class of n-tuples of element of B in X n /S n . The fact that B(i) is injective follows from the fact that every component B n (i) is. Similarly to show that B(i) is an embedding it is enough to show that each B n (i) is. To see that this is the case we need to show that for every open U of B n /S n there exists an open V of X n /S n such that U = V ∩ B n /S n and conversely that every subset of this shape is open in B n /S n . We write p n : B n B n /S n and q n : X n X n /S n .
For the first direction, let U be open in B n /S n , it follows that p −1 n (U ) is open in B, and thus that there exists an open V of X n such that p −1 n (U ) = B n ∩ V . If we can choose V to be closed under permutation we are done. Every permutation is a bijective isometry and thus a homeomorphism, and thus an open map, i.e. π(V ) is open for every π ∈ S n . It follows that is open and closed under permutations (this procedure amounts to taking all the reflections of tuples along the diagonal). It follows that q −1 n (q n [V * ]) = V * and q n (V * ) is thus open in X n /S n . Moreover since B n ∩ V is already closed under permutations B n ∩ V = B n ∩ V * , and therefore U = B n /S n ∩ q n (V * ). For the opposite direction, let U be open in X n /S n and consider U ∩ B n /S n , it is clear that which is open in B n since q n (U ) is open in X n . For intersections, we proceed as in Proposition 5.1. Let j 1 , j 2 : A, B X be two embeddings, let p 1 : A ∩ B → A and p 2 : A ∩ B B be the corresponding embeddings and consider µ ∈ BA, ν ∈ BB such that Bj 1 (µ) = Bj 2 (ν). We define λ ∈ B(A ∩ B) λ(x) = µ(p 1 (x)) = ν(p 2 (x)) We check that the last equality holds in exactly the same way as in the proof of Proposition 5.1, and the rest of the proof also follows identically. which is an element of the basis of the topology of V(B), since elements of the shape U i ∩ B are precisely the opens of B. Conversely therefore, starting from an element W of this shape it is clear that by removing all the intersections with B we get an element W of the basis of the topology on V(X) such that W ∩ V(B) = W , and V thus preserves embeddings. For intersections, let j 1 , j 2 : A, B X be two embeddings, let p 1 : A ∩ B → A and p 2 : A∩B B be the corresponding embeddings and consider K A ∈ VA, K B ∈ VB such that Vj 1 (K A ) = Vj 2 (K B ), i.e. such that j 1 [K A ] = j 2 [K B ]. This means that K = K A = K B is a subset of A∩B. To see that it is compact in A∩B, let i U i ⊇ K be an open cover: for each i either U i is of the form p −1 1 (V i ) for some V i open in A, or it is of the form p −1 2 (V i ) for some V i open in B. In the latter case, since j 2 is an embedding, there exists W i open in C such that U i = p −1 2 (j −1 (W i )), but then U i = p −1 1 (j −1 1 (W i )), which means that we can assume without loss of generality that for each i the element U i of the cover is of the form p −1 1 (V i ) for some V i open in A. It is easy to see that V i is an open cover of K in A, from which we can extract a finite sub-cover, whose inverse image under p 1 will be an finite sub-cover of K in A ∩ B. It follows that VA ∩ VB V(A ∩ B) as sets, and since V preserves embeddings, they are also homeomorphic. 2