Synthetic topology in Homotopy Type Theory for probabilistic programming

12/16/2019 ∙ by Martin E. Bidlingmaier, et al. ∙ 0

The ALEA Coq library formalizes measure theory based on a variant of the Giry monad on the category of sets. This enables the interpretation of a probabilistic programming language with primitives for sampling from discrete distributions. However, continuous distributions have to be discretized because the corresponding measures cannot be defined on all subsets of their carriers. This paper proposes the use of synthetic topology to model continuous distributions for probabilistic computations in type theory. We study the initial σ-frame and the corresponding induced topology on arbitrary sets. Based on these intrinsic topologies we define valuations and lower integrals on sets, and prove versions of the Riesz and Fubini theorems. We then show how the Lebesgue valuation, and hence continuous distributions, can be constructed.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Monads on Cartesian closed categories are a semantics for a large class of effectful functional programming languages (Moggi, 1991). The ALEA Coq library (Audebaud and Paulin-Mohring, 2006) provides an interpretation of ml, a functional programming language with primitives for random choice, by constructing a version of the Giry monad (Giry, 1982) on the category of Coq’s types. Giry monads generally assign to a suitable class of spaces their spaces of valuations, and in ALEA’s case it is the class of discrete spaces. This monad is suitable for embedding programming languages with discrete sampling constructs into the ambient logic of Coq, as for example in applications to cryptography (Béguelin, 2010)

. But continuous distributions are essential in statistics, machine learning and differential privacy, and these distributions have to be discretized in ALEA because they cannot be defined on discrete spaces. For example, the Lebesgue measure is only defined on Borel sets, and hence is not directly definable in ALEA.

We propose the use of synthetic topology as a principled way to deal with the problem of continuous distributions. In synthetic topology, one works with a set of open truth values, from which a notion of intrinsic topology on any set can be derived. Working internally in a model of synthetic topology, we develop a theory of valuations and lower integrals on sets which takes the intrinsic topologies into account. We show that a version of the Riesz theorem holds in this setting: Valuations are in one-to-one correspondence with lower integrals. This is then used to define a Giry monad on the category of sets in terms of the continuation monad, and we prove a version of the Fubini theorem. Assuming the metrizability of the real numbers , which asserts that the intrinsic topology on the set agrees with the metric topology, we then define the Lebesgue valuation as an element of .

In non-classical measure theory (which is required because the metrizability of is contradictory with classical logic), the Dedekind or Cauchy real numbers have to be replaced by the lower reals because the former are not closed under enumerable suprema. A lower real is a lower closed rounded inhabited subset of , and in synthetic topology it is natural to require that this subset is furthermore an open subset. An analogous construction for Dedekind reals in synthetic topology is studied by Lešnik (2010) in great generality. The Homotopy Type Theory (HoTT) book (Univalent Foundations Program, 2013) also proposes this in the special case of equal to the initial -frame, and a formalization on top of Coq’s Math Classes (Spitters and Van der Weegen, 2011) and the HoTT library (Bauer et al., 2017) has been carried out by Gilbert (2016). We develop the theory of lower reals valued in the initial -frame and construct an isomorphism with the -cpo completion of the rationals .

The initial -frame is itself the -cpo completion of the partial order of the booleans or equivalently the pointed -cpo completion of the unit set . Pointed -cpo completions of sets are studied by Altenkirch et al. (2017) in HoTT using quotient inductive inductive types (Altenkirch et al., 2018). We explain how their construction can be adapted to -cpo completions of preorders with respect to covers. This generality is needed to define -cpo completions of the rationals and the definition of a formal -frame of opens in the Dedekind reals .

Some of the results presented in this paper have been formalized in Coq on top of the HoTT library, and an exposition of the formalization has appeared in French (Faissole and Spitters, 2018). Homotopy type theory has a number of advantages over standard Coq, even when one is only interested in sets, i.e. types with trivial higher structure. ALEA can only prove its version of the Giry monad to adhere to the monad laws pointwise and resorts to setoids because neither function extensionality nor quotients are part of standard Coq. This is not a problem in homotopy type theory, where function extensionality is provable and quotients of sets can be constructed as a special case of higher inductive types. Sets in HoTT form a -pretopos with a (externally) countable hierarchy universes; that is, it is a model predicative constructive mathematics including quotients and universes (Rijke and Spitters, 2014). As we are working predicatively, the set has to be understood as set of truth values in a fixed but implicit universe . We adopt the convention of the HoTT book and say that a fact holds merely to mean mean a proof irrelevant statement, and otherwise mean a proof relevant one.

This is the logical foundation throughout the paper, with two exceptions: First, we assume the existence of free -cpo completions (assumption 1), and it is to our knowledge unknown whether these can be constructed in our foundations. However, we identify three reasoning principles, all of which are generally considered constructive, and which each separately implies the existence of free -completions. Secondly, the metrizability of the Dedekind reals is assumed in section 8 in order to construct the Lebesgue valuation. This assumption is perhaps more limiting as it contradicts classical logic. Nevertheless, Brouwerian intuitionistic mathematics proves it (Lešnik, 2010), and so our results can be interpreted in models such as the big topos of topological spaces (Fourman, 2013; Lešnik, 2010) or K2-realizability topos (Bauer, 2005; Kleene and Vesley, 1965; Weihrauch, 2012). It is worth observing that we do not assume the axiom of countable choice.

The topos used in Fourman (1984, 2013) and the topos of continuous -actions for the localic monoid of endomorphisms of Baire space used in Van Der Hoeven and Moerdijk (1984) are equivalent by the Comparison Lemma (Johnstone, 2002, Theorem C.2.2.3) because the topological monoid is dense in the site of separable locales, all of which can be covered by Baire space. Thus sheaves in the latter topos can be seen as a uni-typed versions of sheaves in the former topos. Both of these works provide a constructive elaboration of Brouwer’s continuity principles.

It was proved by Shulman (2019) that most of HoTT as presented in the HoTT book can be interpreted in all Grothendieck -toposes (Lurie, 2009). Shulman’s -topos models can also interpret propositional resizing (impredicativity), and so assumption 1 holds in these models, too. Every Grothendieck -topos is equivalent to the category of -truncated objects in the corresponding -topos. Thus the -topos models over the sites of Fourman (1984) and Van Der Hoeven and Moerdijk (1984) also interpret our second assumption.

In concurrent work with our initial work on this topic (Faissole and Spitters, 2018), Huang (2017) developed the semantics of a probabilistic programming language targeted at machine learning with semantics in topological domains. Meanwhile, Huang et al. (2020) have connected the two approaches by showing that the interpretation of a valuation in the internal logic of the K2-realizability topos indeed gives the notion of valuation on topological domains as defined in Huang (2017).

The paper is structured as follows. Section 2 contains some of the order-theoretic preliminaries and notation used throughout the paper. Section 3 discusses the construction and properties of -cpo completions. Section 4 studies the initial -frame as a set of truth values in synthetic topology. Section 5 constructs the lower reals and contains a proof of their universal property (theorem 2). Section 6 defines valuations and integrals and proves their equivalence (the Riesz theorem 3). Section 7 constructs the Giry monad and proves a Fubini theorem 4. Section 8 discusses the metrizability of and constructs the Lebesgue measure. Section 9 provides an interpretation of ml based on the Giry monad, which can be extended to continuous distributions. Section 10 concludes.

2 Preliminaries

A preorder consists of a carrier set and a transitive and reflexive relation on . We generally identify a preorder with its carrier set , leaving the order relation implicit. A map of preorders is monotone if implies for all . A partial order is a preorder whose ordering relation is antisymmetric. A suborder of a preorder is a monotone map with a partial order such that implies . Suborders of may be identified with subsets of .

Let and be preorders and let be a monotone map. The join of is a least element such that for all . Dually, a meet is a greatest element such that for all . If is a partial order, joins and meets are unique if they merely exist. Identifying subsets with suborders of , we write for the join over the corresponding inclusion map. A monotone map of preorders and is final if for each there merely exists such that . If is a monotone map into a partial order and is final, then the two joins and exist and agree if either one exists.

A preorder is directed if is inhabited and there is a function (not necessarily monotone) such that for all we have and . The partial order has for its carrier set the natural numbers with its natural order (which is generated by for all ). If is enumerable (i.e. there exists a surjection ) and directed, then there exists a final map . Thus enumerable directed joins in can be reduced to joins over maps , i.e. chains in .

Bottom and top elements are joins respectively meets over the empty set. A lattice is a partial order which as all binary joins and binary meets for . It is distributive if holds for all . An -complete partial order (-cpo) is a partial order which has all enumerable directed joins. A monotone map of -cpos and is -(Scott-)continuous if preserves enumerable directed joins. A -frame is a partial order with bottom and top elements, binary meets and enumerable joins which satisfy the distributivity law . A partial order is a -frame if and only if it has top and bottom elements and is both a distributive lattice and an -cpo: Arbitrary enumerable joins can be computed as using just the lattice and -cpo structure.

Sets of truth values are partially ordered by implication. They are stable under joins (disjunctions) and meets (conjunctions) over small indexing sets.

3 Presentations of -cpos

In this section we adapt the notion of dcpo presentation described in Jung et al. (2008) for -cpo presentations. We discuss three proofs of the existence of free -cpo completions, and construct presentations of product -cpos.

Definition 1.

An -cpo presentation consists of a preorder and a cover relation such that ( is covered by ) holds only if is an enumerable directed suborder of (thus is given by a map with directed image). We generally leave the covering relation implicit and refer to the -cpo presentation as just . A morphism of -cpo presentations is a monotone map preserving covers, in the sense that if holds in , then holds in for all and .

Every -cpo can be regarded as an -cpo presentation with cover relation

(1)

for directed and enumerable. -continuous maps of -cpos may be identified with their morphisms when considered as -cpo presentations.

Assumption 1.

Let be an -cpo presentation. Then there is a free -cpo over , i.e. there is a morphism of -cpo presentations with an -cpo such that for any given morphism with an -cpo there is a unique -continuous map such that .

It appears that assumption 1 is independent of constructive predicative mathematics. However, it follows from rather weak additional mathematical principles, all of which are generally considered constructive.

As a first option, one can work with propositional resizing (impredicativity) (Univalent Foundations Program, 2013), i.e. assume that the inclusions are equalities. Working impredicatively, Jung et al. (2008) construct free dcpos over dcpo presentations. We sketch a straightforward adaptation of their proof for -cpos. Say a lower subset is an ideal if from and it follows that , and let be the partial order of all ideals. Ideals are closed under arbitrary intersections, so every subset is contained in the least ideal containing it:

(2)

It follows that has all joins and that they can be computed as . Assigning to each the principle ideal gives a monotone map from to which preserves covers. It exhibits as the free suplattice over , i.e. the free partial order with all joins subject to the cover relations. Now can be defined as the least subset of which contains the principle ideals that is closed under joins of enumerable directed families.

Next, can be constructed as a quotient inductive inductive type (QIIT) (Altenkirch et al., 2018) in homotopy type theory. The special case of the free -cpo with bottom element over a set (i.e. discrete partial order without covers) is worked out in Altenkirch et al. (2017). Given a set , they define and a dependent predicate mutually recursive as a QIIT. Elements of and their equalities are generated by the constructors η: A →A_⊥: (∑_x : N →A_⊥ ∏_n : N x_n ≤x_n + 1) →A_⊥
⊥: A_⊥α: ∏_x, y : A_⊥ x ≤y →y ≤x →x = y. has constructors corresponding to reflexivity, transitivity and the universal properties of and . The recursion principle for as QIIT is the universal property of the free domain over . This argument can easily be adapted for our purpose: To construct given an -cpo presentation , one omits from the scheme defining the constructor and adds constructors corresponding to monotonicity of and

(3)

where is a monotone and final map into . The semantics of QIITs are not entirely understood, but it is proved in Lumsdaine and Shulman (2017) that all Grothendieck -topos models validate the existence of many HITs. Work on reducing QIITs to such simpler inductive constructions is ongoing; see (Altenkirch et al., 2018).

As a third alternative, can be constructed as a quotient of the set of monotone sequences in if one is willing to assume the axiom of countable choice, at least in the important special case where the covering relation is such that holds only if for all , which is true in all our applications. A similar construction for is worked out in Altenkirch et al. (2017), with the general idea going back to Rosolini (1986). Let be the preorder on the set of monotone functions which is generated from if for all there merely exists such that , and whenever , where denotes the constant sequence with value and is a final sequence in . If are monotone and , then it can be shown by induction over transitivity of that for all there merely exist either or such that respectively is an upper bound for both and . It follows that the image of the set-theoretic transpose of a monotone function ( need not be monotone with respect to the product order) is directed: The mere existence of binary upper bounds implies the existence of a function assigning upper bounds because of the bijection and countable choice. We obtain a final sequence , which can be shown to be a join of . Let be the quotient partial order of the preorder . By countable choice, every sequence can be lifted to one in , where its join can be computed and mapped back to . Thus is an -cpo, and the verification of its universal property is straightforward.

Proposition 1.

The free -cpo completion is monotone on functions: If , then .

Proof.

The subset contains for all and is closed under directed enumerable joins. ∎

Jung et al. (2008, proposition 2.8) construct presentations of product dcpos based on presentations of their factors, and an analogous result holds for -cpos. Our proof differs slightly from the theirs because we do not assume that -completions are constructed as set of ideals and instead rely solely on the universal property.

Proposition 2.

Let and be -cpo presentations. Define a cover relation on the product partial order by if in and if in . Then the canonical map is an order isomorphism.

Proof.

Let be the function assigning to each the function . is an -cpo with joins computed pointwise. If and , then by definition of the cover relation on . Thus preserves covers and induces an -continuous map . Let be its transpose; it is valued in -continuous functions. Suppose and let us prove that for each we have

(4)

If for some , then this holds because in . If (4) holds for every element for a directed enumerable family , then

(5)

because and for all commute with joins and joins commute among each other. Thus preserves covers and induces an -continuous map . Let be its transpose.

is -continuous in each argument. Thus if and are monotone maps with enumerable and directed, then

(6)

because, being directed, the diagonal is final. It follows that is -continuous. Thus is the identity by the universal property of the -cpo completion, and holds by the universal property of products. ∎

Corollary 1.

Let be an -cpo presentation. If has a bottom element , then is a bottom element, and likewise for top elements. If has all binary joins which are compatible with covers in the sense that preserves the covers on defined in proposition 2, then has all binary joins and preserves them. The same is true for binary meets.

Proof.

Without loss of generality, we may assume that for all we have because adding these covers to does not change the generated -cpo . Endow the terminal partial order with the covering relation , where is the unique element of the unit set. Then the map is a map of -cpo presentations, and so are its right or left adjoints if they exists. Because and the -cpo completion is monotone (proposition 1), it follows that is a right (left) adjoint if is. Thus has a bottom (top) element if has one.

Suppose in . Then

(7)

because is directed. We may thus add the diagonal covers

(8)

to the covers of without changing the generated -cpo. Because presents the product , the diagonal is obtained by -cpo completion of the diagonal of . Now suppose has binary joins which preserve the covers defined in proposition 2. Binary joins will always preserve diagonal covers as in (8). Thus the binary join map can be extended to a left adjoint to the diagonal of , i.e. has binary joins. Similarly, if has a cover preserving binary meet map, then its extension to will be right adjoint to the diagonal. ∎

4 Synthetic topology and the initial -frame

In synthetic topology (Hyland, 1991; Escardó, 2004; Lešnik, 2010) one works with sets and functions as if they behave like topological spaces and continuous maps. For this analogy to have any value, the very least one would expect is a notion of open subset of a given set (i.e. space). The set of (small) subsets of a given set is given by the set of functions . It is thus natural to expect a subset

that classifies the

open subsets, in the sense that a function is the indicator function of an open subset if and only if it factors via . may be thought of as set of open truth values. We obtain sets of open subsets for every set (space) , and it can indeed be verified that the preimage of an open subset under every function is again open. Thus all functions are continuous.

In traditional (analytic) topology, corresponds to the Sierpinsky space: The space with carrier whose only nontrivial open is the singleton set . Indicator functions with a topological space (in the usual sense) are continuous if and only if the preimage of is open; in other words if and only if corresponds to an open subset.

Without imposing any further requirements on , there is not much we can say about the sets . For example, might be empty, in which case only the empty subset has any open subsets at all. If , then for all . For the booleans, the opens are precisely the decidable subsets. In this case, is closed under finite conjunctions and disjunction, corresponding to open subsets being closed under finite intersections and unions. But in constructive models, the booleans are usually not closed under infinite conjunction, so we may not assume that any infinite unions of opens are open. Arguably the most interesting case is where is a proper subset of (so that the topology is not discrete), contains the boolean truth values and and is closed under enumerable disjunction. This makes it possible to study limits and first-countable spaces such as the real numbers, which are at the heart of integration theory. Following the HoTT book and Gilbert (2016), we take for the least subset of satisfying these constraints: The initial -frame.

Definition and Proposition 1 (Gilbert (2016)).

The Sierpinsky space is the free -cpo over the partial order of decidable truth values. admits the structure of a -frame, and it is the initial one. The map given by exhibits as suborder of and preserves all -frame structure.

Thus is a suborder of , and we freely identify elements with their image in . The preservation of enumerable joins by the inclusion means that if holds for an enumerable family of elements , then there merely exists such that .

As explained in section 3, in the presence of countable choice may be identified with monotone binary sequences where distinguish sequences only by whether they eventually reach . This set is also known as the Rosolini dominance (Rosolini, 1986) and denoted by . When , open subsets can be understood as the semi-decidable subsets. Let and let be an increasing binary sequence representing . If for some , then , but we can never conclude by checking only a finite prefix of . Under a realizability interpretation, corresponds to a computation producing an infinite stream of digits which will eventually contain if and only if . If furthermore itself is enumerable, we obtain an enumeration of . The Rosolini dominance is not well-behaved without countable choice. For example, it is not closed under enumerable disjunction. We circumvent this issue by using the initial -frame instead, which is closed under enumerable disjunction by definition.

An important requirement imposed on the set of open truth values is the dominance axiom. Consider inclusions of spaces such that is open in and is open in . In analytic topology, this implies that is open in . This is not automatic in synthetic topology, but holds if is a dominance (Rosolini, 1986):

Definition 2.

A subset is a dominance if for all and it holds that

(9)

Rosolini (1986) proved that is a dominance under the assumption of countable choice. It follows that is a dominance if countable choice holds. But being a dominance can be proved directly, and even without assuming countable choice:

Theorem 1.

The Sierpinsky space is a dominance.

Proof.

We prove (9) for fixed using the induction principle of as free -cpo completion of . If and , then in particular and thus is in . If , then , which is an element of . Now let for an ascending chain in . Suppose that and that (9) with in place of holds for all . Combining this with and it follows that is in for all . But then

(10)

by the distributive law, which is in . ∎

Given a dominance and a set , Rosolini constructs a partial map classifier of , which is an object representing partial maps whose domains of definition are open with respect to . Following Escardó and Knapp (2017), the partial map classifier can be defined as

(11)

Here is identified with the subsingleton set . They refer to elements as partial elements. is the value, its extent. Under a realizability interpretation and , maps can be thought of as partial functions from to , in the sense that their interpretations yield potentially non-terminating computations producing results in . The interpretation of constructive logic in the effective topos even validates the axiom that for every function

there merely exists a Turing machine which computes it

(Bridges and Richman, 1987, chapter 3).

Altenkirch et al. (2017) propose defining the partial map classifier of as the QIIT described in section 3. In our terminology, is the -cpo completion , where we consider as the partial order obtained by freely adjoining a bottom element to the discrete partial order . Escardó and Knapp (2017) mention that can be understood in terms of Rosolini’s lifting construction.

Indeed, has the structure of an -cpo with bottom element under : The structure map is defined by assigning to each element the unique map with value . For and in let

(12)

this defines a partial order on . Its bottom element is the unique map . The join of an enumerable directed set is given by , where is defined by whenever is in . Thus there is a unique -continuous map which is compatible with the structure maps and preserves the bottom element. We can then show the following:

Proposition 3.

The map is an order isomorphism.

Proof.

First note that the projection that sends a partial element to its extent is -continuous and preserves the bottom element. The unique map induces a map , which can equivalently be described as assigning to the truth value by proposition 1. (A direct proof of this can also be found in Gilbert (2016).) By the universal property of , these maps commute with , so if , then .

Now let us show that exhibits as suborder of . Suppose and such that in . We show by induction over . If , then trivially . If for some , then , hence . From this it follows by our initial remark that there merely exists such that . In particular, , where is the unique element of the unit set, hence . Now let be the join of a directed enumerable subset . We may assume that for all , if , then . Thus because for all . But then by definition of least upper bound.

It remains to show that is surjective and hence an order isomorphism. For this we must construct for each partial element an element such that . We proceed by induction over . We can set if and if . Now let be a directed enumerable join in . We may assume that for partial elements of the form with there merely exists such that . Because was already proved to be the inclusion of a suborder,

(13)

embeds into . By the induction hypothesis it is isomorphic to , hence directed and enumerable. Now . ∎

5 The lower reals

A Dedekind cut is pair of sets of rational numbers of the form and for some real number . The condition that is of this form can be stated purely in terms of rational numbers without referring to the real numbers, so the (Dedekind) real numbers can be defined as the set of all pairs satisfying these requirements; see e.g. Johnstone (2002). Constructively, even a bounded set of does not necessarily have a supremum. This is problematic in integration theory as integrals of functions on non-compact spaces are constructed by approximating them from below.

A lower real is given only by the lower part . Note that, constructively, cannot be reconstructed from just or vice-versa. In the setting of synthetic topology, it is natural to ask that the subsets (and ) are valued in the Sierpinsky space , so that they correspond to open subsets of . For Dedekind reals, this has been studied extensively by Lešnik (2010). The usage of the initial -frame in the definition of Dedekind real numbers is also proposed in the HoTT book (section 11.2) and has been formalized by Gilbert (2016). For us is the Sierpinsky space, so real numbers given by open Dedekind cuts can be understood as those for which the predicates and on rational numbers are semi-decidable. If is a lower real, then only the predicate will be semi-decidable. We use the symbol to refer to the Dedekind reals valued in and likewise .

Definition 3.

A lower real is an open subset of satisfying the following axioms:

  • There merely exists such that ,

  • for all , if then there merely exists such that , and

  • for all , if , then .

The set of all lower reals is denoted by . For let

(14)

The subset of non-negative lower reals is given by

(15)

In predicative foundations, the Dedekind or lower reals usually have to be parameterized by a universe level , corresponding to the size of the set of truth values the lower (and upper) cuts are valued in. The resulting set of reals will only be an element of the th universe. Using the set of open truth values , we avoid this nuisance and obtain just one set of Dedekind and lower reals, respectively.

Crucial for the use of lower reals in integration theory is their order-theoretic structure:

Proposition 4.

The lower reals endowed with the relation

(16)

for are a partial order. Finite meets and enumerable joins in are computed pointwise and satisfy the distributivity law . The suborder of non-negative lower reals is a -frame. The map exhibits as suborder of . ∎

In view of proposition 4, it is natural to wonder whether is obtained by a completion process of . This is indeed the case. Define a cover relation by for enumerable directed such that exists and is equal to . The embedding preserves enumerable joins and thus induces an -continuous map . Similarly we have , where is understood as -cpo presentation with the restricted cover relation of .

Theorem 2.

The unique -continuous maps and under respectively are order isomorphisms.

Noting that the two operations preserve covers, we conclude with 2 the following:

Corollary 2.

Addition on and multiplication on extend uniquely to -continuous operations on and , respectively.

Multiplication cannot be (constructively) extended to an operation on all lower reals because it is not monotone. In terms of lower cuts, we have if and only if there merely exist and such that , and similarly for multiplication.

The statement analogous to theorem 2 for the usual lower reals (which are not required to be valued in ) and completion under arbitrary directed joins can be shown as follows. The proposed inverse to maps a lower real to the union in the completion of under arbitrary directed joins. This defines a continuous map which is compatible with the inclusions of , hence by the universal property of the completion. On the other hand, because for all . Unfortunately, this proof does not directly transfer to our situation because lower reals are not necessarily enumerable in the sense that there is a surjection , at least not in the absence of countable choice.

Proof of theorem 2..

For brevity, we only prove the statement about , the proof for being similar. Note that the covers of are stable under binary joins, thus has binary joins and hence arbitrary enumerable joins. This allows us to construct a map as follows. Let and pick . For each , let be the unique -continuous map which sends to and to . Now set

(17)

If , then by definition, and so . Thus is well-defined as it does not depend on the choice of .

is defined as composition of -continuous maps, so is -continuous itself. It is compatible with the structure maps and because

(18)

by definition of the cover relation on . It follows that by the universal property of .

Note that preserves arbitrary enumerable joins (not necessarily directed) because the map preserves binary joins. Let . It can be shown by induction over that for all . Thus

(19)

On the other hand, suppose and let us show that , i.e. that . Because is a rounded lower subset of , there merely exists such that . Then , hence . ∎

6 Integrals and Valuations

In this section we define valuations, which play the role of measures but are defined only on opens, and integrals. We then prove a version of the Riesz theorem, which states that there is a one-to-one correspondence between valuations and integrals. Valuations are often preferred over measures in constructive mathematics because measures would have to be valued in the hyperreals (Coquand and Palmgren, 2002). They have a long tradition in the domain-theoretic semantics of probabilistic computations, see e.g. Jones and Plotkin (1989). It is observed there that classically, valuations on compact Hausdorff spaces are in bijective correspondence with regular measures. Our proof of the Riesz theorem is inspired by Coquand and Spitters (2009) and Vickers (2011), who prove similar results in the setting of locales.

Fix a set . Recall that , the set of open subsets of , is defined as the set of functions . The -frame structures of and induce -frame structures on the sets of functions and , with all structure defined pointwise.

Definition 4.

A (-continuous) valuation on a set is an -continuous map preserving the bottom element that satisfies the modularity law

(20)

for all opens . is a sub-probability valuation if . The set of all valuations on is denoted by

and the set of sub-probability valuations by

.

Let be the unique -continuous map such that and . By postcomposition we obtain a map that assigns to each its (real) indicator function . This map is an order embedding, and so we can equivalently think of a valuation as assigning lower reals to a class of functions . The Riesz theorem states that every valuation can be extended to a lower integral, which is a function defined on all maps , and that every lower integral is determined by its restriction to indicator functions.

Definition 5.

A lower integral on is an -continuous map preserving the bottom element that is furthermore additive, i.e. satisfies

(21)

for all . is a sub-probability lower integral if . The set of all lower integrals on is denoted by and the set of sub-probability lower integrals by .

The reader might wonder at this point why we need the generality of sub-probability valuations and integrals, as opposed to probability valuations and integrals, which would assign to (the indicator function of) the whole space the value 1. Valuations and integrals on some set form partial orders, with ordering defined pointwise. Now if we restrict to proper probability valuations and integrals, these orders will usually not have least elements (consider, for example, valuations on the set of two elements). On the other hand, for their sub-probabilistic versions we have the following, which will be crucial for the interpretation of fixpoint operators in section 9:

Proposition 5.

The inclusions and are embeddings of -cpos with bottom elements. ∎

Proposition 6.

Every lower integral is compatible with multiplication by scalars from , in the sense that for all and . In particular, lower integrals are linear over .

Proof.

If , then because is additive. Thus if is a positive rational, then , hence . If is a directed enumerable set of lower reals such that for each we have for all , then

(22)

by -continuity of and multiplication, so is compatible with multiplication by . Because is the -cpo completion of (theorem 2), it follows that is compatible with scalar multiplication by arbitrary non-negative lower reals . ∎

We are now ready to state the central result of this section.

Theorem 3 (Riesz).

The assignment

(23)

defines map that restricts to a map . Both maps are order isomorphisms.

We begin the proof by showing that restrictions of lower integrals to indicator functions are valuations.

Lemma 1.

Let be an integral on . Then is a valuation on . If is a sub-probability integral, then is a sub-probability valuation.

Proof.

Recall that is obtained by postcomposing with the unique -continuous map that satisfies and . Thus is -continuous, too, hence -continuity of follows from -continuity of . By definition , so if the latter is , then so is the former.

What remains to be shown is that satisfies the modularity law, i.e. that

(24)

holds for all . By linearity of and the definition of indicator functions, it will suffice to show that for all it holds that

(25)

and we will do so by induction over . If , both sides are equal to , and if , then both sides are equal to . Now let for an enumerable directed subset , and suppose that equation (25) holds with in place of for all . Using the fact that the involved operations binary meet and join with , addition and are all -continuous, we compute

(26)
(27)
(28)

Next we construct the extension of a valuation to an integral. Fix .

Definition 6.

Let . The lower -integral is defined as follows. For let

(29)

it is an open subset of . Let

(30)

for . Now

(31)

The main difficulty in showing that is indeed a lower integral is the verification of linearity. Our main tool will be the generalized modularity lemma, originally due to Horn and Tarski (1948, corollary 1.3) in the special case of boolean algebras. More recent references are Coquand and Spitters (2009) and Vickers (2011); the latter also contains a proof of the version that will be used here. Generalized modularity is phrased in terms of the following construction, which in the special case can be understood as the submonoid of functions generated by the indicator functions for .

Definition 7.

Let be a distributive lattice with bottom element. The modular monoid is the commutative monoid generated by the carrier of subject to

(32)

for all , and .

Note that the modularity law and the preservation of bottom elements guarantee precisely that valuations factor uniquely as monoid homomorphism .

Lemma 2 (Generalized Modularity Lemma).

Let be a distributive lattice and . Then in we have

(33)

where for decidable .

Let and . Define to be if and equal to if .

Lemma 3.

Let . Then in