aa r X i v : . [ m a t h . L O ] M a y Partial Combinatory Algebras of Functions
Jaap van OostenDepartment of MathematicsUtrecht UniversityP.O.Box 80.010, 3508 TA Utrecht, The Netherlands
May 13, 2009
Abstract
We employ the notions of ‘sequential function’ and ‘interrogation’ (di-alogue) in order to define new partial combinatory algebra structureson sets of functions. These structures are analyzed using J. Longley’spreorder-enriched category of partial combinatory algebras and decidableapplicative structures.We also investigate total combinatory algebras of partial functions.One of the results is, that every realizability topos is a quotient of arealizability topos on a total combinatory algebra.
AMS Subject Classification (2000): 03B40,68N18
Introduction
Let us think of a computing device which, in the course of its calculations, isallowed to consult an oracle. I wish to keep the intuition of ‘computing device’ asflexible as possible and refrain therefore from a definition; but one requirementI want to stick to is: the device will use only finitely many oracle queries inany terminating computation (there may be never terminating computations inwhich the device just keeps on passing queries to the oracle).If a terminating computation always results in an output, the device thendetermines a partial function O Φ → R , where O is the set of oracles and R the set of results (outputs). In cases of practical interest, R is a discrete setsuch as the set N of natural numbers, whereas O , like the set of all functions N → N , has a nontrivial topology. The finiteness requirement above implies inthis example that the partial function O → R is continuous, and this is oftentaken as the meaning of the Use Principle in Recursion Theory (e.g. [8], p.50:“The Use Principle asserts that Φ e is continuous”).In this paper I concentrate on the situation where O is the set A A of functions A → A for some infinite set A , and queries are of form: “what is your value at1 ∈ A ?”. I argue that here it makes sense to consider a subclass of the classof (partial) continuous functions on A A : the sequential functions. Actually, themap Φ will turn out to be sequential.It is shown that the sequential functions play an important role in the con-struction of partial combinatory algebras . I show that Kleene’s construction ofa partial combinatory algebra structure on N N ([3]; see [11], 1.4.3, for a conciseexposition) can be generalized to a partial combinatory algebra structure onany set A A for infinite A .Then, some further analysis is carried out in the case that A itself has a par-tial combinatory algebra structure and the coding which is necessary for definingthe structure of A A , is actually definable from A . A universal property is ob-tained in Longley’s category ([4]) of partial combinatory algebras and decidableapplicative morphisms. We also look at sub-partial combinatory algebras of A A .Next, we discuss partial combinatory algebras on sets of partial functions.In the end we obtain a theorem in the theory of realizability toposes: everyrealizability topos is a quotient of a realizability topos on a total combinatoryalgebra. The notion ‘sequential’ has been around for a long time, and stems from thestudy of Plotkin’s calculus
PCF ([7]). For a fairly recent paper discussingvarious approaches to the matter, see [6].The notion of a sequential tree was defined in [9]. I slightly modify it here.
Definition 1.1
Let A be a set, and T a set of finite functions p : A ′ → A with A ′ ⊂ A . We shall also write dom( p ) for A ′ . The set T is ordered byinclusion. T is called a sequential tree if it is a tree, with the empty function asroot, and has the property that for every p ∈ T which is not a leaf, there is anelement a dom( p ) such that for all immediate successors q of p in T , we havedom( q ) = dom( p ) ∪ { a } .A sequential tree is total if for each p ∈ T which is not a leaf, there is a dom( p ) such that the set of immediate successors of p in T is the set of all functions q satisfying dom( q ) = dom( p ) ∪ { a } .We shall mainly be interested in total sequential trees. Clearly, for such a tree,every function A → A determines a path through the tree. Suppose F is afunction from the set of leaves of T to A . Then F and T determine a partialfunction Φ T,F : A A → A as follows: Φ T,F ( α ) is defined if and only if the paththrough T determined by α ends in a leaf v ; and in that case, Φ T,F ( α ) = F ( v ). Definition 1.2
A partial function A A → A of the form Φ T,F is called a partialsequential function .Note, that a function Φ
T,F is a total function (i.e., everywhere defined) if andonly if the tree T is well-founded. 2he set A is given the discrete topology and the set of functions A A theproduct topology. One of the lemmas underlying the construction of Kleene’s K (a partial combinatory algebra of functions N N ) is that when A is count-able, every partial continuous function A A → A with open domain is partialsequential.If A is uncountable, we still have that every total continuous function A A → A is sequential, but this may fail for partial functions with open domain, as thefollowing proposition shows. Proposition 1.3
Let A be an infinite set. Every continuous function A A → A is sequential, but if A is uncountable, there exist partial continuous functionswith open domain, that are not partial sequential. Proof . Let Φ : A A → A be continuous. For a finite function p : A ′ → A with A ′ ⊂ A , let U p = { α ∈ A A | p ⊂ α } be the open neighborhood determined by p . By continuity, the function Φ has a base B , that is: a set of finite functions p such that Φ is constant on U p and such that for every α ∈ A A there is a p ∈ B such that p ⊂ α .Call two finite functions s and t compatible if s ∪ t is a function (i.e., s ( a ) = t ( a ) whenever a ∈ dom( s ) ∩ dom( t )). For arbitrary finite s , let B s be the set ofthose p ∈ B such that p and s are compatible. Claim
For any finite function s , either Φ is constant on U s or there is a finitesubset C of A − dom( s ) such that for every p ∈ B s , dom( p ) meets C . Proof of Claim : Suppose there is no such C ; then given any two elements p, q of B s we can find r ∈ B s such that dom( r ) − dom( s ) is disjoint from (dom( p ) ∪ dom( q )) − dom( s ). Then r is compatible both with p and with q , and since Φ isconstant on U p , U q and U r , Φ takes the same values on U p and U q . We concludethat Φ is constant on U s .We now build a sequential tree for Φ as follows: T will be the union of asequence T ⊆ T ⊆ · · · of well-founded sequential trees.Let T consist of only the empty function. Suppose T n has been defined. Forevery leaf s of T n define the set of elements of T n +1 extending s as follows: if Φ isconstant on U s , this set is empty (and s is also a leaf of T n +1 ). Otherwise, pick afinite set C for s as in the Claim ; and order C as { c , . . . , c n } . Then add for each k , 1 ≤ k ≤ m , all functions extending s whose domain is dom( s ) ∪ { c , . . . , c k } .Each T n is clearly a well-founded sequential tree, by induction; and by con-struction the following is true: if p ∈ B and p is compatible with a leaf s of T n ,then either Φ is constant on U s (in which case s is a leaf of T ), or the cardinalityof s ∩ p is at least n . Hence, since the sets { U p | p ∈ B} cover A A , the tree T iswell-founded. Define for any leaf s of T , F ( s ) = Φ( α ) for an arbitrary α ∈ U s .Then Φ = Φ T,F .For the second statement, split A in two disjoint, nonempty subsets A , A .Let Φ be a partial function which is constant on its domain, and which is onlydefined on those α for which there is an a ∈ A with α ( a ) ∈ A . Then Φ cannotbe partial sequential: suppose it is; let T be a sequential tree for it. Choose3 such that α ( a ) A for each a ∈ A . Then the path through T determinedby α must be infinite by assumption on T , but the union of this path is apartial function on A with countable domain A ′ . But then any function α ′ which agrees with α on A ′ but has α ′ ( a ) ∈ A for some a A ′ , will determinethe same infinite path, although Φ( α ′ ) should be defined.Partial sequential functions A A → A can be coded by elements of A A in thefollowing way. Let A ∗ be the free monoid on A , i.e. the set of finite sequencesof elements of A . Fix an injective function( a , . . . , a n − )
7→ h a , . . . , a n − i : A ∗ → A The elements in the image of this map are called coded sequences . Let q and r (for ‘query’ and ‘result’) be two specified, distinct elements of A . With thesedata we define a partial operation ϕ : A A × A A → A as follows.For α, β ∈ A A and u = h a , . . . , a n − i a coded sequence, call u an in-terrogation of β by α , if for each j ≤ n − a ∈ A such that α ( h a , . . . , a j − i ) = h q, a i and β ( a ) = a j . Of course, for j = 0 this means that α ( h i ) = h q, a i and β ( a ) = a . The elements h q, a i are called the queries of theinterrogation. Note that α and β uniquely determine a sequence of interrogations (the interrogation process ) which may be finite or infinite. We shall apply the notionof interrogation also to finite functions.We say that ϕ ( α, β ) is defined with value b , if there is an interrogation u of β by α such that α ( u ) = h r, b i . We call the element h r, b i the result of theinterrogation u .Write ϕ α for the partial function β ϕ ( α, β ) : A A → A . Proposition 1.4
A partial function A A → A is of the form ϕ α for some α ∈ A A , precisely when it is sequential. Proof . Suppose we have a partial sequential function Φ
T,F . Then for any s ∈ T , the sequential tree structure of T induces a linear order on dom( s ), saydom( s ) = { c , . . . , c n − } (and the predecessors of s in T are restrictions of s tosubsets { c , . . . , c j − } ). Let a i = s ( c i ). Let α be any function A → A such thatfor each s ∈ T , with c i , a i as above, α ( h a , . . . , a n − i ) = h r, F ( s ) i if s is a leaf of T , and α ( h a , . . . , a n − i ) = h q, c n i if c n is the unique element of dom( t ) − dom( s )for each immediate successor t of s in T . Clearly then, ϕ α = Φ T,F .Conversely, given α , let T be the set of all finite functions s such that thereexists an interrogation of s by α which contains all the values of s . It is easyto see that T is a total sequential tree. Let us look at the leaves of T . If s issuch a leaf, we have the following 3 possibilities:1) the interrogation process of s by α is infinite: α continues to ask forinformation it has already received;2) for some interrogation u of s by α , α ( u ) is neither a query nor a result; In [9], I called these “dialogues”. Now I find they are far too one-sided for that name
4) for some interrogation u of s by α , α ( u ) = h r, b i for some b .Let T result from T by the following: for every leaf s of T for which 1) or 2)holds, choose an injective function ( a , a , . . . ) of N into A − dom( s ), and addall finite functions of the form s ∪ t for which dom( t ) = { a , . . . , a k } for some k ≥ s is a leaf of T (hence a leaf of T to which 3) applies), define F ( s ) = b if α ( u ) = h r, b i for the shortest interrogation u of s by α yielding aresult. Then ϕ α = Φ T,F . A A Our aim is to prove that with the partial map α, β αβ defined below indefinition 2.2, the set A A has the structure of a partial combinatory algebra .Let us first recall what this means: Definition 2.1 A partial combinatory algebra is a set X together with a partialfunction X × X → X , written x, y xy , such that there exist elements k and s in X satisfying the two axioms:( k ) For any x, y ∈ X , kx and ( kx ) y are defined, and ( kx ) y = x ;( s ) For any x, y, z ∈ X , sx and ( sx ) y are defined, and (( sx ) y ) z is definedprecisely if ( xz )( yz ) is, and these expressions define the same element of X if defined.The partial function a, b ab is called the application function . Definition 2.2
For α, β ∈ A A and a ∈ A , call u = h a , . . . , a n − i an a - interrogation of β by α , if for each j ≤ n −
1, there is a b ∈ A such that α ( h a, a , . . . , a j − i ) = h q, b i and β ( b ) = a j .We say that ϕ a ( α, β ) is defined with value c , if for some a -interrogation u of β by α , α ( u ) = h r, c i .Then, define a partial function A A → A , denoted αβ αβ in the followingway: αβ is defined if and only if for every a ∈ A , ϕ a ( α, β ) is defined. In thatcase, αβ is the function a ϕ a ( α, β ).The following proposition is straightforward. Proposition 2.3
For any α and a , the partial function β ϕ a ( α, β ) is se-quential.Conversely, suppose that for every a ∈ A we are given a partial sequentialfunction F a : A A → A . Then there is an element α F of A A such that for all β ∈ A A and all a ∈ A , ϕ a ( α, β ) is defined if and only if F a ( β ) is, and equal toit in that case. Hence if for all a F a ( β ) is defined, αβ is defined and for all a , αβ ( a ) = F a ( β ) .
5e shall have to deal with sequential functions of more than one variable.
Definition 2.4
Let T be a set of pairs of finite functions ( s, t ), ordered bypairwise inclusion. We say that T is a bisequential tree if T is a tree, and forany non-leaf ( s, t ) ∈ T we have: either there is a dom( s ) such that the set ofimmediate successors of ( s, t ) in T is the set of finite functions ( s ′ , t ) where s ′ extends s and dom( s ′ ) = dom( s ) ∪ { a } , or there is b dom( t ) such that the setof immediate successors is the set of ( s, t ′ ) with dom( t ′ ) = dom( t ) ∪ { b } .Any pair of functions A → A determines a unique path through a bisequen-tial tree, and just as for the case of one variable we say that a partial function φ : A A × A A → A is bisequential if there is a bisequential tree T and a function F from the leaves of T to A , such that φ = Φ T,F . Lemma 2.5
Let G be a total bisequential function A A × A A → A . Then there isan element φ G of A A such that for all α and β , φ G α is defined, and ϕ ( φ G α, β ) = G ( α, β ) . Proof . Let G be Φ T,F , so T is a bisequential tree, F a function from the leavesof T to A , such that G ( α, β ) = F (( p, q )) for the unique leaf ( p, q ) determinedby ( α, β ). Note, that since G is total, the tree T is well-founded.Call a non-leaf ( s, t ) of T a (0 , u )-point if all immediate successors of ( s, t )are of form ( s ′ , t ) with dom( s ′ ) = dom( s ) ∪ { u } ; similarly, a (1 , v )-point hasimmediate successors ( s, t ′ ) with dom( t ′ ) = dom( t ) ∪ { v } . Suppose s ( u ) = a , . . . , s ( u n − ) = a n − , t ( v ) = b , . . . , t ( v m − = b m − are the values of s and t in the path, in that order. We define the value of φ G on the interrogation hh b , . . . , b m − i , a , . . . , a n − i = φ G ( hh ~b i , ~a i )If ( s, t ) is a (0 , u )-point, let φ G ( hh ~b i , ~a i ) = h q, u i ; if ( s, t ) is a (1 , v )-point, let φ G ( hh ~b i , ~a i ) = h r, h q, v ii . Finally, if ( s, t ) is a leaf, φ G ( hh ~b i , ~a i ) = h r, h r, F ( s, t ) i .It is then straightforward to verify that for every ( α, β ) passing through thepoint ( s, t ), we have for all j ≤ m − φ G α )( h b , . . . , b j − i ) = h q, v j i , andif ( s, t ) is a leaf of T , we have ( φ G α )( h b , . . . , b m − i ) = h r, G ( α, β ). Since T iswell-founded, it is easy to complete the definition of φ G in such a way that φ G α is always defined. Then also, ϕ ( φ G α, β ) = G ( α, β ) as desired. Corollary 2.6
Suppose for each a ∈ A a total bisequential function G a : A A × A A → A is given. Then there is an element φ G of A A such that for all α, β ∈ A A and a ∈ A , φ G α is defined, ( φ G α ) β is defined and (( φ G α ) β )( a ) = G a ( α, β ) . Proof . Straightforward from propositions 2.3 and 2.5.We can now state the main theorem of this section.
Theorem 2.7
For an infinite set A , A A , together with the map ( α, β ) αβ ,has the structure of a partial combinatory algebra. roof . We have to find elements k and s satisfying ( k ) and ( s ) of definition 2.1.Since for any a ∈ A the map ( α, β ) → α ( a ) is bisequential, it follows at oncefrom corollary 2.6 that there is an element k of A A such that ( kα ) β = α .For s , we have to do a bit more work. Let α , β be fixed for the moment.We define a function S αβ as follows: we define recursively the values of S αβ onelements of the form h a i ∗ u = h a, a , . . . , a m − i of which we assume, inductively, that u = h a , . . . , a m − i is an a -interrogationof a finite function t by S αβ .Assume the interrogation u has length n . Determine a maximal sequence( v , . . . , v n − , b , w , . . . , w m − , c , . . . , v j , . . . , v n j − j , b j , w j , . . . , w m j − j , c j , . . . )of length ≤ n , such that for any segment( v j , . . . , v n j − j , b j , w j , . . . , w m j − j , c j )or initial parts of it, the following holds (where applicable):i) h v j , . . . , v n j − j i is an h a, c , . . . , c j − i -interrogation of t by α with result h q, b j i (so the value of α on this sequence is h r, h q, b j ii );ii) h w j , . . . , w m j − j i is a b j -interrogation of t by β with result c j .We define the value S αβ ( h a i ∗ u ) as follows:1) if the sequence ends in ( v j , . . . , v kj ) and α ( hh a, c , . . . , c j − i , v j , . . . , v kj i ) = h q, x i then S αβ ( h a i ∗ u ) = h q, x i ;2) if the sequence ends in ( b j , w j , . . . , w kj ) and β ( h b j w j , . . . , w kj i ) = h q, x i then S αβ ( h a i ∗ u ) = h q, x i ;3) if the sequence ends in ( v j , . . . , v n j − j ) and α ( hh a, c , . . . , c j − i , v j , . . . , v n j − j i ) = h r, h r, y ii then S αβ ( h a i ∗ u ) = h r, y i ;4) in all other cases, α ( h a i ∗ u ) = h q, q i .7ow it is a matter of straightforward verification that if γ is any function ex-tending t , and αγ , βγ are defined, then the sequence c , . . . , c j forms an a -interrogation of βγ by αγ .Hence, ( S αβ γ )( a ) is defined precisely when (( αγ )( βγ ))( a ) is, and equal to itin that case.It is also left to you to check by inspection of the definition of S αβ , that forfixed a and u , the function ( α, β ) S αβ ( h a i ∗ u )is bisequential.By corollary 2.6 it follows that there is an element s ∈ A A such that for all α and β , sα and ( sα ) β are defined, and ( sα ) β = S αβ . Then by the remarksabove, this s satisfies axiom ( s ) of definition 2.1. We conclude that A A , withthe given partial map ( α, β ) αβ , is a partial combinatory algebra, as claimed.We shall denote the partial combinatory algebra on A A by K ( A ). K ( A ) In this section we try to analyze the construction of K ( A ) a bit, from thepoint of view of Longley’s 2-category PCA of partial combinatory algebras (firstdefined in [4]; there is also a description in [11]). Convention . From now on, when dealing with iterated applications we shalluse the familiar convention of ‘associating to the left’: i.e. we write abcd insteadof (( ab ) c ) d .PCA is a preorder-enriched category. The objects are partial combinatoryalgebras. Given two such, A and B , a 1-cell, or applicative morphism , from A to B is a total relation γ from A to B (we think of γ as a function A → P ∗ ( B )into the set of nonempty subsets of B ), with the property that there exists anelement r ∈ B such that, whenever a, a ′ ∈ A , b ∈ γ ( a ) , b ′ ∈ γ ( a ′ ) and aa ′ isdefined, then rbb ′ is defined and an element of γ ( aa ′ ). The element r is calleda realizer for γ .If γ, γ ′ : A → B are two applicative morphisms, we say γ (cid:22) γ ′ if there isan element s ∈ B such that for all a ∈ A and all b ∈ γ ( a ), sb is defined andan element of γ ′ ( a ). The element s is said to realize γ (cid:22) γ ′ . For two parallelarrows γ, γ ′ : A → B we write γ ∼ = γ ′ if γ (cid:22) γ ′ and γ ′ (cid:22) γ .It is part of the theory of partial combinatory algebras that every partialcombinatory algebra A contains elements ⊥ , ⊤ and C (thought of as ‘Booleans’and ‘definition by cases’), satisfying for all a, b ∈ A : C ⊤ ab = a and C ⊥ ab = b Instead of
Cvab we write If v then a else b .Suppose γ : A → B is an applicative morphism and ⊤ A , ⊥ A are Booleansin A , ⊤ B , ⊥ B are Booleans in B . We call the morphism γ decidable if there is8n element d ∈ B (the decider for γ ) such that for all b ∈ γ ( ⊤ A ), db = ⊤ B andfor all b ∈ γ ( ⊥ A ), db = ⊥ B . There is a subcategory of PCA on the decidableapplicative morphisms.One further definition: if γ : A → B is an applicative morphism and f is apartial function A → A , then f is said to be representable w.r.t. γ , if there isan element r f ∈ B (which then represents f ), such that for all a ∈ dom( f ) andall b ∈ γ ( a ), r f b is defined and an element of γ ( f ( a )). Proposition 3.1
For a ∈ A let ˆ a denote the constant function with value a .For any partial combinatory algebra structure on A , the map γ ( a ) = { ˆ a } definesa decidable applicative morphism A → K ( A ) . Every total function A → A isrepresentable w.r.t. γ . Proof . This is easy. Let ρ be any element of A A satisfying: ρ ( hh x ii ) = h r, h q, q ii ρ ( hh x, b ii ) = h q, q i ρ ( hh x, b i , a i ) = (cid:26) h r, h r, ab ii if ab is defined in A h r, h q, q ii otherwise ρ ( h n i ) = h r, r i if n = h x i and n = h x, b i Then it is easily verified that if ab is defined in A , ρ ˆ a is defined and ρ ˆ a ˆ b = b ab .Hence, γ is an applicative morphism. Furthermore, for any good choice ofBooleans ⊤ , ⊥ in A one can take ˆ ⊤ , ˆ ⊥ for Booleans in A A , so decidability iseasy. That every f : A → A is representable, is left to you.At this point I wish to collect a few bits of notation and theory of partialcombinatory algebras; everything can be found in sections 1.1 and 1.3 of [11].Let A be a partial combinatory algebra.1) If t and s are terms built up from elements of A and the applicationfunction, t ↓ means “ t is defined”, and t ≃ s means: t is defined if and onlyif s is, and they denote the same element of A if defined.2) Given a term t ( x , . . . , x n +1 ) built up from elements of A , variables x , . . . , x n +1 and the application function, there is a standard construction for an ele-ment h x · · · x n +1 i t of A which satisfies:( h x · · · x n +1 i t ) a · · · a n ↓ ( h x · · · x n +1 i t ) a · · · a n +1 ≃ t ( a , . . . , a n +1 )3) A has elements p, p , p ( pairing and unpairing combinators) such that pab ↓ , p ( pab ) = a and p ( pab ) = b ; A contains a copy { ¯0 , ¯1 , . . . } of thenatural numbers such that any computable function is represented by anelement of A ; and A has a standard coding of tuples [ · , . . . , · ] together withelements representing the basic manipulation of these.4) A has a fixed-point operator : an element z such that for all f, x ∈ A : zf ↓ and zf x ≃ f ( zf ) x (this is also referred to as “the recursion theorem in A ”). 9t is clear that the construction of K ( A ) given above, depends on the coding oftuples h· , . . . , ·i and the elements q and r . Since we wish to study the connectionto A in the case A itself has the structure of a partial combinatory algebra, wemake the following definition. Definition 3.2
Suppose A is an infinite set and ( A, · ) a partial combinatoryalgebra structure on A . We say that K ( A ) is based on ( A, · ) if, in the definitionof an interrogation of β by α , we have used the standard coding [ · , . . . , · ] of A , q and r are, respectively, the Booleans ⊥ and ⊤ , and the values of α at suchinterrogations are p ⊥ u or p ⊤ u .We say that K ( A ) is compatible with ( A, · ) if there are elements a, b, c ∈ A such that:i) for every tuple u , . . . , u n − , a ( h u , . . . , u n − i ) = [ u , . . . , u n − ] and b ([ u , . . . , u n − ]) = h u , . . . , u n − i ;ii) cq = ⊥ and cr = ⊤ . Theorem 3.3
Suppose ( A, · ) is a partial combinatory algebra and K ( A ) isbased on ( A, · ) . Let γ : A → K ( A ) be the applicative morphism of 3.1. Thenfor any decidable applicative morphism δ : A → B such that every total function A → A is representable w.r.t. δ , there is a greatest decidable applicative mor-phism ε : K ( A ) → B such that εγ ∼ = δ . Here, ‘greatest’ and ‘ ∼ = ’ refer to thepreorder on applicative morphisms. Proof . Given δ , define ε as follows: ε ( α ) is the (nonempty) set of elements b ∈ B which represent α w.r.t. δ .First we show that ε is an applicative morphism: we have to construct arealizer for ε . Let r be a realizer for δ and d a decider for δ . Let p, p , p in A be the pairing and unpairing combinators, and [ · , . . . , · ] the standard coding oftuples in A . Choose π ∈ δ ( p ) and π i ∈ δ ( p i ), for i = 0 ,
1. Let c be an elementof B such that, if u = [ u , . . . , u k − ] in A and y ∈ A , v ∈ δ ( u ), x ∈ δ ( y ), then cvx ∈ δ ([ u , . . . , u k − , y ]). Let s ∈ B be such that if y ∈ A and x ∈ δ ( y ), then sx ∈ δ ([ y ]).Using the fixed-point combinator in B , find F ∈ B satisfying for all a, b, v ∈ B : F ab ↓ and F abv ≃ If d ( rπ ( av )) then rπ ( av ) else F ab ( cv ( rb ( rπ ( av ))))Now suppose a ∈ ε ( α ), b ∈ ε ( β ). Claim . For any y ∈ A , x ∈ δ ( y ), and any y -interrogation u = [ u , . . . , u k − ] of β by α , there is a v ∈ δ ([ y, u , . . . , u k − ]) such that F ab ( sx ) ≃ F abv .This claim is proved by induction on k . For k = 0, since sx ∈ δ ([ y ]) there isnothing to prove.Suppose the Claim holds for j ≤ k , and [ u , . . . , u k ] is a y -interrogation.By induction hypothesis there is a v ∈ δ ([ y, u , . . . , u k − ]) such that F ab ( sx ) ≃ F abv . Since [ u , . . . , u k ] is a y -interrogation of β by α , we have α ([ y, u , . . . , u k − ]) =10 ⊥ e and β ( e ) = u k , for some e ∈ A . Since av ∈ δ ( α ([ y, u , . . . , u k − ])) = δ ( p ⊥ e )we have rπ ( av ) ∈ δ ( ⊥ ) so d ( rπ ( av )) = ⊥ in B . By definition of F , we have F ab ( sx ) ≃ F abv ≃ F ab ( cv ( rb ( rπ ( av ))))It is easily checked that cv ( rb ( rπ ( av ))) is an element of δ ([ y, u , . . . , u k ]). Thisproves the Claim.Now if u = [ u , . . . , u k − ] is a y -interrogation of β by α with result g , that is tosay α ([ y, u , . . . , u k − ]) = p ⊤ g , and v ∈ δ ([ y, u , . . . , u k − ]) is as in the Claim,then by definition of F , F abv = rπ ( av ) ∈ δ ( g )We conclude that if αβ ( y ) = g then F ab ( sx ) ∈ δ ( g ); hence, if αβ ↓ , then h x i F ab ( sx ) ∈ ε ( αβ ). Therefore, the element ρ = h abx i F ab ( sx ) is a realizerfor ε .That ε is decidable follows easily from the fact that δ is, and the fact that in K ( A ) we may take ˆ ⊥ and ˆ ⊤ for the Booleans.If b ∈ B is an element of εγ ( a ), that is, b represents ˆ a w.r.t. δ , then for any cho-sen, fixed ξ ∈ S a ′ ∈ A δ ( a ′ ) we have bξ ∈ δ ( a ) so h b i bξ realizes εγ (cid:22) δ ; converselyif b ∈ δ ( a ) then the element h x i b ∈ B clearly represents ˆ a w.r.t. δ . So we seethat εγ ∼ = δ .In order to see that ε is the greatest applicative morphism satisfying εγ ∼ = δ ,suppose ε ′ is another one. Suppose r ′ realizes ε ′ , s realizes that ε ′ γ (cid:22) δ , and t realizes that δ (cid:22) εγ . In K ( A ) there is an element σ such that for all α ∈ A A and a ∈ A , σα ˆ a = d α ( a ) (this is left to the reader). Choose τ ∈ ε ′ ( σ ).Let α ∈ A A and a ∈ A be arbitrary. Suppose z ∈ ε ′ ( α ). If x ∈ δ ( a )then tx ∈ ε ′ ( γ ( a )) = ε ′ (ˆ a ), so r ′ ( r ′ τ z )( tx ) ∈ ε ′ ( d α ( a )) = ε ′ ( γ ( α ( a ))); hence s ( r ′ ( r ′ τ z )( tx )) ∈ δ ( α ( a )).We conclude that h x i s ( r ′ ( r ′ τ z )( tx )) represents α w.r.t. δ ; in other words,is an element of ε ( α ). Therefore, h zx i s ( r ′ ( r ′ τ z )( tx )) realizes ε ′ (cid:22) ε , as was toprove.Of course, theorem 3.3 also works if K ( A ) is compatible with A . K ( A ) We now turn our attention to sub-partial combinatory algebras of K ( A ): sub-sets B ⊂ A A such that, whenever α, β ∈ B and αβ ↓ in K ( A ), then αβ ∈ B ,and moreover, B with the inherited partial application function is a partialcombinatory algebra. For brevity, let’s call B a sub-pca of K ( A ).A stronger notion, which is relevant to relative realizability (see [2, 1]), re-quires B to contain elements k and s which satisfy the axioms ( k ) and ( s ) of 2.1both with respect to B and with respect to K . We call such sub-pcas elemen-tary . Examples of elementary sub-pcas are: the inclusion of Rec in K , where11ec is the set of total recursive functions; or ∆ n ⊂ K ; or RE ⊂ P ( ω ), whereRE is the set of recursively enumerable subsets of N .An instrument for studying sub-pcas of K ( A ), in the case A has a partialcombinatory algebra structure and K ( A ) is compatible with A ) is the preorder ≤ T on partial functions A → A , defined in [10]. There, the following theoremis proved: Theorem 3.4
Let A be a partial combinatory algebra and f : A → A a partialfunction. There is a partial combinatory algebra A [ f ] and a decidable applicativemorphism ι f : A → A [ f ] such that f is representable w.r.t. ι f , and moreover anydecidable applicative morphism γ : A → B such that f is representable w.r.t. γ ,factors uniquely through ι f . One can then define, for two partial functions f, g : A → A : f ≤ T g if f isrepresentable w.r.t. ι g . This gives a preorder on the set of partial endofunctionson A , which in the case that A is K (the partial combinatory algebra of indicesof partial recursive functions) and f and g are total functions, coincides withTuring reducibility.Moreover, A [ f ] is defined as follows. The underlying set is A itself, and onedefines a “ b -interrogation of f by a ” just as in the definition of K ( A ) above,but now using application in A : i.e. it is a coded sequence u = [ u , . . . , u n − ]such that for each j < n there is a v ∈ A such that a ([ u , . . . , u j − ]) = [ ⊥ , v ]and f ( v ) = u j . Then a · f b = c if there is a b -interrogation u of f by a , suchthat au = [ ⊤ , c ]. The partial map a, b a · f b is the application function for A [ f ].We see that if in K ( A ) the element α is representable in A , by a ∈ A ,and αβ is defined, then αβ ( x ) = a · β x for every x ∈ A . We see that αβ isrepresentable in A [ β ], so αβ ≤ T β .We are led to conjecture that a sub-pca of K ( A ) should be downwards closed w.r.t. the preorder ≤ T . Let us see what can be said about this. Proposition 3.5
Let A be a partial combinatory algebra and suppose K ( A ) is compatible with A . Suppose B ⊂ A A is nonempty and closed under theapplication function (if α, β ∈ B and αβ ↓ , then αβ ∈ B ).i) if for every a ∈ A there is an element α ∈ B which extends the partialfunction represented by a , then B is downwards closed w.r.t. ≤ T ;ii) without the hypothesis of i), the result may fail, even if B is a sub-pca of K ( A ) . Proof . i) Suppose γ ∈ B and β ≤ T γ . Then there is an a ∈ A such that for all x ∈ A , a · γ x = β ( x ). If α ∈ B extends the partial function represented by a ,we have αγ = β . So β ∈ B , and B is downwards closed w.r.t. ≤ T .ii) My counterexample is a (non-elementary) sub-pca of Kleene’s original K . It is easiest to formulate in the original definition of K : for α, β ∈ N N wesay αβ ( x ) = y if there is an n such that α h x, β (0) , . . . , β ( n − i = y + 1 α h x, β (0) , . . . , β ( j − i = 0 for all j < n αβ is defined if for all x there is a y such that αβ ( x ) = y .Now define: E = h i ; E n +1 = h E n i . Let B ⊂ N N be given by B = { α ∈ N N | for all n , α ( E n ) = n } It is easy to check that if α ∈ B and αβ is defined in K , then αβ ∈ B . Moreover,if k ′ and s ′ are the functions in B which agree with k (and s , respectively) outside { E , E , . . . } , then k ′ and s ′ satisfy the axioms ( k ) and ( s ) of 2.1. So B is asub-pca of K , but evidently not closed under ‘recursive in’. Remarks
1) The result of part i) in the proposition above can be strengthened a bit. Inordinary recursion theory, the poset of Turing degrees is a join-semilattice.It is not clear whether this is so for the general notion of ≤ T consideredhere (but see section 4, but one can define the following: for α, γ , . . . , γ n ∈ A A say α ≤ T ( γ , . . . , γ n ) if α is representable in A [ γ , . . . , γ n ]. Call B ⊂ A A an ideal if whenever γ , . . . , γ n ∈ B and α ≤ T ( γ , . . . , γ n ), then α ∈ B . One can prove that if B satisfies the hypothesis of ii), then B isan ideal.2) About part ii): I do not know whether there exist elementary sub-pcas of K that are not downwards closed w.r.t. ≤ T .3) I would have liked to include a statement in Proposition 3.5 saying thatif B is downwards closed w.r.t. ≤ T , then B is an elementary sub-pca of K ( A ). The intuitive reason being, that k and s are definable in A , hence ≤ T β for every β ∈ B , hence in B . However, this fails in general, becauseof the need of making k and s total. We have had to define k and s alsooutside the relevant interrogations. But in a general partial combinatoryalgebra it is not decidable whether or not a given element is a pair, ora coded sequence. We shall see that this problem disappears when weconsider partial combinatory algebras of partial functions in section 4.Theorem 3.3 can be generalized to certain sub-pcas of K ( A ). The proof isstraightforward. Proposition 3.6
Suppose B ⊂ A A is a sub-pca which contains all constantfunctions ˆ a for a ∈ A and the function ρ from the proof of 3.1. Then there is adecidable applicative morphism γ : A → B which has the property that whenever δ : A → C is decidable and every element of B is representable w.r.t. δ , thenthere is ε : B → C such that εγ ∼ = δ . If, moreover, B contains an element σ such that for all α ∈ B and a ∈ A , σα ˆ a = d α ( a ) , then ε is greatest with thisproperty. Total Combinatory Algebras of Partial Func-tions
With some care, the whole set-up of this paper generalizes to the set Ptl(
A, A )of partial functions A → A .For each α ∈ Ptl(
A, A ) we have a partial function ϕ α : Ptl( A, A ) → A givenby interrogations. Modifying the definition of sequential functions in such away that we now consider nontotal sequential trees T and partial maps F fromthe leaves of T to A , we easily see that a partial function Ptl( A, A ) → A issequential, precisely if it is of the form ϕ α for some α ∈ Ptl(
A, A ). Note thatin this case, given ϕ α , we can (much simpler than in the proof of 1.4) definethe corresponding sequential tree as the set of those finite functions s such thatthere is an interrogation of s by α which contains all values of s and is in thedomain of α . Finally, for a leaf s of the tree we we can define F ( s ) = b if thereis an interrogation u of s by α such that α ( u ) = h r, b i .Quite similar to section 2, we have a partial combinatory algebra structureon Ptl( A, A ). This generalizes the construction of B (for A = N ) in [9, 5]. Justas in Definition 2.2 we have a partial function ϕ a : Ptl( A, A ) × Ptl(
A, A ) → A for each a ∈ A , and hence a total function α, β αβ : Ptl( A, A ) × Ptl(
A, A ) → Ptl(
A, A ). The notion of a bisequential function is also straightforward, andanalogously to Lemma 2.5 we have, for every partial bisequential function G :Ptl( A, A ) × Ptl(
A, A ) → A , an element φ G such that for all α and β , ϕ φ G α ( β ) ≃ G ( α, β ).Again, this is simpler than in the case of total functions: no artificial con-struction in order to make sure that φ G α is a total function, is required.The proof of Theorem 2.7 also simplifies, because the elements k and s neednot be artificially extended beyond what they have to perform on the relevantinterrogations. It follows, that if K p ( A ) is compatible with A , k and s can bechosen to be representable in A .Let us write K p ( A ) for the partial combinatory algebra structure on Ptl( A, A ).Since the application function is total, we speak of a (total) combinatory algebra .We have the same map γ : A → K p ( A ) as in Proposition 3.1; it is decidable,and every function A → A is representable w.r.t. γ . It is worth noting that inthe partial case, the definition of ρ in the proof of 3.1 can be simplified: wesimply define ρ ( hh x, b i , a i ) ≃ h r, h r, ab ii and don’t need to define ρ outside the set of elements of form hh x ii or hh x, b ii .It follows, that if K p ( A ) is compatible with A , this function ρ is representablein A .The combinatory algebra K p ( A ) satisfies a similar semi-universal propertyas the one given for K ( A ) in Theorem 3.3, with the map γ : A → K p ( A ),provided K p ( A ) is compatible with A . This gives the following corollary. Corollary 4.1 K ( A ) is an elementary sub-pca of K p ( A ) and a retract of it inthe category of partial combinatory algebras and isomorphism classes of applica-tive morphisms. roof . The choice of k and s we made for K ( A ) also works for K p ( A ): so theinclusion i : A A → Ptl(
A, A ) is elementary; it is also an applicative morphism,and decidable. Furthermore, if we apply the semi-universal property of K p ( A )to the diagram A γ / / γ (cid:15) (cid:15) K ( A ) K p ( A )we obtain an applicative map ε : K p ( A ) → K ( A ). Concretely, ε ( α ) = { β | for all a ∈ dom( α ), β ˆ a = d α ( a ) } It is not hard to show that εi is isomorphic to the identity on K ( A ).The pattern, that definitions are simpler and theorems more elegant and smoothin the case of partial functions, extends to the study of sub-pcas of K p ( A ). Firstof all we have the following proposition: Proposition 4.2
The preorder ≤ T on partial functions A → A (relative to apartial combinatory algebra structure on A ) has binary joins. Proof . Given partial functions f and g define f ⊔ g by:( f ⊔ g )( y ) ≃ If p y then f ( p y ) else g ( p y )So ( f ⊔ g )([ ⊤ , x ]) ≃ f ( x ) and ( f ⊔ g )([ ⊥ , x ]) ≃ g ( x ). It is left to the reader that f ⊔ g is a join for f, g with respect to ≤ T .One can now simply define an ideal of K p ( A ) to be a downwards closed setwhich is also closed under ⊔ . Given a subset B of Ptl( A, A ), let us write B ⊆ forthe set B ⊆ = { f ∈ Ptl(
A, A ) | there is g ∈ B such that f ⊆ g } Furthermore let us write ¯ a for the partial function x ax , for a ∈ A . Proposition 4.3
Let A be a partial combinatory algebra and suppose K p ( A ) is compatible with A . Suppose B ⊂ Ptl(
A, A ) is closed under the applicationfunction.i) If B is downwards closed w.r.t. ≤ T , then B is an elementary sub-pca of K p ( A ) ;ii) If for every a ∈ A we have ¯ a ∈ B , then B ⊆ is an ideal of K p ( A ) . Proof . The first item is the remark made before, that in the partial case wecan choose k and s to be representable in A .For the second item: first we remark that there is an element a ∈ A suchthat for any γ , γ ∈ Ptl(
A, A ), ¯ aγ γ = γ ⊔ γ in K p ( A ). This is left to thereader. So from the hypotheses on B it follows that B is closed under ⊔ . Since15pplication in K p ( A ) is monotone in both variables w.r.t. ⊆ , it follows that also B ⊆ is closed under ⊔ .Next, we see that B ⊆ is downwards closed w.r.t. ≤ T . Suppose β ′ ∈ B , β ⊆ β ′ and γ ≤ T β . We need to show: γ ∈ B ⊆ . Since γ ≤ T β , there is an a ∈ A satisfying a · β x = γ ( x ) for all x ∈ dom( γ ). Then also a · β ′ x = γ ( x ) for all x ∈ dom( γ ). But this means that γ ⊆ ¯ aβ ′ . Since B is closed under applicationand ¯ a, β ′ ∈ B by assumption, γ ∈ B ⊆ as desired.We also have the following generalization of the factorization theorem: Theorem 4.4
Suppose B is an elementary sub-pca of K p ( A ) containing the(simplified) function ρ of the proof of 3.1 and all constant functions ˆ a . Let γ : A → B be the decidable applicative morphism γ ( a ) = { ˆ a } . Then for anydecidable applicative morphism δ : A → C such that every partial function in B is representable w.r.t. δ , there is an applicative morphism ε : B → C satisfying εγ ∼ = δ . Let us apply this to a specific case. For B , let us take T ( A ) = { ¯ a | a ∈ A } (where ¯ a is as in 4.3). Since every ¯ a is representable in A , we have a triangle A γ ! ! DDDDDDDD id A / / AT ( A ) ε = = zzzzzzzz which commutes up to isomorphism: εγ ∼ = id A . About the other composition: γε , we cannot say much. However, there is another map ε ′ : T ( A ) → A whichmakes the triangle commute. Define: ε ′ ( α ) = { a | ¯ a = α } . There is anelement b ∈ A such that for every a ∈ A : ¯ b ˆ a = ¯ a . This means, that γε ′ (cid:22) id T ( A ) (the other inequality does not hold). This means that γ ⊣ ε ′ is anadjoint pair of decidable applicative morphisms. From the theory of geometricmorphisms between realizability toposes in chapter 2 of [11] it follows that thereis a geometric surjection: RT ( T ( A )) → RT ( A ). We have obtained the followingtheorem: Theorem 4.5
Every realizability topos is a quotient of a realizability topos ona total combinatory algebra.
Acknowledgement . Part of the research reported here was carried out by myformer Ph.D. student Bram Arens.
References [1] L. Birkedal. Developing theories of types and computability via realizability.
Elec-tronic Notes in Theoretical Computer Science , 34:viii+282, 2000. Book version ofPhD-thesis.
2] L. Birkedal and J. van Oosten. Relative and modified relative realizability.
Ann.Pure Appl.Logic , 118:115–132, 2002.[3] S.C. Kleene.
Formalized Recursive Functionals and Formalized Relizability , vol-ume 89 of
Memoirs of the American Mathematical Society . American Mathemat-ical Society, 1969.[4] J. Longley.
Realizability Toposes and Language Semantics . PhD thesis, EdinburghUniversity, 1995.[5] J. Longley. The Sequentially Realizable Functionals.
Ann. Pure Appl. Logic ,117(1–3):1–93, 2002.[6] Paul-Andr´e Melli`es. Sequential algorithms and strongly stable functions.
Theor.Comp.Sci. , 343:237–281, 2005.[7] G. Plotkin. LCF considered as a programming language.
Theor. Computer Sci-ence , 5:223–255, 1977.[8] Robert I. Soare.
Recursively Enumerable Sets and Degrees . Perspectives in Math-ematical Logic. Springer-Verlag, 1987.[9] J. van Oosten. A combinatory algebra for sequential functionals of finite type. InS.B. Cooper and J.K. Truss, editors,
Models and Computability , pages 389–406.Cambridge University Press, 1999.[10] J. van Oosten. A general form of relative recursion.
Notre Dame Journ. FormalLogic , 47(3):311–318, 2006.[11] J. van Oosten.
Realizability: an Introducton to its Categorical Side , volume 152of
Studies in Logic . North-Holland, 2008.. North-Holland, 2008.