Sheaf Toposes for Realizability

We compare realizability models over partial combinatory algebras by embedding them into sheaf toposes. We then use the machinery of Grothendieck toposes and geometric morphisms to study the relationship between realizability models over diﬀerent partial combinatory algebras. This research is part of the Logic of Types and Computa-tion project at Carnegie Mellon University under the direction of Dana Scott.


Introduction
The purpose of this paper is to compare realizability models over partial combinatory algebras by embedding them into sheaf toposes. We then use the machinery of Grothendieck toposes and geometric morphisms to study the relationship between realizability models over different partial combinatory algebras. This work is related to Rosolini and Streicher [RS99], where the focus was mainly on the locally cartesian closed structure of realizability models, as well as to Mulry [Mul82] and Rosolini [Ros86]. Here we are also interested in comparison of logical properties.
As a reference on topos theory we use [MM92], and Johnstone and Moerdijk [JM89] as a reference on local map of toposes. Longley's dissertation [Lon94] contains material on partial combinatory algebras, applicative morphisms, and realizability. In Birkedal's dissertation [Bir00] and in [ABS99] you can find further information about realizability, and also on local maps of toposes and the corresponding -calculus.
Example 2.3 The first Kleene Algebra K is the set of natural numbers N equipped with Kleene application n · m = {n}m which applies the n-th partial recursive function {n} to m. The existence of K and S is a consequence of the s-m-n theorem [Rog87].
Example 2.4 The second Kleene Algebra B = N N , or the Baire space, is a partial combinatory algebra. The continuous partial application is defined as follows. If α ∈ N N , let αn be the sequence [α0, . . . , α(n − 1)], encoded reasonably as a natural number. Define the operation by α β = n ⇐⇒ ∃ m ∈ N . α(βm) = n + 1 ∧ ∀ k < m . α(βk) = 0 . Now the partial application on B is defined by (α | β)n = α (n::β) , where n::β is the sequence obtained by prepending n to β. We consider α | β to be defined only if (α | β)n is defined for all n ∈ N. For details about the PCA structure of B, see [KV65].
Definition 2.5 (John Longley) Let E and F be PCAs. An applicative morphism ρ : E PCA − −− → F is a total relation ρ ⊆ E × F for which there exists r ∈ F, such that rx ↓ for all x ∈ F, and for all u, v ∈ E, x, y ∈ F, if ρ(u, x), ρ(v, y) and uv ↓, then rxy ↓ and ρ(uv, rxy). We say that r is a realizer for the applicative morphism ρ. The composition of applicative morphisms is the usual composition of relations. An applicative morphism is discrete when ρ(u, x) and ρ(v, x) implies u = v.
Example 2.6 A discrete applicative morphism ι : B PCA − −− → P can be obtained by embedding B into P via ιa = an n ∈ N , where an ∈ N is the sequence [a0, . . . , a(n − 1)] suitably encoded as a natural number. Note that ι is actually a function, i.e., a single-valued total relation. There is also a discrete applicative morphism δ : In words, a sequence a is a δ-implementation of x if it enumerates the elements of x. The trick with adding 1 ensures that the empty set is accounted for.
Applicative morphisms induce functors between realizability toposes. We only consider discrete applicative morphisms here, because they induce functors between categories of modest sets.
Definition 2.7 Let A be a PCA. A modest set (S, S ) over A is a set S with a realizability relation S ⊆ A × S such that for every x ∈ S there exists a ∈ A such that a S x, and for all a ∈ A, x, y ∈ S, A realized function f : (S, S ) → (T, T ) between modest sets is a function f : S → T that is tracked by some a ∈ A, which means that, for all x ∈ S, The category of modest sets and realized functions is denoted by Mod(A).
The category of modest sets Mod(A) is equivalent to the perhaps better known category PER(A) of partial equivalence relations on A.
Example 2.8 The category Mod(P) is equivalent to the category of countably based equilogical spaces [BBS98]. A countably based equilogical space is a pair (X, ≡ X ) where X is a countably based T 0 -space and ≡ is an equivalence relation on X. A morphism [f ] : (X, ≡ X ) → (Y, ≡ Y ) is an equivalence class of equivalence preserving continuous maps. Two such maps are considered equivalent when they map equivalent points to equivalent points.
Example 2.9 The category Mod(K) is closely related to Eršov's numbered set. The modest sets over K are equivalent to the category of partial numerings, which are partial surjections N S. Eršov's numbered sets are the total surjections from N, and in Mod(K) they are the regular quotients of the natural number object.
Example 2.10 The category Mod(B) is the ambient category of Type Two Effectivity [Wei00]. It is equivalent to 0-equilogical spaces [Bau00], which is the full subcategory on those countably based equilogical spaces whose underlying topological space is 0-dimensional.
Any discrete applicative morphism ρ : A realized map f : (S, S ) → (T, T ) is mapped to the same map ρf = f : S → T . To see that ρf is realized, let r ∈ F be a realizer for ρ, and let a ∈ E be a realizer for f . Because ρ is total there exists b ∈ F such that ρ(a, b), and rb is a realizer for ρf .

Sheaves over a PCA
We would like to embed Mod(A) into a sheaf topos. An obvious choice is the topos of sheaves for a subcanonical Grothendieck topology on Mod(A), which is generated by suitable regular epimorphic families. There is an equivalent but much simpler description of this topos, which is obtained as follows.
For the site we take the category A whose objects are subsets of A, and morphisms are the realized maps between subsets of A. More precisely, if X, Y ⊆ A then a morphism f : X → Y is a function f : X → Y for which there exists a ∈ A such that, for all b ∈ X, ab ↓ and f b = ab.
In many cases A is equivalent to a well known category. For example, P is equivalent to the category ωTop 0 of countably based T 0spaces, whereas B is equivalent to the category 0Dim of countably based 0-dimensional Hausdorff spaces.
In order to obtain a convenient description of the Grothendieck topology on A we need to know precisely which coproducts exist in A . For this the purpose we prove Lemma 2.11 below. Let us call a family (X i ) i∈I non-trivial if none of the objects X i are initial. We are only interested in coproducts of non-trivial families because we can always omit any summands that are initial. The cardinality of a set I is denoted by |I|.
Lemma 2.11 Let A be a PCA. There exists a regular cardinal number w(A), called the weight of A, such that the coproduct of a non-trivial family (X i ) i∈I exists in A if, and only if, |I| < w(A).
Proof. We prove the following statement: if a coproduct of a non-trivial family (X i ) i∈I exists in A , then coproducts of all I-indexed families exist. We then take as the weight of A the smallest cardinal κ for which there exists a non-trivial κ-indexed family such that its coproduct does not exist in A .
Let (X i ) i∈I be a non-trivial family and let C = i∈I X i be its coproduct in A , with canonical injections e i : X i → C that are realized by r i ∈ A, for each i ∈ I. We denote the image of X i under e i by e i (X i ).
First we show that the coproduct of (1) i∈I exists. An object in A is initial if, and only if, it is the empty set. Because (X i ) i∈I is non-trivial the sets e i (X i ) are non-empty, hence there exists a choice function c : We show that S = c i i ∈ I is a coproduct of the family (1) i∈I with the i-th canonical injection realized by Kc i . It suffices to find a realizer for an arbitrary function f : S → A. Let g i : X i → A be the morphism realized by K(f (c i )). Then there exists a unique morphism g : C → A, realized by some s ∈ A, such that g(e i (x)) = g i (x) = f (c i ) for all i ∈ I and all x ∈ X i . In particular, f (c i ) = g(c i ) = sc i for all i ∈ I, hence s realizes f . Now let (Y i ) i∈I be an arbitrary I-indexed family. We claim that the set It remains to show that w(A) is a regular cardinal. It is necessarily infinite because A always has all finite coproducts. By [Jec97, Lemma 3.6], it suffices to show that i<λ κ i < w(A) whenever λ < w(A) and Similarly, the coproduct L = i<λ K i exists. But L is also a coproduct of i<λ κ i many copies of 1, therefore i<λ κ i < w(A).
The name weight of a PCA is motivated by the fact that in a topological PCA it often happens that its weight is the successor of its topological weight, which is the cardinality of a minimal base for its topology. For example, the topological weights of P and B are ℵ 0 and their weights are ℵ 1 because P ωTop 0 and B 0Dim have precisely all countable coproducts. The first Kleene algebra has weight ℵ 0 . PCAs built as syntactic models of the untyped λ-calculus typically have weight ℵ 0 because the corresponding sites have precisely all the finite coproducts.
Corollary 2.12 Let A be a PCA. In Mod(A), the coproduct of a non-trivial family (X i ) i∈I exists if, and only if, |I| < w(A).
Proof. The category A is the full subcategory of Mod(A) on the canonically separated modest sets, which in turn is equivalent to the full subcategory Proj(A) on the regular projective modest sets over A. It is easy to check that the inclusion of Proj(A) into Mod(A) preserves and reflects all coproducts that exist. By combining this with the fact that every modest set is covered by a regular epi whose domain is regular projective, we get the desired result.
As the Grothendieck topology on A we take the coproduct topology C which is generated by those families Definition 2.13 The category of sheaves on A for the coproduct topology is denoted by Sh(A).
Observe that the sheaves on A are simply those presheaves P that "preserve products", i.e., Theorem 2.14 The category Sh(A) is equivalent to the category of sheaves Sh(Mod(A), R) for the subcanonical Grothendieck topology R generated by those families {f i : B i → A} i∈I for which |I| < w(A) and the morphism Proof. As in the proof of Corollary 2.12, we may replace A with the equivalent category Proj(A) of regular projective modest sets over A.
Let the jointly-split topology S on Proj(A) be generated by those families {f i : B i → A} i∈I for which |I| < w(A) and the morphism splits, i.e., has a right inverse s : A → i∈I B i . Let us verify that the jointly split families form a basis for Grothendieck topology: 1. Isomorphisms cover: It is obvious that an isomorphism is covering since it is split by its inverse.
2. Stability under pullbacks: Suppose {f i : B i → A} i∈I covers A. Consider the pullback along g : C → A. Since coproducts in A are stable, we get a pullback diagram The morphism s in the above diagram is the splitting of [f i ] i . We want to show that the left-hand vertical morphism splits, which follows easily from the pullback property of the diagram. Since 3. Transitivity: Suppose {f i : B i → A} i∈I is a covering family, and for each i ∈ I, the family {g ij : C ij → B i } j∈J i covers B i . Then [f i ] i splits by a morphism s and [g ij ] j splits by a morphism r i , for each i ∈ I. The coproduct C = i∈I j∈J i C ij exists because i∈I |J i | < w(A). This is so because w(A) is a regular cardinal, |I| < w(A) and Next, we show that the jointly split families generate precisely the coproduct topology C. We need to show that a sieve {f i : B i → A} i∈I contains an Scover if, and only if, it contains a C-cover. One direction is easy, since every C-cover is obviously an S-cover. For the converse, if {f j : B j → A} j∈J is jointly split by s : A → j∈J B j , then we can decompose A into a coproduct A ∼ = j∈J s * B j , as in the pullback diagram Therefore, if a sieve contains a jointly split family {f j : B j → A} j∈J , then it also contains a family whose coproduct is isomorphic to A.
As in the statement of the theorem, let R be the Grothendieck topology on Mod(A) generated by those families {f i : B i → A} i∈I for which |I| < w(A) and [f i ] i∈I : i∈I B i → A is a regular epi. To finish the proof, we apply the Comparison Lemma [MM92, Appendix, Corollary 4.3] to Sh(Mod(A), R) and Sh(Proj(A), S). For this we must check three conditions: 1. Topology R is subcanonical: we chose R to be generated by certain regular-epimorphic families.

Every object in Mod(A) is R-covered by objects in Proj(A):
this is equivalent to every modest set being a regular quotient of a regular projective modest set, which is the case. Conversely, suppose f : B → A is a regular epi and A ∈ Proj(A).
Since A is regular projective there exists a right inverse s : B → A of f , hence f is split.

Corollary 2.15 The Yoneda embedding
is full and faithful, preserves the locally cartesian closed structure, regular epis, and coproducts. In terms of categorical logic, it preserves and reflects validity of formulas involving full first-order logic, exponentials, dependent types, disjoint sum types, and quotients of ¬¬-stable equivalence relations. In addition, y preserves infinitary disjunctions and coproducts of cardinality less than w(A). In case w(A) ≥ ℵ 1 , y also preserves the natural numbers object.
More precisely, the functor y is defined as follows. If I : A → Mod(A) is the inclusion, then for S ∈ Mod(A), yS = Hom(I( ), S) where the hom-set is taken in Mod(A). We do not have to compose with sheafification because the topology is subcanonical.
The Yoneda embedding y itself extends similarly along the inclusion J : Mod(A) → RT(A) of modest sets into the realizability topos for A, to give a functor Y : RT(A) → Sh(A), as indicated below.

Mod(A)
The functor Y is defined much like y, i.e., for X ∈ RT(A), let Y (X) = Hom(J( ), X), where the hom-set is now taken in RT(A). It can be shown fairly easily that Y also preserves first-order logic, but unlike y, it is not faithful (since the modest sets do not generate RT(A)), nor does it preserve exponentials.
Example 2.16 Countably based equilogical spaces embed via the Yoneda embedding into the topos Sh(P) Sh(ωTop 0 , C ω ) of sheaves on the countably based T 0 spaces equipped with the countable coproducts topology.
Example 2.17 The topos Sh(K) is closely related to Mulry's recursive topos R [Mul82]. Specifically, a site for R is the category R of r.e. sets and partial recursive functions, equipped with the finite cover topology; the evident inclusion functor i : R → K induces a geometric morphism Sh(K) → R which, however, is not an equivalence. To see this, consider an immune set 1 I ⊆ N as an object of K . A non-recursive function h : I → I induces a natural endomorphism h•− on the restricted representable functor Hom(i(−), I) in R which is not induced by any morphism in Sh(K).

Example 2.18
The category Mod(B) embeds into the topos Sh(B) which is equivalent to the topos Sh(0Dim, C ω ), where 0Dim is the category of countably based 0-dimensional Hausdorff spaces.
The inverse image part ρ * of the geometric morphism in the above diagram makes the evident square commute up to natural isomorphism.
An applicative retraction does not seem to induce a third adjoint if we use realizability toposes RT(E) and RT(F) instead of sheaf toposes (although one might consider relative realizability [Bir99,ABS99]). On the other hand, many applicative retractions that we have encountered are +-preserving, and so they induce local maps of sheaf toposes. A good conceptual explanation of this phenomenon would be desirable.

A Forcing Semantics for Realizability
The following theorem spells out the Kripke-Joyal semantics in Sh(A), see [MM92, Section VI.6]. The interpretation of disjunction, negation and existential quantification is simpler than the usual one due to the simple nature of the coproduct topology on the site A .
Theorem 2.20 Let X, Y ∈ Sh(A), and let x : X φ(x) x : X ψ(x) x : X, y : Y ρ(x, y) be formulas in the internal language of Sh(A). Let A ∈ A and a ∈ XA. The Kripke-Joyal forcing relation |= is interpreted as follows: ψ(a) if, and only if, A |= φ(a) and A |= ψ(a).

5.
A |= ∀ y ∈ Y . ρ(a, y) if, and only if, for all f : B → A in A and all b ∈ Y B, one has B |= ρ(a · f, b).

6.
A |= ∃ y ∈ Y . ρ(a, y) if, and only if, A = i∈I A i in A , |I| < w(A), and for each i Proof. We only need to show that the standard interpretations of disjunction, negation, and existential quantification simplify to the forms stated in the theorem. This follows easily from the characterization of the topology via the disjoint sum basis.
The interpretation of negation is correct because an object is covered by the empty family {} if, and only if, it is the initial object 0.
Suppose A |= ∃ y ∈ Y . ρ(a, y). Then there is a family {ι i : A i → A} i∈I such that A = i∈I A k , ι i : A i → A is the canonical inclusion for every i ∈ I, and there exists b i ∈ Y A i such that A i |= ρ(a · ι i , b i ). This proves one direction. The converse is proved easily as well.
If Mod(A) has countable coproducts a clause involving countable disjunctions can be added. The forcing semantics can be restricted to the modest sets, as long as the formulas are restricted to first-order logic with exponentials, dependent types, subset types, and quotients of ¬¬-stable equivalence relations. It is a consequence of Corollary 2.15 that such a formula is valid in the forcing semantics above if, and only if, it is valid in the realizability interpretation.

A Transfer Principle for Modest Sets
Suppose (η δ) : E PCA − −− → F is an applicative retraction such that δ is +preserving. The transfer principle from Awodey et. al. [ABS99] can be applied to the induced local map of toposes, We say that a formula θ in the internal language of a topos is local 2 if it is built from atomic predicates, including equations, using first-order logic, and if in every subformula of the form φ −→ ψ, there is no ∀ or −→ in φ.
If θ is a local sentence in the internal logic of Sh(F), we write Sh(F) |= θ when the canonical interpretation of θ is valid in Sh(F). The sentence θ can also be interpreted in Sh(E) by mapping the types and relations occurring in θ over to Sh(E) with η * . The transfer principle from [ABS99] then tells us that for such a local sentence θ, It follows that if only types and relations from Mod(F) occur in θ then the transfer principle restricts to the categories of modest sets: Here we interpret θ in Mod(E) by mapping all types and relations that occur in θ over to Mod(E) by η. The notation Mod(E) |= θ means that the sentence θ is valid in the standard realizability interpretation, or equivalently, in the forcing semantics as described in Theorem 2.20. The following theorem explains why Mod(P) and Mod(B) appear to be very similar, at least as far as simple types are concerned. where N is interpreted as the natural numbers object, N N is interpreted as the obvious exponential, and R is interpreted as the object of Cauchy real numbers.
Proof. The theorem holds because the functor ι : Mod(B) → Mod(P) preserves the natural numbers object N, its function space N N , and the real numbers object R. It is not hard to see that δ preserves countable coproducts, which are precisely the coproducts that Mod(P) has.
In Theorem 2.21 we cannot allow variables of higher types such as N N N and R R to occur, because it is well known that the following local sentence involving N N N is valid in Mod(B) but not in Mod(P): (2) The sentence states that every functional F ∈ N N N has an associate α ∈ N N in the sense of Kleene [Kle59]. Here α|β is Kleene's continuous function application. The statement n = (α|β) is equivalent to Similarly, a statement that all functions f ∈ R R are continuous is valid in Mod(B) but not in Mod(P). Thus, in a roundabout way, we obtain the following result.
Corollary 2.22 The functor ι : Mod(B) → Mod(P) does not preserve exponentials. In particular, ι(N N N ) is not isomorphic to the object N N N in Mod(P), and ι(R R ) is not isomorphic to the object R R in Mod(P).
We can in fact prove Corollary 2.22 directly as follows. Let X = N N N be the object of type 2 functionals in 0Equ, which is equivalent to Mod(B), and let Y = N N N be the object of type 2 functionals in Equ. Both X and Y are equilogical spaces. The space |X| is a Hausdorff space. The space |Y | is the subspace of the total elements of the Scott domain D = [N ⊥ ω → N ⊥ ]. The equivalence relation on |Y | is the consistency relation of D restricted to |Y |. Suppose f : |Y | → |X| represented an isomorphism, and let g : |X| → |Y | represent its inverse. Because f is monotone in the specialization order and |X| has a trivial specialization order, a ≡ Y b implies f x = f y. Therefore, g • f : |Y | → |Y | is an equivariant retraction. By [Bau00, Proposition 4.1.8], Y is a topological object. By [Bau00, Corollary 4.1.9], this would mean that the topological quotient |Y |/≡ Y is countably based, but it is not, as is well known.
Another way to see that Y cannot be topological is to observe that Y is an exponential of the Baire space, but the Baire space is not exponentiable in ωTop 0 , and in particular N N N is not a topological object.
Finally, we remark that statement (2) is of course valid in Mod(P) if N N N is replaced by ι(N N N ). But then it becomes a simple truism, since it can be shown that in Mod(P) the space ι(N N N ) is just the set of those functionals that have an associate: Corollary 2.22 should be contrasted with the fact that there is an epimono ι(N N N ) → N N N that is not iso but nevertheless induces a natural bijection between the global points of ι(N N N ) and the global points of N N N . In this sense, the finite types over N in Mod(P) and Mod(B) are equivalent as far as the cartesian closed structure is concerned, but here we see that they have different logical properties.