Constructive Domains with Classical Witnesses

10/11/2019 ∙ by Dirk Pattinson, et al. ∙ 0

We develop a constructive theory of continuous domains from the perspective of program extraction. Our goal that programs represent (provably correct) computation without witnesses of correctness is achieved by formulating correctness assertions classically. Technically, we start from a predomain base and construct a completion. We then investigate continuity with respect to the Scott topology, and present a construction of the function space. We then discuss our main motivating example in detail, and instantiate our theory to real numbers that we conceptualise as the total elements of the completion of the predomain of rational intervals, and prove a representation theorem that precisely delineates the class of representable continuous functions.



There are no comments yet.


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

The ability to extract programs from proofs is one of the hallmark features of constructive mathematics [18]: from a proof of a formula of the form we can automatically obtain a (computable) function such that for all . Within mathematics, the variables usually have types, such as natural or real numbers, or functions between types.

Computationally, while some of these types, such as the natural numbers, can be computed with directly, there is no immediate way to compute with others. The prime example here are the real numbers that are represented either as infinitely-long running Turing machines

[19], rational Cauchy sequences with modulus [7], linear fractional transformations [12], digit streams [14] and domains [10].

From the view of program extraction, the data structure that is used to represent mathematical objects is systematically derived from their definition. If we define real numbers to be Cauchy sequences with modulus, then programs extracted from an existence proof will produce just that – a Cauchy sequence with modulus. The vast majority of the work on constructive real analysis and program extraction has focussed on the Cauchy representation and its variants such as the signed digit representation, e.g. [18, 7, 5]. There is little work on other representations, with the notable exception of [2] which develops a theory of constructive domains that is instantiated to obtain representations of real numbers.

In domain theory, real numbers are represented as nested sequences of (rational, or dyadic) intervals, with the interpretation that every interval gives an upper and lower bound to the number being approximated. In other words, every sequence element gives a guaranteed enclosure of the actual result, and the successive computation of sequence elements can be halted if the actual precision, measured by the interval width, falls below a given threshold.

Compared with a representation as Cauchy sequences with modulus, domains offer two attractive features. First, every stage of approximation carries with an actual error bound, rather than the worst case error, as given by the modulus of convergence for Cauchy reals. For example, computing the square root of using Newton iteration (as carried out in e.g. [15]) one obtains a rational Cauchy Sequence such that for example, for all . Instantiating the same method to obtain a shrinking sequence of nested rational intervals such that one obtains that . Both methods use the same initial approximation of

, and indeed the computed Cauchy sequence is identical to the sequence of upper interval endpoints. The significant difference is explained as the modulus is a worst case estimate, whereas the differences between upper and lower interval endpoint are obtained from the actual computation and avoid over-estimation.

The second attractive feature of a domain theoretic approach is that most classes of domains are closed under the formation of function spaces, i.e. one systematically obtains a representation of the space of e.g. real-valued functions.

Both motivate the development of a more general theory of domains, as e.g. carried out in [2]. Our work is similar in spirit, focuses on extracted programs and data type as an end goal. Specifically, our aim is to extract (necessarily effective) functions that operate on the basis of the domains under consideration. For the special case of real numbers (and functions), our goal is to obtain algorithms in the style descibed in [10]. There, mathematical operations (such as computing square roots) are first extended to an appropriate domain (such as the interval domain), then restricted to the base of the domain, and in a third step, shown to be recursive by considering a computable enumeration of basis elements. Indeed, one of our goals is to short-circuit effectivity considerations that are often laborious and provide little insight. Our slogan is “proofs, not programs” as the constructive reasoning (via the realisability interpretation) immediately yields necessarily recursive algorithms.

Putting the extracted algorithm into the centre of attention gauges the formulation of the notion of domain, and this is where differences to [2] begin to emerge. The programs we are seeking to extract should embody just the computational essence, but no additional terms that evidence correctness. For example, when extracting a program to compute a real number, we only seek a nested sequence of intervals, but not a witness of the fact that the intervals are converging to zero in width. This is similar to the approach taken in [5] where one freely adds (true) axioms without computational content to the theory that forms the basis of extraction. That is, we are interested in constructive existence, but are content with classical correctness. Conceptually, this can be understood as phrasing correctness in the classical (double negation) fragment of constructive logic. Technically, the (intended) consequence of this is that correctness proofs do not have any computational content, and are therefore invisible after program extraction, using a standard realisability interpretation [18].

For example, subjecting the proof of the existence of the square root of two to a realisability interpretation, our aim is to extract only a nested sequence of intervals. To achieve this, the definition of equality needs to be free of computational content. We solve this by judiciously setting up the theory in such a way that treats existence of objects as constructive existence, whereas properties are usually formulated classically.

Another aspect where our theory puts the extracted algorithm into the centre of attention is the definition of completion of domain bases. It is one of the hallmark features of domains is that ideal elements (such as infinite sequences, or real numbers) can be approximated by elements of a base. Constructively, we take the notion of a base as primitive, and recover ideal elements in the completion of the base. Classical domain theory, see e.g. [1] usually considers completion by directed suprema. Here, take the same approach as [2] and consider completions by infinite sequences, as they are much more easily representable computationally.

Plan of the paper and main results. We introduce the notion of a predomain base that is similar to [2] in Section 3

, but our definition of the way-below relation is classical, and we establish some basic lemmas, notably interpolation, for later use. We also introduce our main motivating, and running, example, the predomain base of formal intervals. In Section

4, we introduce the continuous completion of a predomain base, along with a (defined) notion of equality. As foreshadowed in the introduction, equality (defined in terms of way-below) is classical and devoid of computational content. The main result here is the extension property that allows us to extend any continuous function defined on a predomain base to its completion.

In Section 5 we align the order-theoretic notion of continuity to topological continuity. As expected, this necessitates a classical definition of the Scott topology which we also show to be generated by upsets of the way-below relation as in the classical theory. In particular, we can show that order theoretic and topological continuity coincide. Our consideration of continuity naturally lead to the construction of constructing function spaces that we carry out in Section 6. In the classical theory, function spaces are constructed as the set of Scott continuous functions, with pointwise ordering. Here, we investigate the construction of function spaces on the level of predomain bases. More specifically, we present a construction of a predomain base, the completion of which precisely captures the space of continuous functions between the completion of two bases. In Sections 7 we specialise our theory to our initial motivating example, and recapture real numbers as the total elements of the (continuous completion of the) domain of formal intervals. We show that the Eucildean topology arises as the restriction of the Scott topology to real numbers, and investigate the relationship between Cauchy reals and the domain-theoretic reals. As a consequence of our constructive existence – classical correctness approach, both notions are only equivalent if Markov’s principle holds (and in fact, we can prove Markov’s principle from their equivalence). We conclude by relating - continuous functions to the restrictions of Scott continuous total functions. This unearthes a new notion of continuity which appears to be weaker than uniform continuity but at the same time stronger than pointwise continuity that we call intensional non-discontinuity. We leave the question of a more detailed analysis of this notion to future work.

Related work. We have already mentioned [2] which is closes to the work reported in this paper. The main differences are that our notions of way-below and equality are defined classically whereas op.cit. employs constructive definitions. We also present a construction of function spaces as completion of predomain bases in Section 6.

Our work stands in the tradition of Bishop-style Constructive Analysis, [7], and indeed we work in a purely constructive setting. What is different is our treatment of real numbers that we derive from the interval domain, similarly to the classical treatment of real analysis in [9, 11] via continuous domains, except that we do not focus on the (classical) notion of computability. Again from a classical perspective, our real numbers (and functions) can be thought of as the total objects of (constructively understood) domains, studied in [3], although we don’t investigate the notion of totality per se. The comparison between different notions of continuity on the induced set of real numbers is of course insipred by [13]. Much of this paper is owed to discussions with Helmut Schwichtenberg. His notes [15] develop constructive analysis with a view to program extraction, and the question that motivated the present paper was whether this is also possible using a domain representation of the reals, rather than a Cauchy sequence representation with a worst-case modulus of convergence.

2 Preliminaries and Notation

We work in standard Bishop-style constructive mathematics [7] that we we envisage as being formalised in Higher-Type intuitioonistic arithmetic [18]. We write for the natural numbers, for the integers and for the rationals, and for the positive rationals.

We use the term ’weak existence’ to refer to the weak existential quantifier . In informal reasoning, we often say that ‘there must exist such that ’ or ‘there weakly exists such that ’ for . We read defined operations universally, that is assuming that defines uniquely () and we let denote ‘the unique such that ’, we read a formula as . In particular, if there must exist such that , using does not assert (strong) existence.

3 Predomain Bases and Interpolation

A predomain base is a countable ordered structure that collects finitely representable objects used to approximate elements of ideal structures, such as the real numbers. Examples of predomain bases are finite sequences (approximating infinite streams) and rational intervals (approximating real numbers). The order structure captures information content, such as the prefix ordering for finite sequences, and reverse inclusion for rational intervals.

Predomain bases are the constructive analogue of a base in classical domain theory [1], where arbitrary elements of the domain can be displayed as directed suprema of base elements. In a constructive setting, the totality of the domain is not given and needs to be constructed, similar to the (constructive) notion of real numbers as rational Cauchy sequences with a modulus of convergence. This section discusses basic properties of predomain bases, and we then construct completions in Section 4.

Definition 3.1 (Predomain Bases).

Let be a poset. A chain in is a sequence such that for all . If is (another) poset, we call a function Scott continuous if for all chains , provided that all suprema in the last equality exist. An element is way below an element if there must exist such that whenever is a chain in with and . We write if is way below , and also say that approximates . A chain is an approximating sequence of if for all and . A predomain base is a countable poset with decidable ordering in which every element has an approximating sequence.

A non-empty, finite set is consistent, written if it must have an upper bound, i.e. there must exist such that for all . We say that consistency is continuous if for all and for all implies where is a nonempty, finite set. The poset is bounded complete if every finite consistent subset has a least upper bound , and pointed if it has a least element .

Note that all bounded complete posets are necessarily pointed.

Remark 3.2.

The notion of predomain base differs from that of [2] in that op.cit. requires that an approximating sequence be a -chain. This immediately entails interpolation: if in a predomain base where every element has an approximating -chain, we have for a -chain so that for some by definition of . But then so that , i.e. interpolates between and .

We require that every element can be displayed as where each which is strictly weaker. As a consequence, we need additional hypotheses to establish interpolation in Corollary 3.14. On the other hand, our definition makes it easier to construct predomain bases as we don’t need to ensure that approximating sequences are -chains, as for example in the construction of function spaces given later in Lemma 6.10.

We are also adopting a different (weaker) definition of the way-below relation that is formulated using strong existence in op.cit.. Both are equivalent if Markov’s Principle is assumed. By directly phrasing the way-below relation in terms of weak existence, Markov’s Principle can be avoided. A helpful pattern of proof that exploits weak existence is the following. Suppose that and . Then . Similarly, the notion of bounded completeness, phrased in terms of weak existence, is stronger than that of op.cit. which uses strong existence. Technically, we need to use weak existence of an upper bound to establish that the continuous completion of a (bounded complete) predomain base has suprema of all increasing chains (Corollary 4.5). Conceptually, weak existence suffices as the witness of boundedness of a finite subset of a predomain base is not used in the construction of the least upper bound.

Example 3.3.

Let be a countable set with decidable equality. Then and are predomain bases where is the set of finite sequences of and is the prefix ordering. Both are bounded complete and satisfy for all (resp. ).

If and are predomain bases, then so are and with the pointwise and co-pointwise ordering. Moreover is a predomain base where (we tacitly assume ) and if either or and . The predomain bases , and are the product, coproduct and lifting of and (resp. of ).

Example 3.4.

The poset ordered by iff is called the predomain base of rational intervals. We usually write for the pair and think of as a rational interval. For , we sometimes write to denote the lower and upper endpoint of , and for the symmetric extension of by .

It is not immediate (but easy) to see that is a predomain base. The negative formulation of gives the following characterisation that has been established in [2, Proposition 7.2] using Markov’s Principle.

Lemma 3.5.

Let . Then .


For the only-if direction, assume that . As we can find such that from which we obtain that .

For the converse, assume that and assume that . Then and . We claim that there weakly exist and so that and . So assume that for all . Then is an upper bound of and therefore . Hence , contradiction. The proof of weak existence of is analogous. Hence there weakly exists such that we have , that is, . ∎

Lemma 3.6.

is a predomain base.


Let be given. Then is a approximating sequence of . ∎

Lemma 3.7.

Consistency on is continuous.


Let be a finite set and let for all . Assume furthermore that is consistent for all , we show that is consistent. The latter is the case if . We have, for all , that which implies the claim. ∎

Example 3.8.

Consistency is not automatically continuous. Consider for instance the predomain base and two sequences and . Then and are consistent for all but and are not.

We collect some basic facts about posets and the way-below relation that are used in the proof of our first technical result, the interpolation property (Proposition 3.13 and Corollary 3.14). The majority of results are standard in (classical) domain theory, see e.g. [1], and we include them here both to be self-contained and to demonstrate that they continue to hold in our framework.

Lemma 3.9.

Let be a poset. Then whenever . Moreover, implies that , and similarly implies that , for .


For the first item, assume that . As there must exist such that whence .

Now suppose that . Let . Then there is , weakly, such that whence , too. Now suppose that and let . Then whence there is , weakly, such that . ∎

The proof of the above lemma uses that is -closed which follows from decidability.

Lemma 3.10.

Let be a poset, a finite set and . If and then whenever for all .


Suppose that . Then, for all , we have that , as is an upper bound of . As there must exist such that . Let . Then for all . Hence as is the least upper bound. ∎

Corollary 3.11.

Let be a bounded complete poset and a finite set. If for such that and is consistent, then both and exist in and .


As is consistent, exists in , and there must exist an upper bound such that for all . Moreover, for all as hence is also consistent (with upper bound ), hence exists in , and the claim follows from Lemma 3.10. ∎

Lemma 3.12.

Let be a poset and and chains in . If exists in and then .


We first show that is an upper bound of for all . We have that as is an upper bound of and is an upper bound of . Similarly . Hence is an upper bound of and follows as is the least upper bound.

Now we show that is indeed the least upper bound of . So take another upper bound , that is, for all . Then and for all . Hence and . As is the least upper bound of and , it follows that . ∎

The above facts are used to prove our first result, the (weak) interpolation property.

Proposition 3.13.

Let be a bounded complete predomain base, and assume that on is decidable. Then has the weak interpolation property, that is, whenever for there must exist such that .


We adapt the (classical) proof based on directed suprema ([1, Lemma 2.2.15]) to our setting. Assume that , and let .

As and is a predomain base, we can find an element with (e.g. the first element of an approximating sequence of ). By the same reasoning, we can find with . Let and consider the sequence

Then is well-defined, as suprema are taken over a non-empty, bounded (by ) and finite set.

We now claim that . First, it is clear that for all . To see that is a least upper bound of the , suppose that for all , and we show that . Let be an approximating sequence for . As , it suffices to show that for all . So let . As , there exists an approximating sequence for , and in particular for all . Now fix an arbitrary , we show that . As is countable, we can find such that and . Let . Then and therefore as . As we have that . As was arbitrary, this implies that . By the same argument, as was arbitrary and , we may conclude that , thus establishing the claim.

We now have that . Therefore, there weakly exists such that . Let where is a finite, non-empty set. For each we can moreover find with .

By Lemma 3.10 we have that . Therefore is our desired interpoland. This (only) shows weak existence of an interpoland, due to the weak existence of the number used in its construction. ∎

Corollary 3.14.

Let be a bounded complete predomain base for which is decidable. If and for all then there must exist an interpoland such that for all .


By the previous lemma, we can find interpolants for each such that . By Lemma 3.10 we have that satisfies and moreover so that for all . ∎

We conclude the section with a technical lemma on swapping the order of suprema that we will use later.

Lemma 3.15.

Suppose that is a poset and is monotonic, i.e. and implies . Then

  1. the sequence is monotonic for all

  2. if exists for all , then is monotonic

  3. if both and both exist, they are equal.


The first item is immediate by monotonicity of . For the second item, fix . We show that . This is immediate as is an upper bound of for all .

For the last item, suppose that and both exist, in particular this entails that exists for all . We first show that is an upper bound of all for all . By monotonicity, we have that . To finish the proof, we need to show that is the least upper bound of for all . So let be a competitor, i.e. for all . We show that . This follows once we establish that for all as is the least upper bound of all . So let . But this is evident as by assumption. ∎

Corollary 3.16.

Let be a poset that has suprema of all increasing chains, and let be monotone. Then both and exist and are equal.

4 Completion of Predomain Bases

We give a direct description of the rounded ideal completion of [2] with ideals being represented by chains. The rounded ideal (or continuous) completion is distinguished from the ideal completion by the definition of the order on the completion in terms of approximation on the underlying predomain base, rather than in terms of its order.

Definition 4.1 (Continuous Completion).

Let be a predomain base. The continuous completion of is the set of increasing sequences in , with partial order defined by

for increasing sequences and in .

The function that maps to the constant sequence is called the canonical embedding, and in the sequel we identify elements in with their canonical embedding.

The above definition of the order on the completion of a predomain base showcases the first instance of our “constructive existence – classical correctness” approach in the classical definition of the order relation on the completion above. In particular, this implies that a realiser of carries no computational content. It is straightforward to see that the order relation defined above is in fact a partial order. We omit the straightforward proof of this fact.

Lemma 4.2.

The order relation on the continuous completion of a predomain base is a preorder.

In particular, this makes into a poset where iff and . This definition of equality immediately entails that arbitrary suprema, if they exist, are unique up to equality, i.e. and implies . Moreover, suprema are extensional: if for all and , then .

It is an easy but very useful observation that every element of the continuous completion is equal to the supremum of the elements of (the canonical embeddings of) its representing sequence.

Lemma 4.3.

Let be a predomain base and . Then .


First, is an upper bound of all . To see this, let and with . We have to show that there must exist some with . But this clearly holds for . To see that is the least upper bound of all , consider a competing upper bound with for all . To see that , let , with . As there must exist such that which is precisely what we need to show for . ∎

We now show that the continuous completion of a predomain base has suprema of all increasing chains. Below, we write if for all and say that a predomain base has weak interpolation if there weakly exists such that whenever is finite and .

Lemma 4.4.

Let be a predomain base and an approximating sequence of . If is an increasing sequence in and , then the following statements hold.

  1. the set is consistent. If consistency is continuous, the same applies to the set .

  2. the sequence is increasing. If consistency is continuous, the same applies to the sequence .

  3. If has weak interpolation, we have for all . If consistency on is moreover continuous, also for all .

  4. if for all , then . If consistency on is continuous, then also .


For the first item, fix and let . As is an approximating sequence of we have . As , there must exist such that . Let . Then so that is an upper bound of .

Now assume that consistency is continuous. Then consistency of follows if the sets are consistent for all . Let and . By what we have just demonstrated, there must exist an upper bound of the set . We show that is an upper bound of . This follows since for we have that and the fact that is an upper bound of .

The second item, monotonicity of and is clear since both and .

For the third item, we begin by showing that . So fix and suppose that , we show that there must exist such that . As there must exist such that . The same relation holds if we replace by so we assume that without loss of generality. Then as required. Now assume that consistency is continuous. To see that , fix , and assume that . We show that there must exist such that . This holds, for example, if for then .

For the last item, assume that and for all . We first show that . To see this, fix , and assume that . We show that there must exist such that . By assumption, we have . Fix . Since and , there must exist such that . If , we have for all . Hence, by Corollary 3.11 we obtain as required. Now suppose that consistency is continuous. To see that , fix and such that . We show that there must exist such that (as above) . Fix . As there must exist such that . For this , we moreover have that so that there must exist for which since . Hence for we have that so that by Corollary 3.11, and finally as desired. ∎

The last lemma finally puts us into a position to show that the completion of a predomain base is in fact complete.

Corollary 4.5.

Let be a bounded complete predomain base. Then has suprema of all increasing chains.


For bounded complete predomain bases, we have established the weak interpolation property in Corollary 3.14. The claim follows from Lemma 4.4. ∎

We have the following extension theorem.

Proposition 4.6.

Suppose that and are predomain bases for which consistency is continuous, and suppose that has weak interpolation. Then every continuous map has a Scott-continuous extension .


Let be an approximating sequence for each element . Define for a monotone sequence . Then is monotone as is monotone. We show that is Scott-continuous. For this we fix an increasing sequence where and use Lemma 4.4 to establish that

for the -th element of using that consistency on is continuous. For the -th element of we similarly obtain

also using Lemma 4.4 and continuity of consistencey on . For the claim, we need to establish . To see that fix and such that . We show that there must exist such that . As has weak interpolation, there must exist such that . Therefore

using continuity of . Therefore there must exist such that . As for and there must exist such that . Let . Then . For we therefore obtain that . For the reverse direction fix and such that . We show that there must exist such that . But this is evident for as by monotonicity of , for all , whence . ∎

We now show that bounded completeness transfers from a predomain base to its completion.

Lemma 4.7.

Let be a bounded-complete predomain base and suppose that consistency on is continuous. Let be finite and consistent.

  1. is consistent for all .

i.e. the completion of a bounded-complete predomain base is bounded complete, and finite suprema of consistent sets are calculated pointwise.


For the first item, let be an upper bound of , and let be an approximating sequence of . As consistency on is continuous, it suffices to show that is continuous for all . So let . For , as and , there must exist such that . Let . Then is an upper bound of .

For the second item, note that exists since is consistent and is monotone as all are monotone so that