Kleene’s second algebra is a partial combinatory algebra based on Baire space.
Let be the set of natural numbers equipped with the discrete topology, so that the function space is a countable product of copies of . By means of continued fractions?, this space is homeomorphic to the Baire space of irrational numbers between and .
To define Kleene’s second algebra, we need several ingredients:
There is a function which takes the constant function at to , and any other function to the predecessor of the first non-zero .
Each irrational number releases a stream of rational approximants by successive truncations of the continued fraction of . By coding rational numbers by natural numbers, we get a corresponding stream of natural numbers . The map
that sends to is continuous.
is the terminal coalgebra of the endofunctor on , so there is an isomorphism whose inverse is denoted .
Composition of functions defines a map .
Now consider the composite
and curry this to a map . Let be the inclusion map.
Kleene’s second algebra is the applicative structure or partial binary operation on defined by the pullback