Exhaustible sets in higher-type computation

We say that a set is exhaustible if it admits algorithmic universal quantification for continuous predicates in finite time, and searchable if there is an algorithm that, given any continuous predicate, either selects an element for which the predicate holds or else tells there is no example. The Cantor space of infinite sequences of binary digits is known to be searchable. Searchable sets are exhaustible, and we show that the converse also holds for sets of hereditarily total elements in the hierarchy of continuous functionals; moreover, a selection functional can be constructed uniformly from a quantification functional. We prove that searchable sets are closed under intersections with decidable sets, and under the formation of computable images and of finite and countably infinite products. This is related to the fact, established here, that exhaustible sets are topologically compact. We obtain a complete description of exhaustible total sets by developing a computational version of a topological Arzela--Ascoli type characterization of compact subsets of function spaces. We also show that, in the non-empty case, they are precisely the computable images of the Cantor space. The emphasis of this paper is on the theory of exhaustible and searchable sets, but we also briefly sketch applications.


Introduction
A wealth of computational problems of interest have the following form: Given a set K and a property p of elements of K, decide whether or not all elements of K satisfy p.For K fixed in advance, this is equivalent to the emptiness problem for p.One is often interested in suitable restrictions on the possible syntactical forms of the predicate p that guarantee that this problem is decidable (or, less ambitiously, that the non-emptiness problem is semi-decidable) uniformly in the syntactical form of p.In this work, on the other hand, the emphasis is on the set K rather than the predicate p, and we study the case in which K is infinite.Moreover, p is not assumed to be given syntactically or via any other kind of intensional information: we only use information about the input-output relation determined by p considered as a boolean-valued function.In the absence of intensional information, continuity of p plays a fundamental role, where p is continuous iff for any x in the domain of p, the boolean value p(x) depends only on a finite amount of information about x.We work in the realm of higher-type computation with continuous functionals, using Ershov-Scott domains to model partial functionals, and Kleene-Kreisel spaces to model total functionals [34,31].
We say that the set K is exhaustible if the above problem can be algorithmically solved for any continuous p defined on K, uniformly in p.The uniform dependency on p is formulated by giving the algorithm the type (D → B) → B, where D is a domain, K ⊆ D, and B is the domain of booleans.The main question investigated in this work is what kinds of infinite sets are exhaustible.
Clearly, finite sets of computable elements are exhaustible.What may be rather unclear is whether there are infinite examples.Intuitively, there can be none: how could one possibly check infinitely many cases in finite time?This intuition is correct when K is a set of natural numbers: it is a theorem that, in this case, K is exhaustible if and only if it is finite.This can be proved by reduction to the halting problem, but there is also a purely topological argument (Remark 5.6).However, it turns out that there is a rich supply of infinite exhaustible sets.A first example, the Cantor space of infinite sequences of binary digits, goes back to the 1950's, or even earlier, with the work of Brouwer, as discussed in the related-work paragraph below.
We say that K is searchable if there is an algorithm that, given any continuous predicate p, either selects some x ∈ K such that p(x) holds, or else reports that there isn't any.It is easy to see that searchable sets are exhaustible.We show that, for sets of total elements, the converse also holds and hence the two notions coincide.Moreover, a selection functional can be constructed uniformly from a quantification functional (Section 6).
We develop tools for systematically building exhaustible and searchable sets, and some characterizations, including the following: they are closed under intersections with decidable sets, under the formation of computable images and of finite and countably infinite products (Section 4).In the case of exhaustibility, the last claim is restricted to sets of total elements, and is open beyond this case.The non-empty exhaustible sets of total elements are precisely the computable images of the Cantor space (Section 6).We also formulate and prove an Arzela-Ascoli type characterization of exhaustible sets of total elements of function types (Section 7).
The above closure properties and characterizations resemble those of compactness in topology.This is no accident: we show that exhaustible sets of total elements are indeed compact, in the Kleene-Kreisel topology (Section 5).This plays a crucial role in the correctness proofs of some of the algorithms, and, indeed, in their very construction.Thus, the specifications of all of our algorithms can be understood without much background, but an understanding of the working of some of them requires some amount of topology.We have organized the presentation so that the algorithms occurring earlier are motivated by topology but don't rely on knowledge of topology for their formulation or correctness proofs.
In Section 2 we include background material that can be consulted on demand and in Section 3 we define the central notions investigated in this work.In Section 8 we include technical remarks, further work, announcement of results, applications, and research directions.In the concluding Section 9 we review the role topology plays in our investigation of exhaustible and searchable sets.Related work.Brouwer's Fan functional gives the modulus of uniform continuity of a discretevalued continuous functional on the Cantor space.According to personal communication by Dag Normann, computability of the Fan functional was known in the late 1950's.This immediately gives rise to the exhaustibility of the Cantor space.A number of authors have considered the definability of the Fan functional in various formal systems.Normann [34] cites Tait (1958, unpublished), Gandy (around 1982, unpublished) and Berger [7] (1990).Tait showed that the Fan functional is not definable from Kleene's schemes S1-S9 interpreted over total functionals.Berger observed that, for partial functionals, PCF definability coincides with S1-S9 definability, and showed that the Fan functional is PCF definable.In order to do that, he first explicitly defined a selection functional for the Cantor space.Then Hyland informed the community that Gandy was aware of the PCF/S1-S9 definability of the Fan functional for the partial interpretation of Kleene's schemes, but Gandy's construction seems to be lost.
Acknowledgements.I have benefited from stimulating discussions with, and questions by, Andrej Bauer, Ulrich Berger, Dan Ghica, Achim Jung, John Longley, Paulo Oliva, Matthias Schröder, and Alex Simpson.I also thank Dag Normann for having answered many questions regarding the history and technical ramifications of the subject of higher-type computation, and for sending me a copy of Tait's unpublished manuscript -but the reader should consult his paper [34] for a more accurate and detailed account.

Background
The material developed here can consulted on demand, except for Section 2.1, which introduces and briefly discusses our model of computation.Some readers will be more familiar with domain theory and Ershov-Scott continuous functionals (and PCF or functional programming) via denotational semantics, and others with the Kleene-Kreisel continuous functionals via higher-type computability theory, and we consider these two models and their relationship [34].Alternatively, we could have worked with Weihrauch's model of computation via representations [46], which generalizes Kleene's approach via associates [31].Even better, we could have worked with the QCB model of computation, which subsumes both domain theory and representation theory in a natural way [3,4].We adopt the Ershov-Scott and Kleene-Kreisel approaches as they have played a wide role [34].A presentation based on QCB spaces would have been not only more general but also cleaner in several ways, but less familiar and perhaps more technically demanding.Our objective in this paper is to address the essential issues without getting distracted by an excessive amount of generality.
2.1.Domains of computation.We work on a cartesian closed category of computable maps of effectively given domains that contains the flat domains of booleans, B = {0, 1, ⊥}, and of natural numbers, N = N ∪ {⊥}, such as [17] or [44] among other possibilities.Notice that these categories are closed under countable cartesian powers.We don't need to, and we don't, explicitly refer to effective presentations, and in particular to numberings of finite elements or abstract bases etc. to formulate computability results.We instead start from well known computable functions and use the fact that computable functions are closed under definition by lambda abstraction, application, least fixed points etc.Moreover, we don't invoke non-sequential functions such as Platek's parallel-or [41] or Plotkin's parallel-exists [35] in order to construct new computable functions.Our algorithms can thus be directly understood as functional programs in e.g.PCF [35], FPC [37] (PCF extended with recursive types, interpreted as solutions of domain equations) or practical versions of FPC such as Haskell [12,25], as done in [19].
At some point we need further assumptions on our domains of computation to be able to formulate and prove certain results.Some of those results can be formulated, and perhaps also be proved, for domains with totality in the sense of Berger [8].We consider the particular case consisting of the smallest collection of domains containing B and N and closed under finite products, countable powers and exponentials (=function spaces).

2.2.
Higher-type computation.The remainder of this section is not needed until Theorem 4.9.As discussed in e.g.[34,29,30], there are many approaches to higher-type computation.Kleene defined the total functionals directly, but it has been found more convenient to work with the larger collection of partial functionals and isolate the total ones within them, as done by Kreisel.The approaches are equivalent, and such total functionals are often referred to as Kleene-Kreisel functionals or continuous functionals.It turns out that, as discussed by Normann [34], this coincides with another approach that also arises programming language semantics: equivalence classes of total functionals on Ershov-Scott domains.We work with both total functionals on domains and a characterization of the Kleene-Kreisel functionals, due to Hyland, in terms of compactly generated spaces.
Types.The simple types are defined by induction as where o and ι are ground types for booleans and natural numbers respectively.The subset of pure types is defined by σ ::= ι | σ → ι.As usual, we'll occasionally reduce statements about simple types to statements about pure types.
Partial functionals.For each type σ, define a domain D σ of partial functionals of type σ by induction as follows:

Dσ
where the products and exponentials are calculated in the cartesian closed category of continuous maps of Scott domains, where a Scott domain is an algebraic, bounded complete, and directed complete poset [1].
Total functionals.For each type σ, define a set T σ ⊆ D σ of total functionals and a relation ∼ σ on D σ as follows, where γ ranges over the ground types o and ι: Then the set T σ can be recovered from the relation ∼ σ as and the relation can be recovered from the set as x ∼ σ y ⇐⇒ x ⊓ y ∈ T σ ⇐⇒ x, y ∈ T σ and x and y are bounded above.
Computability.Plotkin [35] characterized the computable partial functionals as those that are PCF-definable from parallel-or and parallel-exists [35].All computable functionals we construct from Section 6 onwards are defined in PCF without parallel extensions.This characterization of computability includes, in particular, total functionals.An interesting fact, which we don't need to invoke, is that every total functional definable in PCF with parallel extensions is equivalent to one definable in PCF without parallel extensions [32].
2.3.Kleene-Kreisel functionals.For each type σ, define by induction a set C σ of Kleene-Kreisel functionals of type σ and a surjection ρ σ : T σ → C σ as follows, so that For ground types and product types, define For function types, consider the diagram ( †) The square (1) commutes for some map T σ → T τ if and only if f ∈ T σ→τ , and in this case the map is uniquely determined as the (co)restriction of f .Moreover, in this case, there is a unique map φ making the square (2) commute, because ρ σ is a surjection.We define Then, by construction, for any σ and all x, y ∈ D σ , we have that x ∼ σ y iff x, y ∈ T σ and ρ σ (x) = ρ σ (y).

M. ESCARD Ó
If ( †) commutes, we say that f is a representative of φ.A Kleene-Kreisel functional is computable iff it has a computable representative.
A stronger form of this is known as "simple types are retracts of pure types" (see e.g.[30]).Here we use the fact that every pure type is either ι or of the form τ → ι, and that ι is a retract of τ → ι for any τ .

2.4.
Compactly generated spaces.The remainder of this section is not needed until Section 5, where it is used in order to formulate and prove the crucial Lemma 5.5 that establishes compactness of exhaustible sets of total elements.Compactly generated Hausdorff spaces, or k-spaces, to be introduced shortly, are to total computation as Scott domains are to partial computation.This becomes clear in Section 2.5.Here we briefly introduce k-spaces and some of their fundamental topological properties that are applied to prove various computational theorems.For more details and proofs, see e.g.[21] or the references contained therein.
We begin by considering the Hausdorff case.If F is a closed set of a Hausdorff space X, then K ∩ F is closed for every compact set K ⊆ X.Any set F that satisfies this condition is called k-closed.The Hausdorff space X is a k-space iff every k-closed set is closed.(This is equivalent to saying that X is the colimit of its compact subspaces ordered by inclusion.)Any Hausdorff space can be transformed into a k-space by stipulating that all k-closed sets are closed.In categorical terms, this construction is a coreflection of the category of Hausdorff spaces into its subcategory of k-spaces.
The category of Hausdorff k-spaces is cartesian closed.Given objects X and Y , their categorical product X ×Y is the coreflection of their topological product.Their exponential Y X consists of the continuous maps X → Y under the coreflection of the compact-open topology.The compact-open topology has subbasic open sets of the form where K is a compact subset of X and V is an open subset of V .Cartesian closedness amounts to the fact that the evaluation map is continuous, and that for any continuous map f : We also need to consider k-spaces without the restriction to the Hausdorff case.Let X be an arbitrary topological space.A probe is a continuous function p : K → X where K is a compact Hausdorff space.A set F ⊆ X is k-closed if p −1 (F ) is closed for every probe p : K → X.Then, again, X is a k-space iff every k-closed set is closed, and kspaces form a cartesian closed category, and the inclusion of Hausdorff k-spaces preserves products and exponentials.All locally compact spaces are k-spaces, and this includes non-Hausdorff examples such as Scott domains under the Scott topology.The description of the products and exponentials in the general case is omitted and the reader is referred to the above references, but in any case they are not needed for the purposes of this work, with one exception: an exponential of k-spaces whose base is the Sierpinski space has the Scott topology [21].This is applied in the proof of the following lemma.
Denote by S the Sierpinski space with an isolated point ⊤ and a limit point ⊥.This is the same as the domain {⊥, ⊤} under the Scott topology.For any topological space X, a function p : X → S is continuous iff p −1 (⊤) is open, and a set U ⊆ X is open iff its characteristic function χ U , defined by χ U (x) = ⊤ ⇐⇒ x ∈ U , is continuous.Thus, using the Sierpinski space, the notion of openness is reduced to that of continuity.The following reduces the notion of compactness to that of continuity (a particular case of this is proved in [18], with essentially the same proof as the one give here).lattice of open sets to the points of S X , and it was shown in [21] that the topology of the exponential S X is the one induced by this bijection.Hence the functional 2.5.Hyland's characterization of the Kleene-Kreisel functionals.For certain constructions and proofs of algorithms, we consider a topology on the set of Kleene-Kreisel functionals.
Definition 2.3.Endow T σ with the relative Scott topology and C σ with the quotient topology of the surjection ρ σ : T σ → C σ .We refer to this topology on C σ as the Kleene-Kreisel topology, and to the resulting spaces C σ as the Kleene-Kreisel spaces.The points of the Kleene-Kreisel spaces are often referred to as the continuous functionals in the highertype computability (or higher-type recursion) literature.
A proof of the following inductive topological characterization of the Kleene-Kreisel spaces, attributed to Hyland, can be found in Normann [31].
The following two lemmas, which are part of the folklore of the subject, are applied in order to show that exhaustible sets of total elements are compact in the Kleene-Kreisel topology (Lemma 5.5(1)).A set is called clopen if it is both closed and open.Lemma 2.5.For every clopen U ⊆ C σ there is a total predicate p ∈ (D σ → B) such that Proof.Because U is clopen, its characteristic function χ U : C σ → 2 is continuous, and hence so is the composite i • χ U • ρ σ : T σ → B, where i : 2 → B in the inclusion.Because T is dense in D σ (see e.g.[8]) and because Scott domains, and hence B, are densely injective (see e.g.[24]), by definition of injectivity this extends to a continuous function p : D σ → B. Then p is total by construction, and the extension property amounts to the above set inclusions.
A space is zero-dimensional iff it has a base of clopen sets.The zero-dimensional reflection ZC of a space C is obtained by taking the same set of points and the clopen sets as a base.
Lemma 2.6.ZC σ and C σ have the same compact subsets.
Proof.We first show that KZC = C where C = C σ and K is the coreflector into the category of k-spaces.The property KZC = C is easily seen to be inherited by retracts, and hence, by Lemma 2.1, it is enough to consider σ = τ → ι, and hence C = N Y for some k-space Y .Exponentials in k-spaces are given by the k-coreflection of the compact-open topology on the set of continuous maps.When the target is N, the compact-open topology is clearly zero-dimensional and Hausdorff.Now, it is easy to see that KZC = C iff there is some zero-dimensional topology whose k-reflection is C, and hence we are done.The result then follows from the well-known fact that a Hausdorff space has the same compact sets as its k-coreflection.
If the spaces C σ were zero-dimensional, the above lemma would be superfluous.But Matthias Schröder [39] has recently shown, after this paper was produced and refereed, that the spaces C σ are not zero-dimensional, and in fact not even regular, answering a question of [5,33].

Exhaustible and searchable sets
We now formulate the central notions investigated in this work.Definition 3.1.if K is a subset of the domain D, we say that a predicate p ∈ (D → B) is defined on K if p(x) = ⊥ for every x ∈ K. Definition 3.2.We say that a subset K of the domain D is exhaustible if there is a computable functional ∀ K : (D → B) → B such that for any p ∈ (D → B) defined on K, Such a universal quantification functional is not uniquely determined, because its behaviour is not specified for predicates p that are not defined on K.For the sake of clarity, we'll often write "∀ K (λx. . . .)" as "∀x ∈ K. . . .".
Clearly, it is equivalent to instead require the existence of a computable functional ∃ K : (D → B) → B such that for any p ∈ (D → B) defined on K, because such functionals are inter-definable by the De Morgan Laws and hence we'll freely switch between them.
We now formulate searchability in a way slightly different from that of the introduction, which is more convenient for our purposes.The only essential difference is that the present, official definition excludes the empty set (cf. Remark 3.5).Definition 3.3.We say that a set K ⊆ D is searchable if there is a computable functional ε K : (D → B) → D such that, for every predicate p ∈ (D → B) defined on K, (1) ε K (p) ∈ K, and (2) p(ε K (p)) = 1 if p(x) = 1 for some x ∈ K. Again, notice that the selection functional ε K is not uniquely determined by K.
Thus, ε K (p) is an example of an element of K for which p holds, if such an element exists, or a counter-example in K if no such example exists.Lemma 3.4.Searchable sets are exhaustible.
The empty set is exhaustible with ∀ ∅ (p) = 1, but it is not searchable because the condition ε ∅ (p) ∈ ∅ cannot hold.But we'll see in Section 6 that, under fairly general and natural conditions, the two notions turn out to agree in the non-empty case.Moreover, it is clear that non-empty finite sets of computable elements are both exhaustible and searchable.Remark 3.5.With 1 = {⋆}, an equivalent definition of searchability is that (1) K has a computable element e K , and (2) there is if there is no example, and otherwise ε ′ K (p) ∈ K and p(ε ′ K (p)) = 1.In fact, given ε K one can define e K = ε K (λx.1) and Conversely, given ε ′ K and e K as specified, one can define Regarding examples, we'll deduce later the known fact that the Cantor space is searchable.For the moment, we show that the natural numbers with a point at infinity form a searchable set.Definition 3.6.The one-point compactification of the natural numbers is the subspace N ∞ of the Cantor space 2 ω ⊆ B ω consisting of the sequences 0 n 1 ω (representing natural numbers n) and 0 ω (representing the added point at infinity).
The relative Scott topology on the Cantor space agrees with the product topology of the discrete space 2, but such topological considerations are not needed until Section 5.In constructive mathematics, N ∞ is equivalently defined as the set of sequences α ∈ 2 ω with α i ≤ α i+1 , to avoid excluded middle.In functional programming, N ∞ also arises as the set of maximal elements of the domain of lazy natural numbers.
Example 3.7.N ∞ is searchable, with selection functional ε N∞ defined by primitive recursion as This construction is implicit in Exercise 1 of Barendregt [2, Page 581], attributed to Kreisel.The point of that exercise is that this algorithm can be interpreted as a functional in the full type hierarchy, defined in Gödel's system T , that also works for discontinuous p.The exercise uses this to prove that the substructure of definable elements is not extensional, or equivalently, that the set-theoretical model of system T fails to be fully abstract.This exercise was brought to my attention by Gordon Plotkin and Alex Simpson, after I posed this full abstraction question to them.Notice that the Kleene-Kreisel model of system T is fully abstract, using the fact that the elements of a dense set are definable.

Building new searchable sets from old
In this section we develop algorithms that don't require knowledge of topology but are motivated by topological considerations.Starting from the finite sets, the algorithms allow us to systematically build plenty of infinite searchable sets.The intuition behind the topological notion of compactness is that compact sets behave, in many relevant respects, as if they were finite.Infinite sets that admit exhaustive search in finite time share the same intuition.Hence it is natural to conjecture that they also share similar structural properties.For example, compact sets are closed under the formation of products (Tychonoff theorem).Motivated by this, in this section we show that searchable sets are closed under countable products, and we also export other closure properties from topology to computation.Definition 4.1.For a given set K ⊆ D, we say that a set The topological motivation for the above proposition is that the intersection of a closed set with a compact set is compact.Decidable sets correspond to sets that are open and closed, and hence, bearing in mind that exhaustible sets (ought to) correspond to compact sets, the above proposition ought to be true, which it is.It is an easy exercise to show that exhaustible and searchable sets are closed under binary unions.But binary intersections are problematic.In fact, in topology, in the absence of assumptions such as the Hausdorff separation axiom, compact sets fail to be closed under binary intersections.Hence any algorithm for binary intersections would have to exploit specialized topological and/or ordertheoretic properties of domains.The topological motivation for the following proposition is that, in topology, continuous images of compact sets are compact.In fact, it arises by replacing continuity by computability and compactness by exhaustibility.Proposition 4.3.Exhaustible and searchable sets are closed under the formation of computable images.
Proof.Let f ∈ (D → D ′ ) be computable and let K be a subset of D. For any quantification functional is clearly a quantification functional for f (K).
For any selection functional ε K : (D → B) → D, the following definition gives a selection functional ε f (K) : (D → B) → D: That is, first find x such that q(f (x)) holds, using ε K , and then apply f to this x.
The following corresponds to the fact that compact sets in topology are closed under finite products: Proposition 4.4.Exhaustible and searchable sets are closed under the formation of finite products.
Proof.For K ⊆ D and K ′ ⊆ D ′ exhaustible, define ), using the fact that searchable sets are exhaustible, and let ε K×K ′ (p) = (x, x ′ ).
Compact sets in topology are closed under arbitrary products.We now show that searchable sets are closed under countable products.We would like to show that for any sequence of searchable sets K i ⊆ D i , their product i K i ⊆ i D i is also searchable, but this would require dependent types, which are not part of the traditional higher-type computation formalism (but see [10] and [9]).So we assume that the components K i of the product are all subsets of the same domain D, so that i K i ⊆ D ω instead, leaving the more general question for future work.
Given selection functionals we wish to construct a selection functional The idea, which iterates the proof of Proposition 4.4, is to let

M. ESCARD Ó
The component x n will be found using ε Kn , and existential quantifications will be recursively reduced to search.To make this precise, we change notation.Given a sequence such that ε i is a selection functional for K i , we wish to find that is a selection functional for i K i .That is, we are looking for a computable functional that transforms any sequence of selection functionals for subsets of D into a selection functional for a subset of D ω : To complete the derivation of the functional Π, we reduce the existential quantification to a suitable recursive call to Π.If the functional Π is to meet its specification, Π(λi.ε i+n+1 ) should be a selection functional for the set i K i+n+1 .But a searchable set is exhaustible by Lemma 3.4.To implement the proof of this lemma in our situation, for any given p, n, x n , define For the sake of clarity, here we have used " * ", rather than juxtaposition as above, to indicate concatenation of elements and sequences.Then )).To find x n such that this holds, we use ε n : Because we don't want a different variable x n for each n, we rename the variable to simply x.This completes our derivation of the product functional: where and where for any sequence β we write β (k) to denote the sequence β with the first k elements removed: For future use, we also write β ′ = β (1) and The original proof of the following theorem, sketched in [19], uses an auxiliary recurrence relation and dependent choices.The following more elegant proof, based on alternative recurrences and bar induction, was presented to me by Ulrich Berger and is included with his permission: ).We prove the properties (1)(n) and (2)(n) simultaneously by course of values induction.Proof of (1)(n) assuming (2)(k) for all k < n: By the assumption, Hence (2), and hence This completes the proof of the claim.
For a subset L of a domain E and q : E → B defined on L, say that an element x ∈ L solves q over L if q(x) = ⊥, and q(x) = 1 provided q(y) = 1 for some y ∈ L. Then δ : (E → B) → E is a selection function for L iff δ(q) solves q over L for every q defined on L. Define the proposition S(p, i K i ) by We need to show that if p is defined on i K i then S(p, i K i ) holds.The set of continuous predicates p defined on i K i can be defined as follows by bar induction: (1) if p(⊥) = ⊥ then p is defined on i K i , and (2) if p x is defined on i K i+1 for all x ∈ K 0 then p is defined on i K i .Therefore, it suffices to show that for all p ∈ (D ω → B), and assume that b = ⊥.Then p = λα.b,by monotonicity of p.Let ε i be a selection function for Proof of (ii): Assume the bar induction hypothesis ( †) S(p i is a selection function for K i+1 , it follows from ( †) that Π(ε ′ )(p x ) solves p x over i K i+1 for all x ∈ K 0 .Then λx.p x (Π(ε ′ )(p x )) is defined on K 0 , and since ε 0 is a selection function for K 0 , it follows that Π(ε)(p)(0) ∈ K 0 .
Proof of (ii)(b): Assume p(α) = 1 for some α ∈ i K i .Then α ′ ∈ i K i+1 and p α 0 (α ′ ) = 1, and, by ( †), we have S( (1) The Cantor space 2 ω ⊆ B ω is searchable.A selection functional is given by Π(λi.ε 2 ) where ε 2 is a selection functional for the finite set 2 ⊆ B. (2) If K i ⊆ N is a sequence of finite sets that are finitely enumerable uniformly in i, then i K i ⊆ N ω is searchable, again using the product functional.If a product i K i is searchable, then each set K n is searchable uniformly in n, by Proposition 4.3 as it is the computable image of i K i under the n-th projection.
Remark 4.8.Berger's selection algorithm ε : (B ω → B) → B ω for the Cantor space, mentioned in the introduction, can be written as If one defines ∃ : (B ω → B) → B by ∃(p) = p(ε(p)), as in the proof of Lemma 3.4, then the above definition is equivalent to Our product algorithm is inspired by this idea.
From now on, we rely on Section 2.2 for the definition of totality.By Lemma 3.4 above and by Theorem 6.3 below, a non-empty set of total elements is exhaustible iff it is searchable, and hence the above theorem shows that non-empty, exhaustible sets of total elements are closed under countable products.For Sierpinski-valued, rather than boolean-valued, universal quantification functionals, a countable-product algorithm is given in [18], but we don't know how to approach countable products of boolean-valued quantifiers without the detour via selection functionals at the time of writing.
We now derive a uniform continuity principle from Theorem 4.6, motivated by topological theorems that assert that, in certain contexts, continuous functions are uniformly continuous on compact sets.Define ) is defined on a product i K i of searchable sets, then there is a number n such that for all α, α We cannot conclude that f |n (α) == f (α) for all α ∈ i K i because there is no reason why the predicate λα.f |n (α) == f (α) should be defined on i K i .To overcome this difficulty, let β ∈ i K i+n and define g n (α) = f (α 0 α 1 . . .α n−1 β) so that g n is defined on i K i and above f n .By monotonicity, The following is an immediate consequence of this and Theorem 4.6: Corollary 4.10.The functional fan = fan is computable uniformly in any sequence of selection functionals for the sets K i ⊆ D, and is defined on any f that is defined on i K i .Moreover, if the sets K i consist of total elements of a domain D = D σ , then the fan functional is total.
This holds, in particular, if D = N and each K i is a finite subset of N defined uniformly in i, which is the case that has been considered in higher-type computability theory regarding the fan functional (see e.g.[23]).Here we have generalized this to arbitrary higher types D = D σ .A consequence of the exhaustibility of the Cantor space is that: Corollary 4.11.The total elements of the function space (B ω → N ) have decidable equivalence.
Proof.The algorithm (==) : does the job.This can be generalized as follows, where we now rely on Section 2.3 for the definition of the Kleene-Kreisel spaces C σ .Definition 4.12.The discrete and compact types are inductively defined as The reason for this terminology is that the space C σ is discrete if σ is discrete, and it is compact if σ is compact, as observed in [18].Theorem 4.13.
(2) The total elements of a domain of compact type form a searchable set.
(3) The total elements of a domain of discrete type have decidable equivalence.
Proof.By induction on the definitions of discrete and compact type.The first condition holds by the Kleene-Kreisel density theorem, which gives a computable dense sequence of C σ , and by the fact that C σ is discrete.For the second condition, use Theorem 4.6 with the aid of the first condition, and, for the third one, use the argument of Corollary 4.11.
We conclude this section with a natural notion that plays a fundamental role in our investigation of exhaustible and searchable sets and their relationship.Let D = D σ and D ′ = D σ ′ for types σ and σ ′ .Definition 4.14.We say that a set K ⊆ D is entire if it consists of total elements and is closed under total equivalence.Notice that if p is total then it is defined on every entire set.If p is not total and K is not entire, but if p is defined on K, then p(x) = p(x ′ ) for all x ∼ x ′ in K, because if x ∼ x ′ then x and x ′ are bounded above and hence so are p(x) and p(x ′ ), which then must be equal as they are non-bottom by definition.But if x ∈ K and x ′ ∼ x for x ′ outside K, it doesn't follow that p(x ′ ) = ⊥ (consider e.g.K = {λi.1}for σ = ι → o and p(α) = α(⊥)).
The following closure properties of entire sets are easily verified: Definition 4.15.The image of an entire set by a total function doesn't need to be entire, but it consists of total elements, and hence its closure under total equivalence is entire.We refer to this as its entire image.(Thus, entire images are defined for total functions and entire sets only.)Proposition 4.16.Exhaustible and searchable sets are closed under the formation of computable entire images.
Proof.For given f : D → D ′ and K ⊆ D exhaustible, consider the quantification functional defined in the proof of Proposition 4.3.If f is total and K is entire with entire image L, then we can take ∀ L = ∀ f (K) .To verify this, let q be defined on L. Then q is defined on f (K) ⊆ L, and hence if q(l) = 1 for all l ∈ L, then ∀ L (q) = 1.If, on the other hand, q(l) = 0 for some l ∈ L, then l ∼ f (x) for some x ∈ K.But then q(f (x)) = 0, and so ∀ T (q) = 0, which concludes the verification.The argument for searchable sets is similar.Definition 4.17.Let S = {⊥, ⊤} by the Sierpinski domain and F ⊆ D = D σ be entire.
(1) F is decidable if there is a total computable map ψ F : D → B such that, for all total x ∈ D, ψ Notice that the functions ψ F is not uniquely determined by F , because its behaviour is specified on a subset of D, but that χ F is uniquely determined by F .Notice also F is decidable if and only if it is decidable on T in the sense of Definition 4.1 with K = T .

Compactness of exhaustible sets
A notion analogous to exhaustibility, with the Sierpinski domain S playing the role of the boolean domain B, is considered in [18].A crucial fact, formulated here as Lemma 2.2, is that the (now unique) quantification functional ∀ K : (D → S) → S is continuous iff the set K is compact in the Scott topology of D. Hence, because computable functionals are continuous, Sierpinski-exhaustible sets are compact, and so Sierpinski exhaustibility is seen as articulating an algorithmic version of the topological notion of compactness.The computational idea is that, given any semi-decidable property of D, one can semi-decide whether it holds for all elements of K. Closure properties analogous to the above are established for Sierpinski exhaustibility in [18].

M. ESCARD Ó
The present investigation can be seen as a natural follow-up of that work that arises by asking what changes if one moves from semi-decision problems to decision problems.One significant change is that continuity of a quantification functional ∀ K : (D → B) → B doesn't entail the compactness of K in the Scott topology any longer: Examples 5.1.
(1) There are exhaustible sets that fail to be compact in the Scott topology.
By [40,36], any second-countable T 0 space, e.g. the real line R, can be embedded into the domain D = B ω under the Scott topology.But R is a connected space, which is equivalent to saying that every continuous boolean-valued map defined on it is constant.Hence a predicate p Therefore R is trivially exhaustible: ∀ R (p) = p(0).But it is not compact.Notice also that any space embedded into the total elements of B ω must be totally disconnected, and hence any embedding of R into B ω must assign non-total elements of B ω to some real numbers.One may suspect that if such embeddings are ruled out, this problem would disappear.But this is not the case, as the next example shows.
(2) There are exhaustible sets of total elements that fail to be Scott compact.
In fact, there is a trivial and pervasive counter-example.Let f ∈ ((N → N ) → N ) be total.Then the total equivalence class K of f , as is well known and easy to verify, doesn't have minimal elements, and hence cannot be compact in the Scott topology.But it is exhaustible with ∀ K (p) = p(f ).
One may feel somewhat cheated by the second counter-example, because although the set K is not Scott compact, it is generated by the singleton {f }, which is Scott compact, and because we took ∀ K to be ∀ {f } (cf. the proof of Proposition 4.16).Lemma 5.5(3) below shows that any counter-example is generated by a Scott compact set in a similar fashion.In any case, although exhaustible sets do fail to be compact in the Scott topology, if they consist of total elements then they are compact in the Kleene-Kreisel topology.In order to formulate and prove this, we need some definitions.We now rely on Section 2.3.
(1) By the shadow of a set K ⊆ T we mean its ρ-image in C. Similarly, by the shadow of an element x ∈ T we mean its ρ-image ρ(x) in C.
Recall that the Cantor space is the set 2 ω of maximal elements of B ω .Remark 5.3.Sometimes, for example for the implementation of the product functional defined in Section 4 in the language PCF, which lacks countable powers, one works with the Cantor space within the function space B N .The Cantor space is homeomorphic to the subspace of total strict functions α ∈ B N , where α is strict if α(⊥) = ⊥.It is also homeomorphic to the quotient of the set of all total elements of B N .But notice that the set of maximal elements of B N is not homeomorphic to the Cantor space.This is because the two non-strict elements λi.0 and λi.1 are finite (or order compact), and hence isolated in the relative Scott topology (meaning that the two corresponding singletons are open), and hence the maximal elements have a topology strictly finer than that of the Cantor space, as there are no isolated points in the Cantor space.As is well known in topology, no compact Hausdorff topology can have another compact Hausdorff topology as a strict refinement.Every (computationally) exhaustible set is topologically exhaustible in the sense of the following definition, because computable maps are continuous.Definition 5.4.We say that a set K ⊆ D is topologically exhaustible if there is a continuous map ∀ K ∈ ((D → B) → B) satisfying the conditions of Definition 3.2.
The following is our main tool in the constructions and proofs of correctness and termination of algorithms developed in Sections 6-7.Its proof relies on Sections 2.4 and 2.5.
(1) Any topologically exhaustible set of total elements is Kleene-Kreisel compact.
(2) Any non-empty, Kleene-Kreisel compact entire set is an entire continuous image of the Cantor space and hence is topologically exhaustible.(3) Any Kleene-Kreisel compact entire set has a Scott compact subset with the same shadow.
Proof.(1): Let K ⊆ T be exhaustible.By Lemma 2.6 and the fact that clopen sets are closed under finite unions, to establish compactness of ρ(K), it is enough to consider a directed clopen cover U .By Lemma 2.5, for every U ∈ U there is a total Then q U ⊑ p U , the set {q U | U ∈ U } is directed, and r = U ∈U q U .Because ρ(K) ⊆ U , we have that K ⊆ r −1 (1) and hence ∀ K (r) = 1.So, by continuity of ∀ K , there is U ∈ U with ∀ K (q U ) = 1, and hence with ∀ K (p U ) = 1 by monotonicity.Let x ∈ K. Then p U (x) = 1 by specification of ∀ K and the fact that p U is total and hence defined on K.But then ρ(x) ∈ U , for otherwise ( †) would entail p U (x) = 0.This shows that ρ(K) ⊆ U , and so ρ(K) is compact.
(2): By e.g.[21], any compact subset of C is countably based (even though C is not).But any non-empty compact Hausdorff countably based space is a continuous image of the Cantor space.Hence there is a continuous map 2 ω → C with image ρ(K) for any entire set K ⊆ D. Then the entire image of the Cantor space under any representative B ω → D is K.
(3): This follows from the argument given in (2), because the Cantor space is Scott compact.
Remark 5.6.In particular, this gives a topological view of the computational fact stated in the introduction that exhaustible sets of natural numbers must be finite: all compact sets are finite in a discrete space.Kleene-Kreisel compactness can be expressed as a finite-subcover condition for the Scott topology as follows: An entire set K ⊆ D is Kleene-Kreisel compact if and only if every cover of K by Scott open sets that are closed under total equivalence has a finite subcover.This is a straightforward consequence of the fact that the Kleene-Kreisel topology is the quotient by total equivalence of the relative Scott topology on the total elements.
We also remark that there is a natural topology on D, coarser than the Scott topology, in which all exhaustible sets are compact.Part of the argument of Lemma 5.5 (1) shows that any exhaustible set K is compact in the coarsest topology on D such that all predicates p ∈ (D ∈ B) defined on K are continuous.This is generated by directed unions of basic open sets of the form p −1 (1) with p as above, because such sets are closed under finite unions and intersections.This construction is analogous to the zero-dimensional reflection of a topology, and happens to coincide with it in the case considered in Lemma 5.5 (1), modulo quotienting, and can also be compared with the weak topology in functional analysis.

Searchability of exhaustible sets
We already know that every searchable set is exhaustible (Lemma 3.4).This implication is uniform, in the sense that there is a computable functional that transforms selection functionals into quantification functionals, namely ε → λp.p(ε(p)).We now establish the converse for non-empty entire sets, and some additional results.The fact that exhaustible entire sets are Kleene-Kreisel compact, established in the previous section, plays a fundamental role in the construction of the algorithms Definition 6.1.We say that a set S ⊆ D = D σ is a retract up to total equivalence if there is a function r ∈ (D → D) such that (1) r(x) ∈ S for all total x ∈ D, (2) r(s) ∼ s for all s ∈ S.
In this case, r is total, all elements of S are total, and r(r(x)) ∼ r(x) for all total x.Notice that r is a retract up to total equivalence iff it is a total function and its Kleene-Kreisel shadow ρ(r) : C → C is a retract in the usual topological sense, where C = C σ .Definition 6.2.We say that two entire sets K ⊆ D = D σ and L ⊆ E = D τ are homeomorphic up to total equivalence if there are total functions f ∈ (D → E) and g ∈ (E → D) such that g(f (x)) ∼ x and f (g(y)) ∼ y for all x ∈ K and y ∈ L. This is equivalent to saying that the shadow functions ρ(f ) and ρ(g) restrict to a (true) homeomorphism between the shadows of K and L. In this case, L is the entire f -image of K, and K is the entire g-image of L. Theorem 6.3.If K ⊆ D = D σ is a non-empty, exhaustible entire set then, uniformly in any quantification functional for K: (1) K is searchable.
(2) K is a computable entire image of the Cantor space.
(3) K is computably homeomorphic to some entire exhaustible subset of the Baire domain N ω , up to total equivalence.(4) K is a computable retract up to total equivalence.(5) K is co-semi-decidable.
In particular, after the theorem is proved, one can w.l.o.g.work with total predicates rather than predicates defined on K, as for any predicate p ∈ (D σ → B) defined on K one can uniformly find a total predicate that agrees with p on K, by composition with the retraction.
Proof.We proceed by cases, of increasing generality, on the type of K.The case K ⊆ N is trivial and is implicitly used in the case K ⊆ N ω , which in turn is used in the next case K ⊆ (D → N ).The general case K ⊆ D is reduced to this last case via retracts using Lemma 2.1.
This construction defines ε K uniformly in ∃ K .We could now easily show that K satisfies the other conditions of the theorem, but this won't be required for our proof, as this will follow in later cases.
For future use, notice that if K ⊆ N is entire and exhaustible, then the supremum of the finite set K (which is zero if K is empty and the largest element of K otherwise) can be computed uniformly in any quantification functional for K as sup K = µm.∀n∈ K.n ≤ m.
Hence, the finite enumeration e n of the elements of K, in ascending order, for 0 ≤ n < cardinality(K), is uniformly computable as We stop when we find n such that e n = sup K, and we include e n iff ∃m ∈ K.m = sup K.
(ii) Case K ⊆ N ω .We first argue that we can find some α ∈ K, uniformly in ∃ K , by the following algorithm defined by course-of-values induction on n: Recall that we defined α = n β ⇐⇒ ∀i < n.β i = α i in the paragraph preceding Theorem 4.9.By construction, for every n there is β ∈ K with α = n β, and in particular α is total.Because the shadow of K is compact, it is closed, and because K is entire, α ∈ K, as required.Then we can define, using Proposition 4.2 and the above algorithm to construct α in both cases, Again, this construction defines ε K uniformly in ∃ K .
We now show that K is a computable retract up to total equivalence, uniformly in any quantification functional for K. Define Because the shadow of K is closed, the finite prefixes of its members form a tree whose infinite paths correspond to the elements of K.The above algorithm follows the infinite path α through the tree, either for ever (always following the first case) or until the path exits the tree (reaching the second case).If and when α exits the tree, we replace the remainder of α by the left-most infinite branch of the subtree at which α exits the tree.Then r clearly satisfies the required conditions.
A semi-decision procedure for the complement of K is given by α ∈ K ⇐⇒ r(α) = α, using the fact that apartness of total elements of N ω is semi-decidable.(This is a computational version of the topological fact that retracts of Hausdorff spaces are closed.) We now show that K is a computable entire image of the Cantor space.For any i, the set K i = {α i | α ∈ K} is exhaustible by Proposition 4.3 as evaluation at i is computable.It is enough to show that i {0, 1, . . ., sup K i } ⊆ N ω is an entire image of the Cantor space by a computable map t : B ω → N ω , because then r • t has K as its entire image since K is contained in that product.But this is straightforward: at each stage j of the computation of t(α), look at the next ⌈log 2 (sup K j )⌉ digits of the input α, compute the natural number f (j) represented by this finite sequence, and let t(α)(j) = min(sup K j , f (j)).
(iii) Case K ⊆ (D → N ) where D = D σ for an arbitrary type σ: In order to reduce this to case (ii), we invoke the Kleene-Kreisel density theorem, to get a computable sequence We will define a total function E = E K in the other direction, ) exhibits K as a retract of (D → N ) up to total equivalence.Thus, for f ∈ K, one can recover the behaviour of f at total elements from its behaviour on the dense sequence d.Because this implies that K is the entire image of P (K), and because P (K) is searchable by case (ii), it will follow that K is searchable and an entire image of the Cantor space, because E preserves total equivalence on P (K).
For α ∈ N ω and n ∈ N, define Here we regard α as potentially coding the action of some f on the set of elements d i .The set F α n is decidable on K uniformly in α and n, and hence K α n is uniformly exhaustible by Proposition 4.2.Lemma 6.4.If K ⊆ (D → N ) is a Kleene-Kreisel compact entire set, then for all total α ∈ N ω and all total x ∈ D there is n such that f } is clopen, where we write x = ρ(x).By density of d n , the set n K α n has at most one element, where K α n denotes the shadow of , and hence for all f , By Proposition 4.16, the entire P -image L ⊆ N ω of K is exhaustible.Let r = r L be defined as in case (ii), and define E : where n is the least number such that ∀f, , this can be found uniformly in α, and hence E is computable uniformly in K. Proof of correctness of E.
(a) E is total and maps L into K.Let α ∈ N ω be total.Then r(α) ∈ L, by construction of r, and hence there is g ∈ K with r(α) ∼ P (g), and so with g ∈ K r(α) n for any n.Let x ∈ D be total and n be the least number such that f , and hence E(α)(x) = g(x).Therefore E(α) ∼ g ∈ K, and hence E(α) ∈ K as K is entire, and in particular E is total.By construction E ∼ E • r, and hence, because r exhibits L as a retract up to total equivalence and K is entire, the E-image of L is K.
Continuing from the proof of (a), for α = P (f ) we have r(α) ∼ α by construction of r, and hence for any g ∈ K such that P (g) = r(α) we have A semi-decision procedure for the complement of K is given as in case (ii), , for total functions f ′ and f since K is entire and d is dense.
Because E and P are total, they induce computable Kleene-Kreisel functionals E = ρ(E) : N N → N C and P = ρ(P ) : then the restriction of P to K followed by the co-restriction to its image is a homeomorphism K → P (K): abstractly because any continuous bijection of compact Hausdorff spaces is a homeomorphism, and concretely because the bi-restriction of E is a continuous inverse.Hence any exhaustible subset of (D → N ) is computably homeomorphic to the shadow of some exhaustible subset of the Baire domain N ω , up to total equivalence.
(iv) General case.We derive this from the case (iii).By Lemma 2.1, for any D = D σ there are D ′ = D τ →ι and computable P : D ′ → D and E : D → D ′ such R = E • P is a retraction up to total equivalence and T σ is the entire image of P .Let K ⊆ D be a non-empty, exhaustible entire set, and let K ′ be the entire E-image of K. Then K is the entire image of P (K ′ ), and, because K is entire, a predicate p ′ ∈ (D ′ → B) defined on K ′ holds for all x ′ ∈ K ′ if and only if p ′ • E holds for all x ∈ K. Hence K ′ is exhaustible with . By case (iii) above, K ′ is searchable.Therefore K is searchable by Proposition 4.3.Similarly, the other properties we need to establish are closed under the formation of retracts and hence are inherited from case (iii).
This concludes the proof of Theorem 6.3.

Ascoli-Arzela type characterizations of exhaustible sets
We reformulate a theorem of Gale's [22] that characterizes compact subsets of function spaces (Theorem 7.1).This suggests a characterization of exhaustible entire sets (Theorem 7.5), whose topological version is developed first (Theorem 7.4).The main idea is to replace a condition in Gale's theorem by a continuity condition (Section 7.1), and then further replace it by a computability condition (Section 7.2).This method of transforming topological theorems into computational theorems is the main thrust of the paper [18], which develops many instances of computational manifestations of topological theorems.
7.1.Topological version.The Heine-Borel theorem characterizes the compact subsets of Euclidean space R n as those that are closed and bounded.The Arzela-Ascoli theorem generalizes this to subsets of R X , where X is a compact metric space and R X is the set of continuous functions endowed with the metric defined by A set K ⊆ R X is compact if and only if it is closed, bounded and equi-continuous.Equicontinuity of K means that the functions f ∈ K are simultaneously continuous, in the sense that for every x ∈ X and every ǫ > 0, there is δ > 0 such that d(x, x ′ ) < δ =⇒ d(f (x), f (x ′ )) for all x ′ ∈ X and all f ∈ K.The Heine-Borel theorem is the particular case in which X is the discrete space {1, . . ., n}, for equi-continuity holds automatically for any subset of R X in this case.The above metric on R X induces the compact-open topology.More general Arzela-Ascoli type theorems characterize compact subsets of spaces Y X of continuous functions under the compact-open topology, for a variety of spaces X and Y , with a number of generalizations or versions of the notion of equi-continuity, notably even continuity in the sense of Kelley [28].
Among a multitude of generalizations of the Arzela-Ascoli theorem, that of Gale [22, Theorem 1] proves to be relevant concerning exhaustibility of entire sets: for every open set V ⊆ Y .Gale didn't assume Y to be a k-space and formulated this for the compact-open topology, but his theorem holds for the exponential topology if we require Y to be a k-space.
Regarding compactness, we have already mentioned that a Hausdorff space has the same compact sets as its k-coreflection, and that the exponential topology is the k-reflection of the compact-open topology.Although there are more closed sets in the exponential topology, Gale's argument works with closedness of K in the exponential topology.This follows from the general considerations of Kelley [28,Chapter 7].
The last condition is a version of equi-continuity.Because X is not assumed to be compact, the set K cannot be globally bounded in any sense, but it is pointwise bounded in the sense of the second condition.This gives a characterization of compact subsets of Kleene-Kreisel spaces of the form N C and in particular of Kleene-Kreisel spaces of pure type, because N is regular.However, as discussed in Section 2.5, Matthias Schröder has recently shown that N N N is not regular, and this justifies the restriction of our characterizations of exhaustible entire sets to particular kinds of types in Section 7.2.
Notice that when X = Y = N, this amounts to the well known characterization of compact subsets K of the Baire space N ω as finitely branching trees.The equi-continuity condition, as in the case of the Heine-Borel theorem, is superfluous, because any set is equicontinuous in this case as the topology of the exponent is discrete.Condition (1) says that the elements of K are the paths of a tree, and (2) says that the tree is finitely branching, because the compact subsets of the base space are finite.Lemma 2.2 and the remarks preceding it allow one to consider continuity of functions involving points of a k-space X, open sets and closed sets (using the function space S X and representing open sets and closed sets by their characteristic functions), and compact sets (using the function space S S X and representing compact sets by their universal quantification functionals).We now reformulate Gale's theorem by expressing condition (3) as a continuous version of a slight strengthening of condition (2).
The dependence of (K ∩ F )(x) in the parameters F and x is given by the functional , where we write is open because Φ is continuous, and which shows that the set f ∈K∩F f −1 (V ) is the same as U and hence is open.Definition 7.2.We say topologically decidable etc. taking the continuous versions of Definitions 4.1 and 4.17.
We now formulate and prove an analogue of this theorem, which replaces (i) the Sierpinski space S by the boolean domain B, (ii) Hausdorff k-spaces by Scott domains, (iii) compact subsets by topologically exhaustible entire subsets, (iv) closed subsets by topologically decidable sets (cf.Definitions 3.2 and 5.4).We again apply Gale's theorem, exploiting Hyland's characterization of the Kleene-Kreisel spaces as k-spaces.The proof follows the same pattern as that of Theorem 7.1, but there are a number of additional steps.Firstly, using Gale's theorem, we get continuous maps defined on Kleene-Kreisel spaces.These are extended to continuous maps on domains using the Kleene-Kreisel density theorem and Scott's injectivity theorem, as in Lemma 2.5.(In Theorem 7.5, such an extension will be instead defined by an algorithm, but still relying on the density theorem.)Secondly, the set F in condition ( 2) is closed in Theorem 7.1 but is neither open nor closed in Theorem 7.4, although it has clopen shadow, because the Sierpinski space has been replaced by the boolean domain.To overcome this difficulty, we rely on the following version of Gale's theorem: Remark 7.3.An inspection of the proof of Gale's theorem shows that it also holds if, in condition (3), the set F ranges over subbasic closed sets in the compact-open topology: and every open set V ⊆ Y .In one direction this is clear: if condition (3) holds for all closed F , then it holds for F = N (Q, B).For the other direction, notice that condition (3) is used only in the "Lemma" [22, page 305] for F of this form (the sets W x in the second last line of that page, and the set T of page 306).
Let D = D σ and C = C σ for an arbitrary type σ, and recall the concepts and notation introduced in Definitions 4.17 and 5.4.Theorem 7.4.An entire set K ⊆ (D → N ) is topologically exhaustible if and only if the following two conditions hold: 1. K is topologically co-semi-decidable.
2. The set (K∩F )(x) is topologically exhaustible for any F that is topologically decidable on K, and any x ∈ D total, continuously in F and x.
Here the dependence of (K ∩ F )(x) in F and x is to be given by a functional Proof.(⇒): (1): By Lemma 5.5, the shadow K = ρ(K) ⊆ N C of K is compact and hence closed.Hence the map N C → B that sends f ∈ K to ⊥ and f ∈ K to 1 is continuous.By composition with the quotient map ρ : T → N C , where T = T σ→ι , we get a map T → B.
Because T is dense in (D → N ) and B is densely injective, the domain D σ→ι under the Scott topology is injective over dense embeddings, which means that this map extends to a continuous map (D → N ) → B. By construction, this exhibits K as a topologically co-semi-decidable subset of (D → N ).
(2): Define Γ(ψ F , x) = λp.∀f∈ K.ψ F (f ) =⇒ p(f (x)).The result then follows from the fact that the category of Scott domains under the Scott topology is cartesian closed, and hence functions that are λ-definable from continuous maps are themselves continuous.
(⇐): We apply Gale's theorem to show that the shadow K = ρ(K) is compact.Then it is topologically exhaustible by Lemma 5.5.
Gale (1): If K is topologically co-semi-decidable, then, by definition, we have a continuous function (D → N ) → B that maps f ∈ K to ⊥ and f ∈ K to 1. Hence K is closed in T because it is the inverse image of the closed set {⊥} restricted to T .Because K is entire, it is closed under total equivalence by definition, and hence, because ρ : T → N C is a quotient map, K is closed.
Gale (2): The assumption gives that for any x ∈ D total, K(x) is exhaustible, considering F = (D → N ).Because K is entire and x is total, K(x) ⊆ N. Hence by Lemma 5.5, K(x) is compact in N ⊆ N .
Gale (3): Let F ⊆ N C be a subbasic open set of the form N (Q, V ) with Q ⊆ C compact and V ⊆ N (necessarily) clopen.Then the set Q = ρ −1 (Q) is entire and Kleene-Kreisel compact, and hence, by Lemma 5.5, it is topologically exhaustible.Also, V is a topologically decidable subset of N .So the predicate p : (D → N ) → B defined by ) is continuous and defined on K, and p = ψ F for F = T ∩ p −1 (1).Now define u : D → B by u(x) = Γ(ψ F , x)(χ V ).Then u is continuous and open, because it is closed under total equivalence and because ρ is a quotient map.7.2.Computational version.At this stage of our investigation, such a characterization is available only for certain types, which include pure types, and for entire sets (for the reasons explained in Section 7.1).Let D = D σ and C = C σ for an arbitrary type σ.We establish the computational version of Theorem 7.4.Theorem 7.5.An entire set K ⊆ (D → N ) is exhaustible if and only if the following two conditions hold: 1. K is co-semi-decidable.
2. The set (K ∩ F )(x) is exhaustible for any F decidable on K, and any x ∈ D total, uniformly in F and x.Moreover, the equivalence is uniform.
A few remarks are in order before embarking into the proof.The claim holds, with the same proof, if conditions (1) and ( 2) are replaced by any of the following conditions, respectively: 1 ′ .K is topologically co-semi-decidable. 1 ′′ .K has closed shadow. 1 ′′′ .The shadow of K is closed in the topology of pointwise convergence. 1 ′′′′ .K has compact shadow.

M. ESCARD Ó
2 ′ .The set (K ∩ F α n )(x) is exhaustible, uniformly in n ∈ N , α ∈ N ω and x ∈ D total.Recall (proof of Theorem 6.3) that we defined In the formulation of the theorem, the fact that conditions (1) and ( 2) uniformly imply the exhaustibility of K is in principle given by a computable functional of type However, the computational information given by condition ( 1) is not used in the construction of the conclusion (although the topological information is used in its correctness proof).Moreover, the information given by condition ( 2) is not fully used in the construction.Replacing it by (2 ′ ) we get Additionally the pair α, n is really coding a finite sequence, and, as we have seen, exhaustible sets of natural numbers are uniformly equivalent to finite enumerations of natural numbers.Hence the above can be written as Therefore the above characterization reduces the type level of ∀ K by two.
The last step of the proof of this theorem mimics topological proofs of Arzela-Ascoli type theorems (which we haven't included): to show that K ⊆ Y X is compact under assumptions such as those of Gale's theorem (Section 7.1), one first concludes that x∈X K(x) is compact by the Tychonoff theorem, then shows that the relative topology of K is the topology of pointwise convergence, and that it is pointwise closed, and hence concludes that it is homeomorphically embedded into the product as a closed subset, and therefore that it must be compact.In the proof below, we have replaced the Tychonoff theorem by its countable computational version given by Theorem 4.6, using a dense sequence of the exponent.The first steps of the proof are needed in order to make this replacement possible, and they are modifications of the constructions developed in Section 6.
(⇐): By Theorem 7.4, the set K is topologically exhaustible, and hence is Kleene-Kreisel compact by Lemma 5.5.This compactness conclusion is our only use of Theorem 7.4 in this proof.We apply this to establish the correctness of the algorithms defined below.
Define P : (D → N ) → N ω by P (f )(i) = f (d i ), as in the proof of Theorem 6.3, where d ∈ D ω is a computable dense sequence, and let L = P (K).Because F α n is decidable on K, the set K α n = K ∩ F α n is exhaustible by Proposition 4.2, and K α n (x) is exhaustible uniformly M. ESCARD Ó

Technical remarks, further work, applications and directions
We now discuss some technical aspects of the above development, announce some results that we intend to report elsewhere, and discuss potential applications and directions for future work in this field.An interesting aspect of this selection function for the Cantor space is that it doesn't perform case analysis on the value of p, and so, in some sense, it doesn't work by trial and error.
In order to understand this, first notice that the above recursive definition of δ makes sense if the domain of booleans is replaced by any domain T with an element 1 ∈ T : We consider the case in which T = T ω is the domain of possibly non-well-founded ωbranching trees with leaves labelled by 1.We define this as the canonical solution of the domain equation T ∼ = {1} + T ω , where the sum is lifted.Thus, a tree is either ⊥, or else a leaf 1, or else an unlabelled root followed by a forest of countably many trees.Denote the canonical isomorphism by Then P : T ω → T and the forest δ(P ) ∈ T ω gives a general formula for solving p(α) = 1 with α ranging over 2 ω .In fact, for any given p ∈ (B ω → B), define an evaluation function eval = eval p : T → B by eval(1) = 1, eval(P (α)) = p(λi.eval(α i )).
Equivalently, eval is the unique homomorphism from the initial algebra [1, P ] : {1}+T ω → T to the algebra [1, p] : {1} + B ω → B. Hence the solution α of the equation p(α) = 1 is given by evaluating the general solution δ(P ) at p: We illustrate this with finite forests.Any p ∈ (B ω → B) defined on 2 ω is uniformly continuous, and hence of the form p(α) = q(α 0 , . . ., α n−1 ) for some n and for q : B n → B defined by this equation.Now consider the domain T = T n of n-branching trees, and denote the canonical isomorphism by To make sense of the above definition of δ for this choice of T , define x * (α 0 , . . ., α n−2 , α n−1 ) = (x, α 0 , . . ., α n−2 ) ∈ T n for x ∈ T and α ∈ T n .We tabulate some forests, which grow doubly exponentially, but only exponentially if auxiliary variables are used to denote common subtrees (corresponding to the variable x 0 in the recursive definition of δ): where In order to find (x 0 , x 1 , x 2 ) ∈ B 3 such that q(x 0 , x 1 , x 2 ) = 1 holds, we substitute q for Q in the above equations, compute (x 0 , x 1 , x 2 ), and check whether q(x 0 , x 1 , x 2 ) = 1 holds.If it does, then we have found a solution (in fact the largest in the lexicographic order), and otherwise we conclude that there is no solution.Thus, the forest δ(Q) gives a closed formula for solving the equation q(α) = 1, and telling whether there is a solution, composed only from q and the constant 1.To solve q(α) = 0, just replace 1 by 0 in the formula.
8.2.Solution of equations with exhaustible domain.By definition, a set K ⊆ D is searchable iff for every predicate p ∈ (D → B) defined on K one can find x 0 ∈ K, uniformly in p, such that if the equation p(x) = 1 has a solution x ∈ K, then x = x 0 is a solution.We first observe that this is equivalent to requiring that for every function f ∈ (D → N ) defined on K and any total y ∈ N one can find x 0 ∈ K, uniformly in f and y, such that if the equation f (x) = y has a solution x ∈ K, then x = x 0 is a solution.For one direction, consider the predicate p(x) = (f (x) == y), and, for the other, consider the natural inclusion of B into N (which is the identity under our notation).Clearly, this generalizes from N to any domain E = D σ with σ discrete in the sense of Definition 4.12.But notice that in this case the equation has to be written in the form f (x) ∼ y.
It is natural to ask whether this generalizes to functions f ∈ (D → E) with E arbitrary.But it is known that, in general, if an equation has more than one solution, it is typically not possible to algorithmically find some solution [6].We announce the following result: Let D = D σ→ι and E = D τ →ι for types σ and τ , let K ⊆ D be an exhaustible entire set, F ∈ (D → E) be total and g 0 ∈ E be total.
(1) If the equation F (f ) ∼ g 0 has a solution f ∈ K, unique up to total equivalence, then some f 0 ∼ f is computable, uniformly in F , g 0 and any universal quantification functional for K.
(2) It is semi-decidable whether F (f ) ∼ g 0 doesn't have a solution f ∈ K, with the same uniformity condition.In order to establish this, we prove the following generalization of Lemma 6.4: Let K n ⊆ D σ→ι be a sequence of entire sets such that K n ⊇ K n+1 and that n K n is the equivalence class of some total f .Then one can find a computable total function f 0 ∼ f , uniformly in any sequence of universal quantification functionals for K n .This is not very useful in computable analysis via representations, because typically uniqueness, when it holds, is only up to equivalence of representations rather than total equivalence.But we do have a corresponding result for equations involving real numbers.In light of the following, it is natural to ask whether there is a further corresponding result for real valued functions of real variables.8.3.An exhaustible set of analytic functions.An application of the exhaustibility of the Cantor space to the computation of definite integrals and function maxima has been given by Simpson [43].A generalization of this is developed by Scriven [42].We consider computation with real numbers via admissible Baire-space representations [46] and domain representations [15].For any x ∈ I = [−1/2, 1/2] and any sequence a ∈ [−b, b] ω , the Taylor series n a n x n converges to a number in the interval [−2b, 2b].We announce the following example of a searchable, and hence exhaustible, set: For any real number b > 0, the set A = A b of analytic functions f : has a searchable set of representatives, uniformly in b.In our proof of this, we argue that any f ∈ A can be computed uniformly in its Taylor coefficients and use the fact that [−b, b] ω has a searchable set of representatives.This can be used to deduce that: (1) The Taylor coefficients of any f ∈ A can be computed uniformly in f .
(2) The distance function d A : R I → R defined by Bishop's notion of locatedness [13,14]).(3) For any f ∈ R I , it is semi-decidable, uniformly in f , whether f ∈ A.

8.4.
Peano's theorem.This celebrated theorem asserts that certain differential equations have solutions, but without indicating what the solutions might look like.Its proofs are typically based on the Arzela-Ascoli theorem, and proceed by applying Euler's algorithm to produce a sequence of approximate solutions.In general, however, this sequence is not convergent, but, by an application of compactness, there is a convergent subsequence, although no specific example is exhibited by this argument, which is then easily seen to produce a solution of the equation.It is therefore natural to ask whether our tools could be applied to compute unique solutions of such differential equations under suitable assumptions.Here the goal is not to obtain a usable algorithm, but rather to understand the classical proof from a computational perspective in connection with the notion of exhaustibility and its interaction with the notion of compactness and with the Arzela-Ascoli theorem.8.5.Uncountable products of searchable sets.It is natural to ask whether the countable product theorem 4.6 can be generalized to uncountable index sets.This question is pertinent in view of well known constructive versions of the Tychonoff theorem in locale theory [27] and formal topology [16], which don't restrict the cardinality of the index set.However, this seems unlikely in the realm of Kleene-Kreisel higher type computability theory.Consider the case in which the index set is the Cantor space.By the classical Tychonoff theorem, the product of 2 ω -many copies of 2 is compact.This product could be written as 2 2 ω .But this notation in higher-ype computation is interpreted as a function space, and in the category of Kleene-Kreisel spaces one has 2 2 ω ∼ = N, because the base is discrete and the exponent is compact (cf.Theorem 4.13).This phenomenon in fact also takes place in the categories of locales [26] and topological spaces [18].In the Tychonoff theorem for locales or spaces, the indices form a set or equivalently a discrete space.But a discrete Kleene-Kreisel space is countable (and more generally a discrete QCB space is countable).8.6.Totality of the product functional and bar recursion.In Theorem 4.6 we constructed a computable functional Π such that Π(ε)(p) ∈ i K i whenever ε i is a selection functional for a set K i and p is defined on i K i .It is natural to ask whether the functional Π is actually total.Paulo Oliva has shown that this is indeed the case (personal communication).Moreover, he has observed that if the type of booleans is replaced by the type of natural numbers, our recursive definition of Π still makes sense and that it also gives rise to a total functional, which he calls CBR (course-of-values bar recursion).He additionally proved that CBR is primitively recursively inter-definable with the modified bar recursion functional MBR defined in [11].We are currently investigating together the ramifications of these observations.8.7.Alternative notions of exhaustibility.If one is interested only in total functionals and sets of total elements, it is natural formulate the following alternative notion of exhaustibility: A set K ⊆ D is entirely exhaustible if it is entire and there is a total computable functional ∀ K : (D → B) → B) such that for every total p ∈ (D → B) one has ∀ K (p) = 1 iff p(x) = 1 for all x ∈ K. Because, as we have seen, non-empty, exhaustible entire sets are computable retracts, it follows that any exhaustible entire set is entirely exhaustible.The converse fails (but see the next paragraph), because e.g.any dense subset of the Cantor space is entirely exhaustible using Berger's algorithm and the fact that any total predicate is uniquely determined, up to total equivalence, by its behaviour on a dense of set of total elements.Moreover, when one is only interested in total functions and total elements, it is perhaps more natural to work with Kleene-Kreisel spaces directly, without the detour via domains, e.g.defined as k-spaces.QCB spaces are a natural and general setting for such considerations [3,4].One might say that a subset K of a space X is totally exhaustible if there is a computable functional ∀ K : (X → 2) → 2 such that for every p ∈ (X → 2), we have that ∀ K (p) = 1 iff p(x) = 1 for all x ∈ K.When e.g.X = N N , total exhaustibility of K ⊆ X doesn't entail compactness of K, again considering the example of a dense subset of the Cantor space.But Matthias Schröeder (personal communication in 2006) proved that if X is a QCB space which is the sequential coreflection of a zero-dimensional Hausdorff space, then any totally exhaustible closed set K ⊆ X is compact.This includes the case in which X is a Kleene-Kreisel space.Using this and the above observations, one can show that, as far as higher-type computation with total continuous functionals is concerned, the notions of exhaustibility and total exhaustibility agree for closed sets.8.8.A unified type system for total and partial computation.As we have already discussed, Kleene-Kreisel spaces and Ershov-Scott domains live together in the cartesian closed category of compactly generated spaces, and in fact in the subcategory of QCB spaces.Additionally, the inclusions of k-spaces and of Ershov-Scott domains into these categories preserve the cartesian-closed structure [21,3].Hence total and partial higher-type functionals coexist in the same cartesian closed category.One can envisage a higher-type system that simultaneously incorporates, but explicitly distinguishes, total and partial objects, and corresponding PCF-style formal systems.Among the formation rules one can have two types for the natural numbers, with and without ⊥, and it would make sense to stipulate that σ → τ is a partial type whenever σ is any type and τ is a partial type, and that σ → τ is a total type when both σ and τ are total types.In its simplest form, such a language could include Gödel's system T for total types and PCF for partial types.Such a formalism would have simplified, and made more transparent, much of the development concerning exhaustible sets of total elements, where we could have benefited from functionals that take total inputs and produce potentially partial outputs.In particular, all the technical considerations of total equivalence and shadows could have been avoided in this way, making the development more transparent.Such functionals are actually total, but their construction uses modes of definition that belong to the realm of partial computation.The system-T fragment could be further extended with total computable functionals such as bar recursion and some of those developed here, once one has shown they are indeed total.8.9.Time complexity of exhaustive search.In the paper [19], we report some surprisingly fast experimental results, which serve to counteract an impression that might be gained from the technical development that the algorithms presented would be essentially intractable and of purely theoretical interest.Moreover, that paper formulates run-time conjectures that provide examples of questions that one would like to be able to treat rigorously and that are potentially useful as target problems for work in higher-type complexity theory.The conjectures express the run time in terms of the modulus of uniform continuity of the input predicate on the exhaustible set, and hence topology seems to play a role in higher-type complexity too.8.11.Operational perspective.An advantage of the proof of Theorem 4.6 sketched in [19] is that it can be directly interpreted in the operational setting [18,20].The proofs of the other results of Section 4 are also easily seen to work in the above operational setting.But a development of operational counter-parts for those of later sections is left as an open problem.This requires an operational reworking of the topological Section 5, which seems challenging.

Concluding remark on the role of topology
The algorithms developed in this work have purely computational specifications, which allow them to be applied without knowledge of specialized mathematical techniques in the theory of computation.However, the correctness proofs of some of the algorithms crucially rely on topological techniques.In this sense, this work is a genuine application of topology to computation: theorems formulated in the language of computation, proofs developed in the language of topology.
But there is another sense in which topology proves to play a crucial role.Compact sets in topology are advertised as sets that behave, in many important respects, as if they were finite.Then exhaustively searchable sets ought to be compact.And compact sets are known to be closed under continuous images and under finite and infinite products.Moreover, for countably based Hausdorff spaces, they are the continuous images of the Cantor space.Hence searchable sets ought to have corresponding closure properties and characterization, which is what this work establishes, among other things, motivated by these considerations.Thus, in a more abstract level, topology is applied as a paradigm for discovering unforeseen notions, algorithms and theorems in computability theory.

Lemma 2 . 4 .
With products and exponentials in the category of Hausdorff k-spaces, (1) C γ has the discrete topology for γ ground, and because the category of k-spaces is cartesian closed and the above is a λ-definition from continuous maps, Φ is continuous.(⇐): It suffices to show that Gale's conditions (1)-(3) hold.Condition (1) is the same as ours, and Gale (2) follows from our condition (2) with F = Y X .To prove Gale (3), let F ⊆ Y X be closed and V ⊆ Y be open.Then the set
and only if every directed cover of K by open sets has a member that covers K, because from any cover one obtains a directed cover with the same union by adding the finite unions of the members of the cover.Hence by definition of the Scott topology, a set is compact if and only if its open-neighbourhood filter is open in the Scott topology of the lattice of open sets.But U → χ U is a bijection from the